@zgfe/business-lib 1.0.0-beta.1 → 1.0.0-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.
Files changed (90) hide show
  1. package/es/analysisLayout/demo/index.js +1 -1
  2. package/es/analysisLayout/index.js +1 -4
  3. package/es/analysisLayout/index.less +2 -1
  4. package/es/assets/iconfont/iconfont.css +123 -0
  5. package/es/assets/iconfont/iconfont.js +46 -0
  6. package/es/assets/iconfont/iconfont.json +198 -0
  7. package/es/assets/iconfont/iconfont.ttf +0 -0
  8. package/es/assets/iconfont/iconfont.woff +0 -0
  9. package/es/assets/iconfont/iconfont.woff2 +0 -0
  10. package/es/attributeSelector/demo/multi.js +1 -1
  11. package/es/attributeSelector/demo/multiForm.js +1 -1
  12. package/es/attributeSelector/demo/single.js +1 -1
  13. package/es/attributeSelector/demo/singleForm.js +1 -1
  14. package/es/attributeSelector/group.js +1 -1
  15. package/es/attributeSelector/index.js +2 -1
  16. package/es/attributeSelector/index.less +2 -2
  17. package/es/chart/chartConfig.d.ts +20 -5
  18. package/es/chart/chartConfig.js +169 -117
  19. package/es/chart/demo/bar.js +8 -12
  20. package/es/chart/demo/data/data.d.ts +8 -0
  21. package/es/chart/demo/data/data.js +28 -0
  22. package/es/chart/demo/index.js +6 -5
  23. package/es/chart/demo/pie.js +5 -22
  24. package/es/chart/index.d.ts +28 -12
  25. package/es/chart/index.js +94 -17
  26. package/es/chart/util/format.d.ts +4 -0
  27. package/es/chart/util/format.js +61 -0
  28. package/es/commonStyle/icon.less +32 -5
  29. package/es/commonStyle/index.less +3 -171
  30. package/es/commonStyle/select.less +3 -12
  31. package/es/commonStyle/theme.less +80 -39
  32. package/es/commonStyle/variable.less +5 -2
  33. package/es/components/iconFont.d.ts +5 -0
  34. package/es/components/iconFont.js +30 -0
  35. package/es/datePicker/demo/form.js +1 -1
  36. package/es/datePicker/demo/index.js +1 -1
  37. package/es/datePicker/index.js +8 -15
  38. package/es/datePicker/index.less +4 -28
  39. package/es/dialog/components/list.js +1 -1
  40. package/es/dialog/components/selectToInput.js +12 -1
  41. package/es/dialog/components/style/list.less +1 -1
  42. package/es/dialog/components/style/tab.less +2 -2
  43. package/es/dialog/components/tab.js +1 -1
  44. package/es/dialog/demo/index.js +1 -1
  45. package/es/dialog/demo/index2.js +20 -2
  46. package/es/dialog/demo/index3.js +1 -1
  47. package/es/dialog/style/index.less +7 -1
  48. package/es/eventSelector/demo/form.js +1 -1
  49. package/es/eventSelector/demo/index.js +1 -1
  50. package/es/eventSelector/demo/nodata.js +1 -1
  51. package/es/eventSelector/index.d.ts +1 -1
  52. package/es/eventSelector/index.js +3 -13
  53. package/es/eventSelector/{cascade.less → index.less} +2 -1
  54. package/es/globalAttributes/demo/index.js +1 -1
  55. package/es/globalAttributes/index.js +2 -1
  56. package/es/index.d.ts +1 -1
  57. package/es/index.js +1 -4
  58. package/es/multipleSelector/demo/index.js +1 -1
  59. package/es/multipleSelector/index.js +2 -8
  60. package/es/multipleSelector/index.less +23 -25
  61. package/es/select/demo/index.js +32 -4
  62. package/es/select/index.d.ts +2 -1
  63. package/es/select/index.js +30 -8
  64. package/es/select/index.less +1 -0
  65. package/es/table/demo/index.js +1 -1
  66. package/es/table/demo/index2.js +1 -1
  67. package/es/table/index.js +1 -1
  68. package/es/table/index.less +78 -41
  69. package/es/targetConditionGroup/components/conditionItem.js +3 -3
  70. package/es/targetConditionGroup/components/style/group.less +1 -1
  71. package/es/targetConditionGroup/components/style/index.less +1 -1
  72. package/es/targetConditionGroup/demo/form.js +1 -1
  73. package/es/targetConditionGroup/demo/index.js +1 -1
  74. package/es/targetConditionGroup/index.js +2 -1
  75. package/es/targetConditionGroup/index.less +1 -2
  76. package/es/targetSelector/components/BizCascadeBox.d.ts +1 -1
  77. package/es/targetSelector/components/BizCascadeBox.js +1 -1
  78. package/es/targetSelector/demo/form.js +1 -1
  79. package/es/targetSelector/demo/index.js +1 -1
  80. package/es/targetSelector/demo/nodata.js +1 -1
  81. package/es/targetSelector/index.js +1 -2
  82. package/es/targetSelector/index.less +1 -26
  83. package/es/userGroup/demo/cluster.js +1 -1
  84. package/es/userGroup/demo/index.js +1 -1
  85. package/es/userGroup/index.js +1 -2
  86. package/es/userGroup/index.less +1 -1
  87. package/es/userGroup/userCluster.js +2 -1
  88. package/package.json +1 -1
  89. package/es/chart/demo/data.d.ts +0 -11
  90. package/es/chart/demo/data.js +0 -37
