@zgfe/business-lib 1.1.55-beta.0 → 1.1.55-beta.2
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/demo/index.js +8 -0
- package/es/addToPanel/index.js +3 -1
- package/es/chart/demo/data/data.js +1 -1
- package/es/chart/demo/pie.js +2 -5
- package/es/chart/index.js +1 -1
- package/es/chart/types.d.ts +3 -0
- package/es/chart/util/chartOptionConfig.d.ts +1 -1
- package/es/chart/util/chartOptionConfig.js +23 -4
- package/es/chart/util/formatOption.js +3 -0
- package/es/layout/optionTitle/index.js +8 -3
- package/es/layout/optionTitle/layout.js +1 -1
- package/es/layout/optionTitle/styles/index.less +14 -0
- package/es/utils/ajax.js +2 -0
- package/package.json +2 -2
|
@@ -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,6 +167,7 @@ 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
172
|
maskClosable: false,
|
|
171
173
|
onCancel: props.onCancel,
|
|
@@ -248,7 +250,7 @@ var BizAddToPanel = function BizAddToPanel(props) {
|
|
|
248
250
|
}, function (_ref) {
|
|
249
251
|
var getFieldValue = _ref.getFieldValue;
|
|
250
252
|
var type = getFieldValue('chartType');
|
|
251
|
-
return type
|
|
253
|
+
return showTypes.indexOf(type) > -1 ? /*#__PURE__*/React.createElement(Form.Item, {
|
|
252
254
|
label: "\u663E\u793A",
|
|
253
255
|
name: "showList",
|
|
254
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
|
@@ -5,10 +5,7 @@ export default (function () {
|
|
|
5
5
|
return /*#__PURE__*/React.createElement(BizChart, {
|
|
6
6
|
data: pieData,
|
|
7
7
|
type: "pie",
|
|
8
|
-
showAll:
|
|
9
|
-
|
|
10
|
-
legendOrient: "vertical",
|
|
11
|
-
colors: ['#1D9ED1', '#F383A2', '#9FB40F', '#FF6B3B', '#8C8C47'],
|
|
12
|
-
showList: ['付款成功', '搜索商品', '查看商品详情', 'click']
|
|
8
|
+
showAll: true,
|
|
9
|
+
radius: ['30%', '75%']
|
|
13
10
|
});
|
|
14
11
|
});
|
package/es/chart/index.js
CHANGED
|
@@ -56,7 +56,7 @@ var BizChart = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
56
56
|
if (!data) return eOption;
|
|
57
57
|
if (type === 'pie') {
|
|
58
58
|
var rData = formatPieData(data, showAll, showList);
|
|
59
|
-
eOption = getPieOption(rData, legendPosition, legendOrient, tooltipFormatter);
|
|
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;
|
|
@@ -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, "</span>\n </div>");
|
|
232
251
|
};
|
|
233
252
|
}
|
|
234
253
|
return _objectSpread(_objectSpread({}, baseConfig), {}, {
|
|
@@ -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('');
|
|
@@ -127,14 +127,17 @@ var BizTargetFromPanel = function BizTargetFromPanel(props) {
|
|
|
127
127
|
});
|
|
128
128
|
};
|
|
129
129
|
if (!((_props$value10 = props.value) === null || _props$value10 === void 0 ? void 0 : _props$value10.panelId)) {
|
|
130
|
-
return /*#__PURE__*/React.createElement(
|
|
130
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
131
|
+
className: "".concat(classPrefix, "-content")
|
|
132
|
+
}, props.children);
|
|
131
133
|
}
|
|
132
134
|
return /*#__PURE__*/React.createElement(BizTargetFromPanelContext.Provider, {
|
|
133
135
|
value: {
|
|
134
136
|
handleSearch: setBtnOptions
|
|
135
137
|
}
|
|
136
138
|
}, /*#__PURE__*/React.createElement(Spin, {
|
|
137
|
-
spinning: loading
|
|
139
|
+
spinning: loading,
|
|
140
|
+
wrapperClassName: classPrefix
|
|
138
141
|
}, /*#__PURE__*/React.createElement(BizOptionLayout, {
|
|
139
142
|
ref: titleRef,
|
|
140
143
|
value: title,
|
|
@@ -145,7 +148,9 @@ var BizTargetFromPanel = function BizTargetFromPanel(props) {
|
|
|
145
148
|
onBack: function onBack() {
|
|
146
149
|
return onClick(BizOptionTitleProps.OptionTypes.CANCEL);
|
|
147
150
|
}
|
|
148
|
-
},
|
|
151
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
152
|
+
className: "".concat(classPrefix, "-content ").concat(classPrefix, "-content2")
|
|
153
|
+
}, props.children), showDialog && /*#__PURE__*/React.createElement(BizAddToPanel, {
|
|
149
154
|
defaultValue: {
|
|
150
155
|
panel: {
|
|
151
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
|
}
|
package/es/utils/ajax.js
CHANGED
|
@@ -80,6 +80,7 @@ export function responseErrorHandler(url, apiResult, errorTitle, notifyType) {
|
|
|
80
80
|
msg = '账户未登录或登录已失效';
|
|
81
81
|
} else if (new RegExp("".concat(ResponseStatus.noPermission)).test(apiResult.code)) {
|
|
82
82
|
msg = '账户没有权限';
|
|
83
|
+
throw new Error(apiResult.msg);
|
|
83
84
|
}
|
|
84
85
|
if (!flag) {
|
|
85
86
|
msg = apiResult.msg || msg;
|
|
@@ -88,6 +89,7 @@ export function responseErrorHandler(url, apiResult, errorTitle, notifyType) {
|
|
|
88
89
|
description: msg
|
|
89
90
|
});
|
|
90
91
|
message.error(msg);
|
|
92
|
+
throw new Error(msg);
|
|
91
93
|
}
|
|
92
94
|
return apiResult;
|
|
93
95
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zgfe/business-lib",
|
|
3
|
-
"version": "1.1.55-beta.
|
|
3
|
+
"version": "1.1.55-beta.2",
|
|
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": "cf0536417852436598e08a1bb2f79e8db51f422d"
|
|
64
64
|
}
|