@zgfe/business-lib 1.0.26 → 1.0.27-adanalysis.0

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 (83) hide show
  1. package/es/addToPanel/index.js +16 -33
  2. package/es/assets/iconfont/demo_index.html +3 -647
  3. package/es/assets/iconfont/iconfont.css +3 -115
  4. package/es/assets/iconfont/iconfont.js +33 -37
  5. package/es/assets/iconfont/iconfont.json +0 -196
  6. package/es/assets/iconfont/iconfont.ttf +0 -0
  7. package/es/assets/iconfont/iconfont.woff +0 -0
  8. package/es/assets/iconfont/iconfont.woff2 +0 -0
  9. package/es/assets/styles/resetAntd.less +2 -7
  10. package/es/attrConditions/components/stringList.js +1 -1
  11. package/es/attrConditions/components/valuesList.js +5 -7
  12. package/es/attrConditions/group.js +4 -4
  13. package/es/attrConditions/types.d.ts +0 -1
  14. package/es/attributeSelector/styles/index.less +2 -31
  15. package/es/attributeSelector/util.js +1 -9
  16. package/es/chart/demo/bar.js +4 -3
  17. package/es/chart/demo/data/data.d.ts +0 -7
  18. package/es/chart/demo/data/data.js +0 -10
  19. package/es/chart/demo/data/data3.d.ts +2 -0
  20. package/es/chart/demo/data/data3.js +574 -15
  21. package/es/chart/demo/map.js +2 -1
  22. package/es/chart/index.js +2 -2
  23. package/es/chart/util/chartOptionConfig.d.ts +54 -1
  24. package/es/chart/util/chartOptionConfig.js +7 -13
  25. package/es/chart/util/formatData.js +1 -2
  26. package/es/chart/util/formatOption.js +23 -7
  27. package/es/chart/util/mapUtil.d.ts +2 -2
  28. package/es/chart/util/mapUtil.js +75 -59
  29. package/es/cycleTime/index.d.ts +0 -1
  30. package/es/cycleTime/index.js +5 -12
  31. package/es/cycleTime/month.d.ts +0 -1
  32. package/es/cycleTime/month.js +3 -6
  33. package/es/cycleTime/styles/month.less +0 -12
  34. package/es/datePicker/datePicker.js +1 -3
  35. package/es/{cycleTime/demo/disable.d.ts → datePicker/demo/day.d.ts} +1 -0
  36. package/es/datePicker/demo/day.js +49 -0
  37. package/es/datePicker/index.js +5 -3
  38. package/es/datePicker/styles/index.less +2 -1
  39. package/es/datePicker/types.d.ts +2 -0
  40. package/es/datePicker/utils.d.ts +1 -0
  41. package/es/datePicker/utils.js +37 -1
  42. package/es/eventSelector/index.js +2 -2
  43. package/es/eventSelector/listPanel.js +5 -20
  44. package/es/eventSelector/types.d.ts +1 -1
  45. package/es/layout/analysisLayout/demo/index.js +1 -5
  46. package/es/layout/analysisLayout/index.js +5 -5
  47. package/es/layout/analysisLayout/index.less +6 -0
  48. package/es/select/demo/multiple.js +2 -3
  49. package/es/select/handle.js +12 -50
  50. package/es/select/index.js +9 -44
  51. package/es/select/overlay.d.ts +1 -1
  52. package/es/select/overlay.js +5 -4
  53. package/es/select/styles/handle.less +28 -50
  54. package/es/select/types.d.ts +0 -6
  55. package/es/targetConditionGroup/index.js +1 -3
  56. package/es/targetConditionGroup/types.d.ts +0 -1
  57. package/es/targetSelector/index.js +0 -13
  58. package/es/targetSelector/styles/index.less +0 -1
  59. package/es/userCondition/conditions/styles/eventCondition.less +1 -1
  60. package/es/userCondition/conditions/styles/tagsCondition.less +1 -1
  61. package/es/userCondition/conditions/tagsCondition.js +13 -26
  62. package/es/userCondition/conditions/textDesc.js +8 -29
  63. package/es/userCondition/demo/index.js +228 -5
  64. package/es/userCondition/types.d.ts +3 -21
  65. package/es/userCondition/util.d.ts +1 -23
  66. package/es/userCondition/util.js +5 -39
  67. package/es/userTagsSelector/cascaderOverlay.js +42 -132
  68. package/es/userTagsSelector/demo/index.js +5 -12
  69. package/es/userTagsSelector/groups/groupOption.js +2 -3
  70. package/es/userTagsSelector/groups/index.js +11 -18
  71. package/es/userTagsSelector/groups/styles/option.less +1 -6
  72. package/es/userTagsSelector/index.js +3 -17
  73. package/es/userTagsSelector/multipleCheckPanel/checkOption.js +1 -2
  74. package/es/userTagsSelector/multipleCheckPanel/index.js +16 -7
  75. package/es/userTagsSelector/styles/cascaderOverlay.less +4 -9
  76. package/es/userTagsSelector/types.d.ts +10 -1
  77. package/es/userTagsSelector/util.d.ts +1 -1
  78. package/es/userTagsSelector/util.js +2 -6
  79. package/es/utils/ajax.js +1 -5
  80. package/package.json +3 -3
  81. package/es/cycleTime/demo/disable.js +0 -17
  82. package/es/userCondition/demo/mockData.d.ts +0 -85
  83. package/es/userCondition/demo/mockData.js +0 -546