package/es/chart/index.js CHANGED
@@ -16,18 +16,25 @@ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Sy
16
16
 
17
17
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
18
18
 
19
- import React, { useEffect, useState } from 'react';
19
+ import React, { useEffect, useMemo, useState } from 'react';
20
20
  import ReactEChartsCore from 'echarts-for-react/lib/core';
21
21
  import * as echarts from 'echarts';
22
- import { getChartOption } from './chartConfig';
22
+ import { getChartOption, getPieConfig } from './chartConfig';
23
+ import util from '../utils/util';
24
+ import { chartColors } from './color';
23
25
 
24
26
  var BizChart = function BizChart(props) {
25
27
  var _props$type = props.type,
26
28
  type = _props$type === void 0 ? 'line' : _props$type,
27
- option = props.option,
28
29
  data = props.data,
30
+ showList = props.showList,
31
+ _props$showAll = props.showAll,
32
+ showAll = _props$showAll === void 0 ? true : _props$showAll,
29
33
  _props$sameColor = props.sameColor,
30
34
  sameColor = _props$sameColor === void 0 ? true : _props$sameColor,
35
+ _props$reverseXAxis = props.reverseXAxis,
36
+ reverseXAxis = _props$reverseXAxis === void 0 ? false : _props$reverseXAxis,
37
+ seriesName = props.seriesName,
31
38
  tooltipFormatter = props.tooltipFormatter,
32
39
  xAxisFormatter = props.xAxisFormatter,
33
40
  yAxisFormatter = props.yAxisFormatter,
@@ -40,30 +47,100 @@ var BizChart = function BizChart(props) {
40
47
  chartOption = _useState2[0],
41
48
  setChartOption = _useState2[1];
42
49
 
43
- useEffect(function () {
44
- var eOption = getChartOption(type, data === null || data === void 0 ? void 0 : data.xData, data === null || data === void 0 ? void 0 : data.seriesData, sameColor, legendPosition, legendOrient);
45
-
46
- if (tooltipFormatter) {
47
- eOption.tooltip.formatter = tooltipFormatter;
50
+ var showMap = useMemo(function () {
51
+ var data = {};
52
+
53
+ if (showList) {
54
+ showList.forEach(function (item) {
55
+ if (util.isArray(item)) {
56
+ data[item.join('-')] = true;
57
+ } else if (util.isString(item)) {
58
+ data[item] = true;
59
+ }
60
+ });
48
61
  }
49
62
 
50
- if (xAxisFormatter) {
51
- eOption.xAxis.axisLabel.formatter = xAxisFormatter;
63
+ return data;
64
+ }, [showList]);
65
+
66
+ var formatPieData = function formatPieData(data) {
67
+ var list = [];
68
+ var other = {
69
+ name: '其它',
70
+ value: 0
71
+ };
72
+ data.series.forEach(function (item) {
73
+ var series = {
74
+ name: item.names.join('-'),
75
+ value: item.values[0]
76
+ };
77
+
78
+ if (showAll) {
79
+ list.push(series);
80
+ } else {
81
+ if (showList && showMap[series.name] || !showList && list.length < 10) {
82
+ // 数据被showList命中,或者没定义showList,但位于前十的记录
83
+ list.push(series);
84
+ } else {
85
+ other.value += item.values[0];
86
+ }
87
+ }
88
+ });
89
+ if (!showAll && other.value > 0) list.push(other);
90
+ return list;
91
+ };
92
+
93
+ var formatChartData = function formatChartData(data) {
94
+ if (reverseXAxis) {
95
+ var series = {
96
+ names: [seriesName || ''],
97
+ values: []
98
+ };
99
+ var x_axis = [];
100
+ var sData = [];
101
+ data.series.forEach(function (seriesItem, index) {
102
+ x_axis.push(seriesItem.names.join('-'));
103
+
104
+ if (reverseXAxis && showList && !showMap[data.series[index].names.join('-')]) {
105
+ return;
106
+ }
107
+
108
+ sData.push({
109
+ name: x_axis[index],
110
+ value: seriesItem.values[0],
111
+ itemStyle: {
112
+ normal: {
113
+ color: chartColors[sData.length]
114
+ }
115
+ }
116
+ });
117
+ });
118
+ return {
119
+ x_axis: x_axis,
120
+ series: sData
121
+ };
122
+ } else {
123
+ return data;
52
124
  }
125
+ };
53
126
 
54
- if (yAxisFormatter) {
55
- eOption.yAxis.axisLabel.formatter = yAxisFormatter;
56
- }
127
+ useEffect(function () {
128
+ var eOption = {};
129
+
130
+ if (type === 'pie') {
131
+ var rData = formatPieData(data);
132
+ eOption = getPieConfig(rData, legendPosition, legendOrient, tooltipFormatter);
133
+ } else {
134
+ var _rData = formatChartData(data);
57
135
 
58
- if (valueUnit) {
59
- eOption.yAxis.name = valueUnit;
136
+ eOption = getChartOption(type, reverseXAxis && showList ? showList : _rData.x_axis, _rData.series, sameColor, legendPosition, legendOrient, valueUnit, tooltipFormatter, xAxisFormatter, yAxisFormatter, reverseXAxis, seriesName);
60
137
  }
61
138
 
62
- console.log('option>>>', eOption);
139
+ console.log(type, ' >>> ', eOption);
63
140
  setChartOption(function () {
64
141
  return _objectSpread({}, eOption);
65
142
  });
66
- }, [data, type]);
143
+ }, [data, type, reverseXAxis]);
67
144
  return /*#__PURE__*/React.createElement(ReactEChartsCore, {
68
145
  echarts: echarts,
69
146
  option: chartOption,
@@ -0,0 +1,4 @@
1
+ declare const tooltipFormatterDefault: (params: any) => string;
2
+ declare const yAxisFormatterDefault: (value: number) => string;
3
+ declare const xAxisFormatterDefault: (value: string) => string;
4
+ export { tooltipFormatterDefault, xAxisFormatterDefault, yAxisFormatterDefault };
@@ -0,0 +1,61 @@
1
+ import util from '../../utils/util';
2
+
3
+ var tooltipFormatterDefault = function tooltipFormatterDefault(params) {
4
+ var xDate = params[0].name;
5
+ var xLabel = xDate;
6
+
7
+ if (/^\d{4}-\d{2}-\d{2}$/.test(xLabel)) {
8
+ // 处理日期
9
+ xLabel = xLabel.replace(/\d{4}-/, '');
10
+ }
11
+
12
+ var htmlArray = [];
13
+
14
+ if (params.length > 1) {
15
+ htmlArray.push("<span class=\"biz-chart-tooltip-title\">".concat(xLabel, "</span>"));
16
+ }
17
+
18
+ params.forEach(function (item) {
19
+ var lineLabel = item.value;
20
+
21
+ if (item.seriesName.indexOf('CTR') > -1) {
22
+ lineLabel += '%';
23
+ } else {
24
+ lineLabel = util.toThousands(lineLabel);
25
+ }
26
+
27
+ htmlArray.push("<div class=\"biz-chart-tooltip-item\"><span class=\"biz-chart-tooltip-content\">".concat(item.marker).concat(params.length > 1 ? item.seriesName : item.name, ":</span> <span class=\"biz-chart-tooltip-value\">").concat(lineLabel, "</span></div>"));
28
+ });
29
+ return htmlArray.join('');
30
+ };
31
+
32
+ var yAxisFormatterDefault = function yAxisFormatterDefault(value) {
33
+ if (parseFloat(String(value)) >= 1000) {
34
+ return util.toThousands(parseFloat((value / 1000).toFixed(1))) + 'k';
35
+ } else {
36
+ return String(value);
37
+ }
38
+ };
39
+
40
+ var xAxisFormatterDefault = function xAxisFormatterDefault(value) {
41
+ if (/^\d{4}-\d{2}-\d{2}$/.test(value)) {
42
+ // 处理日期
43
+ return value.replace(/\d{4}-/, '');
44
+ } else if (/^\d{4}-\d{2}-\d{2}\|\d{4}-\d{2}-\d{2}$/.test(value)) {
45
+ // 周、月日期
46
+ var dates = value.match(/\d{4}-\d{2}-\d{2}/g);
47
+ return dates ? dates[0].replace(/\d{4}-/, '') + '~' + dates[1].replace(/\d{4}-/, '') : value;
48
+ } else {
49
+ value = util.strMiddleSplit(value);
50
+
51
+ if (/:/.test(value)) {
52
+ return value.replace(/\d{4}-\d{2}-\d{2}\s/, '');
53
+ } else if (/,/.test(value)) {
54
+ return value.replace(/,/g, '-');
55
+ } else {
56
+ return value;
57
+ }
58
+ }
59
+ };
60
+
61
+ export { tooltipFormatterDefault, xAxisFormatterDefault, yAxisFormatterDefault };
@@ -1,9 +1,9 @@
1
- @import './index.less';
1
+ @import './variable.less';
2
2
 
3
3
  .biz-icon-add {
4
4
  width: fit-content;
5
5
  padding: 2px;
6
- color: @titleColor;
6
+ color: @fontColor3;
7
7
  font-weight: 400;
8
8
  font-size: 14px;
9
9
  line-height: 20px;
@@ -71,12 +71,16 @@
71
71
  line-height: 20px;
72
72
  border-radius: 4px;
73
73
  cursor: pointer;
74
+ .anticon {
75
+ margin-right: 8px;
76
+ font-size: 24px;
77
+ }
74
78
  }
75
79
 
76
80
  .biz-btn-primary,
77
81
  .ant-btn-primary {
78
82
  color: #fff;
79
- background: #165dff;
83
+ background: @themeColor;
80
84
  border: none;
81
85
 
82
86
  &:hover,
@@ -88,8 +92,8 @@
88
92
  }
89
93
 
90
94
  &:disabled {
91
- color: #cacdd4;
92
- background: #f6f6f6;
95
+ color: @disableColor;
96
+ background: @grayColor;
93
97
  }
94
98
  }
95
99
 
@@ -145,3 +149,26 @@
145
149
  border-color: #165dff;
146
150
  }
147
151
  }
152
+
153
+ .ant-tooltip {
154
+ .ant-tooltip-inner {
155
+ border-radius: @boxRadius2;
156
+ }
157
+
158
+ &.biz-tooltip {
159
+ width: auto;
160
+
161
+ .ant-tooltip-inner {
162
+ padding: 4px;
163
+ color: @fontColor;
164
+ background-color: #fff;
165
+ border-radius: 4px;
166
+ box-shadow: 0px 4px 10px rgba(0, 0, 0, 0.1);
167
+ }
168
+
169
+ .ant-tooltip-arrow-content {
170
+ background-color: #fff;
171
+ --antd-arrow-background-color: #fff;
172
+ }
173
+ }
174
+ }
@@ -1,171 +1,3 @@
1
- /** 全局变量 **/
2
- @themeColor: #165dff;
3
- /* 字体颜色 */
4
- @fontColor: #021429;
5
- /* 中性色/次要-信息2 */
6
- @fontColor2: #242541;
7
- /* 中性色/次要-信息3 */
8
- @fontColor3: #5f6085;
9
- /* 图标颜色 */
10
- @iconColor: #5f6085;
11
- /* layout icon颜色 */
12
- @layoutIconColor: #242541;
13
- /* 标题颜色 */
14
- @titleColor: #5f6085;
15
- /* 灰色*/
16
- @grayColor: #f6f6f6;
17
- @disableColor: #cacdd4;
18
- /* 边框圆角 */
19
- @boxRadius: 4px;
20
- /* 特殊圆角 */
21
- @specialRadius: 10px;
22
- /* icon圆角 */
23
- @iconRadius: 3px;
24
- /* hover背景色 */
25
- @hoverBgColor: #e8efff;
26
- /* 中性色/gray-8背景色 */
27
- @grayBgColor: #fafafb;
28
- /* hover字体颜色 */
29
- @hoverColor: #165dff;
30
- /* active背景色 */
31
- @activeBgColor: #165dff;
32
- /* active字体颜色 */
33
- @activeColor: #ffffff;
34
- /* 删除hover背景色 */
35
- @deleteHoverBgColor: #fed5d1;
36
- /* 删除hover字体色 */
37
- @deleteHoverColor: #fb5547;
38
- /* 按钮 */
39
- @btnPrimaryBgColor: #165dff;
40
- @btnPrimaryFontColor: #ffffff;
41
-
42
- /* 字体大小 */
43
- @fontSize: 14px;
44
- /* 图标大小 */
45
- @iconSize: 16px;
46
- /* 字体weight */
47
- @fontWeight: 400;
48
- /* border */
49
- @boxBorder: 1px solid #ecedf0;
50
- @borderColor: #ecedf0;
51
- /* padding */
52
- @searchPadding: 24px;
53
- @contentPadding: 32px;
54
- /*下拉框宽度*/
55
- @dropdownWidth: 284px;
56
- /* 分析维度, 关系 */
57
- @dropdownWidth2: 120px;
58
- /*更多操作*/
59
- @dropdownWidth3: 200px;
60
- /* 指标下拉框= 200+284*/
61
- @dropdownHeight: 400px;
62
-
63
- /* 下拉框外框 */
64
- @dropdownPadding: 8px;
65
- /*下拉选项*/
66
- @dropdownItemPadding: 14px 8px;
67
- /**/
68
- @selectItemHeight: 48px;
69
- /*级联二级选择项*/
70
- @selectItem2Height: 40px;
71
- /*级联二级内边距*/
72
- @selectItem2Padding: 8px 10px;
73
-
74
- .boxBg {
75
- color: @fontColor;
76
- background-color: #fff;
77
- &:hover:not(.box-active, .box-disabled) {
78
- color: @hoverColor;
79
- background-color: @hoverBgColor;
80
- .biz-icon {
81
- color: @hoverColor;
82
- }
83
- }
84
- }
85
- .box-hover {
86
- color: @hoverColor;
87
- background-color: @hoverBgColor;
88
- .biz-icon {
89
- color: @hoverColor;
90
- }
91
- }
92
- .box-active {
93
- color: @activeColor !important;
94
- background-color: @activeBgColor;
95
- .biz-icon {
96
- color: @activeColor;
97
- }
98
- }
99
- .box-disabled {
100
- color: @fontColor !important;
101
- background-color: #f5f5f5;
102
- cursor: not-allowed !important;
103
- }
104
- .biz-search {
105
- box-sizing: border-box;
106
- padding: 4px;
107
- background: #f6f6f6;
108
- border-radius: @specialRadius;
109
- &:hover,
110
- &.active {
111
- background-color: @hoverBgColor;
112
- .biz-search-box {
113
- background-color: #fff;
114
- border-color: #165dff;
115
- }
116
- }
117
- .biz-search-box {
118
- height: 40px;
119
- background: #f6f6f6;
120
- border-color: #f6f6f6;
121
- border-radius: @specialRadius;
122
- box-shadow: none;
123
-
124
- input {
125
- background: transparent;
126
- }
127
- .ant-input {
128
- border: none;
129
- }
130
- &.small {
131
- height: 32px;
132
- }
133
- }
134
- }
135
-
136
- .mb-12 {
137
- margin-bottom: 12px;
138
- }
139
-
140
- /*滚动条凹槽的颜色,还可以设置边框属性 */
141
- ::-webkit-scrollbar-track-piece {
142
- background-color: #fff;
143
- -webkit-border-radius: 10px;
144
- -moz-border-radius: 10px;
145
- border-radius: 10px;
146
- }
147
-
148
- /*滚动条的宽度*/
149
- ::-webkit-scrollbar {
150
- width: 10px;
151
- height: 10px;
152
- }
153
-
154
- /*滚动条的设置*/
155
- ::-webkit-scrollbar-thumb {
156
- background-color: #cacdd4;
157
- background-clip: padding-box;
158
- border: 2px solid #fff;
159
- -webkit-border-radius: 10px;
160
- -moz-border-radius: 10px;
161
- border-radius: 10px;
162
- }
163
-
164
- /*滚动条鼠标移上去*/
165
- ::-webkit-scrollbar-thumb:hover {
166
- // background-color: #bbb;
167
- }
168
- ::-webkit-scrollbar-track-piece {
169
- width: 6px;
170
- height: 6px;
171
- }
1
+ @import './theme.less';
2
+ @import './icon.less';
3
+ @import './select.less';
@@ -1,13 +1,4 @@
1
- @import './index.less';
2
- @import './theme.less';
3
-
4
- /* 标题 */
5
-
6
- /*下拉框样式重写*/
7
- // .biz-select {
8
- // width: 100%;
9
- // color: @fontColor;
10
- // }
1
+ @import './variable.less';
11
2
 
12
3
  /*文本框样式*/
13
4
  .biz-select-cotainer {
@@ -71,7 +62,7 @@
71
62
 
72
63
  .biz-select-zhankai {
73
64
  position: absolute;
74
- top: 9px;
65
+ top: 5px;
75
66
  right: 10px;
76
67
  display: none;
77
68
  color: @iconColor;
@@ -92,7 +83,7 @@
92
83
  font-size: @fontSize;
93
84
  line-height: 48px;
94
85
  background: #ffffff;
95
- border-radius: @specialRadius;
86
+ border-radius: @boxRadius2;
96
87
  box-shadow: 0px 4px 10px rgba(0, 0, 0, 0.1);
97
88
  }
98
89