@gingkoo/pandora-metabase 1.0.158-alpha.1 → 1.0.158-alpha.2

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.
@@ -76,7 +76,7 @@ var SelectFilterColumn = function SelectFilterColumn(_ref) {
76
76
  _ref$filterCustomType = _ref.filterCustomType,
77
77
  filterCustomType = _ref$filterCustomType === void 0 ? false : _ref$filterCustomType,
78
78
  parentPopupChannel = _ref.parentPopupChannel;
79
- var normalizedInitialValue = (0, _utils.normalizeExpressionAtom)(value, data);
79
+ var normalizedInitialValue = (0, _utils.normalizeExpressionAtom)(value, data, filterCustomType);
80
80
  var _useState = (0, _react.useState)(normalizedInitialValue),
81
81
  _useState2 = (0, _slicedToArray2["default"])(_useState, 2),
82
82
  curColumn = _useState2[0],
@@ -333,7 +333,7 @@ var SelectFilterColumn = function SelectFilterColumn(_ref) {
333
333
  rhs: rhsVal,
334
334
  condition: condition,
335
335
  database_type: databaseType
336
- }), filterCustomType ? [] : data);
336
+ }), data, filterCustomType);
337
337
  var quotes = generateQuotes(nextExpression.rhs, nextExpression);
338
338
  typeof onChange === 'function' && onChange((0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, nextExpression), {}, {
339
339
  quotes: quotes
@@ -1020,7 +1020,7 @@ var SelectFilterColumn = function SelectFilterColumn(_ref) {
1020
1020
  onSelect: function onSelect(fields, quotes) {
1021
1021
  setCurColumn((0, _utils.normalizeExpressionAtom)((0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, curColumn), {}, {
1022
1022
  lhs: fields
1023
- }), data));
1023
+ }), data, filterCustomType));
1024
1024
  setIsNext(true);
1025
1025
  }
1026
1026
  })
@@ -1056,8 +1056,8 @@ var FormulaList = (0, _react.forwardRef)(function (props, ref) {
1056
1056
  return (0, _utils2.normalizeAndOrStructure)(value || []);
1057
1057
  }, [value]);
1058
1058
  var normalizedExpressionValue = (0, _react.useMemo)(function () {
1059
- return (0, _utils3.normalizeExpressionAtoms)(normalizedStructureValue, data);
1060
- }, [normalizedStructureValue, data]);
1059
+ return (0, _utils3.normalizeExpressionAtoms)(normalizedStructureValue, data, store.filterCustomType);
1060
+ }, [normalizedStructureValue, data, store.filterCustomType]);
1061
1061
  var normalizedValue = (0, _react.useMemo)(function () {
1062
1062
  return normalizedExpressionValue.map(_utils2.syncAtomQuotes);
1063
1063
  }, [normalizedExpressionValue]);
