@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.
- package/lib/cjs/components/metabase/index.js +8 -4
- package/lib/cjs/components/modules/summarize/group-by.js +1 -1
- package/lib/cjs/components/modules/summarize/select-index.js +1 -1
- package/lib/cjs/components/popup.d.ts +40 -102
- package/lib/cjs/components/popup.js +219 -190
- package/lib/cjs/hooks/use-state.js +14 -8
- package/lib/cjs/index.js +4 -1
- package/lib/cjs/types.d.ts +1 -0
- package/lib/es/components/metabase/index.js +8 -4
- package/lib/es/components/modules/summarize/group-by.js +1 -1
- package/lib/es/components/modules/summarize/select-index.js +1 -1
- package/lib/es/components/popup.d.ts +40 -102
- package/lib/es/components/popup.js +220 -191
- package/lib/es/hooks/use-state.js +14 -8
- package/lib/es/index.js +4 -1
- package/lib/es/types.d.ts +1 -0
- package/package.json +1 -1
|
@@ -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
|
-
|
|
148
|
-
|
|
149
|
-
var _useState45 = (0, _react.useState)(
|
|
147
|
+
groupByEnableAlias = _useState44[0],
|
|
148
|
+
setGroupByEnableAlias = _useState44[1]; // 聚合是否开启别名
|
|
149
|
+
var _useState45 = (0, _react.useState)(true),
|
|
150
150
|
_useState46 = (0, _slicedToArray2["default"])(_useState45, 2),
|
|
151
|
-
|
|
152
|
-
|
|
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
|
-
|
|
156
|
-
|
|
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) => {
|
package/lib/cjs/types.d.ts
CHANGED
|
@@ -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
|
-
|
|
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
|
-
|
|
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.
|
|
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.
|
|
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
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
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
|
-
|
|
24
|
+
closable: boolean;
|
|
25
|
+
innerSpacing: number;
|
|
49
26
|
};
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
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;
|