@zgfe/business-lib 1.1.55 → 1.1.56-beta.1
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/es/addToPanel/components/styleList.js +1 -1
- package/es/addToPanel/demo/index.js +8 -0
- package/es/addToPanel/index.js +3 -2
- package/es/chart/demo/data/data.js +1 -1
- package/es/chart/demo/pie.js +2 -4
- package/es/chart/index.js +2 -2
- package/es/chart/types.d.ts +4 -0
- package/es/chart/util/chartOptionConfig.d.ts +1 -1
- package/es/chart/util/chartOptionConfig.js +23 -4
- package/es/chart/util/formatData.d.ts +4 -1
- package/es/chart/util/formatData.js +7 -4
- package/es/chart/util/formatOption.js +3 -0
- package/es/datePicker/datePicker.js +2 -2
- package/es/demoWrapper/head.d.ts +1 -0
- package/es/demoWrapper/head.js +8 -2
- package/es/demoWrapper/index.js +4 -1
- package/es/layout/optionTitle/demo/page.d.ts +2 -0
- package/es/layout/optionTitle/demo/page.js +5 -0
- package/es/layout/optionTitle/index.js +25 -11
- package/es/layout/optionTitle/layout.js +1 -1
- package/es/layout/optionTitle/styles/index.less +14 -0
- package/es/layout/optionTitle/types.d.ts +2 -2
- package/es/utils/ajax.js +22 -10
- package/es/utils/demo/ajax.js +1 -2
- package/es/utils/demo/interruption.d.ts +2 -0
- package/es/utils/demo/interruption.js +38 -0
- package/package.json +2 -2
|
@@ -57,7 +57,7 @@ var StyleList = function StyleList(props) {
|
|
|
57
57
|
key: item.value,
|
|
58
58
|
placement: "top",
|
|
59
59
|
disabled: item.disabled || !item.children,
|
|
60
|
-
|
|
60
|
+
dropdownRender: function dropdownRender() {
|
|
61
61
|
return ChildList(item);
|
|
62
62
|
}
|
|
63
63
|
}, /*#__PURE__*/React.createElement("div", {
|
|
@@ -15,6 +15,10 @@ var chartTypes = [{
|
|
|
15
15
|
label: '汇总图',
|
|
16
16
|
value: 'bar',
|
|
17
17
|
icon: 'huizongtu'
|
|
18
|
+
}, {
|
|
19
|
+
label: '占比图',
|
|
20
|
+
value: 'pie',
|
|
21
|
+
icon: 'huizongtu'
|
|
18
22
|
}, {
|
|
19
23
|
label: '地图',
|
|
20
24
|
value: 'map',
|
|
@@ -32,6 +36,10 @@ var chartTypes = [{
|
|
|
32
36
|
label: '汇总图',
|
|
33
37
|
value: 'bar',
|
|
34
38
|
icon: 'huizongtu'
|
|
39
|
+
}, {
|
|
40
|
+
label: '占比图',
|
|
41
|
+
value: 'pie',
|
|
42
|
+
icon: 'huizongtu'
|
|
35
43
|
}]
|
|
36
44
|
}, {
|
|
37
45
|
label: '分数',
|
package/es/addToPanel/index.js
CHANGED
|
@@ -43,6 +43,7 @@ var BizAddToPanel = function BizAddToPanel(props) {
|
|
|
43
43
|
router = _useContext.router,
|
|
44
44
|
routes = _useContext.routes,
|
|
45
45
|
isDemo = _useContext.isDemo;
|
|
46
|
+
var showTypes = ['line', 'bar', 'pie'];
|
|
46
47
|
useEffect(function () {
|
|
47
48
|
queryGroups();
|
|
48
49
|
}, []);
|
|
@@ -166,8 +167,8 @@ var BizAddToPanel = function BizAddToPanel(props) {
|
|
|
166
167
|
}
|
|
167
168
|
return /*#__PURE__*/React.createElement(BizDialog, {
|
|
168
169
|
open: true,
|
|
170
|
+
width: "auto",
|
|
169
171
|
title: props.type === 'edit' ? '修改当前看板指标' : '向看板添加指标',
|
|
170
|
-
width: 503,
|
|
171
172
|
maskClosable: false,
|
|
172
173
|
onCancel: props.onCancel,
|
|
173
174
|
onOk: onAdd,
|
|
@@ -249,7 +250,7 @@ var BizAddToPanel = function BizAddToPanel(props) {
|
|
|
249
250
|
}, function (_ref) {
|
|
250
251
|
var getFieldValue = _ref.getFieldValue;
|
|
251
252
|
var type = getFieldValue('chartType');
|
|
252
|
-
return type
|
|
253
|
+
return showTypes.indexOf(type) > -1 ? /*#__PURE__*/React.createElement(Form.Item, {
|
|
253
254
|
label: "\u663E\u793A",
|
|
254
255
|
name: "showList",
|
|
255
256
|
colon: false,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export default {
|
|
2
2
|
x_axis: ['2022-03-31', '2022-04-01', '2022-04-02', '2022-04-03', '2022-04-04', '2022-04-05', '2022-04-06', '2022-04-07', '2022-04-08', '2022-04-09', '2022-04-10', '2022-04-11', '2022-04-12', '2022-04-13'],
|
|
3
3
|
series: [{
|
|
4
|
-
names: ['
|
|
4
|
+
names: ['付款成功付款成功付款成功付款成功付款成功付款成功付款成功付款成功付款成功付款成功付款成功付款成功付款成功付款成功'],
|
|
5
5
|
values: [26, 27, 43, 44, 40, 34, 33, 33, 34, 24, 30, 31, 31, 38]
|
|
6
6
|
}, {
|
|
7
7
|
names: ['注册-发送手机验证码'],
|
package/es/chart/demo/pie.js
CHANGED
|
@@ -6,9 +6,7 @@ export default (function () {
|
|
|
6
6
|
data: pieData,
|
|
7
7
|
type: "pie",
|
|
8
8
|
showAll: false,
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
colors: ['#1D9ED1', '#F383A2', '#9FB40F', '#FF6B3B', '#8C8C47'],
|
|
12
|
-
showList: ['付款成功', '搜索商品', '查看商品详情', 'click']
|
|
9
|
+
showList: ['搜索商品', '查看商品详情', 'pv', 'scroll'],
|
|
10
|
+
radius: ['30%', '75%']
|
|
13
11
|
});
|
|
14
12
|
});
|
package/es/chart/index.js
CHANGED
|
@@ -55,8 +55,8 @@ var BizChart = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
55
55
|
var eOption = {};
|
|
56
56
|
if (!data) return eOption;
|
|
57
57
|
if (type === 'pie') {
|
|
58
|
-
var rData = formatPieData(data, showAll, showList);
|
|
59
|
-
eOption = getPieOption(rData, legendPosition, legendOrient, tooltipFormatter);
|
|
58
|
+
var rData = formatPieData(data, showAll, showList, props.showOther);
|
|
59
|
+
eOption = getPieOption(rData, legendPosition, legendOrient, props.showLabel, props.radius, props.center, tooltipFormatter);
|
|
60
60
|
} else if (type === 'line' || type === 'bar') {
|
|
61
61
|
var _rData = formatChartData(data, showAll, showList, reverseXAxis, colors);
|
|
62
62
|
eOption = getChartOption(type, _rData, legendPosition, legendOrient, valueUnit, xRotate, yRotate, tooltipFormatter, xAxisFormatter, yAxisFormatter, legendFormatter, reverseXAxis, seriesName);
|
package/es/chart/types.d.ts
CHANGED
|
@@ -29,6 +29,9 @@ export declare namespace ChartTypes {
|
|
|
29
29
|
isCity?: boolean;
|
|
30
30
|
userGroup?: string;
|
|
31
31
|
colors?: string[];
|
|
32
|
+
showLabel?: boolean;
|
|
33
|
+
radius?: string | number | Array<string | number>;
|
|
34
|
+
center?: Array<string | number>;
|
|
32
35
|
tooltipFormatter?: (param: any) => string;
|
|
33
36
|
xAxisFormatter?: (param: any) => string;
|
|
34
37
|
yAxisFormatter?: (param: any) => string;
|
|
@@ -40,6 +43,7 @@ export declare namespace ChartTypes {
|
|
|
40
43
|
legendOrient?: 'horizontal' | 'vertical';
|
|
41
44
|
showList?: Array<any>;
|
|
42
45
|
showAll?: boolean;
|
|
46
|
+
showOther?: boolean;
|
|
43
47
|
reverseXAxis?: boolean;
|
|
44
48
|
seriesName?: string;
|
|
45
49
|
}
|
|
@@ -17,7 +17,7 @@ export declare const xAxisConfig: XAXisOption;
|
|
|
17
17
|
export declare const yAxisConfig: YAXisOption;
|
|
18
18
|
export declare const tooltipConfig: TooltipComponentOption;
|
|
19
19
|
export declare const getChartOption: (chartType: string, data: ChartTypes.Value, legendPosition?: 'top' | 'bottom' | 'middle', legendOrient?: 'horizontal' | 'vertical', unit?: string, xRotate?: number, yRotate?: number, tooltipFormatter?: ((value: any) => string) | undefined, xAxisFormatter?: ((value: any) => string) | undefined, yAxisFormatter?: ((value: any) => string) | undefined, legendFormatter?: ((value: any) => string) | undefined, reverseXAxis?: boolean, seriesName?: string) => EChartsOption;
|
|
20
|
-
export declare const getPieOption: (seriesData?: object[], legendPosition?: 'top' | 'bottom' | 'middle', legendOrient?: 'horizontal' | 'vertical', tooltipFormatter?: ((value: any) => string) | undefined) => EChartsOption;
|
|
20
|
+
export declare const getPieOption: (seriesData?: object[], legendPosition?: 'top' | 'bottom' | 'middle', legendOrient?: 'horizontal' | 'vertical', showLabel?: boolean, radius?: string | number | Array<string | number>, center?: Array<string | number>, tooltipFormatter?: ((value: any) => string) | undefined, legendFormatter?: ((value: any) => string) | undefined) => EChartsOption;
|
|
21
21
|
export declare const getMapOption: (seriesData: object[] | undefined, maxMinValue: {
|
|
22
22
|
min: number;
|
|
23
23
|
max: number;
|
|
@@ -7,6 +7,7 @@ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input ==
|
|
|
7
7
|
import { tooltipFormatterDefault, xAxisFormatterDefault, yAxisFormatterDefault, mapTooltipFormatter, legendFormatterDefault } from './formatOption';
|
|
8
8
|
import { chartColors } from './color';
|
|
9
9
|
import '../styles/index.less';
|
|
10
|
+
import { util } from '../../utils';
|
|
10
11
|
export var baseConfig = {
|
|
11
12
|
color: chartColors,
|
|
12
13
|
backgroundColor: '#fff',
|
|
@@ -26,6 +27,7 @@ export var legendConfig = {
|
|
|
26
27
|
itemHeight: 10,
|
|
27
28
|
itemWidth: 10,
|
|
28
29
|
itemGap: 21,
|
|
30
|
+
z: 10,
|
|
29
31
|
textStyle: {
|
|
30
32
|
color: '#5F6085',
|
|
31
33
|
height: 10,
|
|
@@ -36,7 +38,6 @@ export var legendConfig = {
|
|
|
36
38
|
}
|
|
37
39
|
},
|
|
38
40
|
formatter: ['{a|{name}}'].join('\n'),
|
|
39
|
-
pageIconSize: 10,
|
|
40
41
|
pageTextStyle: {
|
|
41
42
|
color: '#5F6085'
|
|
42
43
|
},
|
|
@@ -200,12 +201,29 @@ export var getPieOption = function getPieOption() {
|
|
|
200
201
|
var seriesData = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
201
202
|
var legendPosition = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'top';
|
|
202
203
|
var legendOrient = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'horizontal';
|
|
203
|
-
var
|
|
204
|
+
var showLabel = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
|
|
205
|
+
var radius = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : [0, '75%'];
|
|
206
|
+
var center = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : ['50%', '55%'];
|
|
207
|
+
var tooltipFormatter = arguments.length > 6 ? arguments[6] : undefined;
|
|
208
|
+
var legendFormatter = arguments.length > 7 ? arguments[7] : undefined;
|
|
204
209
|
var series = [{
|
|
205
210
|
type: 'pie',
|
|
206
211
|
data: seriesData,
|
|
207
212
|
label: {
|
|
208
|
-
show:
|
|
213
|
+
show: showLabel,
|
|
214
|
+
color: 'inherit',
|
|
215
|
+
formatter: function formatter(params) {
|
|
216
|
+
return util.strMiddleSplit(params.name);
|
|
217
|
+
}
|
|
218
|
+
},
|
|
219
|
+
radius: radius,
|
|
220
|
+
center: center,
|
|
221
|
+
emphasis: {
|
|
222
|
+
itemStyle: {
|
|
223
|
+
shadowBlur: 10,
|
|
224
|
+
shadowOffsetX: 0,
|
|
225
|
+
shadowColor: 'rgba(0, 0, 0, 0.1)'
|
|
226
|
+
}
|
|
209
227
|
}
|
|
210
228
|
}];
|
|
211
229
|
var tooltip = JSON.parse(JSON.stringify(tooltipConfig)),
|
|
@@ -220,6 +238,7 @@ export var getPieOption = function getPieOption() {
|
|
|
220
238
|
legend.width = 50;
|
|
221
239
|
grid.left = '10%';
|
|
222
240
|
}
|
|
241
|
+
legend.formatter = legendFormatter ? legendFormatter : legendFormatterDefault;
|
|
223
242
|
tooltip.trigger = 'item';
|
|
224
243
|
if (tooltipFormatter) {
|
|
225
244
|
tooltip.formatter = tooltipFormatter;
|
|
@@ -228,7 +247,7 @@ export var getPieOption = function getPieOption() {
|
|
|
228
247
|
var name = params.name,
|
|
229
248
|
value = params.value,
|
|
230
249
|
color = params.color;
|
|
231
|
-
return "<div class=\"biz-chart-tooltip-item\">\n <
|
|
250
|
+
return "<div class=\"biz-chart-tooltip-item\">\n <div class=\"biz-chart-tooltip-content\">\n <span class=\"biz-tooltip-marker\" style=\"background:".concat(color, "\"></span>\n <div class=\"biz-tooltip-name\">").concat(name, "</div>\n </div> \n <span class=\"biz-chart-tooltip-value\">").concat(value, "(").concat(params.percent, "%)</span>\n </div>");
|
|
232
251
|
};
|
|
233
252
|
}
|
|
234
253
|
return _objectSpread(_objectSpread({}, baseConfig), {}, {
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { ChartTypes } from '../types';
|
|
2
|
-
export declare const formatPieData: (data: ChartTypes.Value, showAll?: boolean, showList?: Array<any
|
|
2
|
+
export declare const formatPieData: (data: ChartTypes.Value, showAll?: boolean, showList?: Array<any>, showOther?: boolean) => {
|
|
3
3
|
name: string;
|
|
4
4
|
value: number;
|
|
5
|
+
itemStyle: {
|
|
6
|
+
color: string;
|
|
7
|
+
};
|
|
5
8
|
}[];
|
|
6
9
|
export declare const formatChartData: (data: ChartTypes.Value, showAll?: boolean, showList?: Array<any>, reverseXAxis?: boolean, color?: string[]) => {
|
|
7
10
|
x_axis: string[];
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import util from '../../utils/util';
|
|
2
2
|
import { chartColors } from './color';
|
|
3
|
-
export var formatPieData = function formatPieData(data, showAll, showList) {
|
|
3
|
+
export var formatPieData = function formatPieData(data, showAll, showList, showOther) {
|
|
4
4
|
var showMap = getShowMap(showList);
|
|
5
5
|
var list = [];
|
|
6
6
|
var other = {
|
|
7
7
|
name: '其它',
|
|
8
|
-
value: 0
|
|
8
|
+
value: 0,
|
|
9
|
+
itemStyle: {
|
|
10
|
+
color: '#ccd0d4'
|
|
11
|
+
}
|
|
9
12
|
};
|
|
10
13
|
data.series.forEach(function (item) {
|
|
11
14
|
var series = {
|
|
@@ -17,12 +20,12 @@ export var formatPieData = function formatPieData(data, showAll, showList) {
|
|
|
17
20
|
} else {
|
|
18
21
|
if (showList && showMap[series.name] || !showList && list.length < 10) {
|
|
19
22
|
list.push(series);
|
|
20
|
-
} else {
|
|
23
|
+
} else if (showOther) {
|
|
21
24
|
other.value += item.values[0];
|
|
22
25
|
}
|
|
23
26
|
}
|
|
24
27
|
});
|
|
25
|
-
if (!showAll && other.value > 0) list.push(other);
|
|
28
|
+
if (showOther && !showAll && other.value > 0) list.push(other);
|
|
26
29
|
return list;
|
|
27
30
|
};
|
|
28
31
|
export var formatChartData = function formatChartData(data, showAll, showList, reverseXAxis, color) {
|
|
@@ -22,6 +22,9 @@ var tooltipFormatterDefault = function tooltipFormatterDefault(params) {
|
|
|
22
22
|
lineLabel = util.toThousands(lineLabel);
|
|
23
23
|
}
|
|
24
24
|
var name = item.seriesName.trim();
|
|
25
|
+
if (item.seriesType === 'bar' && params.length === 1 && !name) {
|
|
26
|
+
name = (item.data && item.data.label ? item.data.label : item.name).trim();
|
|
27
|
+
}
|
|
25
28
|
htmlArray.push("<div class=\"biz-chart-tooltip-item\">\n <div class=\"biz-chart-tooltip-content\">\n <span class=\"biz-tooltip-marker\" style=\"background:".concat(item.color, "\"></span>\n <div class=\"biz-tooltip-name\">").concat(name, "</div>\n </div> \n <span class=\"biz-chart-tooltip-value\">").concat(lineLabel, "</span>\n </div>"));
|
|
26
29
|
});
|
|
27
30
|
return htmlArray.join('');
|
|
@@ -77,7 +77,7 @@ var BizDate = function BizDate(props) {
|
|
|
77
77
|
value: moment(dateRange.begin, 'YYYY-MM-DD'),
|
|
78
78
|
allowClear: false,
|
|
79
79
|
inputReadOnly: true,
|
|
80
|
-
|
|
80
|
+
popupClassName: "".concat(classPrefix, "-drop"),
|
|
81
81
|
locale: locale,
|
|
82
82
|
showToday: false,
|
|
83
83
|
disabledDate: disabledDate,
|
|
@@ -90,7 +90,7 @@ var BizDate = function BizDate(props) {
|
|
|
90
90
|
}) : /*#__PURE__*/React.createElement(RangePicker, {
|
|
91
91
|
value: [moment(dateRange.begin, 'YYYY-MM-DD'), moment(dateRange.end, 'YYYY-MM-DD')],
|
|
92
92
|
allowClear: false,
|
|
93
|
-
|
|
93
|
+
popupClassName: "".concat(classPrefix, "-drop"),
|
|
94
94
|
inputReadOnly: true,
|
|
95
95
|
locale: locale,
|
|
96
96
|
disabledDate: disabledDate,
|
package/es/demoWrapper/head.d.ts
CHANGED
package/es/demoWrapper/head.js
CHANGED
|
@@ -4,13 +4,14 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
|
|
|
4
4
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
5
5
|
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
6
6
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
7
|
-
import { Select, Skeleton } from 'antd';
|
|
7
|
+
import { Select, Skeleton, message } from 'antd';
|
|
8
8
|
import React, { useEffect, useState } from 'react';
|
|
9
9
|
import request from '../utils/ajax';
|
|
10
10
|
var DemoHeader = function DemoHeader(_ref) {
|
|
11
11
|
var defaultApp = _ref.defaultApp,
|
|
12
12
|
onChangeApp = _ref.onChangeApp,
|
|
13
|
-
onLoading = _ref.onLoading
|
|
13
|
+
onLoading = _ref.onLoading,
|
|
14
|
+
onLogin = _ref.onLogin;
|
|
14
15
|
var _useState = useState([]),
|
|
15
16
|
_useState2 = _slicedToArray(_useState, 2),
|
|
16
17
|
appList = _useState2[0],
|
|
@@ -28,6 +29,11 @@ var DemoHeader = function DemoHeader(_ref) {
|
|
|
28
29
|
function queryAppList() {
|
|
29
30
|
setLoading(true);
|
|
30
31
|
request('/zg/web/v2/data/v2ajaxGetDataByApp').then(function (res) {
|
|
32
|
+
if (!res.data) {
|
|
33
|
+
message.error('获取应用列表失败,请重新登录');
|
|
34
|
+
onLogin && onLogin();
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
31
37
|
setAppList(res.data.appList);
|
|
32
38
|
if (defaultApp) {
|
|
33
39
|
_onChange(res.data.appList.find(function (item) {
|
package/es/demoWrapper/index.js
CHANGED
|
@@ -60,7 +60,10 @@ var DemoWrapper = function DemoWrapper(_ref) {
|
|
|
60
60
|
title: /*#__PURE__*/React.createElement(DemoHeader, {
|
|
61
61
|
defaultApp: defaultApp,
|
|
62
62
|
onChangeApp: setApp,
|
|
63
|
-
onLoading: setAppListLoading
|
|
63
|
+
onLoading: setAppListLoading,
|
|
64
|
+
onLogin: function onLogin() {
|
|
65
|
+
return setNotLogin(true);
|
|
66
|
+
}
|
|
64
67
|
}),
|
|
65
68
|
className: className,
|
|
66
69
|
bodyStyle: {
|
|
@@ -19,12 +19,12 @@ import Apis from '../../constants/apis';
|
|
|
19
19
|
import { Spin, message } from 'antd';
|
|
20
20
|
export var classPrefix = 'biz-layout-panel';
|
|
21
21
|
var BizTargetFromPanel = function BizTargetFromPanel(props) {
|
|
22
|
-
var _props$value$target$p;
|
|
22
|
+
var _props$value, _props$value10, _props$value$target$p;
|
|
23
23
|
var _useState = useState([]),
|
|
24
24
|
_useState2 = _slicedToArray(_useState, 2),
|
|
25
25
|
options = _useState2[0],
|
|
26
26
|
setOptions = _useState2[1];
|
|
27
|
-
var _useState3 = useState(props.value.target.name || '洞察'),
|
|
27
|
+
var _useState3 = useState(((_props$value = props.value) === null || _props$value === void 0 ? void 0 : _props$value.target.name) || '洞察'),
|
|
28
28
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
29
29
|
title = _useState4[0],
|
|
30
30
|
setTitle = _useState4[1];
|
|
@@ -42,11 +42,14 @@ var BizTargetFromPanel = function BizTargetFromPanel(props) {
|
|
|
42
42
|
setLoading = _useState10[1];
|
|
43
43
|
var titleRef = useRef(null);
|
|
44
44
|
useEffect(function () {
|
|
45
|
-
|
|
45
|
+
var _props$value2, _props$value3;
|
|
46
|
+
if (!((_props$value2 = props.value) === null || _props$value2 === void 0 ? void 0 : _props$value2.panelId)) return;
|
|
47
|
+
setOptions(((_props$value3 = props.value) === null || _props$value3 === void 0 ? void 0 : _props$value3.target.id) ? panelBtn(onClick) : panelCreateBtn(onClick));
|
|
46
48
|
}, []);
|
|
47
49
|
var onClick = function onClick(type) {
|
|
48
50
|
if (type === BizOptionTitleProps.OptionTypes.CANCEL) {
|
|
49
|
-
var
|
|
51
|
+
var _props$value4;
|
|
52
|
+
var param = ((_props$value4 = props.value) === null || _props$value4 === void 0 ? void 0 : _props$value4.target.id) ? {
|
|
50
53
|
panelId: props.value.panelId,
|
|
51
54
|
elementId: props.value.target.id,
|
|
52
55
|
name: title
|
|
@@ -62,12 +65,13 @@ var BizTargetFromPanel = function BizTargetFromPanel(props) {
|
|
|
62
65
|
}
|
|
63
66
|
};
|
|
64
67
|
var onDelete = function onDelete() {
|
|
68
|
+
var _props$value5, _props$value6;
|
|
65
69
|
setLoading(true);
|
|
66
70
|
ajax(Apis.delPanelElement, {
|
|
67
71
|
method: 'post',
|
|
68
72
|
data: {
|
|
69
|
-
panelId: props.value.panelId,
|
|
70
|
-
elementId: props.value.target.id
|
|
73
|
+
panelId: (_props$value5 = props.value) === null || _props$value5 === void 0 ? void 0 : _props$value5.panelId,
|
|
74
|
+
elementId: (_props$value6 = props.value) === null || _props$value6 === void 0 ? void 0 : _props$value6.target.id
|
|
71
75
|
}
|
|
72
76
|
}).then(function (res) {
|
|
73
77
|
if (!res) return;
|
|
@@ -80,6 +84,7 @@ var BizTargetFromPanel = function BizTargetFromPanel(props) {
|
|
|
80
84
|
});
|
|
81
85
|
};
|
|
82
86
|
var onService = function onService(value, callback) {
|
|
87
|
+
var _props$value7, _props$value8;
|
|
83
88
|
setTitle(value);
|
|
84
89
|
setBtnOptions(!value);
|
|
85
90
|
if (!value) return;
|
|
@@ -87,8 +92,8 @@ var BizTargetFromPanel = function BizTargetFromPanel(props) {
|
|
|
87
92
|
ajax(Apis.updateElementName, {
|
|
88
93
|
method: 'post',
|
|
89
94
|
data: {
|
|
90
|
-
panelId: props.value.panelId,
|
|
91
|
-
elementId: props.value.target.id,
|
|
95
|
+
panelId: (_props$value7 = props.value) === null || _props$value7 === void 0 ? void 0 : _props$value7.panelId,
|
|
96
|
+
elementId: (_props$value8 = props.value) === null || _props$value8 === void 0 ? void 0 : _props$value8.target.id,
|
|
92
97
|
name: value
|
|
93
98
|
}
|
|
94
99
|
}).then(function (res) {
|
|
@@ -112,20 +117,27 @@ var BizTargetFromPanel = function BizTargetFromPanel(props) {
|
|
|
112
117
|
};
|
|
113
118
|
var setBtnOptions = function setBtnOptions(disabled) {
|
|
114
119
|
setOptions(function (option) {
|
|
120
|
+
var _props$value9;
|
|
115
121
|
if (!option.length) return [];
|
|
116
122
|
option[option.length - 1].disabled = disabled;
|
|
117
|
-
if (props.value.target.id) {
|
|
123
|
+
if ((_props$value9 = props.value) === null || _props$value9 === void 0 ? void 0 : _props$value9.target.id) {
|
|
118
124
|
option[option.length - 2].disabled = disabled;
|
|
119
125
|
}
|
|
120
126
|
return _toConsumableArray(option);
|
|
121
127
|
});
|
|
122
128
|
};
|
|
129
|
+
if (!((_props$value10 = props.value) === null || _props$value10 === void 0 ? void 0 : _props$value10.panelId)) {
|
|
130
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
131
|
+
className: "".concat(classPrefix, "-content")
|
|
132
|
+
}, props.children);
|
|
133
|
+
}
|
|
123
134
|
return /*#__PURE__*/React.createElement(BizTargetFromPanelContext.Provider, {
|
|
124
135
|
value: {
|
|
125
136
|
handleSearch: setBtnOptions
|
|
126
137
|
}
|
|
127
138
|
}, /*#__PURE__*/React.createElement(Spin, {
|
|
128
|
-
spinning: loading
|
|
139
|
+
spinning: loading,
|
|
140
|
+
wrapperClassName: classPrefix
|
|
129
141
|
}, /*#__PURE__*/React.createElement(BizOptionLayout, {
|
|
130
142
|
ref: titleRef,
|
|
131
143
|
value: title,
|
|
@@ -136,7 +148,9 @@ var BizTargetFromPanel = function BizTargetFromPanel(props) {
|
|
|
136
148
|
onBack: function onBack() {
|
|
137
149
|
return onClick(BizOptionTitleProps.OptionTypes.CANCEL);
|
|
138
150
|
}
|
|
139
|
-
},
|
|
151
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
152
|
+
className: "".concat(classPrefix, "-content ").concat(classPrefix, "-content2")
|
|
153
|
+
}, props.children), showDialog && /*#__PURE__*/React.createElement(BizAddToPanel, {
|
|
140
154
|
defaultValue: {
|
|
141
155
|
panel: {
|
|
142
156
|
id: props.value.panelId
|
|
@@ -7,7 +7,7 @@ var BizOptionLayout = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
7
7
|
var className = props.className;
|
|
8
8
|
var classPrefix = 'biz-option-layout';
|
|
9
9
|
return /*#__PURE__*/React.createElement("div", {
|
|
10
|
-
className: "".concat(classPrefix, " ").concat(className)
|
|
10
|
+
className: "".concat(classPrefix, " ").concat(className || '')
|
|
11
11
|
}, /*#__PURE__*/React.createElement("div", {
|
|
12
12
|
className: "".concat(classPrefix, "-header")
|
|
13
13
|
}, /*#__PURE__*/React.createElement("div", {
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
@import '~@zgfe/business-lib/es/assets/styles/inner.less';
|
|
2
2
|
|
|
3
3
|
.biz-layout-panel {
|
|
4
|
+
width: 100%;
|
|
5
|
+
height: 100%;
|
|
6
|
+
& > .ant-spin-container {
|
|
7
|
+
height: 100%;
|
|
8
|
+
}
|
|
4
9
|
/*更多按钮*/
|
|
5
10
|
&-btn-more {
|
|
6
11
|
width: @height-base;
|
|
@@ -16,4 +21,13 @@
|
|
|
16
21
|
.__default-hover();
|
|
17
22
|
}
|
|
18
23
|
}
|
|
24
|
+
|
|
25
|
+
&-content {
|
|
26
|
+
width: 100%;
|
|
27
|
+
height: 100%;
|
|
28
|
+
overflow: auto;
|
|
29
|
+
}
|
|
30
|
+
&-content2 {
|
|
31
|
+
height: calc(100% - 64px);
|
|
32
|
+
}
|
|
19
33
|
}
|
|
@@ -2,8 +2,8 @@ import React from 'react';
|
|
|
2
2
|
import AddToPanel from '../../addToPanel/types';
|
|
3
3
|
export declare namespace BizOptionTitleProps {
|
|
4
4
|
export interface Props {
|
|
5
|
-
value
|
|
6
|
-
styleOptions
|
|
5
|
+
value?: Value;
|
|
6
|
+
styleOptions?: AddToPanel.TabItem[];
|
|
7
7
|
children: React.ReactNode;
|
|
8
8
|
afterEditTarget?: (type: string, value?: any) => void;
|
|
9
9
|
}
|
package/es/utils/ajax.js
CHANGED
|
@@ -77,10 +77,10 @@ export function responseErrorHandler(url, apiResult, errorTitle, notifyType) {
|
|
|
77
77
|
if (new RegExp("".concat(ResponseStatus.success, "$")).test(apiResult.code)) {
|
|
78
78
|
flag = true;
|
|
79
79
|
} else if (new RegExp("".concat(ResponseStatus.notLogin)).test(apiResult.code)) {
|
|
80
|
-
|
|
80
|
+
message.error('账户未登录或登录已失效');
|
|
81
81
|
flag = true;
|
|
82
82
|
} else if (new RegExp("".concat(ResponseStatus.noPermission)).test(apiResult.code)) {
|
|
83
|
-
|
|
83
|
+
message.error('账户没有权限');
|
|
84
84
|
flag = true;
|
|
85
85
|
}
|
|
86
86
|
if (!flag) {
|
|
@@ -140,28 +140,40 @@ function _request() {
|
|
|
140
140
|
return req(params.url, params.options);
|
|
141
141
|
case 14:
|
|
142
142
|
res = _context.sent;
|
|
143
|
+
if (res) {
|
|
144
|
+
_context.next = 17;
|
|
145
|
+
break;
|
|
146
|
+
}
|
|
147
|
+
throw new Error('Request Interruption');
|
|
148
|
+
case 17:
|
|
143
149
|
if (!(((_params$options2 = params.options) === null || _params$options2 === void 0 ? void 0 : _params$options2.responseType) === 'blob')) {
|
|
144
|
-
_context.next =
|
|
150
|
+
_context.next = 23;
|
|
145
151
|
break;
|
|
146
152
|
}
|
|
147
153
|
if (!util.isBlob(res.data)) {
|
|
148
|
-
_context.next =
|
|
154
|
+
_context.next = 22;
|
|
149
155
|
break;
|
|
150
156
|
}
|
|
151
157
|
return _context.abrupt("return", downloadFile(res, params.options.fileName));
|
|
152
|
-
case
|
|
158
|
+
case 22:
|
|
153
159
|
res = res.data;
|
|
154
|
-
case
|
|
160
|
+
case 23:
|
|
155
161
|
return _context.abrupt("return", responseWrapper ? responseWrapper(url, responseErrorHandler(url, res, options === null || options === void 0 ? void 0 : options.errorTitle, options === null || options === void 0 ? void 0 : options.notifyType)) : responseErrorHandler(url, res, options === null || options === void 0 ? void 0 : options.errorTitle, options === null || options === void 0 ? void 0 : options.notifyType));
|
|
156
|
-
case
|
|
157
|
-
_context.prev =
|
|
162
|
+
case 26:
|
|
163
|
+
_context.prev = 26;
|
|
158
164
|
_context.t0 = _context["catch"](0);
|
|
165
|
+
if (!(_context.t0.message === 'Request Interruption')) {
|
|
166
|
+
_context.next = 30;
|
|
167
|
+
break;
|
|
168
|
+
}
|
|
169
|
+
throw new Error('Request Interruption');
|
|
170
|
+
case 30:
|
|
159
171
|
return _context.abrupt("return", null);
|
|
160
|
-
case
|
|
172
|
+
case 31:
|
|
161
173
|
case "end":
|
|
162
174
|
return _context.stop();
|
|
163
175
|
}
|
|
164
|
-
}, _callee, null, [[0,
|
|
176
|
+
}, _callee, null, [[0, 26]]);
|
|
165
177
|
}));
|
|
166
178
|
return _request.apply(this, arguments);
|
|
167
179
|
}
|
package/es/utils/demo/ajax.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { Button } from 'antd';
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import { ajax } from '@zgfe/business-lib';
|
|
4
|
-
import { DemoWrapper } from '@zgfe/business-lib';
|
|
3
|
+
import { ajax, DemoWrapper } from '@zgfe/business-lib';
|
|
5
4
|
export default (function () {
|
|
6
5
|
var onDownload = function onDownload() {
|
|
7
6
|
ajax('/zg/web/v2/openapi/label/excel/export', {
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { Button, message } from 'antd';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { ajax } from '@zgfe/business-lib';
|
|
4
|
+
import Request from 'umi-request';
|
|
5
|
+
var CancelToken = Request.CancelToken;
|
|
6
|
+
var cancel;
|
|
7
|
+
export default (function () {
|
|
8
|
+
var getPanels = function getPanels() {
|
|
9
|
+
if (typeof cancel === 'function') {
|
|
10
|
+
cancel();
|
|
11
|
+
}
|
|
12
|
+
ajax('/zg/web/v2/apppanel/panels', {
|
|
13
|
+
method: 'post',
|
|
14
|
+
data: {
|
|
15
|
+
appId: 501648,
|
|
16
|
+
platform: 0
|
|
17
|
+
},
|
|
18
|
+
cancelToken: new CancelToken(function executor(c) {
|
|
19
|
+
cancel = c;
|
|
20
|
+
}),
|
|
21
|
+
responseWrapper: function responseWrapper(_url, res) {
|
|
22
|
+
if (/07$/.test(res.code)) {
|
|
23
|
+
console.log('reLogin-----');
|
|
24
|
+
throw new Error('reLogin');
|
|
25
|
+
}
|
|
26
|
+
return res;
|
|
27
|
+
}
|
|
28
|
+
}).then(function (res) {
|
|
29
|
+
if (!res) return;
|
|
30
|
+
message.success('请求成功');
|
|
31
|
+
}).catch(function (e) {
|
|
32
|
+
console.log(e);
|
|
33
|
+
});
|
|
34
|
+
};
|
|
35
|
+
return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Button, {
|
|
36
|
+
onClick: getPanels
|
|
37
|
+
}, "\u8BF7\u6C42\u63A5\u53E3"));
|
|
38
|
+
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zgfe/business-lib",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.56-beta.1",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"start": "dumi dev",
|
|
6
6
|
"docs:build": "dumi build",
|
|
@@ -60,5 +60,5 @@
|
|
|
60
60
|
"react": "^16.12.0 || ^17.0.0",
|
|
61
61
|
"yorkie": "^2.0.0"
|
|
62
62
|
},
|
|
63
|
-
"gitHead": "
|
|
63
|
+
"gitHead": "2050aad6d38725d5a4f608ede8f00d6950b75c87"
|
|
64
64
|
}
|