@zgfe/modules-event 1.0.3 → 1.0.5-bug.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.
File without changes
@@ -15,7 +15,7 @@ import { Tooltip, Empty } from 'antd';
15
15
  import { BizChart, BizGlobalDataContext, ajax, BizLoading } from '@zgfe/business-lib';
16
16
  import { EventTable } from '../../components';
17
17
  import { judgeIsCity } from '../content/utils';
18
- import { getValue } from '../../modules/content/utils';
18
+ import { getValue, getMapChartData } from '../../modules/content/utils';
19
19
  import { getDefaultShow, getShowColor, getUserGroupsCompareData, getSortData, getChartDataEventAliasName } from '../../utils/formData';
20
20
  import _ from 'lodash';
21
21
  import moment from 'moment';
@@ -152,7 +152,7 @@ var EventChart = /*#__PURE__*/React.forwardRef(function (props, ref) {
152
152
  ref: ref,
153
153
  key: chartType,
154
154
  type: chartType,
155
- data: dataSource,
155
+ data: chartType === 'map' ? getMapChartData(dataSource) : dataSource,
156
156
  legendPosition: "bottom",
157
157
  showList: showList,
158
158
  colors: showColors,
@@ -140,7 +140,9 @@ var EventContent = function EventContent(props) {
140
140
  }
141
141
  var result = res.data;
142
142
  var _data = searchData.dimension ? result : getChartDataEventAliasName(result, eventGroupList);
143
- setShowList(_data ? getDefaultShow(_data) : []);
143
+ var list = _data ? getDefaultShow(_data) : [];
144
+ setShowList(list);
145
+ props.onChangeShow && props.onChangeShow(list);
144
146
  if (['bar', 'pie', 'map'].indexOf(searchData.chartType) !== -1) {
145
147
  _data = getSortData(_data);
146
148
  }
@@ -169,6 +171,7 @@ var EventContent = function EventContent(props) {
169
171
  };
170
172
  var onChangeShow = function onChangeShow(data) {
171
173
  setShowList(data);
174
+ props.onChangeShow && props.onChangeShow(data);
172
175
  };
173
176
  var platformChange = function platformChange(data) {
174
177
  ajaxFlag = true;
@@ -6,5 +6,6 @@ export declare namespace EventContentProps {
6
6
  show?: string[];
7
7
  onSearching?: (flag: boolean) => void;
8
8
  initSearch?: () => void;
9
+ onChangeShow?: (data: string[]) => void;
9
10
  }
10
11
  }
@@ -1,6 +1,7 @@
1
1
  import { AttributeSelect, AttrConditionTypes } from '@zgfe/business-lib';
2
2
  import { bizAttributeSelectorValueProp } from '../../types';
3
3
  import { EventGroup, UserProp, EnvProp } from '@zgfe/business-lib/es/attributeSelector/types';
4
+ export declare const getMapChartData: (data: any) => any;
4
5
  export declare const judgeFilterValue: (data: AttrConditionTypes.GroupValue | undefined, count: number) => boolean;
5
6
  export declare const judgeIsCity: (name: string | undefined) => boolean;
6
7
  export declare const judgeIsArea: (name: string | undefined) => boolean;
@@ -6,6 +6,23 @@ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _ty
6
6
  function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
7
7
  import { ajax } from '@zgfe/business-lib';
8
8
  import { Apis } from '../../constants';
9
+ import _ from 'lodash';
10
+ export var getMapChartData = function getMapChartData(data) {
11
+ var _data = _.cloneDeep(data);
12
+ _data.series.map(function (item) {
13
+ if (item.names.length > 1) {
14
+ if (item.names[1] === '新疆维吾尔自治区') {
15
+ item.names = [item.names[0], '新疆'];
16
+ }
17
+ item.names = item.names.reverse();
18
+ } else {
19
+ if (item.names[0] === '新疆维吾尔自治区') {
20
+ item.names = ['新疆'];
21
+ }
22
+ }
23
+ });
24
+ return _data;
25
+ };
9
26
  export var judgeFilterValue = function judgeFilterValue(data, count) {
10
27
  var flag = true;
11
28
  if (data === undefined) {
@@ -39,39 +39,13 @@ export default (function () {
39
39
  };
40
40
  return /*#__PURE__*/React.createElement(DemoWrapper, {
41
41
  needMeta: true,
42
- defaultApp: 268
42
+ defaultApp: 461
43
43
  }, isDetail ? /*#__PURE__*/React.createElement("div", null, JSON.stringify(detailParams), /*#__PURE__*/React.createElement("br", null), /*#__PURE__*/React.createElement("br", null), /*#__PURE__*/React.createElement(Button, {
44
44
  onClick: function onClick() {
45
45
  return setIsDetail(false);
46
46
  }
47
47
  }, "\u8FD4\u56DE")) : /*#__PURE__*/React.createElement(ModuleEvent, {
48
48
  onChange: onChange,
49
- defaultValue: {
50
- data: {
51
- app_id: 268,
52
- module: 'event',
53
- appId: 268,
54
- platform: 0,
55
- userGroup: [],
56
- time: {
57
- begin: '2023-11-08',
58
- end: '2023-11-15',
59
- relative: [7, 0],
60
- unit: 'day'
61
- },
62
- chartType: 'line',
63
- analysisIndex: 'sum',
64
- analysisAttr: 'total',
65
- id: 16883,
66
- name: 'revenue',
67
- analysisSubject: {
68
- subjectId: 53,
69
- subjectName: 'price',
70
- subjectAlias: null,
71
- unit: '元'
72
- }
73
- }
74
- },
75
49
  afterEditTarget: afterEditTarget,
76
50
  onUserDrill: onUserDrill
77
51
  }));
@@ -127,7 +127,8 @@ var ModuleEvent = function ModuleEvent(props) {
127
127
  params: _objectSpread({
128
128
  app_id: currentApp === null || currentApp === void 0 ? void 0 : currentApp.appId,
129
129
  module: 'event'
130
- }, searchData)
130
+ }, searchData),
131
+ showList: showList
131
132
  }
132
133
  } : undefined,
133
134
  disabled: props === null || props === void 0 ? void 0 : props.panelDisabled,
@@ -163,7 +164,8 @@ var ModuleEvent = function ModuleEvent(props) {
163
164
  elementId: elementId,
164
165
  value: searchData,
165
166
  show: showList,
166
- initSearch: initSearch
167
+ initSearch: initSearch,
168
+ onChangeShow: setShowList
167
169
  })));
168
170
  };
169
171
  ModuleEvent.defaultProps = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zgfe/modules-event",
3
- "version": "1.0.3",
3
+ "version": "1.0.5-bug.0",
4
4
  "scripts": {
5
5
  "start": "dumi dev",
6
6
  "docs:build": "dumi build",
@@ -49,7 +49,7 @@
49
49
  "react": "^16.12.0 || ^17.0.0",
50
50
  "yorkie": "^2.0.0"
51
51
  },
52
- "gitHead": "b54a40e64bc719c7e6aee747f389d8ebfe1d2dc3",
52
+ "gitHead": "c547470b1d32499155edbb36a23e1d9677ea2503",
53
53
  "dependencies": {
54
54
  "react-copy-to-clipboard": "^5.1.0",
55
55
  "react-highlight": "^0.15.0"