@gingkoo/pandora-metabase 1.0.62 → 1.0.64

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.
@@ -144,16 +144,20 @@ var useStore = function useStore() {
144
144
  setFieldEnableAlias = _useState42[1]; // 字段名是否开启别名
145
145
  var _useState43 = (0, _react.useState)(true),
146
146
  _useState44 = (0, _slicedToArray2["default"])(_useState43, 2),
147
- isSelectFields = _useState44[0],
148
- setIsSelectFields = _useState44[1]; // 是否默认勾选字段
149
- var _useState45 = (0, _react.useState)(false),
147
+ groupByEnableAlias = _useState44[0],
148
+ setGroupByEnableAlias = _useState44[1]; // 聚合是否开启别名
149
+ var _useState45 = (0, _react.useState)(true),
150
150
  _useState46 = (0, _slicedToArray2["default"])(_useState45, 2),
151
- tableFlat = _useState46[0],
152
- setTableFlat = _useState46[1]; // 是否平铺数据表
153
- var _useState47 = (0, _react.useState)([]),
151
+ isSelectFields = _useState46[0],
152
+ setIsSelectFields = _useState46[1]; // 是否默认勾选字段
153
+ var _useState47 = (0, _react.useState)(false),
154
154
  _useState48 = (0, _slicedToArray2["default"])(_useState47, 2),
155
- sourceTable = _useState48[0],
156
- setSourceTable = _useState48[1];
155
+ tableFlat = _useState48[0],
156
+ setTableFlat = _useState48[1]; // 是否平铺数据表
157
+ var _useState49 = (0, _react.useState)([]),
158
+ _useState50 = (0, _slicedToArray2["default"])(_useState49, 2),
159
+ sourceTable = _useState50[0],
160
+ setSourceTable = _useState50[1];
157
161
  // 外层ref
158
162
  var popupContainer = (0, _react.useRef)();
159
163
  // const [fetchDatasetFn, setFetchDatasetFn] = useState<(id: string) => Promise<any>>(
@@ -732,6 +736,8 @@ var useStore = function useStore() {
732
736
  setTableEnableAlias: setTableEnableAlias,
733
737
  fieldEnableAlias: fieldEnableAlias,
734
738
  setFieldEnableAlias: setFieldEnableAlias,
739
+ groupByEnableAlias: groupByEnableAlias,
740
+ setGroupByEnableAlias: setGroupByEnableAlias,
735
741
  isSelectFields: isSelectFields,
736
742
  setIsSelectFields: setIsSelectFields,
737
743
  tableFlat: tableFlat,
package/lib/cjs/index.js CHANGED
@@ -62,6 +62,8 @@ var SqlVisionBuilder = _react["default"].forwardRef(function (props, ref) {
62
62
  tableEnableAlias = _props$tableEnableAli === void 0 ? true : _props$tableEnableAli,
63
63
  _props$fieldEnableAli = props.fieldEnableAlias,
64
64
  fieldEnableAlias = _props$fieldEnableAli === void 0 ? true : _props$fieldEnableAli,
65
+ _props$groupByEnableA = props.groupByEnableAlias,
66
+ groupByEnableAlias = _props$groupByEnableA === void 0 ? true : _props$groupByEnableA,
65
67
  _props$isSelectFields = props.isSelectFields,
66
68
  isSelectFields = _props$isSelectFields === void 0 ? true : _props$isSelectFields,
67
69
  _props$tableFlat = props.tableFlat,
@@ -96,9 +98,10 @@ var SqlVisionBuilder = _react["default"].forwardRef(function (props, ref) {
96
98
  store.setIsExit(isExit);
97
99
  store.setTableEnableAlias(tableEnableAlias);
98
100
  store.setFieldEnableAlias(fieldEnableAlias);
101
+ store.setGroupByEnableAlias(groupByEnableAlias);
99
102
  store.setIsSelectFields(isSelectFields);
100
103
  store.setTableFlat(tableFlat);
101
- }, [showFields, fieldNameTpl, tableNameTpl, toolbar, showSubquery, subShowSubquery, constantList, formulaTemplates, ignoreGroupByType, filterCustomType, isExit, tableEnableAlias, fieldEnableAlias, isSelectFields, tableFlat]);
104
+ }, [showFields, fieldNameTpl, tableNameTpl, toolbar, showSubquery, subShowSubquery, constantList, formulaTemplates, ignoreGroupByType, filterCustomType, isExit, tableEnableAlias, fieldEnableAlias, groupByEnableAlias, isSelectFields, tableFlat]);
102
105
  _react["default"].useImperativeHandle(ref, function () {
103
106
  return {
104
107
  // setDatasource: (list) => {
@@ -40,6 +40,7 @@ export interface MetabaseProps {
40
40
  isExit?: boolean;
41
41
  tableEnableAlias?: boolean;
42
42
  fieldEnableAlias?: boolean;
43
+ groupByEnableAlias?: boolean;
43
44
  isSelectFields?: boolean;
44
45
  tableFlat?: boolean;
45
46
  onChange?: (newData: MetaListType[], curData: {
@@ -151,8 +151,10 @@ var Metabase = function Metabase(props) {
151
151
  disabled: saveLoading,
152
152
  onClick: onCheck,
153
153
  children: btnText || __('SqlQueryBuilder.visualize')
154
- }) : null, store.popupContainer.current && _jsx(Popup, {
155
- container: store.popupData.container || store.popupContainer.current,
154
+ }) : null, store.popupContainer.current && _jsx(Popup
155
+ // container={store.popupData.container || store.popupContainer.current}
156
+ , {
157
+ // container={store.popupData.container || store.popupContainer.current}
156
158
  visible: store.popupData.visible,
157
159
  node: store.popupData.node,
158
160
  closable: store.popupClosable,
@@ -162,8 +164,10 @@ var Metabase = function Metabase(props) {
162
164
  });
163
165
  },
164
166
  children: popupContent
165
- }), store.popupContainer.current && _jsx(Popup, {
166
- container: store.popupData2.container || store.popupContainer.current,
167
+ }), store.popupContainer.current && _jsx(Popup
168
+ // container={store.popupData2.container || store.popupContainer.current}
169
+ , {
170
+ // container={store.popupData2.container || store.popupContainer.current}
167
171
  visible: store.popupData2.visible,
168
172
  node: store.popupData2.node,
169
173
  closable: store.popupClosable2,
@@ -336,7 +336,7 @@ var GroupBy = function GroupBy(props) {
336
336
  return handleUpdate(e, i);
337
337
  },
338
338
  children: [v.quotes && _jsx(_Fragment, {
339
- children: store.fieldEnableAlias && _jsx(Tooltip, {
339
+ children: store.groupByEnableAlias && _jsx(Tooltip, {
340
340
  title: !isValidSQLAlias(v === null || v === void 0 ? void 0 : v.fieldAlias) ? __('SqlQueryBuilder.aliasForRules') : __('SqlQueryBuilder.alias'),
341
341
  children: _jsx(Button, {
342
342
  className: cx(':Sqb-TableName-as :Sqb-TableName green-name', _defineProperty({}, 'isError', !isValidSQLAlias(v === null || v === void 0 ? void 0 : v.fieldAlias))),
@@ -334,7 +334,7 @@ var SelectIndex = function SelectIndex(props) {
334
334
  return handleUpdate(e, i);
335
335
  },
336
336
  children: [v.quotes && _jsx(_Fragment, {
337
- children: store.fieldEnableAlias && _jsx(Tooltip, {
337
+ children: store.groupByEnableAlias && _jsx(Tooltip, {
338
338
  title: !isValidSQLAlias(v === null || v === void 0 ? void 0 : v.fieldAlias) ? __('SqlQueryBuilder.aliasForRules') : __('SqlQueryBuilder.alias'),
339
339
  children: _jsx(Button, {
340
340
  className: cx(':Sqb-TableName-as :Sqb-TableName green-name', _defineProperty({}, 'isError', !isValidSQLAlias(v === null || v === void 0 ? void 0 : v.fieldAlias))),
@@ -1,109 +1,47 @@
1
1
  import * as React from 'react';
2
+ interface PropsType {
3
+ visible: boolean;
4
+ children: React.ReactNode;
5
+ hideVisible: () => void;
6
+ node: HTMLElement;
7
+ innerSpacing?: number;
8
+ zIndex?: string | number;
9
+ closable?: boolean;
10
+ }
2
11
  interface StateType {
3
12
  popupRefreshKey: number;
4
13
  }
5
- export declare function generateTrigger(PortalComponent: any): {
6
- new (props: PropsType): {
7
- resizeObserver: ResizeObserver | null;
8
- resetId: number;
9
- ref: any;
10
- componentDidMount(): void;
11
- componentDidUpdate(prevProps: PropsType): void;
12
- componentWillUnmount(): void;
13
- refreshPopup: () => void;
14
- initResizeObserver: () => void;
15
- bindEvent: () => void;
16
- closePopup: () => void;
17
- attachParent: (popupContainer: HTMLSpanElement) => void;
18
- getCurrentNodePos: () => {
19
- x: number;
20
- y: number;
21
- t: number;
22
- h: any;
23
- };
24
- getContainer: () => HTMLSpanElement;
25
- getComponent: () => import("react/jsx-runtime").JSX.Element;
26
- didUpdate: () => void | false;
27
- render(): import("react/jsx-runtime").JSX.Element | null;
28
- context: unknown;
29
- setState<K extends "popupRefreshKey">(state: StateType | ((prevState: Readonly<StateType>, props: Readonly<PropsType>) => StateType | Pick<StateType, K> | null) | Pick<StateType, K> | null, callback?: (() => void) | undefined): void;
30
- forceUpdate(callback?: (() => void) | undefined): void;
31
- readonly props: Readonly<PropsType>;
32
- state: Readonly<StateType>;
33
- refs: {
34
- [key: string]: React.ReactInstance;
35
- };
36
- shouldComponentUpdate?(nextProps: Readonly<PropsType>, nextState: Readonly<StateType>, nextContext: any): boolean;
37
- componentDidCatch?(error: Error, errorInfo: React.ErrorInfo): void;
38
- getSnapshotBeforeUpdate?(prevProps: Readonly<PropsType>, prevState: Readonly<StateType>): any;
39
- componentWillMount?(): void;
40
- UNSAFE_componentWillMount?(): void;
41
- componentWillReceiveProps?(nextProps: Readonly<PropsType>, nextContext: any): void;
42
- UNSAFE_componentWillReceiveProps?(nextProps: Readonly<PropsType>, nextContext: any): void;
43
- componentWillUpdate?(nextProps: Readonly<PropsType>, nextState: Readonly<StateType>, nextContext: any): void;
44
- UNSAFE_componentWillUpdate?(nextProps: Readonly<PropsType>, nextState: Readonly<StateType>, nextContext: any): void;
45
- };
46
- defaultProps: {
14
+ declare class TriggerInternal extends React.Component<PropsType, StateType> {
15
+ private resizeObserver;
16
+ private resetId;
17
+ private popupContainer;
18
+ private contentResizeObserver;
19
+ private scrollHeightCheckTimer;
20
+ private lastScrollHeight;
21
+ private handleClickOutside;
22
+ static defaultProps: {
47
23
  visible: boolean;
48
- children: null;
24
+ closable: boolean;
25
+ innerSpacing: number;
49
26
  };
50
- contextType?: React.Context<any> | undefined;
51
- };
52
- declare const _default: {
53
- new (props: PropsType): {
54
- resizeObserver: ResizeObserver | null;
55
- resetId: number;
56
- ref: any;
57
- componentDidMount(): void;
58
- componentDidUpdate(prevProps: PropsType): void;
59
- componentWillUnmount(): void;
60
- refreshPopup: () => void;
61
- initResizeObserver: () => void;
62
- bindEvent: () => void;
63
- closePopup: () => void;
64
- attachParent: (popupContainer: HTMLSpanElement) => void;
65
- getCurrentNodePos: () => {
66
- x: number;
67
- y: number;
68
- t: number;
69
- h: any;
70
- };
71
- getContainer: () => HTMLSpanElement;
72
- getComponent: () => import("react/jsx-runtime").JSX.Element;
73
- didUpdate: () => void | false;
74
- render(): import("react/jsx-runtime").JSX.Element | null;
75
- context: unknown;
76
- setState<K extends "popupRefreshKey">(state: StateType | ((prevState: Readonly<StateType>, props: Readonly<PropsType>) => StateType | Pick<StateType, K> | null) | Pick<StateType, K> | null, callback?: (() => void) | undefined): void;
77
- forceUpdate(callback?: (() => void) | undefined): void;
78
- readonly props: Readonly<PropsType>;
79
- state: Readonly<StateType>;
80
- refs: {
81
- [key: string]: React.ReactInstance;
82
- };
83
- shouldComponentUpdate?(nextProps: Readonly<PropsType>, nextState: Readonly<StateType>, nextContext: any): boolean;
84
- componentDidCatch?(error: Error, errorInfo: React.ErrorInfo): void;
85
- getSnapshotBeforeUpdate?(prevProps: Readonly<PropsType>, prevState: Readonly<StateType>): any;
86
- componentWillMount?(): void;
87
- UNSAFE_componentWillMount?(): void;
88
- componentWillReceiveProps?(nextProps: Readonly<PropsType>, nextContext: any): void;
89
- UNSAFE_componentWillReceiveProps?(nextProps: Readonly<PropsType>, nextContext: any): void;
90
- componentWillUpdate?(nextProps: Readonly<PropsType>, nextState: Readonly<StateType>, nextContext: any): void;
91
- UNSAFE_componentWillUpdate?(nextProps: Readonly<PropsType>, nextState: Readonly<StateType>, nextContext: any): void;
92
- };
93
- defaultProps: {
94
- visible: boolean;
95
- children: null;
96
- };
97
- contextType?: React.Context<any> | undefined;
98
- };
99
- export default _default;
100
- interface PropsType {
101
- visible: boolean;
102
- children: any;
103
- hideVisible: Function;
104
- node: any;
105
- innerSpacing?: number;
106
- container?: HTMLDivElement;
107
- zIndex?: string | null;
108
- closable?: boolean;
27
+ ref: React.RefObject<HTMLDivElement>;
28
+ constructor(props: PropsType);
29
+ componentDidMount(): void;
30
+ componentDidUpdate(prevProps: PropsType): void;
31
+ componentWillUnmount(): void;
32
+ private mountPopup;
33
+ private unmountPopup;
34
+ private cleanup;
35
+ private refreshPopup;
36
+ private initContentResizeObserver;
37
+ private startScrollHeightCheck;
38
+ private closePopup;
39
+ private createPopupContainer;
40
+ private getContainer;
41
+ private getComponent;
42
+ private didUpdate;
43
+ render(): import("react/jsx-runtime").JSX.Element | null;
109
44
  }
45
+ export declare function generateTrigger(PortalComponent: any): typeof TriggerInternal;
46
+ declare const _default: typeof TriggerInternal;
47
+ export default _default;