@@ -1281,7 +1281,7 @@ var FormulaList = (0, _react.forwardRef)(function (props, ref) {
1281
1281
  return _withSyncedQuotesInner(item, new WeakMap());
1282
1282
  };
1283
1283
  var setCaseList = function setCaseList(atoms) {
1284
- var nextData = (0, _utils3.normalizeExpressionAtoms)(atoms, data).map(function (item) {
1284
+ var nextData = (0, _utils3.normalizeExpressionAtoms)(atoms, data, store.filterCustomType).map(function (item) {
1285
1285
  return withSyncedQuotes(item);
1286
1286
  });
1287
1287
  var quotes = nextData.map(function (item) {
@@ -7,9 +7,9 @@ type ExpressionTable = {
7
7
  columns?: any[];
8
8
  };
9
9
  export declare const EMPTY_RHS_CONDITIONS: Set<string>;
10
- export declare const getExpressionDatabaseType: (expression: AtomsExpression, tables?: ExpressionTable[]) => string;
11
- export declare const normalizeExpressionAtom: (expression: AtomsExpression, tables?: ExpressionTable[]) => AtomsExpression;
12
- export declare const normalizeExpressionAtoms: (atoms?: AtomsItem[], tables?: ExpressionTable[]) => AtomsItem[];
10
+ export declare const getExpressionDatabaseType: (expression: AtomsExpression, tables?: ExpressionTable[], filterCustomType?: boolean) => string;
11
+ export declare const normalizeExpressionAtom: (expression: AtomsExpression, tables?: ExpressionTable[], filterCustomType?: boolean) => AtomsExpression;
12
+ export declare const normalizeExpressionAtoms: (atoms?: AtomsItem[], tables?: ExpressionTable[], filterCustomType?: boolean) => AtomsItem[];
13
13
  export declare const insertTemplateAt: (oldType: string, type: string, list: any[], index: number) => any[];
14
14
  export declare const operatorList: string[];
15
15
  export declare const customTypes: ({
@@ -36,6 +36,10 @@ var findExpressionColumn = function findExpressionColumn(expression) {
36
36
  };
37
37
  var getExpressionDatabaseType = exports.getExpressionDatabaseType = function getExpressionDatabaseType(expression) {
38
38
  var tables = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
39
+ var filterCustomType = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
40
+ if (filterCustomType) {
41
+ return String(expression.database_type || '').toUpperCase();
42
+ }
39
43
  var column = findExpressionColumn(expression, tables);
40
44
  return String((column === null || column === void 0 ? void 0 : column.database_type) || expression.database_type || '').toUpperCase();
41
45
  };
@@ -45,7 +49,8 @@ var normalizeExpressionRhs = function normalizeExpressionRhs(expression) {
45
49
  };
46
50
  var normalizeExpressionAtom = exports.normalizeExpressionAtom = function normalizeExpressionAtom(expression) {
47
51
  var tables = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
48
- var databaseType = getExpressionDatabaseType(expression, tables);
52
+ var filterCustomType = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
53
+ var databaseType = getExpressionDatabaseType(expression, tables, filterCustomType);
49
54
  return (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, expression), {}, {
50
55
  lhs: expression.lhs || [],
51
56
  rhs: normalizeExpressionRhs(expression),
@@ -55,6 +60,7 @@ var normalizeExpressionAtom = exports.normalizeExpressionAtom = function normali
55
60
  var normalizeExpressionAtoms = exports.normalizeExpressionAtoms = function normalizeExpressionAtoms() {
56
61
  var atoms = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
57
62
  var tables = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
63
+ var filterCustomType = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
58
64
  var normalizeList = function normalizeList() {
59
65
  var items = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
60
66
  return items.map(normalizeItem);
@@ -62,7 +68,7 @@ var normalizeExpressionAtoms = exports.normalizeExpressionAtoms = function norma
62
68
  var normalizeItem = function normalizeItem(item) {
63
69
  if (!item || (0, _typeof2["default"])(item) !== 'object') return item;
64
70
  if (item.type === _types.AtomsTypeEnum.EXPRESSION) {
65
- var nextExpression = normalizeExpressionAtom(item, tables);
71
+ var nextExpression = normalizeExpressionAtom(item, tables, filterCustomType);
66
72
  return (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, nextExpression), {}, {
67
73
  lhs: normalizeList(nextExpression.lhs),
68
74
  rhs: normalizeList(nextExpression.rhs)
@@ -68,7 +68,7 @@ var SelectFilterColumn = function SelectFilterColumn(_ref) {
68
68
  _ref$filterCustomType = _ref.filterCustomType,
69
69
  filterCustomType = _ref$filterCustomType === void 0 ? false : _ref$filterCustomType,
70
70
  parentPopupChannel = _ref.parentPopupChannel;
71
- var normalizedInitialValue = normalizeExpressionAtom(value, data);
71
+ var normalizedInitialValue = normalizeExpressionAtom(value, data, filterCustomType);
72
72
  var _useState = useState(normalizedInitialValue),
73
73
  _useState2 = _slicedToArray(_useState, 2),
74
74
  curColumn = _useState2[0],
@@ -325,7 +325,7 @@ var SelectFilterColumn = function SelectFilterColumn(_ref) {
325
325
  rhs: rhsVal,
326
326
  condition: condition,
327
327
  database_type: databaseType
328
- }), filterCustomType ? [] : data);
328
+ }), data, filterCustomType);
329
329
  var quotes = generateQuotes(nextExpression.rhs, nextExpression);
330
330
  typeof onChange === 'function' && onChange(_objectSpread(_objectSpread({}, nextExpression), {}, {
331
331
  quotes: quotes
@@ -1012,7 +1012,7 @@ var SelectFilterColumn = function SelectFilterColumn(_ref) {
1012
1012
  onSelect: function onSelect(fields, quotes) {
1013
1013
  setCurColumn(normalizeExpressionAtom(_objectSpread(_objectSpread({}, curColumn), {}, {
1014
1014
  lhs: fields
1015
- }), data));
1015
+ }), data, filterCustomType));
1016
1016
  setIsNext(true);
1017
1017
  }
1018
1018
  })
@@ -1047,8 +1047,8 @@ var FormulaList = forwardRef(function (props, ref) {
1047
1047
  return normalizeAndOrStructure(value || []);
1048
1048
  }, [value]);
1049
1049
  var normalizedExpressionValue = useMemo(function () {
1050
- return normalizeExpressionAtoms(normalizedStructureValue, data);
1051
- }, [normalizedStructureValue, data]);
1050
+ return normalizeExpressionAtoms(normalizedStructureValue, data, store.filterCustomType);
1051
+ }, [normalizedStructureValue, data, store.filterCustomType]);
1052
1052
  var normalizedValue = useMemo(function () {
1053
1053
  return normalizedExpressionValue.map(syncAtomQuotes);
1054
1054
  }, [normalizedExpressionValue]);
@@ -1272,7 +1272,7 @@ var FormulaList = forwardRef(function (props, ref) {
1272
1272
  return _withSyncedQuotesInner(item, new WeakMap());
1273
1273
  };
1274
1274
  var setCaseList = function setCaseList(atoms) {
1275
- var nextData = normalizeExpressionAtoms(atoms, data).map(function (item) {
1275
+ var nextData = normalizeExpressionAtoms(atoms, data, store.filterCustomType).map(function (item) {
1276
1276
  return withSyncedQuotes(item);
1277
1277
  });
1278
1278
  var quotes = nextData.map(function (item) {
@@ -7,9 +7,9 @@ type ExpressionTable = {
7
7
  columns?: any[];
8
8
  };
9
9
  export declare const EMPTY_RHS_CONDITIONS: Set<string>;
10
- export declare const getExpressionDatabaseType: (expression: AtomsExpression, tables?: ExpressionTable[]) => string;
11
- export declare const normalizeExpressionAtom: (expression: AtomsExpression, tables?: ExpressionTable[]) => AtomsExpression;
12
- export declare const normalizeExpressionAtoms: (atoms?: AtomsItem[], tables?: ExpressionTable[]) => AtomsItem[];
10
+ export declare const getExpressionDatabaseType: (expression: AtomsExpression, tables?: ExpressionTable[], filterCustomType?: boolean) => string;
11
+ export declare const normalizeExpressionAtom: (expression: AtomsExpression, tables?: ExpressionTable[], filterCustomType?: boolean) => AtomsExpression;
12
+ export declare const normalizeExpressionAtoms: (atoms?: AtomsItem[], tables?: ExpressionTable[], filterCustomType?: boolean) => AtomsItem[];
13
13
  export declare const insertTemplateAt: (oldType: string, type: string, list: any[], index: number) => any[];
14
14
  export declare const operatorList: string[];
15
15
  export declare const customTypes: ({
@@ -28,6 +28,10 @@ var findExpressionColumn = function findExpressionColumn(expression) {
28
28
  };
29
29
  export var getExpressionDatabaseType = function getExpressionDatabaseType(expression) {
30
30
  var tables = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
31
+ var filterCustomType = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
32
+ if (filterCustomType) {
33
+ return String(expression.database_type || '').toUpperCase();
34
+ }
31
35
  var column = findExpressionColumn(expression, tables);
32
36
  return String((column === null || column === void 0 ? void 0 : column.database_type) || expression.database_type || '').toUpperCase();
33
37
  };
@@ -37,7 +41,8 @@ var normalizeExpressionRhs = function normalizeExpressionRhs(expression) {
37
41
  };
38
42
  export var normalizeExpressionAtom = function normalizeExpressionAtom(expression) {
39
43
  var tables = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
40
- var databaseType = getExpressionDatabaseType(expression, tables);
44
+ var filterCustomType = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
45
+ var databaseType = getExpressionDatabaseType(expression, tables, filterCustomType);
41
46
  return _objectSpread(_objectSpread({}, expression), {}, {
42
47
  lhs: expression.lhs || [],
43
48
  rhs: normalizeExpressionRhs(expression),
@@ -47,6 +52,7 @@ export var normalizeExpressionAtom = function normalizeExpressionAtom(expression
47
52
  export var normalizeExpressionAtoms = function normalizeExpressionAtoms() {
48
53
  var atoms = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
49
54
  var tables = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
55
+ var filterCustomType = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
50
56
  var normalizeList = function normalizeList() {
51
57
  var items = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
52
58
  return items.map(normalizeItem);
@@ -54,7 +60,7 @@ export var normalizeExpressionAtoms = function normalizeExpressionAtoms() {
54
60
  var normalizeItem = function normalizeItem(item) {
55
61
  if (!item || _typeof(item) !== 'object') return item;
56
62
  if (item.type === AtomsTypeEnum.EXPRESSION) {
57
- var nextExpression = normalizeExpressionAtom(item, tables);
63
+ var nextExpression = normalizeExpressionAtom(item, tables, filterCustomType);
58
64
  return _objectSpread(_objectSpread({}, nextExpression), {}, {
59
65
  lhs: normalizeList(nextExpression.lhs),
60
66
  rhs: normalizeList(nextExpression.rhs)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gingkoo/pandora-metabase",
3
- "version": "1.0.158-alpha.1",
3
+ "version": "1.0.158-alpha.2",
4
4
  "description": "",
5
5
  "main": "lib/es/index.js",
6
6
  "module": "lib/es/index.js",