@@ -38,9 +38,8 @@ export var formatChartData = function formatChartData(data, showAll, showList, r
38
38
  if (reverseXAxis) {
39
39
  x_axis.push(name);
40
40
  sData.push({
41
- name: data.x_axis[0],
41
+ name: name,
42
42
  value: seriesItem.values[0],
43
- label: name,
44
43
  itemStyle: {
45
44
  normal: {
46
45
  color: colorData[sData.length]
@@ -16,7 +16,11 @@ var tooltipFormatterDefault = function tooltipFormatterDefault(params) {
16
16
  }
17
17
 
18
18
  var htmlArray = [];
19
- htmlArray.push("<div class=\"biz-chart-tooltip-title\">".concat(xLabel, "</div>"));
19
+
20
+ if (params.length > 1) {
21
+ htmlArray.push("<div class=\"biz-chart-tooltip-title\">".concat(xLabel, "</div>"));
22
+ }
23
+
20
24
  params.forEach(function (item) {
21
25
  var lineLabel = item.value;
22
26
 
@@ -26,7 +30,7 @@ var tooltipFormatterDefault = function tooltipFormatterDefault(params) {
26
30
  lineLabel = util.toThousands(lineLabel);
27
31
  }
28
32
 
29
- var name = (params.length > 1 ? item.seriesName : item.data && item.data.label ? item.data.label : item.name).trim();
33
+ var name = (params.length > 1 ? item.seriesName : item.name).trim();
30
34
  htmlArray.push("<div class=\"biz-chart-tooltip-item\">\n <span class=\"biz-chart-tooltip-content\">\n <span class=\"biz-tooltip-marker\" style=\"background:".concat(item.color, "\"></span>").concat(name, "\n </span> \n <span class=\"biz-chart-tooltip-value\">").concat(lineLabel, "</span>\n </div>"));
31
35
  });
32
36
  return htmlArray.join('');
@@ -64,16 +68,28 @@ var mapTooltipFormatter = function mapTooltipFormatter(params) {
64
68
  var data = params.data;
65
69
 
66
70
  if (data.childrenOptions && data.childrenOptions.length) {
67
- var htmlArray = [];
68
- htmlArray.push("<div class=\"biz-chart-tooltip-title\">".concat(params.name, "</div>"));
71
+ var series = [];
69
72
  var childrenOptions = data.childrenOptions;
70
73
  childrenOptions.forEach(function (option) {
71
- htmlArray.push("<div class=\"biz-chart-tooltip-item\">\n <span class=\"biz-chart-tooltip-content\">\n ".concat(option.name, "\n </span> \n <span class=\"biz-chart-tooltip-value\">").concat(util.toThousands(option.value), "</span>\n </div>"));
74
+ var label = option.name || option.names.join(',');
75
+ var value = option.value || option.values;
76
+
77
+ if (util.isArray(value)) {
78
+ value = value[value.length - 1];
79
+ }
80
+
81
+ series.push("<div class=\"biz-chart-tooltip-item\"><span class=\"biz-chart-tooltip-content\">".concat(label, ": </span><span class=\"biz-chart-tooltip-value\" style=\"color:#66ccff;\">").concat(util.toThousands(value), "</span></div>"));
72
82
  });
73
- return htmlArray.join('');
83
+ return "".concat(series.join('<br/>'));
84
+ }
85
+
86
+ var dataValue = data.value || data.values;
87
+
88
+ if (util.isArray(dataValue)) {
89
+ dataValue = dataValue[dataValue.length - 1];
74
90
  }
75
91
 
76
- return "<div class=\"biz-chart-tooltip-item\"><span class=\"biz-chart-tooltip-content\">".concat(data.name, ": </span><span>").concat(util.toThousands(data.value), "</span></div>");
92
+ return "<div class=\"biz-chart-tooltip-item\"><span class=\"biz-chart-tooltip-content\">".concat(data.name || data.names.join(','), ": </span><span style=\"color:#66ccff;\">").concat(util.toThousands(dataValue), "</span></div>");
77
93
  };
78
94
 
79
95
  var legendFormatterDefault = function legendFormatterDefault(label) {
@@ -1,6 +1,6 @@
1
1
  import { ChartTypes, ItemDataProps } from '../types';
2
- declare const citySeries: (data: ChartTypes.Value) => ItemDataProps[];
3
- declare const provinceSeries: (data: ChartTypes.Value) => any;
2
+ declare const citySeries: (data: ChartTypes.Value, haveUserGroup: boolean) => ItemDataProps[];
3
+ declare const provinceSeries: (data: ChartTypes.Value, haveUserGroup?: boolean | undefined) => any;
4
4
  declare const maxMinValue: (series: ItemDataProps) => {
5
5
  max: number;
6
6
  min: number;
@@ -10,6 +10,8 @@ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToAr
10
10
 
11
11
  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; }
12
12
 
13
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
14
+
13
15
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
14
16
 
15
17
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
@@ -20,13 +22,13 @@ import util from '../../utils/util';
20
22
  import cityGeoCoord from './data/cityGeoCoord';
21
23
  import provinceGeoCoord from './data/provinceGeoCoord';
22
24
 
23
- var citySeries = function citySeries(data) {
25
+ var citySeries = function citySeries(data, haveUserGroup) {
24
26
  var backGroundMapSeries = {
25
27
  type: 'map',
26
28
  map: 'china',
27
29
  showLegendSymbol: false,
28
- top: 0,
29
- bottom: 0,
30
+ top: 20,
31
+ bottom: 20,
30
32
  data: []
31
33
  };
32
34
  var scatterSeries = {
@@ -37,29 +39,33 @@ var citySeries = function citySeries(data) {
37
39
  data: []
38
40
  };
39
41
  var provinceMapData = {};
40
- var mapStore = formatMapData(data, 'city');
41
- mapStore.x_axis.forEach(function (xItem) {
42
+ data.x_axis.forEach(function (xItem, i) {
42
43
  scatterSeries.name = xItem;
43
- mapStore.series.forEach(function (cityItem) {
44
- var cityName = cityItem.name;
44
+ data.series.forEach(function (cityItem) {
45
+ var cityName = cityItem.names[cityItem.names.length - 1];
46
+ cityName = cityName.replace(/(市|省|自治区)$/, '');
45
47
  var cityCoordObj = cityGeoCoord[cityName];
46
- var cityValue = cityItem.value;
47
- var scatterItem = {
48
- name: cityItem.name,
49
- isCity: true,
50
- value: [cityCoordObj.log, cityCoordObj.lat, cityValue],
51
- childrenOptions: cityItem.childrenOptions
52
- };
53
- scatterSeries.data.push(scatterItem);
54
- var provinceObj = cityCoordObj.province;
55
- var provinceName = provinceObj ? provinceObj.name.replace(/(省|市)$/, '') : '';
56
- var currentMapData = provinceMapData[provinceName];
57
- var currentMapOptions = currentMapData ? currentMapData.childrenOptions : [];
58
- provinceMapData[provinceName] = {
59
- name: provinceName,
60
- value: currentMapData ? currentMapData.value + cityValue : cityValue,
61
- childrenOptions: currentMapOptions.concat([cityItem])
62
- };
48
+
49
+ if (cityCoordObj) {
50
+ var cityValue = cityItem.values[i];
51
+ var scatterItem = {
52
+ name: cityCoordObj.name,
53
+ isCity: true,
54
+ value: [cityCoordObj.log, cityCoordObj.lat, cityValue],
55
+ childrenOptions: cityItem.userGroupCompareData
56
+ };
57
+ scatterSeries.data.push(scatterItem);
58
+ var provinceObj = cityCoordObj.province;
59
+ var provinceName = provinceObj ? provinceObj.name.replace(/(省|市)$/, '') : '';
60
+ var currentMapData = provinceMapData[provinceName];
61
+ var currentMapOptions = currentMapData ? currentMapData.childrenOptions : [];
62
+ provinceMapData[provinceName] = {
63
+ name: provinceName,
64
+ isProvince: true,
65
+ value: currentMapData ? currentMapData.value + cityValue : cityValue,
66
+ childrenOptions: currentMapOptions.concat(haveUserGroup ? cityItem.userGroupCompareData : [cityItem])
67
+ };
68
+ }
63
69
  });
64
70
  });
65
71
 
@@ -75,17 +81,17 @@ var citySeries = function citySeries(data) {
75
81
  return [scatterSeries, backGroundMapSeries];
76
82
  };
77
83
 
78
- var provinceSeries = function provinceSeries(data) {
84
+ var provinceSeries = function provinceSeries(data, haveUserGroup) {
79
85
  var series = [];
80
- var mapStore = formatMapData(data, 'province');
81
- mapStore.x_axis.forEach(function (xItem) {
86
+ var mapStore = formatData(data, haveUserGroup);
87
+ mapStore.x_axis.forEach(function (xItem, i) {
82
88
  var item = {
83
89
  name: xItem,
84
90
  type: 'map',
85
91
  map: 'china',
86
92
  roam: false,
87
- top: 0,
88
- bottom: 0,
93
+ top: 20,
94
+ bottom: 20,
89
95
  label: {
90
96
  show: true,
91
97
  color: '#565656'
@@ -94,7 +100,21 @@ var provinceSeries = function provinceSeries(data) {
94
100
  data: []
95
101
  };
96
102
  mapStore.series.forEach(function (provinceItem) {
97
- item.data.push(provinceItem);
103
+ var name = provinceItem.name || provinceItem.names;
104
+ var provinceName = _typeof(name) === 'object' ? name[name.length - 1] : name;
105
+ provinceName = provinceName.replace(/(市|省|自治区)$/, '');
106
+ var provinceCoordObj = provinceGeoCoord[provinceName];
107
+ name = _typeof(name) === 'object' ? name.join('-') : name;
108
+ name = name.replace(/(市|省|自治区)$/, '');
109
+
110
+ if (provinceCoordObj) {
111
+ item.data.push({
112
+ name: name,
113
+ isProvince: true,
114
+ value: provinceItem.values[i],
115
+ childrenOptions: provinceItem.userGroupCompareData
116
+ });
117
+ }
98
118
  });
99
119
  series.push(item);
100
120
  });
@@ -130,40 +150,36 @@ var maxMinValue = function maxMinValue(series) {
130
150
  };
131
151
  };
132
152
 
133
- var formatMapData = function formatMapData(seriesData, type) {
134
- var store = {
135
- x_axis: seriesData.x_axis,
136
- series: []
137
- };
138
- var areaObjMap = {};
139
- seriesData.series.forEach(function (item) {
140
- var areaName = item.names[0].replace(/(市|省|自治区)$/, '');
141
- var targetName = item.names.slice(1).join(',');
142
- var targeItem = {
143
- name: targetName || areaName,
144
- value: item.values[0]
153
+ var formatData = function formatData(seriesData, haveUserGroup) {
154
+ if (haveUserGroup) {
155
+ var store = {
156
+ x_axis: seriesData.x_axis,
157
+ series: []
145
158
  };
159
+ var areaObjMap = {};
160
+ seriesData.series.forEach(function (item) {
161
+ var areaName = item.names[item.names.length - 1];
162
+
163
+ if (!areaObjMap[areaName]) {
164
+ areaObjMap[areaName] = {
165
+ names: [areaName],
166
+ values: item.values,
167
+ userGroupCompareData: [item]
168
+ };
169
+ } else {
170
+ areaObjMap[areaName].values = [areaObjMap[areaName].values[0] + item.values[0]];
171
+ areaObjMap[areaName].userGroupCompareData.push(item);
172
+ }
173
+ });
146
174
 
147
- if (!areaObjMap[areaName]) {
148
- areaObjMap[areaName] = {
149
- name: areaName,
150
- value: item.values[0],
151
- childrenOptions: [targeItem]
152
- };
153
- } else {
154
- areaObjMap[areaName].value += item.values[0];
155
- areaObjMap[areaName].childrenOptions.push(targeItem);
156
- }
157
- });
158
- var areaMap = type === 'province' ? provinceGeoCoord : cityGeoCoord;
159
-
160
- for (var area in areaObjMap) {
161
- if (areaMap[area]) {
175
+ for (var area in areaObjMap) {
162
176
  store.series.push(areaObjMap[area]);
163
177
  }
164
- }
165
178
 
166
- return store;
179
+ return store;
180
+ } else {
181
+ return seriesData;
182
+ }
167
183
  };
168
184
 
169
185
  export { provinceSeries, citySeries, maxMinValue };
@@ -17,6 +17,5 @@ declare const BizCycleTime: React.FC<{
17
17
  placeholder?: string;
18
18
  onChange?: (val: Value) => void;
19
19
  size?: SizeType;
20
- disable?: boolean;
21
20
  }>;
22
21
  export default BizCycleTime;
@@ -26,8 +26,7 @@ export var CycleTimeUnit;
26
26
 
27
27
  var BizCycleTime = function BizCycleTime(props) {
28
28
  var multiple = props.multiple,
29
- size = props.size,
30
- disable = props.disable;
29
+ size = props.size;
31
30
  var classPrefix = 'biz-cycle-time';
32
31
  var unitList = [{
33
32
  label: '每日',
@@ -158,7 +157,6 @@ var BizCycleTime = function BizCycleTime(props) {
158
157
  className: "".concat(classPrefix, "-unit"),
159
158
  defaultValue: unit,
160
159
  size: size,
161
- disable: disable,
162
160
  onChange: function onChange(v) {
163
161
  setDay([]);
164
162
  setTime(undefined);
@@ -171,8 +169,7 @@ var BizCycleTime = function BizCycleTime(props) {
171
169
  defaultValue: time ? moment(time, 'hh:mm:ss') : undefined,
172
170
  onChange: function onChange(time) {
173
171
  setTime(time === null || time === void 0 ? void 0 : time.format('hh:mm:ss'));
174
- },
175
- disabled: disable
172
+ }
176
173
  }), unit.value === CycleTimeUnit.week && /*#__PURE__*/React.createElement(BizSelect, {
177
174
  options: days,
178
175
  labelField: "label",
@@ -184,20 +181,16 @@ var BizCycleTime = function BizCycleTime(props) {
184
181
  placeholder: props.placeholder,
185
182
  onChange: function onChange(v) {
186
183
  setDay(v);
187
- },
188
- disable: disable,
189
- enableCreate: false
184
+ }
190
185
  }), unit.value === CycleTimeUnit.month && /*#__PURE__*/React.createElement(MonthDay, {
191
186
  placeholder: props.placeholder,
192
187
  defaultValue: day,
193
- onChange: setDayList,
194
- disable: disable
188
+ onChange: setDayList
195
189
  }));
196
190
  };
197
191
 
198
192
  BizCycleTime.defaultProps = {
199
193
  multiple: false,
200
- size: 'middle',
201
- disable: false
194
+ size: 'middle'
202
195
  };
203
196
  export default BizCycleTime;
@@ -8,6 +8,5 @@ declare const MonthDay: React.FC<{
8
8
  defaultValue?: BaseOption<number>[];
9
9
  placeholder?: string;
10
10
  onChange?: (days: BaseOption<number>[]) => void;
11
- disable?: boolean;
12
11
  }>;
13
12
  export default MonthDay;
@@ -18,7 +18,6 @@ import _ from 'lodash';
18
18
 
19
19
  var MonthDay = function MonthDay(props) {
20
20
  var classPrefix = 'biz-month-day';
21
- var disable = props.disable;
22
21
 
23
22
  var _useState = useState([]),
24
23
  _useState2 = _slicedToArray(_useState, 2),
@@ -86,7 +85,6 @@ var MonthDay = function MonthDay(props) {
86
85
  }
87
86
 
88
87
  return /*#__PURE__*/React.createElement(Dropdown, {
89
- disabled: disable,
90
88
  overlay: /*#__PURE__*/React.createElement("div", {
91
89
  className: "".concat(classPrefix, "-overlay")
92
90
  }, dayList.map(function (item) {
@@ -106,7 +104,7 @@ var MonthDay = function MonthDay(props) {
106
104
  }, /*#__PURE__*/React.createElement("div", {
107
105
  className: "".concat(classPrefix, "-wrapper")
108
106
  }, /*#__PURE__*/React.createElement("div", {
109
- className: "".concat(classPrefix, "-handle ").concat(props.size, " ").concat(!chosenDayList.length ? "holder" : '', " ").concat(disable ? 'disable' : '')
107
+ className: "".concat(classPrefix, "-handle ").concat(props.size, " ").concat(!chosenDayList.length ? "holder" : '')
110
108
  }, /*#__PURE__*/React.createElement("div", {
111
109
  className: "".concat(classPrefix, "-val")
112
110
  }, chosenDayList.map(function (item) {
@@ -114,7 +112,7 @@ var MonthDay = function MonthDay(props) {
114
112
  closable: true,
115
113
  key: item.value,
116
114
  onClose: function onClose() {
117
- !disable && onDelMonthDay(item);
115
+ onDelMonthDay(item);
118
116
  }
119
117
  }, item.label);
120
118
  }), !chosenDayList.length && /*#__PURE__*/React.createElement("span", {
@@ -125,7 +123,6 @@ var MonthDay = function MonthDay(props) {
125
123
  };
126
124
 
127
125
  MonthDay.defaultProps = {
128
- size: 'middle',
129
- disable: false
126
+ size: 'middle'
130
127
  };
131
128
  export default MonthDay;
@@ -47,18 +47,6 @@
47
47
  &.ant-dropdown-open > .biz-month-day-handle {
48
48
  .__default-focused();
49
49
  }
50
- .biz-month-day-handle {
51
- &.disable {
52
- cursor: not-allowed !important;
53
- .ant-tag {
54
- color: @disabled-color;
55
- .anticon-close {
56
- color: @disabled-color;
57
- cursor: not-allowed;
58
- }
59
- }
60
- }
61
- }
62
50
  }
63
51
  &-overlay {
64
52
  .__select-panel();
@@ -35,9 +35,7 @@ var BizDate = function BizDate(props) {
35
35
  setDateRange(props.value ? props.value : initValue);
36
36
  }, []);
37
37
  useEffect(function () {
38
- var _props$dateCount;
39
-
40
- if (!((_props$dateCount = props.dateCount) === null || _props$dateCount === void 0 ? void 0 : _props$dateCount.count)) return;
38
+ if (!props.dateCount) return;
41
39
  var date = getDateRange(props.type, props.dateCount.count, !!includeToday);
42
40
  setDateRange(date);
43
41
  if (props.onChange) props.onChange(date, true);
@@ -1,2 +1,3 @@
1
+ import '@zgfe/business-lib/es/assets/styles/resetAntd.less';
1
2
  declare const _default: () => JSX.Element;
2
3
  export default _default;
@@ -0,0 +1,49 @@
1
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
2
+
3
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
4
+
5
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
6
+
7
+ 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; }
8
+
9
+ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
10
+
11
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
12
+
13
+ import { BizDatePicker } from '@zgfe/business-lib';
14
+ import React, { useState } from 'react';
15
+ import '@zgfe/business-lib/es/assets/styles/resetAntd.less';
16
+ import { Divider, Switch } from 'antd';
17
+ export default (function () {
18
+ var _useState = useState({
19
+ unit: 'day',
20
+ begin: '2022-05-03',
21
+ end: '2022-05-30',
22
+ relative: [0, 1]
23
+ }),
24
+ _useState2 = _slicedToArray(_useState, 2),
25
+ time = _useState2[0],
26
+ setTime = _useState2[1];
27
+
28
+ var _useState3 = useState(false),
29
+ _useState4 = _slicedToArray(_useState3, 2),
30
+ includeToday = _useState4[0],
31
+ setIncludeToday = _useState4[1];
32
+
33
+ var handleChange = function handleChange(data) {
34
+ setTime(function () {
35
+ return data;
36
+ });
37
+ };
38
+
39
+ return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", null, "\u5305\u542B\u300C\u4ECA\u5929\u300D: ", /*#__PURE__*/React.createElement(Switch, {
40
+ defaultChecked: includeToday,
41
+ onChange: setIncludeToday
42
+ })), /*#__PURE__*/React.createElement(Divider, null), /*#__PURE__*/React.createElement(BizDatePicker, {
43
+ hideSelector: true,
44
+ includeTodayAndYesterday: true,
45
+ onChange: handleChange,
46
+ includeToday: includeToday,
47
+ defaultValue: time
48
+ }), /*#__PURE__*/React.createElement("br", null), /*#__PURE__*/React.createElement("p", null, "\u5F53\u524D\u503C\uFF1A", JSON.stringify(time)));
49
+ });
@@ -17,7 +17,7 @@ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Sy
17
17
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
18
18
 
19
19
  import React, { useEffect, useState } from 'react';
20
- import { dateList } from './utils';
20
+ import { getDateList } from './utils';
21
21
  import BizSelect from '../select';
22
22
  import BizDate from './datePicker';
23
23
  import './styles/index.less';
@@ -25,6 +25,8 @@ import { Skeleton } from 'antd';
25
25
  export var classPrefix = 'biz-date-picker';
26
26
 
27
27
  var BizDatePicker = function BizDatePicker(props) {
28
+ var dateList = getDateList(props.includeTodayAndYesterday || false);
29
+
28
30
  var _useState = useState(dateList[0]),
29
31
  _useState2 = _slicedToArray(_useState, 2),
30
32
  currentType = _useState2[0],
@@ -108,7 +110,7 @@ var BizDatePicker = function BizDatePicker(props) {
108
110
  paragraph: {
109
111
  rows: 1
110
112
  }
111
- }, /*#__PURE__*/React.createElement(BizSelect, {
113
+ }, !props.hideSelector ? /*#__PURE__*/React.createElement(BizSelect, {
112
114
  className: "".concat(classPrefix, "-type"),
113
115
  value: currentType,
114
116
  labelField: "label",
@@ -116,7 +118,7 @@ var BizDatePicker = function BizDatePicker(props) {
116
118
  theme: "secondary",
117
119
  options: dateList,
118
120
  onChange: onChangeDateType
119
- }), /*#__PURE__*/React.createElement("div", {
121
+ }) : '', /*#__PURE__*/React.createElement("div", {
120
122
  className: "".concat(classPrefix, "-list")
121
123
  }, currentType.children.map(function (item, index) {
122
124
  return /*#__PURE__*/React.createElement("div", {
@@ -9,10 +9,11 @@
9
9
 
10
10
  &-list {
11
11
  display: flex;
12
- margin: 0 16px;
12
+ margin: 0 16px 0 0;
13
13
  }
14
14
 
15
15
  .biz-select-handle {
16
+ margin-right: 16px;
16
17
  padding: 0;
17
18
  }
18
19
 
@@ -12,6 +12,8 @@ export declare namespace DatePickerTypes {
12
12
  value?: Value;
13
13
  includeToday?: boolean;
14
14
  onChange?: (data: Value) => void;
15
+ includeTodayAndYesterday?: boolean;
16
+ hideSelector?: boolean;
15
17
  }
16
18
  interface Option {
17
19
  label: string;
@@ -1,5 +1,6 @@
1
1
  import { DatePickerTypes } from './types';
2
2
  export declare const dateList: DatePickerTypes.Option[];
3
+ export declare function getDateList(lastTwoDays: boolean): DatePickerTypes.Option[];
3
4
  export declare const getDateRange: (type: 'hour' | 'day' | 'week' | 'month', count: number, includeToday: boolean) => {
4
5
  begin: string;
5
6
  end: string;
@@ -1,4 +1,17 @@
1
+ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
2
+
3
+ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
4
+
5
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
6
+
7
+ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
8
+
9
+ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
10
+
11
+ 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; }
12
+
1
13
  import moment from 'moment';
14
+ import _ from 'lodash';
2
15
  export var dateList = [{
3
16
  label: '按小时',
4
17
  value: 'hour',
@@ -49,8 +62,31 @@ export var dateList = [{
49
62
  count: 3
50
63
  }]
51
64
  }];
65
+ export function getDateList(lastTwoDays) {
66
+ var list = _.cloneDeep(dateList);
67
+
68
+ if (lastTwoDays) {
69
+ var dayData = list.find(function (item) {
70
+ return item.value == 'day';
71
+ });
72
+
73
+ if (!dayData.children.find(function (item) {
74
+ return item.value == '今天';
75
+ })) {
76
+ dayData.children = [{
77
+ value: '今天',
78
+ count: 0
79
+ }, {
80
+ value: '昨天',
81
+ count: 1
82
+ }].concat(_toConsumableArray(dayData.children));
83
+ }
84
+ }
85
+
86
+ return list;
87
+ }
52
88
  export var getDateRange = function getDateRange(type, count, includeToday) {
53
- var endDate = moment().subtract(includeToday ? 0 : 1, 'days').format('YYYY-MM-DD'),
89
+ var endDate = moment().subtract(includeToday || count == 0 ? 0 : 1, 'days').format('YYYY-MM-DD'),
54
90
  startDate = '';
55
91
 
56
92
  if (type === 'month') {
@@ -111,8 +111,8 @@ var BizEventSelector = function BizEventSelector(props) {
111
111
  return label;
112
112
  };
113
113
 
114
- var onChange = function onChange(value, isOverview) {
115
- if (!defaultSelectAble && !isOverview) {
114
+ var onChange = function onChange(value) {
115
+ if (!defaultSelectAble) {
116
116
  setVisible(false);
117
117
  }
118
118