@gingkoo/pandora-metabase 1.0.118 → 1.0.119
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/common/Portal/index.js +0 -2
- package/lib/cjs/common/SplitView/index.d.ts +0 -4
- package/lib/cjs/common/SplitView/index.js +0 -10
- package/lib/cjs/components/dialog/custom-column/config.js +4 -48
- package/lib/cjs/components/dialog/custom-column/expression-editor.js +3 -14
- package/lib/cjs/components/dialog/custom-column/expressions/suggest.d.ts +2 -34
- package/lib/cjs/components/dialog/custom-column/expressions/suggest.js +2 -43
- package/lib/cjs/components/dialog/custom-column/expressions/tokenizer.js +8 -65
- package/lib/cjs/components/dialog/custom-column/index.js +2 -4
- package/lib/cjs/components/dialog/custom-column/tokenized-expression.js +2 -3
- package/lib/cjs/components/dialog/custom-column/tokenizedI-input.js +1 -1
- package/lib/cjs/components/dialog/custom-editor/index.js +2 -7
- package/lib/cjs/components/dialog/diff-viewer/index copy.js +1 -16
- package/lib/cjs/components/dialog/expression/date-format-picker.js +2 -20
- package/lib/cjs/components/dialog/expression/date-format.js +2 -8
- package/lib/cjs/components/dialog/expression/index.d.ts +0 -3
- package/lib/cjs/components/dialog/expression/index.js +2 -83
- package/lib/cjs/components/dialog/formula/index.js +1 -30
- package/lib/cjs/components/dialog/formula/utils.js +2 -10
- package/lib/cjs/components/dialog/formula-list/CaseWhenGroup.d.ts +19 -0
- package/lib/cjs/components/dialog/formula-list/CaseWhenGroup.js +109 -0
- package/lib/cjs/components/dialog/formula-list/LogicGroup.d.ts +9 -0
- package/lib/cjs/components/dialog/formula-list/LogicGroup.js +43 -0
- package/lib/cjs/components/dialog/formula-list/index.d.ts +3 -0
- package/lib/cjs/components/dialog/formula-list/index.js +967 -503
- package/lib/cjs/components/dialog/formula-list/index.less +724 -0
- package/lib/cjs/components/dialog/formula-list/utils.d.ts +0 -7
- package/lib/cjs/components/dialog/formula-list/utils.js +117 -113
- package/lib/cjs/components/dialog/select-column/index.d.ts +0 -6
- package/lib/cjs/components/dialog/select-column/index.js +4 -15
- package/lib/cjs/components/dialog/select-column-multiple/index.d.ts +0 -8
- package/lib/cjs/components/dialog/select-column-multiple/index.js +6 -45
- package/lib/cjs/components/dialog/select-join/index.d.ts +0 -5
- package/lib/cjs/components/dialog/select-join/index.js +0 -6
- package/lib/cjs/components/dialog/select-join-column/index.d.ts +0 -8
- package/lib/cjs/components/dialog/select-join-column/index.js +7 -21
- package/lib/cjs/components/dialog/select-join-column-multiple/index.d.ts +0 -8
- package/lib/cjs/components/dialog/select-join-column-multiple/index.js +5 -35
- package/lib/cjs/components/dialog/select-permission-table/index.d.ts +0 -5
- package/lib/cjs/components/dialog/select-permission-table/index.js +0 -6
- package/lib/cjs/components/dialog/select-summarize/index.d.ts +3 -3
- package/lib/cjs/components/dialog/select-summarize/index.js +105 -18
- package/lib/cjs/components/dialog/select-summarize/index.less +23 -0
- package/lib/cjs/components/dialog/select-table/index.d.ts +0 -6
- package/lib/cjs/components/dialog/select-table/index.js +1 -9
- package/lib/cjs/components/metabase/index.js +72 -86
- package/lib/cjs/components/metabase/index.less +7 -7
- package/lib/cjs/components/modules/components/Wrapper.js +1 -1
- package/lib/cjs/components/modules/components/header.js +2 -2
- package/lib/cjs/components/modules/components/meta-icon.d.ts +0 -3
- package/lib/cjs/components/modules/components/meta-icon.js +2 -47
- package/lib/cjs/components/modules/custom-column.js +3 -29
- package/lib/cjs/components/modules/enum/filter-enum.js +9 -88
- package/lib/cjs/components/modules/filter.js +2 -20
- package/lib/cjs/components/modules/index.d.ts +4 -2
- package/lib/cjs/components/modules/index.js +24 -1
- package/lib/cjs/components/modules/join-data.js +13 -291
- package/lib/cjs/components/modules/row-limit.js +0 -1
- package/lib/cjs/components/modules/sort.js +1 -61
- package/lib/cjs/components/modules/summarize/group-by.d.ts +0 -5
- package/lib/cjs/components/modules/summarize/group-by.js +231 -76
- package/lib/cjs/components/modules/summarize/select-index.js +96 -46
- package/lib/cjs/components/modules/table-data.js +11 -64
- package/lib/cjs/components/popup.js +26 -32
- package/lib/cjs/hooks/patch.d.ts +1 -0
- package/lib/cjs/hooks/patch.js +104 -6
- package/lib/cjs/hooks/patch2.js +3 -165
- package/lib/cjs/hooks/use-provider.js +0 -3
- package/lib/cjs/hooks/use-state.js +55 -135
- package/lib/cjs/index.js +0 -15
- package/lib/cjs/locale/en.js +5 -0
- package/lib/cjs/locale/index.js +1 -4
- package/lib/cjs/locale/zh.js +5 -0
- package/lib/cjs/sql-formula.js +0 -1
- package/lib/cjs/store/enum.d.ts +6 -6
- package/lib/cjs/store/enum.js +0 -13
- package/lib/cjs/store/helper.d.ts +2 -1
- package/lib/cjs/store/helper.js +15 -225
- package/lib/cjs/store/types.d.ts +45 -67
- package/lib/cjs/store/types.js +3 -49
- package/lib/cjs/types.d.ts +1 -0
- package/lib/cjs/utils/cookies.js +0 -3
- package/lib/cjs/utils/event.js +1 -1
- package/lib/cjs/utils/helper-dom.d.ts +1 -0
- package/lib/cjs/utils/helper-dom.js +17 -10
- package/lib/cjs/utils/helper.js +1 -24
- package/lib/cjs/utils/keydown.js +4 -7
- package/lib/cjs/utils/platform.d.ts +0 -9
- package/lib/cjs/utils/platform.js +0 -10
- package/lib/cjs/utils/selection.js +0 -6
- package/lib/cjs/utils/storage.d.ts +0 -9
- package/lib/cjs/utils/storage.js +1 -11
- package/lib/cjs/utils/transformSql.d.ts +5 -0
- package/lib/cjs/utils/transformSql.js +42 -113
- package/lib/cjs/utils.d.ts +1 -6
- package/lib/cjs/utils.js +115 -255
- package/lib/es/common/Portal/index.js +0 -2
- package/lib/es/common/SplitView/index.d.ts +0 -4
- package/lib/es/common/SplitView/index.js +0 -10
- package/lib/es/components/dialog/custom-column/config.js +4 -48
- package/lib/es/components/dialog/custom-column/expression-editor.js +3 -14
- package/lib/es/components/dialog/custom-column/expressions/suggest.d.ts +2 -34
- package/lib/es/components/dialog/custom-column/expressions/suggest.js +2 -43
- package/lib/es/components/dialog/custom-column/expressions/tokenizer.js +8 -65
- package/lib/es/components/dialog/custom-column/index.js +2 -4
- package/lib/es/components/dialog/custom-column/tokenized-expression.js +1 -3
- package/lib/es/components/dialog/custom-column/tokenizedI-input.js +1 -1
- package/lib/es/components/dialog/custom-editor/index.js +1 -7
- package/lib/es/components/dialog/diff-viewer/index copy.js +1 -15
- package/lib/es/components/dialog/expression/date-format-picker.js +2 -20
- package/lib/es/components/dialog/expression/date-format.js +2 -8
- package/lib/es/components/dialog/expression/index.d.ts +0 -3
- package/lib/es/components/dialog/expression/index.js +2 -82
- package/lib/es/components/dialog/formula/index.js +0 -30
- package/lib/es/components/dialog/formula/utils.js +2 -10
- package/lib/es/components/dialog/formula-list/CaseWhenGroup.d.ts +19 -0
- package/lib/es/components/dialog/formula-list/CaseWhenGroup.js +102 -0
- package/lib/es/components/dialog/formula-list/LogicGroup.d.ts +9 -0
- package/lib/es/components/dialog/formula-list/LogicGroup.js +36 -0
- package/lib/es/components/dialog/formula-list/index.d.ts +3 -0
- package/lib/es/components/dialog/formula-list/index.js +966 -503
- package/lib/es/components/dialog/formula-list/index.less +724 -0
- package/lib/es/components/dialog/formula-list/utils.d.ts +0 -7
- package/lib/es/components/dialog/formula-list/utils.js +117 -113
- package/lib/es/components/dialog/index.js +3 -3
- package/lib/es/components/dialog/select-column/index.d.ts +0 -6
- package/lib/es/components/dialog/select-column/index.js +4 -14
- package/lib/es/components/dialog/select-column-multiple/index.d.ts +0 -8
- package/lib/es/components/dialog/select-column-multiple/index.js +7 -47
- package/lib/es/components/dialog/select-join/index.d.ts +0 -5
- package/lib/es/components/dialog/select-join/index.js +0 -5
- package/lib/es/components/dialog/select-join-column/index.d.ts +0 -8
- package/lib/es/components/dialog/select-join-column/index.js +7 -20
- package/lib/es/components/dialog/select-join-column-multiple/index.d.ts +0 -8
- package/lib/es/components/dialog/select-join-column-multiple/index.js +5 -34
- package/lib/es/components/dialog/select-permission-table/index.d.ts +0 -5
- package/lib/es/components/dialog/select-permission-table/index.js +0 -5
- package/lib/es/components/dialog/select-summarize/index.d.ts +3 -3
- package/lib/es/components/dialog/select-summarize/index.js +106 -18
- package/lib/es/components/dialog/select-summarize/index.less +23 -0
- package/lib/es/components/dialog/select-table/index.d.ts +0 -6
- package/lib/es/components/dialog/select-table/index.js +1 -8
- package/lib/es/components/metabase/index.js +72 -87
- package/lib/es/components/metabase/index.less +7 -7
- package/lib/es/components/modules/components/Wrapper.js +1 -1
- package/lib/es/components/modules/components/header.js +2 -2
- package/lib/es/components/modules/components/meta-icon.d.ts +0 -3
- package/lib/es/components/modules/components/meta-icon.js +2 -46
- package/lib/es/components/modules/custom-column.js +3 -29
- package/lib/es/components/modules/enum/filter-enum.js +9 -88
- package/lib/es/components/modules/filter.js +2 -19
- package/lib/es/components/modules/index.d.ts +4 -2
- package/lib/es/components/modules/index.js +24 -1
- package/lib/es/components/modules/join-data.js +13 -291
- package/lib/es/components/modules/row-limit.js +0 -1
- package/lib/es/components/modules/sort.js +1 -61
- package/lib/es/components/modules/summarize/group-by.d.ts +0 -5
- package/lib/es/components/modules/summarize/group-by.js +233 -78
- package/lib/es/components/modules/summarize/select-index.js +96 -46
- package/lib/es/components/modules/table-data.js +11 -64
- package/lib/es/components/popup.js +27 -33
- package/lib/es/hooks/patch.d.ts +1 -0
- package/lib/es/hooks/patch.js +103 -5
- package/lib/es/hooks/patch2.js +2 -164
- package/lib/es/hooks/use-provider.js +0 -3
- package/lib/es/hooks/use-state.js +55 -135
- package/lib/es/index.js +0 -14
- package/lib/es/locale/en.js +5 -0
- package/lib/es/locale/index.js +1 -4
- package/lib/es/locale/zh.js +5 -0
- package/lib/es/sql-formula.js +0 -1
- package/lib/es/store/enum.d.ts +6 -6
- package/lib/es/store/enum.js +0 -13
- package/lib/es/store/helper.d.ts +2 -1
- package/lib/es/store/helper.js +13 -224
- package/lib/es/store/types.d.ts +45 -67
- package/lib/es/store/types.js +3 -49
- package/lib/es/types.d.ts +1 -0
- package/lib/es/types.js +1 -18
- package/lib/es/utils/cookies.js +0 -3
- package/lib/es/utils/event.js +1 -1
- package/lib/es/utils/helper-dom.d.ts +1 -0
- package/lib/es/utils/helper-dom.js +16 -9
- package/lib/es/utils/helper.js +1 -24
- package/lib/es/utils/keydown.js +4 -7
- package/lib/es/utils/platform.d.ts +0 -9
- package/lib/es/utils/platform.js +0 -10
- package/lib/es/utils/selection.js +0 -6
- package/lib/es/utils/storage.d.ts +0 -9
- package/lib/es/utils/storage.js +1 -10
- package/lib/es/utils/transformSql.d.ts +5 -0
- package/lib/es/utils/transformSql.js +42 -112
- package/lib/es/utils.d.ts +1 -6
- package/lib/es/utils.js +116 -255
- package/package.json +1 -1
|
@@ -14,7 +14,6 @@ import { splitByUnion } from '../utils';
|
|
|
14
14
|
import storage from '../utils/storage';
|
|
15
15
|
import cloneDeep from 'lodash/cloneDeep';
|
|
16
16
|
import { findIndex } from '../utils';
|
|
17
|
-
// import { joinDataPatch, filterPatch, sortPatch, customColumnPatch, dataPatch } from './patch';
|
|
18
17
|
var metaKey = 1;
|
|
19
18
|
export var SummarizeAlias = 'source';
|
|
20
19
|
var useStore = function useStore() {
|
|
@@ -47,59 +46,59 @@ var useStore = function useStore() {
|
|
|
47
46
|
var _useState = useState(true),
|
|
48
47
|
_useState2 = _slicedToArray(_useState, 2),
|
|
49
48
|
showFields = _useState2[0],
|
|
50
|
-
setShowFields = _useState2[1];
|
|
49
|
+
setShowFields = _useState2[1];
|
|
51
50
|
var _useState3 = useState(false),
|
|
52
51
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
53
52
|
showSubquery = _useState4[0],
|
|
54
|
-
setShowSubquery = _useState4[1];
|
|
53
|
+
setShowSubquery = _useState4[1];
|
|
55
54
|
var _useState5 = useState(false),
|
|
56
55
|
_useState6 = _slicedToArray(_useState5, 2),
|
|
57
56
|
_showSubquery = _useState6[0],
|
|
58
|
-
_setShowSubquery = _useState6[1];
|
|
57
|
+
_setShowSubquery = _useState6[1];
|
|
59
58
|
var _useState7 = useState(defaultToolbar),
|
|
60
59
|
_useState8 = _slicedToArray(_useState7, 2),
|
|
61
60
|
toolbar = _useState8[0],
|
|
62
|
-
setToolbar = _useState8[1];
|
|
61
|
+
setToolbar = _useState8[1];
|
|
63
62
|
var _useState9 = useState('${name}'),
|
|
64
63
|
_useState0 = _slicedToArray(_useState9, 2),
|
|
65
64
|
fieldNameTpl = _useState0[0],
|
|
66
|
-
setFieldNameTpl = _useState0[1];
|
|
65
|
+
setFieldNameTpl = _useState0[1];
|
|
67
66
|
var _useState1 = useState('${name}'),
|
|
68
67
|
_useState10 = _slicedToArray(_useState1, 2),
|
|
69
68
|
tableNameTpl = _useState10[0],
|
|
70
|
-
setTableNameTpl = _useState10[1];
|
|
69
|
+
setTableNameTpl = _useState10[1];
|
|
71
70
|
var _useState11 = useState([]),
|
|
72
71
|
_useState12 = _slicedToArray(_useState11, 2),
|
|
73
72
|
sourceList = _useState12[0],
|
|
74
|
-
setSourceList = _useState12[1];
|
|
73
|
+
setSourceList = _useState12[1];
|
|
75
74
|
var _useState13 = useState([]),
|
|
76
75
|
_useState14 = _slicedToArray(_useState13, 2),
|
|
77
76
|
constantList = _useState14[0],
|
|
78
|
-
setConstantList = _useState14[1];
|
|
77
|
+
setConstantList = _useState14[1];
|
|
79
78
|
var _useState15 = useState([]),
|
|
80
79
|
_useState16 = _slicedToArray(_useState15, 2),
|
|
81
80
|
formulaTemplates = _useState16[0],
|
|
82
|
-
_setFormulaTemplates = _useState16[1];
|
|
81
|
+
_setFormulaTemplates = _useState16[1];
|
|
83
82
|
var _useState17 = useState(false),
|
|
84
83
|
_useState18 = _slicedToArray(_useState17, 2),
|
|
85
84
|
ignoreGroupByType = _useState18[0],
|
|
86
|
-
setIgnoreGroupByType = _useState18[1];
|
|
85
|
+
setIgnoreGroupByType = _useState18[1];
|
|
87
86
|
var _useState19 = useState(false),
|
|
88
87
|
_useState20 = _slicedToArray(_useState19, 2),
|
|
89
88
|
filterCustomType = _useState20[0],
|
|
90
|
-
setfilterCustomType = _useState20[1];
|
|
89
|
+
setfilterCustomType = _useState20[1];
|
|
91
90
|
var _useState21 = useState({}),
|
|
92
91
|
_useState22 = _slicedToArray(_useState21, 2),
|
|
93
92
|
_cacheSource2TableMap = _useState22[0],
|
|
94
|
-
set_cacheSource2TableMap = _useState22[1];
|
|
93
|
+
set_cacheSource2TableMap = _useState22[1];
|
|
95
94
|
var _useState23 = useState({}),
|
|
96
95
|
_useState24 = _slicedToArray(_useState23, 2),
|
|
97
96
|
_cacheColumnsMap = _useState24[0],
|
|
98
|
-
set_cacheColumnsMap = _useState24[1];
|
|
97
|
+
set_cacheColumnsMap = _useState24[1];
|
|
99
98
|
var _useState25 = useState(defaultMeta),
|
|
100
99
|
_useState26 = _slicedToArray(_useState25, 2),
|
|
101
100
|
metaList = _useState26[0],
|
|
102
|
-
_setMeta = _useState26[1];
|
|
101
|
+
_setMeta = _useState26[1];
|
|
103
102
|
var _useState27 = useState({
|
|
104
103
|
visible: false,
|
|
105
104
|
node: null,
|
|
@@ -107,7 +106,7 @@ var useStore = function useStore() {
|
|
|
107
106
|
}),
|
|
108
107
|
_useState28 = _slicedToArray(_useState27, 2),
|
|
109
108
|
popupData = _useState28[0],
|
|
110
|
-
setPopup = _useState28[1];
|
|
109
|
+
setPopup = _useState28[1];
|
|
111
110
|
var _useState29 = useState({
|
|
112
111
|
visible: false,
|
|
113
112
|
node: null,
|
|
@@ -115,47 +114,47 @@ var useStore = function useStore() {
|
|
|
115
114
|
}),
|
|
116
115
|
_useState30 = _slicedToArray(_useState29, 2),
|
|
117
116
|
popupData2 = _useState30[0],
|
|
118
|
-
setPopup2 = _useState30[1];
|
|
117
|
+
setPopup2 = _useState30[1];
|
|
119
118
|
var _useState31 = useState(true),
|
|
120
119
|
_useState32 = _slicedToArray(_useState31, 2),
|
|
121
120
|
popupClosable = _useState32[0],
|
|
122
|
-
setClosable = _useState32[1];
|
|
121
|
+
setClosable = _useState32[1];
|
|
123
122
|
var _useState33 = useState(true),
|
|
124
123
|
_useState34 = _slicedToArray(_useState33, 2),
|
|
125
124
|
popupClosable2 = _useState34[0],
|
|
126
|
-
setClosable2 = _useState34[1];
|
|
125
|
+
setClosable2 = _useState34[1];
|
|
127
126
|
var _useState35 = useState({}),
|
|
128
127
|
_useState36 = _slicedToArray(_useState35, 2),
|
|
129
128
|
currentTable = _useState36[0],
|
|
130
|
-
setCurrentTable = _useState36[1];
|
|
129
|
+
setCurrentTable = _useState36[1];
|
|
131
130
|
var _useState37 = useState(false),
|
|
132
131
|
_useState38 = _slicedToArray(_useState37, 2),
|
|
133
132
|
isExit = _useState38[0],
|
|
134
|
-
setIsExit = _useState38[1];
|
|
133
|
+
setIsExit = _useState38[1];
|
|
135
134
|
var _useState39 = useState(false),
|
|
136
135
|
_useState40 = _slicedToArray(_useState39, 2),
|
|
137
136
|
isSubquery = _useState40[0],
|
|
138
|
-
setIsSubquery = _useState40[1];
|
|
137
|
+
setIsSubquery = _useState40[1];
|
|
139
138
|
var _useState41 = useState(true),
|
|
140
139
|
_useState42 = _slicedToArray(_useState41, 2),
|
|
141
140
|
tableEnableAlias = _useState42[0],
|
|
142
|
-
setTableEnableAlias = _useState42[1];
|
|
141
|
+
setTableEnableAlias = _useState42[1];
|
|
143
142
|
var _useState43 = useState(true),
|
|
144
143
|
_useState44 = _slicedToArray(_useState43, 2),
|
|
145
144
|
fieldEnableAlias = _useState44[0],
|
|
146
|
-
setFieldEnableAlias = _useState44[1];
|
|
145
|
+
setFieldEnableAlias = _useState44[1];
|
|
147
146
|
var _useState45 = useState(true),
|
|
148
147
|
_useState46 = _slicedToArray(_useState45, 2),
|
|
149
148
|
groupByEnableAlias = _useState46[0],
|
|
150
|
-
setGroupByEnableAlias = _useState46[1];
|
|
149
|
+
setGroupByEnableAlias = _useState46[1];
|
|
151
150
|
var _useState47 = useState(true),
|
|
152
151
|
_useState48 = _slicedToArray(_useState47, 2),
|
|
153
152
|
isSelectFields = _useState48[0],
|
|
154
|
-
setIsSelectFields = _useState48[1];
|
|
153
|
+
setIsSelectFields = _useState48[1];
|
|
155
154
|
var _useState49 = useState(false),
|
|
156
155
|
_useState50 = _slicedToArray(_useState49, 2),
|
|
157
156
|
tableFlat = _useState50[0],
|
|
158
|
-
setTableFlat = _useState50[1];
|
|
157
|
+
setTableFlat = _useState50[1];
|
|
159
158
|
var _useState51 = useState([]),
|
|
160
159
|
_useState52 = _slicedToArray(_useState51, 2),
|
|
161
160
|
sourceTable = _useState52[0],
|
|
@@ -163,43 +162,43 @@ var useStore = function useStore() {
|
|
|
163
162
|
var _useState53 = useState([]),
|
|
164
163
|
_useState54 = _slicedToArray(_useState53, 2),
|
|
165
164
|
operatorList = _useState54[0],
|
|
166
|
-
setOperatorList = _useState54[1];
|
|
165
|
+
setOperatorList = _useState54[1];
|
|
167
166
|
var _useState55 = useState([]),
|
|
168
167
|
_useState56 = _slicedToArray(_useState55, 2),
|
|
169
168
|
copyType = _useState56[0],
|
|
170
|
-
setCopyType = _useState56[1];
|
|
169
|
+
setCopyType = _useState56[1];
|
|
171
170
|
var _useState57 = useState(false),
|
|
172
171
|
_useState58 = _slicedToArray(_useState57, 2),
|
|
173
172
|
metabaseCopy = _useState58[0],
|
|
174
|
-
setMetabaseCopy = _useState58[1];
|
|
173
|
+
setMetabaseCopy = _useState58[1];
|
|
175
174
|
var _useState59 = useState(false),
|
|
176
175
|
_useState60 = _slicedToArray(_useState59, 2),
|
|
177
176
|
moduleDiff = _useState60[0],
|
|
178
|
-
setModuleDiff = _useState60[1];
|
|
177
|
+
setModuleDiff = _useState60[1];
|
|
179
178
|
var _useState61 = useState([]),
|
|
180
179
|
_useState62 = _slicedToArray(_useState61, 2),
|
|
181
180
|
sourceData = _useState62[0],
|
|
182
|
-
setSourceData = _useState62[1];
|
|
181
|
+
setSourceData = _useState62[1];
|
|
183
182
|
var _useState63 = useState(false),
|
|
184
183
|
_useState64 = _slicedToArray(_useState63, 2),
|
|
185
184
|
moduleCopy = _useState64[0],
|
|
186
|
-
setModuleCopy = _useState64[1];
|
|
185
|
+
setModuleCopy = _useState64[1];
|
|
187
186
|
var _useState65 = useState(false),
|
|
188
187
|
_useState66 = _slicedToArray(_useState65, 2),
|
|
189
188
|
isMetabaseCopy = _useState66[0],
|
|
190
|
-
setIsMetabaseCopy = _useState66[1];
|
|
189
|
+
setIsMetabaseCopy = _useState66[1];
|
|
191
190
|
var _useState67 = useState(false),
|
|
192
191
|
_useState68 = _slicedToArray(_useState67, 2),
|
|
193
192
|
joinAliasConflictCheck = _useState68[0],
|
|
194
|
-
setJoinAliasConflictCheck = _useState68[1];
|
|
193
|
+
setJoinAliasConflictCheck = _useState68[1];
|
|
195
194
|
var _useState69 = useState([]),
|
|
196
195
|
_useState70 = _slicedToArray(_useState69, 2),
|
|
197
196
|
existsError = _useState70[0],
|
|
198
|
-
setExistsError = _useState70[1];
|
|
197
|
+
setExistsError = _useState70[1];
|
|
199
198
|
var _useState71 = useState(storage._metabaseCopyModule || []),
|
|
200
199
|
_useState72 = _slicedToArray(_useState71, 2),
|
|
201
200
|
metabaseCopyModule = _useState72[0],
|
|
202
|
-
setMetabaseCopyModule = _useState72[1];
|
|
201
|
+
setMetabaseCopyModule = _useState72[1];
|
|
203
202
|
var setFormulaTemplates = function setFormulaTemplates(data) {
|
|
204
203
|
var newData = data === null || data === void 0 ? void 0 : data.map(function (v) {
|
|
205
204
|
var children = v.children.map(function (vv) {
|
|
@@ -213,11 +212,7 @@ var useStore = function useStore() {
|
|
|
213
212
|
});
|
|
214
213
|
_setFormulaTemplates(newData);
|
|
215
214
|
};
|
|
216
|
-
// 外层ref
|
|
217
215
|
var popupContainer = useRef();
|
|
218
|
-
// const [fetchDatasetFn, setFetchDatasetFn] = useState<(id: string) => Promise<any>>(
|
|
219
|
-
// async () => {},
|
|
220
|
-
// ); //fn
|
|
221
216
|
var fetchDatasetFn = useRef();
|
|
222
217
|
var setFetchDatasetFn = function setFetchDatasetFn(fn) {
|
|
223
218
|
fetchDatasetFn.current = fn;
|
|
@@ -232,8 +227,8 @@ var useStore = function useStore() {
|
|
|
232
227
|
var setFetchDiffFn = function setFetchDiffFn(fn) {
|
|
233
228
|
fetchDiffFn.current = fn;
|
|
234
229
|
};
|
|
235
|
-
var setExistsErrorFn =
|
|
236
|
-
var _ref = _asyncToGenerator(
|
|
230
|
+
var setExistsErrorFn = function () {
|
|
231
|
+
var _ref = _asyncToGenerator(_regeneratorRuntime.mark(function _callee(fn, value) {
|
|
237
232
|
var data;
|
|
238
233
|
return _regeneratorRuntime.wrap(function (_context) {
|
|
239
234
|
while (1) switch (_context.prev = _context.next) {
|
|
@@ -260,9 +255,8 @@ var useStore = function useStore() {
|
|
|
260
255
|
return _ref.apply(this, arguments);
|
|
261
256
|
};
|
|
262
257
|
}();
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
|
|
258
|
+
var getModuleDiffCode = function () {
|
|
259
|
+
var _ref2 = _asyncToGenerator(_regeneratorRuntime.mark(function _callee2() {
|
|
266
260
|
var oldCode,
|
|
267
261
|
newCode,
|
|
268
262
|
data,
|
|
@@ -297,22 +291,18 @@ var useStore = function useStore() {
|
|
|
297
291
|
var setProps = function setProps(val) {
|
|
298
292
|
preProps.current = val;
|
|
299
293
|
};
|
|
300
|
-
// 是否显示主表后面的字段按钮 (如果下面 没有聚合,或者选了聚合但是聚合里面没有选值的时候显示 主表字段按钮)
|
|
301
294
|
var showMainColumn = useMemo(function () {
|
|
302
295
|
return metaList === null || metaList === void 0 ? void 0 : metaList.map(function (item, groupIndex) {
|
|
303
|
-
// 过滤出所有汇总类型的项
|
|
304
296
|
var summarizeItems = item.list.filter(function (v) {
|
|
305
297
|
return v.type === TypeEnum.summarize;
|
|
306
298
|
});
|
|
307
299
|
var index = findIndex(item.list, summarizeItems[summarizeItems.length - 1]);
|
|
308
|
-
// 如果没有汇总项,默认显示主列
|
|
309
300
|
if (summarizeItems.length === 0) {
|
|
310
301
|
return {
|
|
311
302
|
showColumn: true,
|
|
312
303
|
index: -1
|
|
313
304
|
};
|
|
314
305
|
}
|
|
315
|
-
// 如果只有一个汇总项,并且 group 和 by 都为空,则也显示主列
|
|
316
306
|
var onlyItem = summarizeItems[0];
|
|
317
307
|
var hasGroupOrBy = Array.isArray(onlyItem.group) && onlyItem.group.length > 0 || Array.isArray(onlyItem.by) && onlyItem.by.length > 0;
|
|
318
308
|
return {
|
|
@@ -326,16 +316,15 @@ var useStore = function useStore() {
|
|
|
326
316
|
getSourceTable(sourceList);
|
|
327
317
|
}
|
|
328
318
|
}, [sourceList, isExit, tableFlat]);
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
var _ref3 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee4(source) {
|
|
319
|
+
var getSourceTable = function () {
|
|
320
|
+
var _ref3 = _asyncToGenerator(_regeneratorRuntime.mark(function _callee4(source) {
|
|
332
321
|
var results;
|
|
333
322
|
return _regeneratorRuntime.wrap(function (_context4) {
|
|
334
323
|
while (1) switch (_context4.prev = _context4.next) {
|
|
335
324
|
case 0:
|
|
336
325
|
_context4.next = 1;
|
|
337
|
-
return Promise.all(source.map(
|
|
338
|
-
var _ref4 = _asyncToGenerator(
|
|
326
|
+
return Promise.all(source.map(function () {
|
|
327
|
+
var _ref4 = _asyncToGenerator(_regeneratorRuntime.mark(function _callee3(v) {
|
|
339
328
|
var tables;
|
|
340
329
|
return _regeneratorRuntime.wrap(function (_context3) {
|
|
341
330
|
while (1) switch (_context3.prev = _context3.next) {
|
|
@@ -370,23 +359,11 @@ var useStore = function useStore() {
|
|
|
370
359
|
return _ref3.apply(this, arguments);
|
|
371
360
|
};
|
|
372
361
|
}();
|
|
373
|
-
// const showMainColumn = useMemo(() => {
|
|
374
|
-
// let summarizeList = metaList.filter((v) => v.type === TypeEnum.summarize);
|
|
375
|
-
// if (
|
|
376
|
-
// !summarizeList.length ||
|
|
377
|
-
// (summarizeList.length === 1 &&
|
|
378
|
-
// !(summarizeList[0] as MetaSummarize).group.length &&
|
|
379
|
-
// !(summarizeList[0] as MetaSummarize).by.length)
|
|
380
|
-
// ) {
|
|
381
|
-
// return true;
|
|
382
|
-
// }
|
|
383
|
-
// return false;
|
|
384
|
-
// }, [metaList]);
|
|
385
362
|
var showToolbar = function showToolbar(name) {
|
|
386
363
|
return !!~toolbar.indexOf(name);
|
|
387
364
|
};
|
|
388
|
-
var fetchDataset =
|
|
389
|
-
var _ref5 = _asyncToGenerator(
|
|
365
|
+
var fetchDataset = function () {
|
|
366
|
+
var _ref5 = _asyncToGenerator(_regeneratorRuntime.mark(function _callee5(datasourceId) {
|
|
390
367
|
var tables, _tables;
|
|
391
368
|
return _regeneratorRuntime.wrap(function (_context5) {
|
|
392
369
|
while (1) switch (_context5.prev = _context5.next) {
|
|
@@ -416,11 +393,8 @@ var useStore = function useStore() {
|
|
|
416
393
|
return _ref5.apply(this, arguments);
|
|
417
394
|
};
|
|
418
395
|
}();
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
// 查询表字段
|
|
422
|
-
var fetchColumns = /*#__PURE__*/function () {
|
|
423
|
-
var _ref6 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee6(table, datasourceId) {
|
|
396
|
+
var fetchColumns = function () {
|
|
397
|
+
var _ref6 = _asyncToGenerator(_regeneratorRuntime.mark(function _callee6(table, datasourceId) {
|
|
424
398
|
var _columns2;
|
|
425
399
|
var oldColumns,
|
|
426
400
|
callback,
|
|
@@ -447,7 +421,6 @@ var useStore = function useStore() {
|
|
|
447
421
|
isSelect = _args6.length > 4 && _args6[4] !== undefined ? _args6[4] : isSelectFields;
|
|
448
422
|
_isSubquery = _args6.length > 5 && _args6[5] !== undefined ? _args6[5] : isSubquery;
|
|
449
423
|
_isExit = _args6.length > 6 && _args6[6] !== undefined ? _args6[6] : isExit;
|
|
450
|
-
// 获取之前选中的数据
|
|
451
424
|
oldObj = {};
|
|
452
425
|
selectId = oldColumns.filter(function (v) {
|
|
453
426
|
oldObj[v.id] = v;
|
|
@@ -496,8 +469,8 @@ var useStore = function useStore() {
|
|
|
496
469
|
return _ref6.apply(this, arguments);
|
|
497
470
|
};
|
|
498
471
|
}();
|
|
499
|
-
var setMeta =
|
|
500
|
-
var _ref7 = _asyncToGenerator(
|
|
472
|
+
var setMeta = function () {
|
|
473
|
+
var _ref7 = _asyncToGenerator(_regeneratorRuntime.mark(function _callee7(curData, groupInd) {
|
|
501
474
|
var changeObj,
|
|
502
475
|
_metaList,
|
|
503
476
|
newMeta,
|
|
@@ -513,7 +486,6 @@ var useStore = function useStore() {
|
|
|
513
486
|
newMeta[groupInd].list = curData;
|
|
514
487
|
_setMeta(newMeta);
|
|
515
488
|
}
|
|
516
|
-
// 过滤掉初始化
|
|
517
489
|
if (!(changeObj === 'init')) {
|
|
518
490
|
_context7.next = 1;
|
|
519
491
|
break;
|
|
@@ -526,7 +498,6 @@ var useStore = function useStore() {
|
|
|
526
498
|
});
|
|
527
499
|
case 2:
|
|
528
500
|
isChange = _context7.sent;
|
|
529
|
-
// 是否还原
|
|
530
501
|
if (isChange === false) {
|
|
531
502
|
_setMeta(_metaList);
|
|
532
503
|
}
|
|
@@ -540,11 +511,9 @@ var useStore = function useStore() {
|
|
|
540
511
|
return _ref7.apply(this, arguments);
|
|
541
512
|
};
|
|
542
513
|
}();
|
|
543
|
-
// 回显
|
|
544
514
|
var setPreData = function setPreData(data) {
|
|
545
515
|
var _isSubquery = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : isSubquery;
|
|
546
516
|
var _isExit = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : isExit;
|
|
547
|
-
// let patchVersion = (data?.[0]?.list?.[0] as any)?.patchVersion || '';
|
|
548
517
|
if (data.length) {
|
|
549
518
|
var _metaList = data === null || data === void 0 ? void 0 : data.map(function (item, groupIndex) {
|
|
550
519
|
var _item$list;
|
|
@@ -554,37 +523,22 @@ var useStore = function useStore() {
|
|
|
554
523
|
if (v.table) {
|
|
555
524
|
v.table.tableUuid = v.table.tableUuid || uuidv4('table');
|
|
556
525
|
}
|
|
557
|
-
// 设置右侧column
|
|
558
526
|
if ((_v$table = v.table2) !== null && _v$table !== void 0 && _v$table.datasourceId) {
|
|
559
527
|
fetchColumns(newMeta[i].table2, newMeta[i].table2.datasourceId, v.columns, function () {
|
|
560
528
|
var columns = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
561
|
-
if (v.isSubquery) {
|
|
562
|
-
// let newColumns: any = [];
|
|
563
|
-
// const items = getSubColumns(v.subquery);
|
|
564
|
-
// newColumns = items?.flatMap((item) => item.columns);
|
|
565
|
-
// (newMeta[i] as MetaJoin).columns = newColumns || [];
|
|
566
|
-
} else {
|
|
529
|
+
if (v.isSubquery) {} else {
|
|
567
530
|
newMeta[i].columns = columns || [];
|
|
568
531
|
}
|
|
569
532
|
setMeta(newMeta, groupIndex, 'init', data);
|
|
570
533
|
}, false, _isSubquery, _isExit);
|
|
571
534
|
return _objectSpread({}, v);
|
|
572
535
|
}
|
|
573
|
-
// 设置column
|
|
574
536
|
if ((_v$table2 = v.table) !== null && _v$table2 !== void 0 && _v$table2.datasourceId) {
|
|
575
537
|
fetchColumns(newMeta[i].table, newMeta[i].table.datasourceId, v.columns, function () {
|
|
576
538
|
var columns = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
577
|
-
if (v.isSubquery) {
|
|
578
|
-
// let newColumns: any = [];
|
|
579
|
-
// const items = getSubColumns(v.subquery);
|
|
580
|
-
// newColumns = items.flatMap((item) => item.columns);
|
|
581
|
-
// (newMeta[i] as MetaJoin).columns = columns || [];
|
|
582
|
-
} else {
|
|
539
|
+
if (v.isSubquery) {} else {
|
|
583
540
|
newMeta[i].columns = columns || [];
|
|
584
541
|
}
|
|
585
|
-
// if (v.type === TypeEnum.joinData) {
|
|
586
|
-
// newMeta[i] = setQuotes(newMeta[i]);
|
|
587
|
-
// }
|
|
588
542
|
setMeta(newMeta, groupIndex, 'init', data);
|
|
589
543
|
}, false, _isSubquery, _isExit);
|
|
590
544
|
return _objectSpread({}, v);
|
|
@@ -611,20 +565,14 @@ var useStore = function useStore() {
|
|
|
611
565
|
_setMeta(defaultMeta);
|
|
612
566
|
}
|
|
613
567
|
};
|
|
614
|
-
// 重新生成 UUID 的辅助函数
|
|
615
|
-
// 只修改 table2 中的 alias、tableUuid,expressions 中相等的 tableUuid 和 tableAlias 同步修改
|
|
616
568
|
var _regenerateUuid = function regenerateUuid(obj) {
|
|
617
569
|
var uuidMap = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
618
570
|
var aliasMap = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
619
571
|
var tableAliasMap = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
|
|
620
572
|
var existingAliases = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : [];
|
|
621
573
|
var originalTable2Uuid = arguments.length > 5 ? arguments[5] : undefined;
|
|
622
|
-
var
|
|
623
|
-
|
|
624
|
-
newTable2Uuid = arguments.length > 6 ? arguments[6] : undefined;
|
|
625
|
-
var
|
|
626
|
-
// 新的 table2 的 tableUuid
|
|
627
|
-
originalTable2Alias = arguments.length > 7 ? arguments[7] : undefined;
|
|
574
|
+
var newTable2Uuid = arguments.length > 6 ? arguments[6] : undefined;
|
|
575
|
+
var originalTable2Alias = arguments.length > 7 ? arguments[7] : undefined;
|
|
628
576
|
if (!obj) return obj;
|
|
629
577
|
if (Array.isArray(obj)) {
|
|
630
578
|
return obj.map(function (item) {
|
|
@@ -633,49 +581,41 @@ var useStore = function useStore() {
|
|
|
633
581
|
}
|
|
634
582
|
if (_typeof(obj) === 'object') {
|
|
635
583
|
var newObj = _objectSpread({}, obj);
|
|
636
|
-
// 处理 joinData 类型:只修改 table2 的 alias 和 tableUuid
|
|
637
584
|
if (newObj.type === 'joinData') {
|
|
638
585
|
if (newObj.table2) {
|
|
639
586
|
var table2 = _objectSpread({}, newObj.table2);
|
|
640
587
|
var originalAlias = table2.alias;
|
|
641
|
-
// 修改 table2.alias
|
|
642
588
|
if (table2.alias) {
|
|
643
589
|
if (!aliasMap[table2.alias]) {
|
|
644
590
|
table2.alias = getAlias(table2.alias, [], [], [].concat(_toConsumableArray(Object.values(aliasMap)), _toConsumableArray(existingAliases)));
|
|
645
|
-
aliasMap[originalAlias] = table2.alias;
|
|
591
|
+
aliasMap[originalAlias] = table2.alias;
|
|
646
592
|
} else {
|
|
647
593
|
table2.alias = aliasMap[table2.alias];
|
|
648
594
|
}
|
|
649
595
|
}
|
|
650
|
-
// 修改 table2.tableUuid
|
|
651
596
|
if (table2.tableUuid && !uuidMap[table2.tableUuid]) {
|
|
652
597
|
var originalUuid = table2.tableUuid;
|
|
653
598
|
var newUuid = uuidv4('table');
|
|
654
599
|
uuidMap[originalUuid] = newUuid;
|
|
655
600
|
table2.tableUuid = newUuid;
|
|
656
|
-
// 记录原始和新 tableUuid,用于 expressions 同步
|
|
657
601
|
originalTable2Uuid = originalUuid;
|
|
658
602
|
newTable2Uuid = newUuid;
|
|
659
603
|
} else if (uuidMap[table2.tableUuid]) {
|
|
660
604
|
table2.tableUuid = uuidMap[table2.tableUuid];
|
|
661
605
|
newTable2Uuid = table2.tableUuid;
|
|
662
606
|
}
|
|
663
|
-
// 记录原始 alias,用于 expressions 同步 tableAlias
|
|
664
607
|
if (originalAlias) {
|
|
665
608
|
originalTable2Alias = originalAlias;
|
|
666
609
|
}
|
|
667
610
|
newObj.table2 = table2;
|
|
668
611
|
}
|
|
669
612
|
}
|
|
670
|
-
// 处理 expressions 中 tableUuid 相等的情况
|
|
671
613
|
if (originalTable2Uuid && newTable2Uuid && newObj.tableUuid === originalTable2Uuid) {
|
|
672
614
|
newObj.tableUuid = newTable2Uuid;
|
|
673
|
-
// 如果 originalTable2Alias 存在,tableAlias 要跟修改后的 table2.alias 保持一致
|
|
674
615
|
if (originalTable2Alias && aliasMap[originalTable2Alias]) {
|
|
675
616
|
newObj.tableAlias = aliasMap[originalTable2Alias];
|
|
676
617
|
}
|
|
677
618
|
}
|
|
678
|
-
// 递归处理嵌套对象
|
|
679
619
|
if (newObj.filter) newObj.filter = _regenerateUuid(newObj.filter, uuidMap, aliasMap, tableAliasMap, existingAliases, originalTable2Uuid, newTable2Uuid, originalTable2Alias);
|
|
680
620
|
if (newObj.lhs) newObj.lhs = _regenerateUuid(newObj.lhs, uuidMap, aliasMap, tableAliasMap, existingAliases, originalTable2Uuid, newTable2Uuid, originalTable2Alias);
|
|
681
621
|
if (newObj.rhs) newObj.rhs = _regenerateUuid(newObj.rhs, uuidMap, aliasMap, tableAliasMap, existingAliases, originalTable2Uuid, newTable2Uuid, originalTable2Alias);
|
|
@@ -696,7 +636,6 @@ var useStore = function useStore() {
|
|
|
696
636
|
var type = _type || obj.type;
|
|
697
637
|
var item = false;
|
|
698
638
|
var newMeta = metaList[groupIndex].list.slice();
|
|
699
|
-
// 如果没有传入 existingAliases,从 metaList 中提取
|
|
700
639
|
if (!existingAliases && newMeta) {
|
|
701
640
|
existingAliases = newMeta === null || newMeta === void 0 ? void 0 : newMeta.map(function (v) {
|
|
702
641
|
var _v$table3, _v$table4;
|
|
@@ -747,9 +686,6 @@ var useStore = function useStore() {
|
|
|
747
686
|
tableUuid: '',
|
|
748
687
|
datasourceId: '',
|
|
749
688
|
datasourceName: ''
|
|
750
|
-
// fieldAlias: '',
|
|
751
|
-
// fieldUuid: '',
|
|
752
|
-
// fields: [],
|
|
753
689
|
},
|
|
754
690
|
columns: [],
|
|
755
691
|
expressions: []
|
|
@@ -809,14 +745,12 @@ var useStore = function useStore() {
|
|
|
809
745
|
};
|
|
810
746
|
}
|
|
811
747
|
if (type === TypeEnum.union) {
|
|
812
|
-
// 添加分组
|
|
813
748
|
var newMetaList = metaList.slice();
|
|
814
749
|
newMetaList.splice.apply(newMetaList, [groupIndex + 1, 0, defaultOperator].concat(defaultMeta));
|
|
815
750
|
_setMeta(newMetaList);
|
|
816
751
|
return false;
|
|
817
752
|
}
|
|
818
753
|
if (obj) {
|
|
819
|
-
// 只对 joinData 类型调用 regenerateUuid
|
|
820
754
|
if (obj.type === TypeEnum.joinData) {
|
|
821
755
|
item = _objectSpread(_objectSpread({}, _regenerateUuid(obj, uuidMap || {}, aliasMap || {}, tableAliasMap || {}, existingAliases || [])), {}, {
|
|
822
756
|
metaKey: metaKey
|
|
@@ -829,25 +763,21 @@ var useStore = function useStore() {
|
|
|
829
763
|
}
|
|
830
764
|
return item;
|
|
831
765
|
};
|
|
832
|
-
// 检查所有同级 joinData 的 table1.id + table2.id 组合是否冲突
|
|
833
766
|
var checkTable1Conflict = function checkTable1Conflict(objList, _index, groupIndex) {
|
|
834
767
|
var _metaList$groupIndex;
|
|
835
768
|
if (!objList || objList.length === 0) return {
|
|
836
769
|
hasConflict: false
|
|
837
770
|
};
|
|
838
771
|
var groupList = ((_metaList$groupIndex = metaList[groupIndex]) === null || _metaList$groupIndex === void 0 ? void 0 : _metaList$groupIndex.list) || [];
|
|
839
|
-
// 获取所有同级 joinData 的 table1.id + table2.id 组合
|
|
840
772
|
var getJoinKey = function getJoinKey(table1, table2) {
|
|
841
773
|
return "".concat((table1 === null || table1 === void 0 ? void 0 : table1.id) || '', "_").concat((table2 === null || table2 === void 0 ? void 0 : table2.id) || '');
|
|
842
774
|
};
|
|
843
|
-
// 收集已存在的 joinData 组合
|
|
844
775
|
var existingJoinKeys = new Set();
|
|
845
776
|
groupList.forEach(function (item) {
|
|
846
777
|
if (item.type === TypeEnum.joinData && item.table1 && item.table2) {
|
|
847
778
|
existingJoinKeys.add(getJoinKey(item.table1, item.table2));
|
|
848
779
|
}
|
|
849
780
|
});
|
|
850
|
-
// 检查每个被粘贴项的组合是否已存在
|
|
851
781
|
var _iterator = _createForOfIteratorHelper(objList),
|
|
852
782
|
_step;
|
|
853
783
|
try {
|
|
@@ -876,7 +806,6 @@ var useStore = function useStore() {
|
|
|
876
806
|
};
|
|
877
807
|
};
|
|
878
808
|
var addMeta = function addMeta(type, index, groupIndex, obj, onConflict) {
|
|
879
|
-
// 检查 table1 冲突(仅在启用配置时检测)
|
|
880
809
|
if (joinAliasConflictCheck && obj && obj.length > 0) {
|
|
881
810
|
var conflict = checkTable1Conflict(obj, index, groupIndex);
|
|
882
811
|
if (conflict.hasConflict && conflict.conflictingAlias && onConflict) {
|
|
@@ -886,11 +815,9 @@ var useStore = function useStore() {
|
|
|
886
815
|
}
|
|
887
816
|
var newMeta = metaList[groupIndex].list.slice();
|
|
888
817
|
var items = [];
|
|
889
|
-
// 创建共享的映射对象,确保循环调用时保持一致
|
|
890
818
|
var sharedUuidMap = {};
|
|
891
819
|
var sharedAliasMap = {};
|
|
892
820
|
var sharedTableAliasMap = {};
|
|
893
|
-
// 提取当前组中已存在的 alias
|
|
894
821
|
var existingAliases = newMeta === null || newMeta === void 0 ? void 0 : newMeta.map(function (v) {
|
|
895
822
|
var _v$table5, _v$table6;
|
|
896
823
|
if (v.type === TypeEnum.data) return (_v$table5 = v.table) === null || _v$table5 === void 0 ? void 0 : _v$table5.alias;
|
|
@@ -909,7 +836,6 @@ var useStore = function useStore() {
|
|
|
909
836
|
if (items[0] === false) {
|
|
910
837
|
return false;
|
|
911
838
|
}
|
|
912
|
-
// @ts-ignore
|
|
913
839
|
newMeta.splice.apply(newMeta, [index, 0].concat(_toConsumableArray(items)));
|
|
914
840
|
setMeta(newMeta, groupIndex);
|
|
915
841
|
return true;
|
|
@@ -917,16 +843,13 @@ var useStore = function useStore() {
|
|
|
917
843
|
var delMeta = function delMeta(meta, groupIndex) {
|
|
918
844
|
if (meta.type === 'group') {
|
|
919
845
|
var _newMeta = metaList.slice();
|
|
920
|
-
// 删除分组
|
|
921
846
|
_newMeta.splice(groupIndex, 1);
|
|
922
|
-
// 删除分组后面一个组
|
|
923
847
|
if (_newMeta[groupIndex]) {
|
|
924
848
|
_newMeta.splice(groupIndex, 1);
|
|
925
849
|
}
|
|
926
850
|
_setMeta(_newMeta);
|
|
927
851
|
return;
|
|
928
852
|
}
|
|
929
|
-
// TIPS 自定义列删除了后面都得删除 暂时不删除 因为过滤器和组合包括自定义列都没用到自定义列
|
|
930
853
|
var index = metaList[groupIndex].list.indexOf(meta);
|
|
931
854
|
var newMeta = metaList[groupIndex].list.slice();
|
|
932
855
|
if (meta.type === TypeEnum.joinData) {
|
|
@@ -948,7 +871,6 @@ var useStore = function useStore() {
|
|
|
948
871
|
}
|
|
949
872
|
}
|
|
950
873
|
if (meta.type === 'union') {
|
|
951
|
-
// 删除分组,连带后面一个组也要删除
|
|
952
874
|
var _newMeta2 = metaList.slice();
|
|
953
875
|
_newMeta2.splice(groupIndex, 2);
|
|
954
876
|
_setMeta(_newMeta2);
|
|
@@ -981,9 +903,7 @@ var useStore = function useStore() {
|
|
|
981
903
|
return _cacheSource2TableMap[datasourceId] || [];
|
|
982
904
|
};
|
|
983
905
|
var reset = function reset() {
|
|
984
|
-
// setSourceList([]);
|
|
985
906
|
_setMeta(defaultMeta);
|
|
986
|
-
// setToolbar(defaultToolbar);
|
|
987
907
|
set_cacheSource2TableMap({});
|
|
988
908
|
set_cacheColumnsMap({});
|
|
989
909
|
};
|
package/lib/es/index.js
CHANGED
|
@@ -3,7 +3,6 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
3
3
|
import React, { useEffect } from 'react';
|
|
4
4
|
import { Provider } from './hooks/use-provider';
|
|
5
5
|
import useData from './hooks/use-state';
|
|
6
|
-
// export { restoreStructure, handleSqlStruct, compressionStructure } from './store/helper';
|
|
7
6
|
import './locale/en';
|
|
8
7
|
import './locale/zh';
|
|
9
8
|
import { __ } from './locale';
|
|
@@ -11,12 +10,6 @@ import Loading from './common/Loading';
|
|
|
11
10
|
import Metabase from './components/metabase';
|
|
12
11
|
import { reassembleByUnion, patchData } from './utils';
|
|
13
12
|
import cloneDeep from 'lodash/cloneDeep';
|
|
14
|
-
/**
|
|
15
|
-
* 规则
|
|
16
|
-
* 1、主表一换 下面全部删除
|
|
17
|
-
* 2、关联如果动了表或者删除了 下面的关联都删除
|
|
18
|
-
* 3、关联如果动了表或者删除了 下面对应排序用到的对应的字段也删除 todo. 未完成 因为有可能关联里面选一样的表 还不知道怎么搞
|
|
19
|
-
*/
|
|
20
13
|
var EMPTY_ARRAY = [];
|
|
21
14
|
var SqlVisionBuilder = React.forwardRef(function (props, ref) {
|
|
22
15
|
var _props$loading = props.loading,
|
|
@@ -124,18 +117,11 @@ var SqlVisionBuilder = React.forwardRef(function (props, ref) {
|
|
|
124
117
|
}, [showFields, fieldNameTpl, tableNameTpl, toolbar, showSubquery, subShowSubquery, constantList, formulaTemplates, ignoreGroupByType, filterCustomType, isExit, tableEnableAlias, fieldEnableAlias, groupByEnableAlias, isSelectFields, tableFlat, copyType, metabaseCopy, moduleDiff, isSubquery, moduleCopy, joinAliasConflictCheck, operatorList]);
|
|
125
118
|
React.useImperativeHandle(ref, function () {
|
|
126
119
|
return {
|
|
127
|
-
// setDatasource: (list) => {
|
|
128
|
-
// store.setSourceList(list);
|
|
129
|
-
// },
|
|
130
|
-
// setPreData: (data) => {
|
|
131
|
-
// store.setPreData(data);
|
|
132
|
-
// },
|
|
133
120
|
reset: function reset() {
|
|
134
121
|
store.reset();
|
|
135
122
|
}
|
|
136
123
|
};
|
|
137
124
|
});
|
|
138
|
-
// ② 表集合没有查出来前 不加载页面
|
|
139
125
|
if (loading) return _jsx(Loading, {
|
|
140
126
|
show: loading,
|
|
141
127
|
msg: __('loading')
|
package/lib/es/locale/en.js
CHANGED
|
@@ -66,6 +66,11 @@ export default register('en', {
|
|
|
66
66
|
'customColumn.cancel': 'cancel',
|
|
67
67
|
'customColumn.somethingAwesomeToDocument': 'something awesome to document',
|
|
68
68
|
'customColumn.expression': 'expression',
|
|
69
|
+
'customColumn.caseWhen': 'CASE WHEN',
|
|
70
|
+
'customColumn.andOr': 'AND / OR',
|
|
71
|
+
'customColumn.logicStart': 'Logic Start',
|
|
72
|
+
'customColumn.caseCondition': 'Condition',
|
|
73
|
+
'customColumn.caseResult': 'Result',
|
|
69
74
|
'customColumn.selectField': 'select columns',
|
|
70
75
|
'customColumn.selectOperator': 'select operator',
|
|
71
76
|
'customColumn.pleaseSelect': 'please select',
|
package/lib/es/locale/index.js
CHANGED
|
@@ -3,9 +3,7 @@ var locales = {};
|
|
|
3
3
|
var activeLocale = getCookie('LOCALE') || 'zh';
|
|
4
4
|
export var isEn = activeLocale === 'en';
|
|
5
5
|
export var register = function register(name, data) {
|
|
6
|
-
if (name in locales) {
|
|
7
|
-
console.warn("[i18n] ".concat(name, " has been registered"));
|
|
8
|
-
} else {
|
|
6
|
+
if (name in locales) {} else {
|
|
9
7
|
locales[name] = data;
|
|
10
8
|
}
|
|
11
9
|
};
|
|
@@ -13,7 +11,6 @@ export var __ = function __(name) {
|
|
|
13
11
|
if (activeLocale in locales) {
|
|
14
12
|
return locales[activeLocale][name] || '';
|
|
15
13
|
} else {
|
|
16
|
-
console.warn("[i18n] locale not found");
|
|
17
14
|
return '';
|
|
18
15
|
}
|
|
19
16
|
};
|