@gingkoo/pandora-metabase 1.0.37 → 1.0.39
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/components/dialog/custom-editor/index.d.ts +1 -0
- package/lib/cjs/components/dialog/custom-editor/index.js +2 -0
- package/lib/cjs/components/dialog/formula/index.js +40 -10
- package/lib/cjs/components/dialog/formula/utils.js +5 -3
- package/lib/cjs/components/dialog/formula-list/utils.js +1 -1
- package/lib/cjs/components/modules/custom-column.js +16 -0
- package/lib/cjs/store/types.d.ts +4 -0
- package/lib/es/components/dialog/custom-editor/index.d.ts +1 -0
- package/lib/es/components/dialog/custom-editor/index.js +2 -0
- package/lib/es/components/dialog/formula/index.js +40 -10
- package/lib/es/components/dialog/formula/utils.js +5 -3
- package/lib/es/components/dialog/formula-list/utils.js +1 -1
- package/lib/es/components/modules/custom-column.js +16 -0
- package/lib/es/store/types.d.ts +4 -0
- package/package.json +1 -1
|
@@ -23,6 +23,7 @@ var VisualBox = _styledComponents["default"].div.attrs({
|
|
|
23
23
|
var CaseEditor = function CaseEditor(props) {
|
|
24
24
|
var value = props.value,
|
|
25
25
|
data = props.data,
|
|
26
|
+
exitData = props.exitData,
|
|
26
27
|
onOk = props.onOk,
|
|
27
28
|
onCancel = props.onCancel;
|
|
28
29
|
// const [popup, setPopup] = useState<PopupType>({ visible: false }); // 弹框信息
|
|
@@ -82,6 +83,7 @@ var CaseEditor = function CaseEditor(props) {
|
|
|
82
83
|
isCustom: true,
|
|
83
84
|
value: caseList,
|
|
84
85
|
data: data,
|
|
86
|
+
exitData: exitData,
|
|
85
87
|
ref: ref,
|
|
86
88
|
onChange: setCaseList
|
|
87
89
|
})]
|
|
@@ -73,7 +73,9 @@ var CaseEditor = function CaseEditor(props) {
|
|
|
73
73
|
};
|
|
74
74
|
// 确定
|
|
75
75
|
var _onOk = function _onOk() {
|
|
76
|
-
typeof onOk === 'function' && (onOk === null || onOk === void 0 ? void 0 : onOk(fun)
|
|
76
|
+
typeof onOk === 'function' && (onOk === null || onOk === void 0 ? void 0 : onOk((0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, fun), {}, {
|
|
77
|
+
quotes: getQuotes(fun.args)
|
|
78
|
+
})));
|
|
77
79
|
};
|
|
78
80
|
// 选择公式名
|
|
79
81
|
var handleFunName = function handleFunName(name) {
|
|
@@ -85,6 +87,21 @@ var CaseEditor = function CaseEditor(props) {
|
|
|
85
87
|
name: name
|
|
86
88
|
}));
|
|
87
89
|
};
|
|
90
|
+
var getQuotes = function getQuotes(_args) {
|
|
91
|
+
var quotes = _args.map(function (v) {
|
|
92
|
+
var quotes = v.list.map(function (vv, i) {
|
|
93
|
+
if (vv !== null && vv !== void 0 && vv.quotes) {
|
|
94
|
+
return vv === null || vv === void 0 ? void 0 : vv.quotes;
|
|
95
|
+
} else if (vv !== null && vv !== void 0 && vv.fieldName) {
|
|
96
|
+
return vv === null || vv === void 0 ? void 0 : vv.fieldName;
|
|
97
|
+
} else {
|
|
98
|
+
return vv.val;
|
|
99
|
+
}
|
|
100
|
+
}).join(' ');
|
|
101
|
+
return quotes;
|
|
102
|
+
}).join(' , ');
|
|
103
|
+
return fun.name + ' ( ' + quotes + ' ) ';
|
|
104
|
+
};
|
|
88
105
|
var addParams = function addParams(index) {
|
|
89
106
|
var _args = (0, _cloneDeep["default"])(fun.args);
|
|
90
107
|
var tem = (0, _utils2.getTemArgs)(formulaList === null || formulaList === void 0 ? void 0 : formulaList[fun.name].args)[index + 1] || {
|
|
@@ -93,6 +110,7 @@ var CaseEditor = function CaseEditor(props) {
|
|
|
93
110
|
};
|
|
94
111
|
_args.splice(index + 1, 0, tem);
|
|
95
112
|
setFun((0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, fun), {}, {
|
|
113
|
+
quotes: getQuotes(_args),
|
|
96
114
|
args: _args
|
|
97
115
|
}));
|
|
98
116
|
};
|
|
@@ -100,6 +118,7 @@ var CaseEditor = function CaseEditor(props) {
|
|
|
100
118
|
var _args = (0, _cloneDeep["default"])(fun.args);
|
|
101
119
|
_args.splice(index, 1);
|
|
102
120
|
setFun((0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, fun), {}, {
|
|
121
|
+
quotes: getQuotes(_args),
|
|
103
122
|
args: _args
|
|
104
123
|
}));
|
|
105
124
|
};
|
|
@@ -138,11 +157,19 @@ var CaseEditor = function CaseEditor(props) {
|
|
|
138
157
|
onChange: function onChange(val) {
|
|
139
158
|
handleFunName(val);
|
|
140
159
|
},
|
|
141
|
-
children: (_store$formulaTemplat = store.formulaTemplates) === null || _store$formulaTemplat === void 0 ? void 0 : _store$formulaTemplat.map(function (
|
|
142
|
-
return (0, _jsxRuntime.jsx)(_pandora.Select.
|
|
143
|
-
|
|
144
|
-
children: option
|
|
160
|
+
children: (_store$formulaTemplat = store.formulaTemplates) === null || _store$formulaTemplat === void 0 ? void 0 : _store$formulaTemplat.map(function (options, index) {
|
|
161
|
+
return (0, _jsxRuntime.jsx)(_pandora.Select.OptGroup, {
|
|
162
|
+
label: options.name,
|
|
163
|
+
children: Array.from(options.children || []).map(function (option, ind) {
|
|
164
|
+
return (0, _jsxRuntime.jsx)(_pandora.Select.Option, {
|
|
165
|
+
value: option.name,
|
|
166
|
+
children: option.name
|
|
167
|
+
}, String(option.name + ind));
|
|
168
|
+
})
|
|
145
169
|
}, index);
|
|
170
|
+
// <Select.Option key={index} value={option.name}>
|
|
171
|
+
// {option.name}
|
|
172
|
+
// </Select.Option>
|
|
146
173
|
})
|
|
147
174
|
})
|
|
148
175
|
}), fun.name && (0, _jsxRuntime.jsxs)("div", {
|
|
@@ -179,12 +206,15 @@ var CaseEditor = function CaseEditor(props) {
|
|
|
179
206
|
onChange: function onChange(data, _quotes) {
|
|
180
207
|
var _args = (0, _cloneDeep["default"])(fun.args);
|
|
181
208
|
_args[i].list = data;
|
|
182
|
-
_args[i].quotes = _quotes || '';
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
209
|
+
// (_args[i] as AtomsCollection).quotes = _quotes || '';
|
|
210
|
+
// const quotes = (_args as AtomsCollection[])
|
|
211
|
+
// .map((v) => {
|
|
212
|
+
// return v.quotes;
|
|
213
|
+
// })
|
|
214
|
+
// .join(' , ');
|
|
186
215
|
setFun((0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, fun), {}, {
|
|
187
|
-
quotes:
|
|
216
|
+
quotes: getQuotes(_args),
|
|
217
|
+
//fun.name + ' ( ' + quotes + ' ) ',
|
|
188
218
|
args: _args
|
|
189
219
|
}));
|
|
190
220
|
}
|
|
@@ -11,9 +11,11 @@ var _utils = require("../formula-list/utils");
|
|
|
11
11
|
var getObjTem = exports.getObjTem = function getObjTem(arr) {
|
|
12
12
|
var obj = {};
|
|
13
13
|
arr === null || arr === void 0 || arr.map(function (v) {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
v.children.map(function (vv) {
|
|
15
|
+
if (vv.name) {
|
|
16
|
+
obj[vv.name] = vv;
|
|
17
|
+
}
|
|
18
|
+
});
|
|
17
19
|
});
|
|
18
20
|
return obj;
|
|
19
21
|
};
|
|
@@ -30,6 +30,7 @@ var CustomColumn = function CustomColumn(props) {
|
|
|
30
30
|
var store = (0, _useProvider.useStore)();
|
|
31
31
|
var customColumn = meta.customColumn;
|
|
32
32
|
var index = (0, _utils.findIndex)(store.metaList[groupIndex].list, meta);
|
|
33
|
+
var notExistsColumns = store.preProps.notExistsColumns;
|
|
33
34
|
function getAvailableColumns() {
|
|
34
35
|
var newMeta = store.metaList[groupIndex].list.slice();
|
|
35
36
|
var columns = [];
|
|
@@ -212,6 +213,19 @@ var CustomColumn = function CustomColumn(props) {
|
|
|
212
213
|
}
|
|
213
214
|
return data;
|
|
214
215
|
}
|
|
216
|
+
// const getPreColumns = () => {
|
|
217
|
+
// let data = [...getColumns(), ...cloneDeep(notExistsColumns || [])];
|
|
218
|
+
// // 将source 拍到最前面
|
|
219
|
+
// const priorityNames = ['source'];
|
|
220
|
+
// const sorted = data.sort((a, b) => {
|
|
221
|
+
// const aPriority = priorityNames.includes(a.name);
|
|
222
|
+
// const bPriority = priorityNames.includes(b.name);
|
|
223
|
+
// if (aPriority && !bPriority) return -1;
|
|
224
|
+
// if (!aPriority && bPriority) return 1;
|
|
225
|
+
// return 0;
|
|
226
|
+
// });
|
|
227
|
+
// return sorted;
|
|
228
|
+
// };
|
|
215
229
|
// 自定义弹窗
|
|
216
230
|
var showSubQuery = function showSubQuery(e, i) {
|
|
217
231
|
var newMeta = store.metaList[groupIndex].list.slice();
|
|
@@ -224,6 +238,8 @@ var CustomColumn = function CustomColumn(props) {
|
|
|
224
238
|
value: store,
|
|
225
239
|
children: (0, _jsxRuntime.jsx)(_customEditor["default"], {
|
|
226
240
|
data: getColumns(),
|
|
241
|
+
// data={getPreColumns()}
|
|
242
|
+
exitData: getColumns(),
|
|
227
243
|
value: _value,
|
|
228
244
|
onCancel: function onCancel() {
|
|
229
245
|
o.close();
|
package/lib/cjs/store/types.d.ts
CHANGED
|
@@ -17,6 +17,7 @@ var VisualBox = Styled.div.attrs({
|
|
|
17
17
|
var CaseEditor = function CaseEditor(props) {
|
|
18
18
|
var value = props.value,
|
|
19
19
|
data = props.data,
|
|
20
|
+
exitData = props.exitData,
|
|
20
21
|
onOk = props.onOk,
|
|
21
22
|
onCancel = props.onCancel;
|
|
22
23
|
// const [popup, setPopup] = useState<PopupType>({ visible: false }); // 弹框信息
|
|
@@ -76,6 +77,7 @@ var CaseEditor = function CaseEditor(props) {
|
|
|
76
77
|
isCustom: true,
|
|
77
78
|
value: caseList,
|
|
78
79
|
data: data,
|
|
80
|
+
exitData: exitData,
|
|
79
81
|
ref: ref,
|
|
80
82
|
onChange: setCaseList
|
|
81
83
|
})]
|
|
@@ -67,7 +67,9 @@ var CaseEditor = function CaseEditor(props) {
|
|
|
67
67
|
};
|
|
68
68
|
// 确定
|
|
69
69
|
var _onOk = function _onOk() {
|
|
70
|
-
typeof onOk === 'function' && (onOk === null || onOk === void 0 ? void 0 : onOk(fun)
|
|
70
|
+
typeof onOk === 'function' && (onOk === null || onOk === void 0 ? void 0 : onOk(_objectSpread(_objectSpread({}, fun), {}, {
|
|
71
|
+
quotes: getQuotes(fun.args)
|
|
72
|
+
})));
|
|
71
73
|
};
|
|
72
74
|
// 选择公式名
|
|
73
75
|
var handleFunName = function handleFunName(name) {
|
|
@@ -79,6 +81,21 @@ var CaseEditor = function CaseEditor(props) {
|
|
|
79
81
|
name: name
|
|
80
82
|
}));
|
|
81
83
|
};
|
|
84
|
+
var getQuotes = function getQuotes(_args) {
|
|
85
|
+
var quotes = _args.map(function (v) {
|
|
86
|
+
var quotes = v.list.map(function (vv, i) {
|
|
87
|
+
if (vv !== null && vv !== void 0 && vv.quotes) {
|
|
88
|
+
return vv === null || vv === void 0 ? void 0 : vv.quotes;
|
|
89
|
+
} else if (vv !== null && vv !== void 0 && vv.fieldName) {
|
|
90
|
+
return vv === null || vv === void 0 ? void 0 : vv.fieldName;
|
|
91
|
+
} else {
|
|
92
|
+
return vv.val;
|
|
93
|
+
}
|
|
94
|
+
}).join(' ');
|
|
95
|
+
return quotes;
|
|
96
|
+
}).join(' , ');
|
|
97
|
+
return fun.name + ' ( ' + quotes + ' ) ';
|
|
98
|
+
};
|
|
82
99
|
var addParams = function addParams(index) {
|
|
83
100
|
var _args = cloneDeep(fun.args);
|
|
84
101
|
var tem = getTemArgs(formulaList === null || formulaList === void 0 ? void 0 : formulaList[fun.name].args)[index + 1] || {
|
|
@@ -87,6 +104,7 @@ var CaseEditor = function CaseEditor(props) {
|
|
|
87
104
|
};
|
|
88
105
|
_args.splice(index + 1, 0, tem);
|
|
89
106
|
setFun(_objectSpread(_objectSpread({}, fun), {}, {
|
|
107
|
+
quotes: getQuotes(_args),
|
|
90
108
|
args: _args
|
|
91
109
|
}));
|
|
92
110
|
};
|
|
@@ -94,6 +112,7 @@ var CaseEditor = function CaseEditor(props) {
|
|
|
94
112
|
var _args = cloneDeep(fun.args);
|
|
95
113
|
_args.splice(index, 1);
|
|
96
114
|
setFun(_objectSpread(_objectSpread({}, fun), {}, {
|
|
115
|
+
quotes: getQuotes(_args),
|
|
97
116
|
args: _args
|
|
98
117
|
}));
|
|
99
118
|
};
|
|
@@ -132,11 +151,19 @@ var CaseEditor = function CaseEditor(props) {
|
|
|
132
151
|
onChange: function onChange(val) {
|
|
133
152
|
handleFunName(val);
|
|
134
153
|
},
|
|
135
|
-
children: (_store$formulaTemplat = store.formulaTemplates) === null || _store$formulaTemplat === void 0 ? void 0 : _store$formulaTemplat.map(function (
|
|
136
|
-
return _jsx(Select.
|
|
137
|
-
|
|
138
|
-
children: option
|
|
154
|
+
children: (_store$formulaTemplat = store.formulaTemplates) === null || _store$formulaTemplat === void 0 ? void 0 : _store$formulaTemplat.map(function (options, index) {
|
|
155
|
+
return _jsx(Select.OptGroup, {
|
|
156
|
+
label: options.name,
|
|
157
|
+
children: Array.from(options.children || []).map(function (option, ind) {
|
|
158
|
+
return _jsx(Select.Option, {
|
|
159
|
+
value: option.name,
|
|
160
|
+
children: option.name
|
|
161
|
+
}, String(option.name + ind));
|
|
162
|
+
})
|
|
139
163
|
}, index);
|
|
164
|
+
// <Select.Option key={index} value={option.name}>
|
|
165
|
+
// {option.name}
|
|
166
|
+
// </Select.Option>
|
|
140
167
|
})
|
|
141
168
|
})
|
|
142
169
|
}), fun.name && _jsxs("div", {
|
|
@@ -173,12 +200,15 @@ var CaseEditor = function CaseEditor(props) {
|
|
|
173
200
|
onChange: function onChange(data, _quotes) {
|
|
174
201
|
var _args = cloneDeep(fun.args);
|
|
175
202
|
_args[i].list = data;
|
|
176
|
-
_args[i].quotes = _quotes || '';
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
203
|
+
// (_args[i] as AtomsCollection).quotes = _quotes || '';
|
|
204
|
+
// const quotes = (_args as AtomsCollection[])
|
|
205
|
+
// .map((v) => {
|
|
206
|
+
// return v.quotes;
|
|
207
|
+
// })
|
|
208
|
+
// .join(' , ');
|
|
180
209
|
setFun(_objectSpread(_objectSpread({}, fun), {}, {
|
|
181
|
-
quotes:
|
|
210
|
+
quotes: getQuotes(_args),
|
|
211
|
+
//fun.name + ' ( ' + quotes + ' ) ',
|
|
182
212
|
args: _args
|
|
183
213
|
}));
|
|
184
214
|
}
|
|
@@ -3,9 +3,11 @@ import { getTemplateItem } from '../formula-list/utils';
|
|
|
3
3
|
export var getObjTem = function getObjTem(arr) {
|
|
4
4
|
var obj = {};
|
|
5
5
|
arr === null || arr === void 0 || arr.map(function (v) {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
v.children.map(function (vv) {
|
|
7
|
+
if (vv.name) {
|
|
8
|
+
obj[vv.name] = vv;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
9
11
|
});
|
|
10
12
|
return obj;
|
|
11
13
|
};
|
|
@@ -26,6 +26,7 @@ var CustomColumn = function CustomColumn(props) {
|
|
|
26
26
|
var store = useStore();
|
|
27
27
|
var customColumn = meta.customColumn;
|
|
28
28
|
var index = findIndex(store.metaList[groupIndex].list, meta);
|
|
29
|
+
var notExistsColumns = store.preProps.notExistsColumns;
|
|
29
30
|
function getAvailableColumns() {
|
|
30
31
|
var newMeta = store.metaList[groupIndex].list.slice();
|
|
31
32
|
var columns = [];
|
|
@@ -208,6 +209,19 @@ var CustomColumn = function CustomColumn(props) {
|
|
|
208
209
|
}
|
|
209
210
|
return data;
|
|
210
211
|
}
|
|
212
|
+
// const getPreColumns = () => {
|
|
213
|
+
// let data = [...getColumns(), ...cloneDeep(notExistsColumns || [])];
|
|
214
|
+
// // 将source 拍到最前面
|
|
215
|
+
// const priorityNames = ['source'];
|
|
216
|
+
// const sorted = data.sort((a, b) => {
|
|
217
|
+
// const aPriority = priorityNames.includes(a.name);
|
|
218
|
+
// const bPriority = priorityNames.includes(b.name);
|
|
219
|
+
// if (aPriority && !bPriority) return -1;
|
|
220
|
+
// if (!aPriority && bPriority) return 1;
|
|
221
|
+
// return 0;
|
|
222
|
+
// });
|
|
223
|
+
// return sorted;
|
|
224
|
+
// };
|
|
211
225
|
// 自定义弹窗
|
|
212
226
|
var showSubQuery = function showSubQuery(e, i) {
|
|
213
227
|
var newMeta = store.metaList[groupIndex].list.slice();
|
|
@@ -220,6 +234,8 @@ var CustomColumn = function CustomColumn(props) {
|
|
|
220
234
|
value: store,
|
|
221
235
|
children: _jsx(CustomEditor, {
|
|
222
236
|
data: getColumns(),
|
|
237
|
+
// data={getPreColumns()}
|
|
238
|
+
exitData: getColumns(),
|
|
223
239
|
value: _value,
|
|
224
240
|
onCancel: function onCancel() {
|
|
225
241
|
o.close();
|
package/lib/es/store/types.d.ts
CHANGED