@finos/legend-query-builder 0.6.23 → 0.6.24
Sign up to get free protection for your applications and to get access to all the features.
- package/lib/components/QueryBuilder.d.ts.map +1 -1
- package/lib/components/QueryBuilder.js +8 -5
- package/lib/components/QueryBuilder.js.map +1 -1
- package/lib/components/QueryBuilderConstantExpressionPanel.js +1 -1
- package/lib/components/QueryBuilderConstantExpressionPanel.js.map +1 -1
- package/lib/components/QueryBuilderParametersPanel.js +1 -1
- package/lib/components/QueryBuilderParametersPanel.js.map +1 -1
- package/lib/components/QueryBuilderSideBar.js +2 -2
- package/lib/components/QueryBuilderSideBar.js.map +1 -1
- package/lib/components/QueryBuilder_TestID.d.ts +1 -1
- package/lib/components/QueryBuilder_TestID.d.ts.map +1 -1
- package/lib/components/QueryBuilder_TestID.js +1 -1
- package/lib/components/QueryBuilder_TestID.js.map +1 -1
- package/lib/components/fetch-structure/QueryBuilderPostFilterPanel.js +5 -5
- package/lib/components/fetch-structure/QueryBuilderPostFilterPanel.js.map +1 -1
- package/lib/components/fetch-structure/QueryBuilderPostTDSPanel.d.ts.map +1 -1
- package/lib/components/fetch-structure/QueryBuilderPostTDSPanel.js +3 -3
- package/lib/components/fetch-structure/QueryBuilderPostTDSPanel.js.map +1 -1
- package/lib/components/fetch-structure/{QueryBuilderOLAPGroupByPanel.d.ts → QueryBuilderTDSWindowPanel.d.ts} +4 -4
- package/lib/components/fetch-structure/QueryBuilderTDSWindowPanel.d.ts.map +1 -0
- package/lib/components/fetch-structure/{QueryBuilderOLAPGroupByPanel.js → QueryBuilderTDSWindowPanel.js} +94 -94
- package/lib/components/fetch-structure/QueryBuilderTDSWindowPanel.js.map +1 -0
- package/lib/components/workflows/ClassQueryBuilder.js +1 -1
- package/lib/components/workflows/ClassQueryBuilder.js.map +1 -1
- package/lib/components/workflows/MappingQueryBuilder.js +1 -1
- package/lib/components/workflows/MappingQueryBuilder.js.map +1 -1
- package/lib/graphManager/QueryBuilderHashUtils.d.ts +14 -14
- package/lib/graphManager/QueryBuilderHashUtils.d.ts.map +1 -1
- package/lib/graphManager/QueryBuilderHashUtils.js +14 -14
- package/lib/graphManager/QueryBuilderHashUtils.js.map +1 -1
- package/lib/index.css +1 -1
- package/lib/package.json +6 -6
- package/lib/stores/QueryBuilderStateBuilder.js +1 -1
- package/lib/stores/QueryBuilderStateBuilder.js.map +1 -1
- package/lib/stores/QueryBuilderValueSpecificationBuilder.d.ts.map +1 -1
- package/lib/stores/QueryBuilderValueSpecificationBuilder.js +2 -1
- package/lib/stores/QueryBuilderValueSpecificationBuilder.js.map +1 -1
- package/lib/stores/QueryBuilderValueSpecificationBuilderHelper.d.ts.map +1 -1
- package/lib/stores/QueryBuilderValueSpecificationBuilderHelper.js +2 -1
- package/lib/stores/QueryBuilderValueSpecificationBuilderHelper.js.map +1 -1
- package/lib/stores/fetch-structure/tds/QueryBuilderTDSState.d.ts +6 -6
- package/lib/stores/fetch-structure/tds/QueryBuilderTDSState.d.ts.map +1 -1
- package/lib/stores/fetch-structure/tds/QueryBuilderTDSState.js +13 -13
- package/lib/stores/fetch-structure/tds/QueryBuilderTDSState.js.map +1 -1
- package/lib/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperatorHelper.js +2 -2
- package/lib/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperatorHelper.js.map +1 -1
- package/lib/stores/fetch-structure/tds/projection/QueryBuilderProjectionValueSpecificationBuilder.js +2 -2
- package/lib/stores/fetch-structure/tds/projection/QueryBuilderProjectionValueSpecificationBuilder.js.map +1 -1
- package/lib/stores/fetch-structure/tds/{olapGroupBy/QueryBuilderOLAPGroupByOperatorLoader.d.ts → window/QueryBuilderWindowGroupByOperatorLoader.d.ts} +3 -3
- package/lib/stores/fetch-structure/tds/window/QueryBuilderWindowGroupByOperatorLoader.d.ts.map +1 -0
- package/lib/stores/fetch-structure/tds/window/QueryBuilderWindowGroupByOperatorLoader.js +36 -0
- package/lib/stores/fetch-structure/tds/window/QueryBuilderWindowGroupByOperatorLoader.js.map +1 -0
- package/lib/stores/fetch-structure/tds/window/QueryBuilderWindowState.d.ts +91 -0
- package/lib/stores/fetch-structure/tds/window/QueryBuilderWindowState.d.ts.map +1 -0
- package/lib/stores/fetch-structure/tds/{olapGroupBy/QueryBuilderOLAPGroupByState.js → window/QueryBuilderWindowState.js} +55 -53
- package/lib/stores/fetch-structure/tds/window/QueryBuilderWindowState.js.map +1 -0
- package/lib/stores/fetch-structure/tds/{olapGroupBy/QueryBuilderOLAPGroupByStateBuilder.d.ts → window/QueryBuilderWindowStateBuilder.d.ts} +1 -1
- package/lib/stores/fetch-structure/tds/window/QueryBuilderWindowStateBuilder.d.ts.map +1 -0
- package/lib/stores/fetch-structure/tds/{olapGroupBy/QueryBuilderOLAPGroupByStateBuilder.js → window/QueryBuilderWindowStateBuilder.js} +10 -10
- package/lib/stores/fetch-structure/tds/window/QueryBuilderWindowStateBuilder.js.map +1 -0
- package/lib/stores/fetch-structure/tds/{olapGroupBy/QueryBuilderOLAPGroupByValueSpecificationBuilder.d.ts → window/QueryBuilderWindowValueSpecificationBuilder.d.ts} +3 -3
- package/lib/stores/fetch-structure/tds/window/QueryBuilderWindowValueSpecificationBuilder.d.ts.map +1 -0
- package/lib/stores/fetch-structure/tds/{olapGroupBy/QueryBuilderOLAPGroupByValueSpecificationBuilder.js → window/QueryBuilderWindowValueSpecificationBuilder.js} +5 -5
- package/lib/stores/fetch-structure/tds/window/QueryBuilderWindowValueSpecificationBuilder.js.map +1 -0
- package/lib/stores/fetch-structure/tds/{olapGroupBy/operators/QueryBuilderTDS_OLAPOperator.d.ts → window/operators/QueryBuilderTDS_WindowOperator.d.ts} +2 -2
- package/lib/stores/fetch-structure/tds/window/operators/QueryBuilderTDS_WindowOperator.d.ts.map +1 -0
- package/lib/stores/fetch-structure/tds/{olapGroupBy/operators/QueryBuilderTDS_OLAPOperator.js → window/operators/QueryBuilderTDS_WindowOperator.js} +2 -2
- package/lib/stores/fetch-structure/tds/window/operators/QueryBuilderTDS_WindowOperator.js.map +1 -0
- package/lib/stores/fetch-structure/tds/window/operators/QueryBuilderTDS_WindowOperator_Average.d.ts +25 -0
- package/lib/stores/fetch-structure/tds/window/operators/QueryBuilderTDS_WindowOperator_Average.d.ts.map +1 -0
- package/lib/stores/fetch-structure/tds/{olapGroupBy/operators/QueryBuilderTDS_OLAPOperator_Average.js → window/operators/QueryBuilderTDS_WindowOperator_Average.js} +6 -4
- package/lib/stores/fetch-structure/tds/window/operators/QueryBuilderTDS_WindowOperator_Average.js.map +1 -0
- package/lib/stores/fetch-structure/tds/{olapGroupBy/operators/QueryBuilderTDS_OLAPOperator_Max.d.ts → window/operators/QueryBuilderTDS_WindowOperator_Count.d.ts} +3 -3
- package/lib/stores/fetch-structure/tds/window/operators/QueryBuilderTDS_WindowOperator_Count.d.ts.map +1 -0
- package/lib/stores/fetch-structure/tds/{olapGroupBy/operators/QueryBuilderTDS_OLAPOperator_Count.js → window/operators/QueryBuilderTDS_WindowOperator_Count.js} +4 -4
- package/lib/stores/fetch-structure/tds/window/operators/QueryBuilderTDS_WindowOperator_Count.js.map +1 -0
- package/lib/stores/fetch-structure/tds/{olapGroupBy/operators/QueryBuilderTDS_OLAPOperator_Min.d.ts → window/operators/QueryBuilderTDS_WindowOperator_Max.d.ts} +3 -3
- package/lib/stores/fetch-structure/tds/window/operators/QueryBuilderTDS_WindowOperator_Max.d.ts.map +1 -0
- package/lib/stores/fetch-structure/tds/{olapGroupBy/operators/QueryBuilderTDS_OLAPOperator_Max.js → window/operators/QueryBuilderTDS_WindowOperator_Max.js} +4 -4
- package/lib/stores/fetch-structure/tds/window/operators/QueryBuilderTDS_WindowOperator_Max.js.map +1 -0
- package/lib/stores/fetch-structure/tds/{olapGroupBy/operators/QueryBuilderTDS_OLAPOperator_Average.d.ts → window/operators/QueryBuilderTDS_WindowOperator_Min.d.ts} +3 -3
- package/lib/stores/fetch-structure/tds/window/operators/QueryBuilderTDS_WindowOperator_Min.d.ts.map +1 -0
- package/lib/stores/fetch-structure/tds/{olapGroupBy/operators/QueryBuilderTDS_OLAPOperator_Min.js → window/operators/QueryBuilderTDS_WindowOperator_Min.js} +4 -4
- package/lib/stores/fetch-structure/tds/window/operators/QueryBuilderTDS_WindowOperator_Min.js.map +1 -0
- package/lib/stores/fetch-structure/tds/{olapGroupBy/operators/QueryBuilderTDS_OLAPOperator_Count.d.ts → window/operators/QueryBuilderTDS_WindowOperator_Sum.d.ts} +3 -3
- package/lib/stores/fetch-structure/tds/window/operators/QueryBuilderTDS_WindowOperator_Sum.d.ts.map +1 -0
- package/lib/stores/fetch-structure/tds/{olapGroupBy/operators/QueryBuilderTDS_OLAPOperator_Sum.js → window/operators/QueryBuilderTDS_WindowOperator_Sum.js} +4 -4
- package/lib/stores/fetch-structure/tds/window/operators/QueryBuilderTDS_WindowOperator_Sum.js.map +1 -0
- package/lib/stores/fetch-structure/tds/{olapGroupBy/operators/QueryBuilderTDS_OLAPRankOperator_RowNumber.d.ts → window/operators/QueryBuilderTDS_WindowRankOperator_AverageRank.d.ts} +3 -3
- package/lib/stores/fetch-structure/tds/window/operators/QueryBuilderTDS_WindowRankOperator_AverageRank.d.ts.map +1 -0
- package/lib/stores/fetch-structure/tds/{olapGroupBy/operators/QueryBuilderTDS_OLAPRankOperator_AverageRank.js → window/operators/QueryBuilderTDS_WindowRankOperator_AverageRank.js} +4 -4
- package/lib/stores/fetch-structure/tds/window/operators/QueryBuilderTDS_WindowRankOperator_AverageRank.js.map +1 -0
- package/lib/stores/fetch-structure/tds/{olapGroupBy/operators/QueryBuilderTDS_OLAPRankOperator_AverageRank.d.ts → window/operators/QueryBuilderTDS_WindowRankOperator_DenseRank.d.ts} +3 -3
- package/lib/stores/fetch-structure/tds/window/operators/QueryBuilderTDS_WindowRankOperator_DenseRank.d.ts.map +1 -0
- package/lib/stores/fetch-structure/tds/{olapGroupBy/operators/QueryBuilderTDS_OLAPRankOperator_DenseRank.js → window/operators/QueryBuilderTDS_WindowRankOperator_DenseRank.js} +4 -4
- package/lib/stores/fetch-structure/tds/window/operators/QueryBuilderTDS_WindowRankOperator_DenseRank.js.map +1 -0
- package/lib/stores/fetch-structure/tds/{olapGroupBy/operators/QueryBuilderTDS_OLAPRankOperator_DenseRank.d.ts → window/operators/QueryBuilderTDS_WindowRankOperator_Rank.d.ts} +3 -3
- package/lib/stores/fetch-structure/tds/window/operators/QueryBuilderTDS_WindowRankOperator_Rank.d.ts.map +1 -0
- package/lib/stores/fetch-structure/tds/{olapGroupBy/operators/QueryBuilderTDS_OLAPRankOperator_Rank.js → window/operators/QueryBuilderTDS_WindowRankOperator_Rank.js} +4 -4
- package/lib/stores/fetch-structure/tds/window/operators/QueryBuilderTDS_WindowRankOperator_Rank.js.map +1 -0
- package/lib/stores/fetch-structure/tds/{olapGroupBy/operators/QueryBuilderTDS_OLAPRankOperator_Rank.d.ts → window/operators/QueryBuilderTDS_WindowRankOperator_RowNumber.d.ts} +3 -3
- package/lib/stores/fetch-structure/tds/window/operators/QueryBuilderTDS_WindowRankOperator_RowNumber.d.ts.map +1 -0
- package/lib/stores/fetch-structure/tds/{olapGroupBy/operators/QueryBuilderTDS_OLAPRankOperator_RowNumber.js → window/operators/QueryBuilderTDS_WindowRankOperator_RowNumber.js} +4 -4
- package/lib/stores/fetch-structure/tds/window/operators/QueryBuilderTDS_WindowRankOperator_RowNumber.js.map +1 -0
- package/lib/stores/shared/LambdaParameterState.d.ts.map +1 -1
- package/lib/stores/shared/LambdaParameterState.js.map +1 -1
- package/package.json +13 -13
- package/src/components/QueryBuilder.tsx +16 -6
- package/src/components/QueryBuilderConstantExpressionPanel.tsx +1 -1
- package/src/components/QueryBuilderParametersPanel.tsx +1 -1
- package/src/components/QueryBuilderSideBar.tsx +2 -2
- package/src/components/QueryBuilder_TestID.ts +1 -1
- package/src/components/fetch-structure/QueryBuilderPostFilterPanel.tsx +8 -8
- package/src/components/fetch-structure/QueryBuilderPostTDSPanel.tsx +6 -8
- package/src/components/fetch-structure/{QueryBuilderOLAPGroupByPanel.tsx → QueryBuilderTDSWindowPanel.tsx} +166 -166
- package/src/components/workflows/ClassQueryBuilder.tsx +1 -1
- package/src/components/workflows/MappingQueryBuilder.tsx +1 -1
- package/src/graphManager/QueryBuilderHashUtils.ts +14 -14
- package/src/stores/QueryBuilderStateBuilder.ts +1 -1
- package/src/stores/QueryBuilderValueSpecificationBuilder.ts +4 -2
- package/src/stores/QueryBuilderValueSpecificationBuilderHelper.ts +3 -1
- package/src/stores/fetch-structure/tds/QueryBuilderTDSState.ts +16 -16
- package/src/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperatorHelper.ts +2 -2
- package/src/stores/fetch-structure/tds/projection/QueryBuilderProjectionValueSpecificationBuilder.ts +2 -2
- package/src/stores/fetch-structure/tds/window/QueryBuilderWindowGroupByOperatorLoader.ts +39 -0
- package/src/stores/fetch-structure/tds/{olapGroupBy/QueryBuilderOLAPGroupByState.ts → window/QueryBuilderWindowState.ts} +83 -76
- package/src/stores/fetch-structure/tds/{olapGroupBy/QueryBuilderOLAPGroupByStateBuilder.ts → window/QueryBuilderWindowStateBuilder.ts} +19 -19
- package/src/stores/fetch-structure/tds/{olapGroupBy/QueryBuilderOLAPGroupByValueSpecificationBuilder.ts → window/QueryBuilderWindowValueSpecificationBuilder.ts} +9 -9
- package/src/stores/fetch-structure/tds/{olapGroupBy/operators/QueryBuilderTDS_OLAPOperator.ts → window/operators/QueryBuilderTDS_WindowOperator.ts} +1 -1
- package/src/stores/fetch-structure/tds/{olapGroupBy/operators/QueryBuilderTDS_OLAPOperator_Average.ts → window/operators/QueryBuilderTDS_WindowOperator_Average.ts} +5 -3
- package/src/stores/fetch-structure/tds/{olapGroupBy/operators/QueryBuilderTDS_OLAPOperator_Count.ts → window/operators/QueryBuilderTDS_WindowOperator_Count.ts} +3 -3
- package/src/stores/fetch-structure/tds/{olapGroupBy/operators/QueryBuilderTDS_OLAPOperator_Max.ts → window/operators/QueryBuilderTDS_WindowOperator_Max.ts} +3 -3
- package/src/stores/fetch-structure/tds/{olapGroupBy/operators/QueryBuilderTDS_OLAPOperator_Min.ts → window/operators/QueryBuilderTDS_WindowOperator_Min.ts} +3 -3
- package/src/stores/fetch-structure/tds/{olapGroupBy/operators/QueryBuilderTDS_OLAPOperator_Sum.ts → window/operators/QueryBuilderTDS_WindowOperator_Sum.ts} +3 -3
- package/src/stores/fetch-structure/tds/{olapGroupBy/operators/QueryBuilderTDS_OLAPRankOperator_AverageRank.ts → window/operators/QueryBuilderTDS_WindowRankOperator_AverageRank.ts} +3 -3
- package/src/stores/fetch-structure/tds/{olapGroupBy/operators/QueryBuilderTDS_OLAPRankOperator_DenseRank.ts → window/operators/QueryBuilderTDS_WindowRankOperator_DenseRank.ts} +3 -3
- package/src/stores/fetch-structure/tds/{olapGroupBy/operators/QueryBuilderTDS_OLAPRankOperator_Rank.ts → window/operators/QueryBuilderTDS_WindowRankOperator_Rank.ts} +3 -3
- package/src/stores/fetch-structure/tds/{olapGroupBy/operators/QueryBuilderTDS_OLAPRankOperator_RowNumber.ts → window/operators/QueryBuilderTDS_WindowRankOperator_RowNumber.ts} +3 -3
- package/src/stores/shared/LambdaParameterState.ts +1 -0
- package/tsconfig.json +15 -15
- package/lib/components/fetch-structure/QueryBuilderOLAPGroupByPanel.d.ts.map +0 -1
- package/lib/components/fetch-structure/QueryBuilderOLAPGroupByPanel.js.map +0 -1
- package/lib/stores/fetch-structure/tds/olapGroupBy/QueryBuilderOLAPGroupByOperatorLoader.d.ts.map +0 -1
- package/lib/stores/fetch-structure/tds/olapGroupBy/QueryBuilderOLAPGroupByOperatorLoader.js +0 -36
- package/lib/stores/fetch-structure/tds/olapGroupBy/QueryBuilderOLAPGroupByOperatorLoader.js.map +0 -1
- package/lib/stores/fetch-structure/tds/olapGroupBy/QueryBuilderOLAPGroupByState.d.ts +0 -91
- package/lib/stores/fetch-structure/tds/olapGroupBy/QueryBuilderOLAPGroupByState.d.ts.map +0 -1
- package/lib/stores/fetch-structure/tds/olapGroupBy/QueryBuilderOLAPGroupByState.js.map +0 -1
- package/lib/stores/fetch-structure/tds/olapGroupBy/QueryBuilderOLAPGroupByStateBuilder.d.ts.map +0 -1
- package/lib/stores/fetch-structure/tds/olapGroupBy/QueryBuilderOLAPGroupByStateBuilder.js.map +0 -1
- package/lib/stores/fetch-structure/tds/olapGroupBy/QueryBuilderOLAPGroupByValueSpecificationBuilder.d.ts.map +0 -1
- package/lib/stores/fetch-structure/tds/olapGroupBy/QueryBuilderOLAPGroupByValueSpecificationBuilder.js.map +0 -1
- package/lib/stores/fetch-structure/tds/olapGroupBy/operators/QueryBuilderTDS_OLAPOperator.d.ts.map +0 -1
- package/lib/stores/fetch-structure/tds/olapGroupBy/operators/QueryBuilderTDS_OLAPOperator.js.map +0 -1
- package/lib/stores/fetch-structure/tds/olapGroupBy/operators/QueryBuilderTDS_OLAPOperator_Average.d.ts.map +0 -1
- package/lib/stores/fetch-structure/tds/olapGroupBy/operators/QueryBuilderTDS_OLAPOperator_Average.js.map +0 -1
- package/lib/stores/fetch-structure/tds/olapGroupBy/operators/QueryBuilderTDS_OLAPOperator_Count.d.ts.map +0 -1
- package/lib/stores/fetch-structure/tds/olapGroupBy/operators/QueryBuilderTDS_OLAPOperator_Count.js.map +0 -1
- package/lib/stores/fetch-structure/tds/olapGroupBy/operators/QueryBuilderTDS_OLAPOperator_Max.d.ts.map +0 -1
- package/lib/stores/fetch-structure/tds/olapGroupBy/operators/QueryBuilderTDS_OLAPOperator_Max.js.map +0 -1
- package/lib/stores/fetch-structure/tds/olapGroupBy/operators/QueryBuilderTDS_OLAPOperator_Min.d.ts.map +0 -1
- package/lib/stores/fetch-structure/tds/olapGroupBy/operators/QueryBuilderTDS_OLAPOperator_Min.js.map +0 -1
- package/lib/stores/fetch-structure/tds/olapGroupBy/operators/QueryBuilderTDS_OLAPOperator_Sum.d.ts +0 -25
- package/lib/stores/fetch-structure/tds/olapGroupBy/operators/QueryBuilderTDS_OLAPOperator_Sum.d.ts.map +0 -1
- package/lib/stores/fetch-structure/tds/olapGroupBy/operators/QueryBuilderTDS_OLAPOperator_Sum.js.map +0 -1
- package/lib/stores/fetch-structure/tds/olapGroupBy/operators/QueryBuilderTDS_OLAPRankOperator_AverageRank.d.ts.map +0 -1
- package/lib/stores/fetch-structure/tds/olapGroupBy/operators/QueryBuilderTDS_OLAPRankOperator_AverageRank.js.map +0 -1
- package/lib/stores/fetch-structure/tds/olapGroupBy/operators/QueryBuilderTDS_OLAPRankOperator_DenseRank.d.ts.map +0 -1
- package/lib/stores/fetch-structure/tds/olapGroupBy/operators/QueryBuilderTDS_OLAPRankOperator_DenseRank.js.map +0 -1
- package/lib/stores/fetch-structure/tds/olapGroupBy/operators/QueryBuilderTDS_OLAPRankOperator_Rank.d.ts.map +0 -1
- package/lib/stores/fetch-structure/tds/olapGroupBy/operators/QueryBuilderTDS_OLAPRankOperator_Rank.js.map +0 -1
- package/lib/stores/fetch-structure/tds/olapGroupBy/operators/QueryBuilderTDS_OLAPRankOperator_RowNumber.d.ts.map +0 -1
- package/lib/stores/fetch-structure/tds/olapGroupBy/operators/QueryBuilderTDS_OLAPRankOperator_RowNumber.js.map +0 -1
- package/src/stores/fetch-structure/tds/olapGroupBy/QueryBuilderOLAPGroupByOperatorLoader.ts +0 -39
@@ -47,16 +47,16 @@ import { assertErrorThrown, guaranteeNonNullable } from '@finos/legend-shared';
|
|
47
47
|
import { observer } from 'mobx-react-lite';
|
48
48
|
import { forwardRef, useCallback, useRef, useState } from 'react';
|
49
49
|
import { type DropTargetMonitor, useDrag, useDrop } from 'react-dnd';
|
50
|
-
import type {
|
50
|
+
import type { QueryBuilderTDS_WindowOperator } from '../../stores/fetch-structure/tds/window/operators/QueryBuilderTDS_WindowOperator.js';
|
51
51
|
import {
|
52
|
-
type
|
53
|
-
type
|
54
|
-
type
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
} from '../../stores/fetch-structure/tds/
|
52
|
+
type QueryBuilderWindowState,
|
53
|
+
type QueryBuilderWindowDropTarget,
|
54
|
+
type QueryBuilderWindowColumnDragSource,
|
55
|
+
QueryBuilderWindowColumnState,
|
56
|
+
QueryBuilderTDS_WindowRankOperatorState,
|
57
|
+
QueryBuilderTDS_WindowAggreationOperatorState,
|
58
|
+
QUERY_BUILDER_WINDOW_COLUMN_DND_TYPE,
|
59
|
+
} from '../../stores/fetch-structure/tds/window/QueryBuilderWindowState.js';
|
60
60
|
import { QUERY_BUILDER_PROJECTION_COLUMN_DND_TYPE } from '../../stores/fetch-structure/tds/projection/QueryBuilderProjectionColumnState.js';
|
61
61
|
import type { QueryBuilderTDSColumnState } from '../../stores/fetch-structure/tds/QueryBuilderTDSColumnState.js';
|
62
62
|
import type { QueryBuilderTDSState } from '../../stores/fetch-structure/tds/QueryBuilderTDSState.js';
|
@@ -64,40 +64,38 @@ import { COLUMN_SORT_TYPE } from '../../stores/fetch-structure/tds/QueryResultSe
|
|
64
64
|
import { QUERY_BUILDER_TEST_ID } from '../QueryBuilder_TestID.js';
|
65
65
|
|
66
66
|
// helpers
|
67
|
-
const
|
67
|
+
const createWindowColumnState = (
|
68
68
|
columnState: QueryBuilderTDSColumnState,
|
69
69
|
tdsState: QueryBuilderTDSState,
|
70
|
-
):
|
71
|
-
const operator = tdsState.
|
70
|
+
): QueryBuilderWindowColumnState => {
|
71
|
+
const operator = tdsState.windowState.operators.filter(
|
72
72
|
(o) =>
|
73
73
|
o.isColumnAggregator() &&
|
74
74
|
o.isCompatibleWithType(columnState.getColumnType()),
|
75
75
|
)[0];
|
76
76
|
const nonColoperator = guaranteeNonNullable(
|
77
|
-
tdsState.
|
78
|
-
(o) => !o.isColumnAggregator(),
|
79
|
-
)[0],
|
77
|
+
tdsState.windowState.operators.filter((o) => !o.isColumnAggregator())[0],
|
80
78
|
);
|
81
79
|
if (operator) {
|
82
|
-
const opState = new
|
83
|
-
tdsState.
|
80
|
+
const opState = new QueryBuilderTDS_WindowAggreationOperatorState(
|
81
|
+
tdsState.windowState,
|
84
82
|
operator,
|
85
83
|
columnState,
|
86
84
|
);
|
87
|
-
return new
|
88
|
-
tdsState.
|
85
|
+
return new QueryBuilderWindowColumnState(
|
86
|
+
tdsState.windowState,
|
89
87
|
[],
|
90
88
|
undefined,
|
91
89
|
opState,
|
92
90
|
`${operator.getLabel()} ${columnState.columnName}`,
|
93
91
|
);
|
94
92
|
} else {
|
95
|
-
return new
|
96
|
-
tdsState.
|
93
|
+
return new QueryBuilderWindowColumnState(
|
94
|
+
tdsState.windowState,
|
97
95
|
[columnState],
|
98
96
|
undefined,
|
99
|
-
new
|
100
|
-
tdsState.
|
97
|
+
new QueryBuilderTDS_WindowRankOperatorState(
|
98
|
+
tdsState.windowState,
|
101
99
|
nonColoperator,
|
102
100
|
),
|
103
101
|
`${nonColoperator.getLabel()} ${columnState.columnName}`,
|
@@ -105,18 +103,18 @@ const createOlapColumnState = (
|
|
105
103
|
}
|
106
104
|
};
|
107
105
|
|
108
|
-
const
|
106
|
+
const QueryBuilderWindowColumnContextMenu = observer(
|
109
107
|
forwardRef<
|
110
108
|
HTMLDivElement,
|
111
109
|
{
|
112
|
-
columnState:
|
110
|
+
columnState: QueryBuilderWindowColumnState;
|
113
111
|
}
|
114
|
-
>(function
|
112
|
+
>(function QueryBuilderWindowGroupByColumnContextMenu(props, ref) {
|
115
113
|
const { columnState } = props;
|
116
114
|
const editColumn = (): void =>
|
117
|
-
columnState.
|
115
|
+
columnState.windowState.setEditColumn(columnState);
|
118
116
|
const removeColumn = (): void =>
|
119
|
-
columnState.
|
117
|
+
columnState.windowState.removeColumn(columnState);
|
120
118
|
|
121
119
|
return (
|
122
120
|
<MenuContent ref={ref}>
|
@@ -176,27 +174,27 @@ const TDSColumnSelectorEditor = observer(
|
|
176
174
|
},
|
177
175
|
);
|
178
176
|
|
179
|
-
const
|
177
|
+
const QueryBuilderWindowColumnModalEditor = observer(
|
180
178
|
(props: {
|
181
|
-
|
182
|
-
|
179
|
+
windowState: QueryBuilderWindowState;
|
180
|
+
windowColumnState: QueryBuilderWindowColumnState;
|
183
181
|
}) => {
|
184
|
-
const {
|
185
|
-
const
|
186
|
-
!
|
187
|
-
const tdsState =
|
182
|
+
const { windowState, windowColumnState } = props;
|
183
|
+
const createNewWindow =
|
184
|
+
!windowState.windowColumns.includes(windowColumnState);
|
185
|
+
const tdsState = windowState.tdsState;
|
188
186
|
const applicationStore = useApplicationStore();
|
189
187
|
const close = (): void => {
|
190
|
-
|
188
|
+
windowState.setEditColumn(undefined);
|
191
189
|
};
|
192
|
-
const isDuplicatedColumnName =
|
193
|
-
?
|
190
|
+
const isDuplicatedColumnName = createNewWindow
|
191
|
+
? windowState.tdsState.tdsColumns
|
194
192
|
.map((c) => c.columnName)
|
195
|
-
.includes(
|
196
|
-
:
|
197
|
-
const windowOptions =
|
193
|
+
.includes(windowColumnState.columnName)
|
194
|
+
: windowState.tdsState.isDuplicateColumn(windowColumnState);
|
195
|
+
const windowOptions = createNewWindow
|
198
196
|
? tdsState.tdsColumns
|
199
|
-
:
|
197
|
+
: windowColumnState.possibleReferencedColumns;
|
200
198
|
const windowOptionsLabels = windowOptions.map((w) => ({
|
201
199
|
label: w.columnName,
|
202
200
|
value: w,
|
@@ -204,19 +202,19 @@ const QueryBuilderOlapColumnModalEditor = observer(
|
|
204
202
|
// column Name
|
205
203
|
const changeColumnName: React.ChangeEventHandler<HTMLInputElement> = (
|
206
204
|
event,
|
207
|
-
) =>
|
205
|
+
) => windowColumnState.setColumnName(event.target.value);
|
208
206
|
// operator
|
209
|
-
const operators =
|
210
|
-
const operationState =
|
211
|
-
const
|
212
|
-
operationState instanceof
|
207
|
+
const operators = windowState.operators;
|
208
|
+
const operationState = windowColumnState.operationState;
|
209
|
+
const windowOpColumn =
|
210
|
+
operationState instanceof QueryBuilderTDS_WindowAggreationOperatorState
|
213
211
|
? operationState.columnState
|
214
212
|
: undefined;
|
215
213
|
const changeOperatorCol = (
|
216
214
|
val: { label: string; value: QueryBuilderTDSColumnState } | null,
|
217
215
|
): void => {
|
218
216
|
if (
|
219
|
-
operationState instanceof
|
217
|
+
operationState instanceof QueryBuilderTDS_WindowAggreationOperatorState
|
220
218
|
) {
|
221
219
|
if (val !== null) {
|
222
220
|
operationState.setColumnState(val.value);
|
@@ -224,26 +222,26 @@ const QueryBuilderOlapColumnModalEditor = observer(
|
|
224
222
|
}
|
225
223
|
};
|
226
224
|
const changeOperator =
|
227
|
-
(olapOp:
|
228
|
-
|
225
|
+
(olapOp: QueryBuilderTDS_WindowOperator) => (): void => {
|
226
|
+
windowColumnState.changeOperator(olapOp);
|
229
227
|
};
|
230
228
|
// window
|
231
229
|
const addOptions = windowOptions.filter(
|
232
|
-
(e) => !
|
230
|
+
(e) => !windowColumnState.windowColumns.includes(e),
|
233
231
|
);
|
234
232
|
const create = (): void => {
|
235
|
-
|
233
|
+
windowState.addWindowColumn(windowColumnState);
|
236
234
|
close();
|
237
235
|
};
|
238
236
|
const addWindowValue = (): void => {
|
239
237
|
if (addOptions.length > 0) {
|
240
|
-
|
238
|
+
windowColumnState.addWindow(guaranteeNonNullable(addOptions[0]));
|
241
239
|
}
|
242
240
|
};
|
243
241
|
// sortby
|
244
|
-
const sortByState =
|
242
|
+
const sortByState = windowColumnState.sortByState;
|
245
243
|
const changeSortBy = (sortOp: COLUMN_SORT_TYPE | undefined) => (): void => {
|
246
|
-
|
244
|
+
windowColumnState.changeSortBy(sortOp);
|
247
245
|
};
|
248
246
|
const changeSortCol = (
|
249
247
|
val: { label: string; value: QueryBuilderTDSColumnState } | null,
|
@@ -256,7 +254,7 @@ const QueryBuilderOlapColumnModalEditor = observer(
|
|
256
254
|
};
|
257
255
|
return (
|
258
256
|
<Dialog
|
259
|
-
open={Boolean(
|
257
|
+
open={Boolean(windowState.editColumn)}
|
260
258
|
onClose={close}
|
261
259
|
classes={{
|
262
260
|
root: 'editor-modal__root-container',
|
@@ -276,18 +274,18 @@ const QueryBuilderOlapColumnModalEditor = observer(
|
|
276
274
|
>
|
277
275
|
<ModalHeader
|
278
276
|
title={
|
279
|
-
|
280
|
-
? 'Create
|
281
|
-
: 'Update
|
277
|
+
createNewWindow
|
278
|
+
? 'Create Window Function Column'
|
279
|
+
: 'Update Window Function Column'
|
282
280
|
}
|
283
281
|
/>
|
284
282
|
<div className="query-builder__olap__modal__body">
|
285
283
|
<PanelFormSection>
|
286
284
|
<div className="panel__content__form__section__header__label">
|
287
|
-
|
285
|
+
Window Operator
|
288
286
|
</div>
|
289
287
|
<div className="panel__content__form__section__header__prompt">
|
290
|
-
|
288
|
+
Window aggregation function to apply and column if required by
|
291
289
|
function
|
292
290
|
</div>
|
293
291
|
<div className="panel__content__form__section__list">
|
@@ -298,13 +296,13 @@ const QueryBuilderOlapColumnModalEditor = observer(
|
|
298
296
|
'query-builder__olap__column__operation__operator__label',
|
299
297
|
{
|
300
298
|
'query-builder__olap__column__operation__operator__label__agg':
|
301
|
-
!
|
299
|
+
!windowOpColumn,
|
302
300
|
},
|
303
301
|
)}
|
304
302
|
>
|
305
303
|
{operationState.operator.getLabel()}
|
306
304
|
</div>
|
307
|
-
{
|
305
|
+
{windowOpColumn && (
|
308
306
|
<div className="panel__content__form__section__list__item query-builder__olap__tds__column__options">
|
309
307
|
<CustomSelectorInput
|
310
308
|
className="query-builder__olap__tds__column__dropdown"
|
@@ -312,8 +310,8 @@ const QueryBuilderOlapColumnModalEditor = observer(
|
|
312
310
|
disabled={windowOptionsLabels.length < 1}
|
313
311
|
onChange={changeOperatorCol}
|
314
312
|
value={{
|
315
|
-
value:
|
316
|
-
label:
|
313
|
+
value: windowOpColumn,
|
314
|
+
label: windowOpColumn.columnName,
|
317
315
|
}}
|
318
316
|
darkMode={
|
319
317
|
!applicationStore.TEMPORARY__isLightThemeEnabled
|
@@ -352,14 +350,14 @@ const QueryBuilderOlapColumnModalEditor = observer(
|
|
352
350
|
<button
|
353
351
|
className="query-builder__olap__column__operation__operator__badge"
|
354
352
|
tabIndex={-1}
|
355
|
-
title="Choose
|
353
|
+
title="Choose Window Function Operator..."
|
356
354
|
>
|
357
355
|
<SigmaIcon />
|
358
356
|
</button>
|
359
357
|
<button
|
360
358
|
className="query-builder__olap__column__operation__operator__dropdown__trigger"
|
361
359
|
tabIndex={-1}
|
362
|
-
title="Choose
|
360
|
+
title="Choose Window Function Operator..."
|
363
361
|
>
|
364
362
|
<CaretDownIcon />
|
365
363
|
</button>
|
@@ -378,15 +376,15 @@ const QueryBuilderOlapColumnModalEditor = observer(
|
|
378
376
|
</div>
|
379
377
|
<div className="panel__content__form__section__list">
|
380
378
|
<div className="panel__content__form__section__list__items">
|
381
|
-
{
|
379
|
+
{windowColumnState.windowColumns.map((value, idx) => (
|
382
380
|
<TDSColumnSelectorEditor
|
383
381
|
key={value.uuid}
|
384
382
|
colValue={value}
|
385
383
|
setColumn={(v: QueryBuilderTDSColumnState) =>
|
386
|
-
|
384
|
+
windowColumnState.changeWindow(v, idx)
|
387
385
|
}
|
388
386
|
deleteColumn={(v: QueryBuilderTDSColumnState): void =>
|
389
|
-
|
387
|
+
windowColumnState.deleteWindow(v)
|
390
388
|
}
|
391
389
|
tdsColOptions={windowOptions}
|
392
390
|
/>
|
@@ -479,14 +477,14 @@ const QueryBuilderOlapColumnModalEditor = observer(
|
|
479
477
|
},
|
480
478
|
)}
|
481
479
|
tabIndex={-1}
|
482
|
-
title="Choose
|
480
|
+
title="Choose Window Function SortBy Operator..."
|
483
481
|
>
|
484
482
|
<SortIcon />
|
485
483
|
</div>
|
486
484
|
<div
|
487
485
|
className="query-builder__olap__column__sortby__operator__dropdown__trigger"
|
488
486
|
tabIndex={-1}
|
489
|
-
title="Choose
|
487
|
+
title="Choose Window Function SortBy Operator..."
|
490
488
|
>
|
491
489
|
<CaretDownIcon />
|
492
490
|
</div>
|
@@ -497,15 +495,15 @@ const QueryBuilderOlapColumnModalEditor = observer(
|
|
497
495
|
|
498
496
|
<PanelFormSection>
|
499
497
|
<div className="panel__content__form__section__header__label">
|
500
|
-
|
498
|
+
Window Function Column Name
|
501
499
|
</div>
|
502
500
|
<div className="panel__content__form__section__header__prompt">
|
503
|
-
Name of
|
501
|
+
Name of Window Function Column that will be part of TDS Result
|
504
502
|
</div>
|
505
503
|
<InputWithInlineValidation
|
506
504
|
className="query-builder__olap__column__name__input input-group__input"
|
507
505
|
spellCheck={false}
|
508
|
-
value={
|
506
|
+
value={windowColumnState.columnName}
|
509
507
|
onChange={changeColumnName}
|
510
508
|
validationErrorMessage={
|
511
509
|
isDuplicatedColumnName ? 'Duplicated column' : undefined
|
@@ -514,7 +512,7 @@ const QueryBuilderOlapColumnModalEditor = observer(
|
|
514
512
|
</PanelFormSection>
|
515
513
|
</div>
|
516
514
|
<ModalFooter>
|
517
|
-
{
|
515
|
+
{createNewWindow ? (
|
518
516
|
<button className="btn modal__footer__close-btn" onClick={create}>
|
519
517
|
Create
|
520
518
|
</button>
|
@@ -569,20 +567,20 @@ const TDSColumnReferenceEditor = observer(
|
|
569
567
|
};
|
570
568
|
|
571
569
|
const handleDrop = useCallback(
|
572
|
-
(item:
|
570
|
+
(item: QueryBuilderWindowColumnDragSource): void => {
|
573
571
|
handleChange(item.columnState);
|
574
572
|
},
|
575
573
|
[handleChange],
|
576
574
|
);
|
577
575
|
const [{ isDragOver }, dropOpConnector] = useDrop<
|
578
|
-
|
576
|
+
QueryBuilderWindowColumnDragSource,
|
579
577
|
void,
|
580
578
|
{ isDragOver: boolean }
|
581
579
|
>(
|
582
580
|
() => ({
|
583
581
|
accept: [
|
584
582
|
QUERY_BUILDER_PROJECTION_COLUMN_DND_TYPE,
|
585
|
-
|
583
|
+
QUERY_BUILDER_WINDOW_COLUMN_DND_TYPE,
|
586
584
|
],
|
587
585
|
drop: (item, monitor): void => {
|
588
586
|
if (!monitor.didDrop()) {
|
@@ -655,12 +653,12 @@ const TDSColumnReferenceEditor = observer(
|
|
655
653
|
},
|
656
654
|
);
|
657
655
|
|
658
|
-
const
|
659
|
-
(props: {
|
660
|
-
const {
|
661
|
-
const
|
662
|
-
const tdsState =
|
663
|
-
const operators =
|
656
|
+
const QueryBuilderWindowColumnEditor = observer(
|
657
|
+
(props: { windowColumnState: QueryBuilderWindowColumnState }) => {
|
658
|
+
const { windowColumnState } = props;
|
659
|
+
const windowState = windowColumnState.windowState;
|
660
|
+
const tdsState = windowState.tdsState;
|
661
|
+
const operators = windowState.operators;
|
664
662
|
// state
|
665
663
|
const ref = useRef<HTMLDivElement>(null);
|
666
664
|
const [windowAnchor, setWindowAnchor] = useState<HTMLButtonElement | null>(
|
@@ -682,58 +680,60 @@ const QueryBuilderOlapGroupByColumnEditor = observer(
|
|
682
680
|
// column Name
|
683
681
|
const changeColumnName: React.ChangeEventHandler<HTMLInputElement> = (
|
684
682
|
event,
|
685
|
-
) =>
|
686
|
-
const isDuplicatedColumnName =
|
683
|
+
) => windowColumnState.setColumnName(event.target.value);
|
684
|
+
const isDuplicatedColumnName =
|
685
|
+
tdsState.isDuplicateColumn(windowColumnState);
|
687
686
|
|
688
687
|
// window columns
|
689
|
-
const windowOptions =
|
688
|
+
const windowOptions = windowColumnState.possibleReferencedColumns;
|
690
689
|
const addWindowOptions = windowOptions.filter(
|
691
|
-
(e) => !
|
690
|
+
(e) => !windowColumnState.windowColumns.includes(e),
|
692
691
|
);
|
693
692
|
const addWindowValue = (): void => {
|
694
693
|
if (addWindowOptions.length > 0) {
|
695
|
-
|
694
|
+
windowColumnState.addWindow(guaranteeNonNullable(addWindowOptions[0]));
|
696
695
|
}
|
697
696
|
};
|
698
697
|
|
699
698
|
// operator
|
700
|
-
const operationState =
|
699
|
+
const operationState = windowColumnState.operationState;
|
701
700
|
const aggregateColumn =
|
702
|
-
operationState instanceof
|
701
|
+
operationState instanceof QueryBuilderTDS_WindowAggreationOperatorState
|
703
702
|
? operationState.columnState
|
704
703
|
: undefined;
|
705
704
|
|
706
705
|
const changeOperator =
|
707
|
-
(olapOp:
|
708
|
-
|
706
|
+
(olapOp: QueryBuilderTDS_WindowOperator) => (): void => {
|
707
|
+
windowColumnState.changeOperator(olapOp);
|
709
708
|
};
|
710
709
|
|
711
710
|
// sortby
|
712
|
-
const sortByState =
|
711
|
+
const sortByState = windowColumnState.sortByState;
|
713
712
|
const changeSortBy = (sortOp: COLUMN_SORT_TYPE | undefined) => (): void => {
|
714
|
-
|
713
|
+
windowColumnState.changeSortBy(sortOp);
|
715
714
|
};
|
716
715
|
|
717
716
|
// action
|
718
|
-
const isRemovalDisabled =
|
717
|
+
const isRemovalDisabled =
|
718
|
+
windowState.tdsState.isColumnInUse(windowColumnState);
|
719
719
|
const removeColumn = (): void => {
|
720
|
-
|
720
|
+
windowColumnState.windowState.removeColumn(windowColumnState);
|
721
721
|
};
|
722
722
|
const editoColumn = (): void => {
|
723
|
-
|
723
|
+
windowState.setEditColumn(windowColumnState);
|
724
724
|
};
|
725
725
|
|
726
726
|
// Drag and Drop
|
727
727
|
const handleHover = useCallback(
|
728
728
|
(
|
729
|
-
item:
|
729
|
+
item: QueryBuilderWindowColumnDragSource,
|
730
730
|
monitor: DropTargetMonitor,
|
731
731
|
): void => {
|
732
|
-
const dragIndex = tdsState.
|
732
|
+
const dragIndex = tdsState.windowState.windowColumns.findIndex(
|
733
733
|
(e) => e === item.columnState,
|
734
734
|
);
|
735
|
-
const hoverIndex = tdsState.
|
736
|
-
(e) => e ===
|
735
|
+
const hoverIndex = tdsState.windowState.windowColumns.findIndex(
|
736
|
+
(e) => e === windowColumnState,
|
737
737
|
);
|
738
738
|
if (dragIndex === -1 || hoverIndex === -1 || dragIndex === hoverIndex) {
|
739
739
|
return;
|
@@ -751,29 +751,29 @@ const QueryBuilderOlapGroupByColumnEditor = observer(
|
|
751
751
|
if (dragIndex > hoverIndex && dragDistance > distanceThreshold) {
|
752
752
|
return;
|
753
753
|
}
|
754
|
-
|
754
|
+
windowState.moveColumn(dragIndex, hoverIndex);
|
755
755
|
},
|
756
|
-
[
|
756
|
+
[windowColumnState, windowState, tdsState.windowState.windowColumns],
|
757
757
|
);
|
758
|
-
const [, dropConnector] = useDrop<
|
758
|
+
const [, dropConnector] = useDrop<QueryBuilderWindowColumnDragSource>(
|
759
759
|
() => ({
|
760
|
-
accept: [
|
760
|
+
accept: [QUERY_BUILDER_WINDOW_COLUMN_DND_TYPE],
|
761
761
|
hover: (item, monitor): void => handleHover(item, monitor),
|
762
762
|
}),
|
763
763
|
[handleHover],
|
764
764
|
);
|
765
765
|
const [{ olapColumnBeingDragged }, dragConnector, dragPreviewConnector] =
|
766
766
|
useDrag<
|
767
|
-
|
767
|
+
QueryBuilderWindowColumnDragSource,
|
768
768
|
void,
|
769
769
|
{
|
770
770
|
olapColumnBeingDragged: QueryBuilderTDSColumnState | undefined;
|
771
771
|
}
|
772
772
|
>(
|
773
773
|
() => ({
|
774
|
-
type:
|
774
|
+
type: QUERY_BUILDER_WINDOW_COLUMN_DND_TYPE,
|
775
775
|
item: () => ({
|
776
|
-
columnState:
|
776
|
+
columnState: windowColumnState,
|
777
777
|
}),
|
778
778
|
collect: (monitor) => ({
|
779
779
|
/**
|
@@ -781,19 +781,19 @@ const QueryBuilderOlapGroupByColumnEditor = observer(
|
|
781
781
|
*/
|
782
782
|
olapColumnBeingDragged:
|
783
783
|
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
|
784
|
-
(monitor.getItem() as
|
784
|
+
(monitor.getItem() as QueryBuilderWindowColumnDragSource | null)
|
785
785
|
?.columnState,
|
786
786
|
}),
|
787
787
|
}),
|
788
|
-
[
|
788
|
+
[windowColumnState],
|
789
789
|
);
|
790
|
-
const isBeingDragged =
|
790
|
+
const isBeingDragged = windowColumnState === olapColumnBeingDragged;
|
791
791
|
dragConnector(dropConnector(ref));
|
792
792
|
useDragPreviewLayer(dragPreviewConnector);
|
793
793
|
|
794
794
|
const handleOpDrop = (val: QueryBuilderTDSColumnState): void => {
|
795
795
|
if (
|
796
|
-
operationState instanceof
|
796
|
+
operationState instanceof QueryBuilderTDS_WindowAggreationOperatorState
|
797
797
|
) {
|
798
798
|
operationState.setColumnState(val);
|
799
799
|
}
|
@@ -804,26 +804,26 @@ const QueryBuilderOlapGroupByColumnEditor = observer(
|
|
804
804
|
}
|
805
805
|
};
|
806
806
|
const handleWindowDrop = useCallback(
|
807
|
-
(item:
|
807
|
+
(item: QueryBuilderWindowColumnDragSource): void => {
|
808
808
|
const colState = item.columnState;
|
809
809
|
if (
|
810
|
-
|
811
|
-
!
|
810
|
+
windowColumnState.possibleReferencedColumns.includes(colState) &&
|
811
|
+
!windowColumnState.windowColumns.includes(colState)
|
812
812
|
) {
|
813
|
-
|
813
|
+
windowColumnState.addWindow(colState);
|
814
814
|
}
|
815
815
|
},
|
816
|
-
[
|
816
|
+
[windowColumnState],
|
817
817
|
);
|
818
818
|
const [{ isDragOver }, dropOpConnector] = useDrop<
|
819
|
-
|
819
|
+
QueryBuilderWindowColumnDragSource,
|
820
820
|
void,
|
821
821
|
{ isDragOver: boolean }
|
822
822
|
>(
|
823
823
|
() => ({
|
824
824
|
accept: [
|
825
825
|
QUERY_BUILDER_PROJECTION_COLUMN_DND_TYPE,
|
826
|
-
|
826
|
+
QUERY_BUILDER_WINDOW_COLUMN_DND_TYPE,
|
827
827
|
],
|
828
828
|
drop: (item, monitor): void => {
|
829
829
|
if (!monitor.didDrop()) {
|
@@ -845,8 +845,8 @@ const QueryBuilderOlapGroupByColumnEditor = observer(
|
|
845
845
|
>
|
846
846
|
<ContextMenu
|
847
847
|
content={
|
848
|
-
<
|
849
|
-
columnState={
|
848
|
+
<QueryBuilderWindowColumnContextMenu
|
849
|
+
columnState={windowColumnState}
|
850
850
|
/>
|
851
851
|
}
|
852
852
|
className={clsx('query-builder__olap__column__context-menu', {
|
@@ -880,7 +880,7 @@ const QueryBuilderOlapGroupByColumnEditor = observer(
|
|
880
880
|
tdsColumn={aggregateColumn}
|
881
881
|
handleChange={handleOpDrop}
|
882
882
|
selectionEditor={{
|
883
|
-
options:
|
883
|
+
options: windowColumnState.possibleReferencedColumns,
|
884
884
|
}}
|
885
885
|
/>
|
886
886
|
)}
|
@@ -909,14 +909,14 @@ const QueryBuilderOlapGroupByColumnEditor = observer(
|
|
909
909
|
<button
|
910
910
|
className="query-builder__olap__column__operation__operator__badge"
|
911
911
|
tabIndex={-1}
|
912
|
-
title="Choose
|
912
|
+
title="Choose Window Function Operator..."
|
913
913
|
>
|
914
914
|
<SigmaIcon />
|
915
915
|
</button>
|
916
916
|
<button
|
917
917
|
className="query-builder__olap__column__operation__operator__dropdown__trigger"
|
918
918
|
tabIndex={-1}
|
919
|
-
title="Choose
|
919
|
+
title="Choose Window Function Operator..."
|
920
920
|
>
|
921
921
|
<CaretDownIcon />
|
922
922
|
</button>
|
@@ -936,10 +936,10 @@ const QueryBuilderOlapGroupByColumnEditor = observer(
|
|
936
936
|
className="query-builder__dnd__placeholder"
|
937
937
|
>
|
938
938
|
<div
|
939
|
-
title={`${
|
939
|
+
title={`${windowColumnState.windowColumns.length} columns partitioned`}
|
940
940
|
className="query-builder__olap__column__window__content__label"
|
941
941
|
>
|
942
|
-
({
|
942
|
+
({windowColumnState.windowColumns.length})
|
943
943
|
</div>
|
944
944
|
<div
|
945
945
|
className={clsx(
|
@@ -968,15 +968,15 @@ const QueryBuilderOlapGroupByColumnEditor = observer(
|
|
968
968
|
<div className="query-builder__olap__column__window__popover">
|
969
969
|
<div className="panel__content__form__section__list">
|
970
970
|
<div className="panel__content__form__section__list__items">
|
971
|
-
{
|
971
|
+
{windowColumnState.windowColumns.map((value, idx) => (
|
972
972
|
<TDSColumnSelectorEditor
|
973
973
|
key={value.uuid}
|
974
974
|
colValue={value}
|
975
975
|
setColumn={(v: QueryBuilderTDSColumnState) =>
|
976
|
-
|
976
|
+
windowColumnState.changeWindow(v, idx)
|
977
977
|
}
|
978
978
|
deleteColumn={(v: QueryBuilderTDSColumnState): void =>
|
979
|
-
|
979
|
+
windowColumnState.deleteWindow(v)
|
980
980
|
}
|
981
981
|
tdsColOptions={windowOptions}
|
982
982
|
/>
|
@@ -1008,7 +1008,7 @@ const QueryBuilderOlapGroupByColumnEditor = observer(
|
|
1008
1008
|
tdsColumn={sortByState.columnState}
|
1009
1009
|
handleChange={handleSortDrop}
|
1010
1010
|
selectionEditor={{
|
1011
|
-
options:
|
1011
|
+
options: windowColumnState.possibleReferencedColumns,
|
1012
1012
|
}}
|
1013
1013
|
/>
|
1014
1014
|
)}
|
@@ -1055,14 +1055,14 @@ const QueryBuilderOlapGroupByColumnEditor = observer(
|
|
1055
1055
|
},
|
1056
1056
|
)}
|
1057
1057
|
tabIndex={-1}
|
1058
|
-
title="Choose
|
1058
|
+
title="Choose Window Function SortBy Operator..."
|
1059
1059
|
>
|
1060
1060
|
<SortIcon />
|
1061
1061
|
</button>
|
1062
1062
|
<button
|
1063
1063
|
className="query-builder__olap__column__sortby__operator__dropdown__trigger"
|
1064
1064
|
tabIndex={-1}
|
1065
|
-
title="Choose
|
1065
|
+
title="Choose Window Function SortBy Operator..."
|
1066
1066
|
>
|
1067
1067
|
<CaretDownIcon />
|
1068
1068
|
</button>
|
@@ -1073,7 +1073,7 @@ const QueryBuilderOlapGroupByColumnEditor = observer(
|
|
1073
1073
|
<InputWithInlineValidation
|
1074
1074
|
className="query-builder__olap__column__name__input input-group__input"
|
1075
1075
|
spellCheck={false}
|
1076
|
-
value={
|
1076
|
+
value={windowColumnState.columnName}
|
1077
1077
|
onChange={changeColumnName}
|
1078
1078
|
validationErrorMessage={
|
1079
1079
|
isDuplicatedColumnName ? 'Duplicated column' : undefined
|
@@ -1109,46 +1109,46 @@ const QueryBuilderOlapGroupByColumnEditor = observer(
|
|
1109
1109
|
},
|
1110
1110
|
);
|
1111
1111
|
|
1112
|
-
export const
|
1113
|
-
(props: {
|
1114
|
-
const {
|
1112
|
+
export const QueryBuilderTDSWindowPanel = observer(
|
1113
|
+
(props: { tdsWindowState: QueryBuilderWindowState }) => {
|
1114
|
+
const { tdsWindowState } = props;
|
1115
1115
|
const applicationStore = useApplicationStore();
|
1116
|
-
const
|
1117
|
-
const col =
|
1116
|
+
const createTDSWindow = (): void => {
|
1117
|
+
const col = tdsWindowState.tdsState.tdsColumns[0];
|
1118
1118
|
if (col) {
|
1119
|
-
const
|
1119
|
+
const newWindowState = createWindowColumnState(
|
1120
1120
|
col,
|
1121
|
-
|
1121
|
+
tdsWindowState.tdsState,
|
1122
1122
|
);
|
1123
|
-
|
1123
|
+
tdsWindowState.setEditColumn(newWindowState);
|
1124
1124
|
}
|
1125
1125
|
};
|
1126
1126
|
// Drag and Drop
|
1127
1127
|
const handleDrop = useCallback(
|
1128
|
-
async (item:
|
1128
|
+
async (item: QueryBuilderWindowDropTarget): Promise<void> => {
|
1129
1129
|
try {
|
1130
|
-
const
|
1130
|
+
const newWindowState = createWindowColumnState(
|
1131
1131
|
item.columnState,
|
1132
|
-
|
1132
|
+
tdsWindowState.tdsState,
|
1133
1133
|
);
|
1134
|
-
|
1134
|
+
tdsWindowState.addWindowColumn(newWindowState);
|
1135
1135
|
} catch (error) {
|
1136
1136
|
assertErrorThrown(error);
|
1137
1137
|
applicationStore.notifyError(error.message);
|
1138
1138
|
return;
|
1139
1139
|
}
|
1140
1140
|
},
|
1141
|
-
[applicationStore,
|
1141
|
+
[applicationStore, tdsWindowState],
|
1142
1142
|
);
|
1143
1143
|
const [{ isDragOver }, dropTargetConnector] = useDrop<
|
1144
|
-
|
1144
|
+
QueryBuilderWindowDropTarget,
|
1145
1145
|
void,
|
1146
1146
|
{ isDragOver: boolean }
|
1147
1147
|
>(
|
1148
1148
|
() => ({
|
1149
1149
|
accept: [
|
1150
1150
|
QUERY_BUILDER_PROJECTION_COLUMN_DND_TYPE,
|
1151
|
-
|
1151
|
+
QUERY_BUILDER_WINDOW_COLUMN_DND_TYPE,
|
1152
1152
|
],
|
1153
1153
|
drop: (item, monitor): void => {
|
1154
1154
|
if (!monitor.didDrop()) {
|
@@ -1163,24 +1163,24 @@ export const QueryBuilderOlapGroupByPanel = observer(
|
|
1163
1163
|
);
|
1164
1164
|
return (
|
1165
1165
|
<div
|
1166
|
-
data-testid={QUERY_BUILDER_TEST_ID.
|
1166
|
+
data-testid={QUERY_BUILDER_TEST_ID.QUERY_BUILDER_WINDOW_GROUPBY}
|
1167
1167
|
className="panel"
|
1168
1168
|
>
|
1169
1169
|
<div
|
1170
|
-
data-testid={QUERY_BUILDER_TEST_ID.
|
1170
|
+
data-testid={QUERY_BUILDER_TEST_ID.QUERY_BUILDER_WINDOW_GROUPBY}
|
1171
1171
|
className="panel"
|
1172
1172
|
>
|
1173
1173
|
<div className="panel__header">
|
1174
1174
|
<div className="panel__header__title">
|
1175
|
-
<div className="panel__header__title__label">
|
1175
|
+
<div className="panel__header__title__label">Window Function</div>
|
1176
1176
|
</div>
|
1177
1177
|
<div className="panel__header__actions">
|
1178
1178
|
<button
|
1179
1179
|
className="panel__header__action"
|
1180
|
-
onClick={
|
1181
|
-
disabled={!
|
1180
|
+
onClick={createTDSWindow}
|
1181
|
+
disabled={!tdsWindowState.tdsState.tdsColumns.length}
|
1182
1182
|
tabIndex={-1}
|
1183
|
-
title="Create
|
1183
|
+
title="Create Window Function Column"
|
1184
1184
|
>
|
1185
1185
|
<PlusIcon />
|
1186
1186
|
</button>
|
@@ -1191,20 +1191,20 @@ export const QueryBuilderOlapGroupByPanel = observer(
|
|
1191
1191
|
isDragOver={isDragOver}
|
1192
1192
|
dropTargetConnector={dropTargetConnector}
|
1193
1193
|
>
|
1194
|
-
{
|
1194
|
+
{tdsWindowState.isEmpty && (
|
1195
1195
|
<BlankPanelPlaceholder
|
1196
|
-
text="Add
|
1196
|
+
text="Add Window Function Column"
|
1197
1197
|
tooltipText="Drag and drop columns here"
|
1198
1198
|
/>
|
1199
1199
|
)}
|
1200
|
-
{!
|
1200
|
+
{!tdsWindowState.isEmpty && (
|
1201
1201
|
<div
|
1202
1202
|
data-testid={QUERY_BUILDER_TEST_ID.QUERY_BUILDER_TDS}
|
1203
1203
|
className="query-builder__olap__columns"
|
1204
1204
|
>
|
1205
|
-
{
|
1206
|
-
<
|
1207
|
-
|
1205
|
+
{tdsWindowState.windowColumns.map((col) => (
|
1206
|
+
<QueryBuilderWindowColumnEditor
|
1207
|
+
windowColumnState={col}
|
1208
1208
|
key={col.uuid}
|
1209
1209
|
/>
|
1210
1210
|
))}
|
@@ -1212,10 +1212,10 @@ export const QueryBuilderOlapGroupByPanel = observer(
|
|
1212
1212
|
)}
|
1213
1213
|
</PanelDropZone>
|
1214
1214
|
</PanelContent>
|
1215
|
-
{
|
1216
|
-
<
|
1217
|
-
|
1218
|
-
|
1215
|
+
{tdsWindowState.editColumn && (
|
1216
|
+
<QueryBuilderWindowColumnModalEditor
|
1217
|
+
windowState={tdsWindowState}
|
1218
|
+
windowColumnState={tdsWindowState.editColumn}
|
1219
1219
|
/>
|
1220
1220
|
)}
|
1221
1221
|
</div>
|