@zgfe/modules-attribution 1.0.5 → 1.1.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.
Files changed (152) hide show
  1. package/README.md +4 -2
  2. package/{dist/esm → es}/components/common/index.js +1 -5
  3. package/es/components/index.d.ts +5 -0
  4. package/es/components/index.js +5 -0
  5. package/es/components/option/index.js +141 -0
  6. package/{dist/esm → es}/components/option/styles/index.less +1 -1
  7. package/es/components/option/types.d.ts +5 -0
  8. package/{dist/esm/components/searchPanel → es/components/searchTime}/index.d.ts +2 -2
  9. package/es/components/searchTime/index.js +49 -0
  10. package/es/components/searchTime/styles/index.less +19 -0
  11. package/{dist/esm/components/searchPanel → es/components/searchTime}/types.d.ts +0 -2
  12. package/es/components/tableList/index.d.ts +8 -0
  13. package/es/components/tableList/index.js +32 -0
  14. package/es/components/tableList/styles/index.less +18 -0
  15. package/{dist/esm → es}/components/title/index.js +31 -27
  16. package/{dist/esm → es}/components/title/searchTitle.js +3 -3
  17. package/{dist/esm → es}/components/title/styles/index.less +22 -10
  18. package/es/constants/apis.d.ts +6 -0
  19. package/es/constants/apis.js +6 -0
  20. package/es/constants/fields.d.ts +11 -0
  21. package/es/constants/fields.js +45 -0
  22. package/es/constants/index.d.ts +4 -0
  23. package/es/constants/index.js +4 -0
  24. package/{dist/esm → es}/constants/initData.js +0 -6
  25. package/es/images/empty.png +0 -0
  26. package/es/index.d.ts +3 -0
  27. package/es/index.js +2 -0
  28. package/es/modules/content/index.d.ts +5 -0
  29. package/es/modules/content/index.js +134 -0
  30. package/es/modules/content/styles/index.less +7 -0
  31. package/es/modules/content/types.d.ts +8 -0
  32. package/es/modules/content/utils.d.ts +2 -0
  33. package/es/modules/content/utils.js +29 -0
  34. package/{dist/esm → es}/modules/home/demo/create.d.ts +0 -1
  35. package/es/modules/home/demo/create.js +23 -0
  36. package/{dist/esm → es}/modules/home/demo/edit.d.ts +0 -1
  37. package/es/modules/home/demo/edit.js +129 -0
  38. package/{dist/esm → es}/modules/home/demo/index.d.ts +0 -1
  39. package/es/modules/home/demo/index.js +19 -0
  40. package/{dist/esm → es}/modules/home/demo/scene.d.ts +0 -1
  41. package/es/modules/home/demo/scene.js +44 -0
  42. package/{dist/esm → es}/modules/home/index.d.ts +2 -2
  43. package/{dist/esm → es}/modules/home/index.js +35 -73
  44. package/es/modules/home/styles/index.less +68 -0
  45. package/{dist/esm → es}/modules/home/types.d.ts +1 -4
  46. package/es/modules/searchPanel/components/attributableEvents.d.ts +4 -0
  47. package/es/modules/searchPanel/components/attributableEvents.js +290 -0
  48. package/{dist/esm/modules/leftPanel → es/modules/searchPanel}/components/globalAttribute.d.ts +3 -1
  49. package/{dist/esm/modules/leftPanel → es/modules/searchPanel}/components/globalAttribute.js +19 -19
  50. package/es/modules/searchPanel/components/index.d.ts +4 -0
  51. package/es/modules/searchPanel/components/index.js +21 -0
  52. package/es/modules/searchPanel/components/targetEvent.d.ts +4 -0
  53. package/es/modules/searchPanel/components/targetEvent.js +159 -0
  54. package/es/modules/searchPanel/index.d.ts +6 -0
  55. package/es/modules/searchPanel/index.js +398 -0
  56. package/es/modules/searchPanel/styles/index.less +226 -0
  57. package/es/modules/searchPanel/types.d.ts +49 -0
  58. package/es/modules/searchPanel/utils.d.ts +8 -0
  59. package/es/modules/searchPanel/utils.js +81 -0
  60. package/{dist/esm → es}/style/index.less +2 -2
  61. package/{dist/esm → es}/style/theme.js +0 -2
  62. package/es/types.d.ts +52 -0
  63. package/es/types.js +2 -0
  64. package/{dist/esm → es}/utils/ajaxConfig.js +0 -7
  65. package/es/utils/request.d.ts +3 -0
  66. package/es/utils/request.js +5 -0
  67. package/{dist/esm → es}/utils/util.js +4 -42
  68. package/package.json +21 -21
  69. package/dist/esm/components/index.d.ts +0 -6
  70. package/dist/esm/components/index.js +0 -6
  71. package/dist/esm/components/option/index.js +0 -222
  72. package/dist/esm/components/option/types.d.ts +0 -9
  73. package/dist/esm/components/renderContent/index.d.ts +0 -5
  74. package/dist/esm/components/renderContent/index.js +0 -92
  75. package/dist/esm/components/renderContent/styles/index.less +0 -21
  76. package/dist/esm/components/renderContent/types.d.ts +0 -15
  77. package/dist/esm/components/searchPanel/index.js +0 -124
  78. package/dist/esm/components/searchPanel/styles/index.less +0 -44
  79. package/dist/esm/components/showList/index.d.ts +0 -10
  80. package/dist/esm/components/showList/index.js +0 -92
  81. package/dist/esm/components/showList/listPanel.d.ts +0 -9
  82. package/dist/esm/components/showList/listPanel.js +0 -118
  83. package/dist/esm/components/showList/styles/index.less +0 -75
  84. package/dist/esm/components/showList/types.d.ts +0 -9
  85. package/dist/esm/components/table/index.d.ts +0 -5
  86. package/dist/esm/components/table/index.js +0 -194
  87. package/dist/esm/components/table/styles/index.less +0 -12
  88. package/dist/esm/components/table/types.d.ts +0 -11
  89. package/dist/esm/constants/apis.d.ts +0 -9
  90. package/dist/esm/constants/apis.js +0 -9
  91. package/dist/esm/constants/chart.d.ts +0 -2
  92. package/dist/esm/constants/chart.js +0 -24
  93. package/dist/esm/constants/color.d.ts +0 -1
  94. package/dist/esm/constants/color.js +0 -1
  95. package/dist/esm/constants/fields.d.ts +0 -218
  96. package/dist/esm/constants/fields.js +0 -242
  97. package/dist/esm/constants/index.d.ts +0 -6
  98. package/dist/esm/constants/index.js +0 -6
  99. package/dist/esm/index.d.ts +0 -2
  100. package/dist/esm/index.js +0 -2
  101. package/dist/esm/modules/content/index.d.ts +0 -5
  102. package/dist/esm/modules/content/index.js +0 -218
  103. package/dist/esm/modules/content/styles/index.less +0 -7
  104. package/dist/esm/modules/content/types.d.ts +0 -8
  105. package/dist/esm/modules/content/types.js +0 -2
  106. package/dist/esm/modules/content/utiles.d.ts +0 -12
  107. package/dist/esm/modules/content/utiles.js +0 -231
  108. package/dist/esm/modules/home/demo/create.js +0 -54
  109. package/dist/esm/modules/home/demo/edit.js +0 -80
  110. package/dist/esm/modules/home/demo/index.js +0 -52
  111. package/dist/esm/modules/home/demo/scene.js +0 -74
  112. package/dist/esm/modules/home/styles/index.less +0 -37
  113. package/dist/esm/modules/home/types.js +0 -2
  114. package/dist/esm/modules/leftPanel/components/panel.d.ts +0 -4
  115. package/dist/esm/modules/leftPanel/components/panel.js +0 -92
  116. package/dist/esm/modules/leftPanel/demo/index.d.ts +0 -3
  117. package/dist/esm/modules/leftPanel/demo/index.js +0 -28
  118. package/dist/esm/modules/leftPanel/index.d.ts +0 -6
  119. package/dist/esm/modules/leftPanel/index.js +0 -285
  120. package/dist/esm/modules/leftPanel/styles/index.less +0 -55
  121. package/dist/esm/modules/leftPanel/types.d.ts +0 -27
  122. package/dist/esm/modules/leftPanel/types.js +0 -2
  123. package/dist/esm/modules/leftPanel/utils.d.ts +0 -5
  124. package/dist/esm/modules/leftPanel/utils.js +0 -262
  125. package/dist/esm/types.d.ts +0 -46
  126. package/dist/esm/types.js +0 -2
  127. package/dist/esm/utils/base64.d.ts +0 -23
  128. package/dist/esm/utils/base64.js +0 -132
  129. package/dist/esm/utils/formData.d.ts +0 -18
  130. package/dist/esm/utils/formData.js +0 -485
  131. package/dist/esm/utils/transfer.d.ts +0 -65
  132. package/dist/esm/utils/transfer.js +0 -206
  133. /package/{dist/esm → es}/components/common/index.d.ts +0 -0
  134. /package/{dist/esm → es}/components/common/styles/index.less +0 -0
  135. /package/{dist/esm → es}/components/option/index.d.ts +0 -0
  136. /package/{dist/esm → es}/components/option/types.js +0 -0
  137. /package/{dist/esm/components/renderContent → es/components/searchTime}/types.js +0 -0
  138. /package/{dist/esm → es}/components/title/index.d.ts +0 -0
  139. /package/{dist/esm → es}/components/title/searchTitle.d.ts +0 -0
  140. /package/{dist/esm → es}/components/title/styles/search.less +0 -0
  141. /package/{dist/esm → es}/components/title/types.d.ts +0 -0
  142. /package/{dist/esm/components/searchPanel → es/components/title}/types.js +0 -0
  143. /package/{dist/esm → es}/constants/initData.d.ts +0 -0
  144. /package/{dist/esm/components/showList → es/modules/content}/types.js +0 -0
  145. /package/{dist/esm → es}/modules/home/demo/styles/index.less +0 -0
  146. /package/{dist/esm/components/table → es/modules/home}/types.js +0 -0
  147. /package/{dist/esm/components/title → es/modules/searchPanel}/types.js +0 -0
  148. /package/{dist/esm → es}/style/image/noData.png +0 -0
  149. /package/{dist/esm → es}/style/image/ring.svg +0 -0
  150. /package/{dist/esm → es}/style/theme.d.ts +0 -0
  151. /package/{dist/esm → es}/utils/ajaxConfig.d.ts +0 -0
  152. /package/{dist/esm → es}/utils/util.d.ts +0 -0
@@ -1,222 +0,0 @@
1
- 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); }
2
- 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; }
3
- 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; }
4
- function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
5
- function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
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
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
8
- 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."); }
9
- 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); }
10
- 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; }
11
- 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; } }
12
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
13
- import { BizGlobalDataContext, IconFont, BizAddToScene, BizAddToPanel } from '@zgfe/business-lib';
14
- import { Button, Select } from 'antd';
15
- var Option = Select.Option;
16
- import React, { useContext, useImperativeHandle, useMemo, useState } from 'react';
17
- import _ from 'lodash';
18
- import { Apis, chartTypes } from "../../constants";
19
- import base64 from "../../utils/base64";
20
- import { getAttrLabel } from "../../utils/formData";
21
- import "./styles/index.less";
22
- import { AttributionContext } from "../../types";
23
- var classPrefix = 'option-group';
24
- var OptionGroup = /*#__PURE__*/React.forwardRef(function (props, ref) {
25
- var searchData = props.searchData,
26
- onClickGenerateReport = props.onClickGenerateReport;
27
- // 看板弹窗
28
- var _useState = useState(false),
29
- _useState2 = _slicedToArray(_useState, 2),
30
- showPanelDialog = _useState2[0],
31
- setShowPanelDialog = _useState2[1];
32
- // 常用场景弹窗
33
- var _useState3 = useState(false),
34
- _useState4 = _slicedToArray(_useState3, 2),
35
- showSceneDialog = _useState4[0],
36
- setShowSceneDialog = _useState4[1];
37
- var _useState5 = useState(),
38
- _useState6 = _slicedToArray(_useState5, 2),
39
- panelValue = _useState6[0],
40
- setPanelValue = _useState6[1];
41
- // 看板弹窗类型
42
- var _useState7 = useState(),
43
- _useState8 = _slicedToArray(_useState7, 2),
44
- panelType = _useState8[0],
45
- setPanelType = _useState8[1];
46
- var _useContext = useContext(BizGlobalDataContext),
47
- currentApp = _useContext.currentApp,
48
- eventGroupList = _useContext.eventGroupList,
49
- userPropList = _useContext.userPropList,
50
- eventEnvList = _useContext.eventEnvList;
51
- var _useContext2 = useContext(AttributionContext),
52
- panelId = _useContext2.panelId,
53
- panelName = _useContext2.panelName,
54
- elementId = _useContext2.elementId,
55
- searching = _useContext2.searching,
56
- enableGenerateReport = _useContext2.enableGenerateReport,
57
- enableAddScene = _useContext2.enableAddScene,
58
- changeLoading = _useContext2.changeLoading,
59
- afterEditTarget = _useContext2.afterEditTarget;
60
- // 看板弹窗的样式中地图是否可选
61
- var styleList = useMemo(function () {
62
- var styleData = _.cloneDeep(chartTypes);
63
- styleData[2].children[2].disabled = !props.enableSelectChart;
64
- styleData[3].disabled = !props.enableSelectChart;
65
- return styleData;
66
- }, [props.enableSelectChart]);
67
- var showList = useMemo(function () {
68
- // 只有一个用户群且是所有用户时,在请求结果中删除了所有用户,所以这里要给加上
69
- if (searchData.userGroup && searchData.userGroup.length === 1 && searchData.userGroup[0] === 0) {
70
- return props.showList ? props.showList.map(function (item) {
71
- var arr = item.split(',');
72
- arr.splice(arr.length - 1, 0, '所有用户');
73
- return arr.join(',');
74
- }) : [];
75
- }
76
- return props.showList || [];
77
- }, [props.showList]);
78
- useImperativeHandle(ref, function () {
79
- return {
80
- saveAsPanel: function saveAsPanel() {
81
- var item = {
82
- panel: {
83
- id: panelId
84
- },
85
- name: panelName ? panelName + '(1)' : '洞察',
86
- chartType: searchData ? searchData.chartType : 'line',
87
- showList: 'fix'
88
- };
89
- setPanelValue(item);
90
- setShowPanelDialog(true);
91
- },
92
- savePanel: function savePanel() {
93
- var item = {
94
- panel: {
95
- id: panelId
96
- },
97
- name: panelName,
98
- chartType: searchData ? searchData.chartType : 'line',
99
- showList: 'fix'
100
- };
101
- setPanelValue(item);
102
- setShowPanelDialog(true);
103
- setPanelType('edit');
104
- }
105
- };
106
- });
107
-
108
- //下载
109
- var onClickExport = function onClickExport() {
110
- changeLoading(true);
111
- var seriesNames = [],
112
- eventNames = [];
113
- props.result.series.forEach(function (item) {
114
- if (item.names) {
115
- var name = item.names[item.names.length - 1];
116
- if (eventNames.indexOf(name) < 0) {
117
- eventNames.push(name);
118
- }
119
- }
120
- });
121
- // 表头信息
122
- if (searchData.globalDimensions) {
123
- searchData.globalDimensions.forEach(function (item) {
124
- var label = item.label;
125
- if (!label) {
126
- label = getAttrLabel(item, eventGroupList, userPropList, eventEnvList);
127
- }
128
- seriesNames.push(base64.encode(label || item.attrName || ''));
129
- });
130
- }
131
- if (searchData.userGroup && searchData.userGroup.length > 1) {
132
- seriesNames.push(base64.encode('用户群'));
133
- }
134
- seriesNames.push(base64.encode('指标'));
135
- var params = _objectSpread(_objectSpread({
136
- appId: currentApp === null || currentApp === void 0 ? void 0 : currentApp.appId
137
- }, searchData), {}, {
138
- down: {
139
- fname: base64.encode('指标_' + eventNames.join('-')),
140
- titles: seriesNames
141
- }
142
- });
143
- var url = "".concat(Apis.download, "?param=").concat(encodeURIComponent(JSON.stringify(params)));
144
- window.open(url);
145
- changeLoading(false);
146
- };
147
- var _onOk = function onOk(type, val) {
148
- if (type === 'panel') {
149
- setPanelType(undefined);
150
- setShowPanelDialog(false);
151
- } else {
152
- setShowSceneDialog(false);
153
- }
154
- if (afterEditTarget) afterEditTarget(type, val);
155
- };
156
- var _onCancel = function onCancel(type) {
157
- if (type === 'panel') {
158
- setShowPanelDialog(false);
159
- setPanelType(undefined);
160
- } else {
161
- setShowSceneDialog(false);
162
- }
163
- };
164
- return /*#__PURE__*/React.createElement("div", {
165
- className: classPrefix
166
- }, /*#__PURE__*/React.createElement(Select, {
167
- placeholder: "\u8BF7\u9009\u62E9\u65F6\u533A",
168
- allowClear: true,
169
- style: {
170
- width: '240px'
171
- }
172
- }, /*#__PURE__*/React.createElement(Option, {
173
- value: "0"
174
- }, "\u4E2D\u56FD\u6807\u51C6\u65F6\u95F4(\u5317\u4EAC)(UTC+8)"), /*#__PURE__*/React.createElement(Option, {
175
- value: "1"
176
- }, "\u4E2D\u56FD\u53F0\u5317(UTC+8)"), /*#__PURE__*/React.createElement(Option, {
177
- value: "2"
178
- }, "\u65E5\u672C\u4E1C\u4EAC(UTC+9)"), /*#__PURE__*/React.createElement(Option, {
179
- value: "3"
180
- }, "\u82F1\u56FD\u82F1\u56FD\u4F26\u6566(UTC+0)"), /*#__PURE__*/React.createElement(Option, {
181
- value: "4"
182
- }, "\u4FC4\u7F57\u65AF\u83AB\u65AF\u79D1(UTC+3)"), /*#__PURE__*/React.createElement(Option, {
183
- value: "5"
184
- }, "\u9A6C\u6765\u897F\u4E9A\u5409\u9686\u5761(UTC+8)"), /*#__PURE__*/React.createElement(Option, {
185
- value: "6"
186
- }, "\u7F8E\u56FD\u7EBD\u7EA6(UTC-4)"), /*#__PURE__*/React.createElement(Option, {
187
- value: "7"
188
- }, "\u52A0\u62FF\u5927\u6E29\u54E5\u534E(UTC-7)")), /*#__PURE__*/React.createElement(Button, {
189
- icon: /*#__PURE__*/React.createElement(IconFont, {
190
- className: "".concat(classPrefix, "-icon"),
191
- type: "xiazai1"
192
- }),
193
- onClick: onClickExport,
194
- disabled: !props.result
195
- }, "\u4E0B\u8F7D\u6570\u636E"), showSceneDialog && /*#__PURE__*/React.createElement(BizAddToScene, {
196
- params: _objectSpread({
197
- app_id: currentApp === null || currentApp === void 0 ? void 0 : currentApp.appId
198
- }, searchData),
199
- onCancel: function onCancel() {
200
- return _onCancel('scene');
201
- },
202
- onOk: function onOk(data) {
203
- return _onOk('scene', data);
204
- }
205
- }), showPanelDialog && /*#__PURE__*/React.createElement(BizAddToPanel, {
206
- defaultValue: panelValue,
207
- params: _objectSpread({
208
- app_id: currentApp === null || currentApp === void 0 ? void 0 : currentApp.appId
209
- }, searchData),
210
- type: panelType,
211
- styleOptions: styleList,
212
- showList: showList,
213
- elementId: elementId,
214
- onCancel: function onCancel() {
215
- return _onCancel('panel');
216
- },
217
- onOk: function onOk(data) {
218
- return _onOk('panel', data);
219
- }
220
- }));
221
- });
222
- export default OptionGroup;
@@ -1,9 +0,0 @@
1
- export interface OptionGroupProps {
2
- value?: any;
3
- title?: string;
4
- searchData: any;
5
- result?: any;
6
- showList?: string[];
7
- enableSelectChart?: boolean;
8
- onClickGenerateReport?: (value: any) => void;
9
- }
@@ -1,5 +0,0 @@
1
- import React from 'react';
2
- import { RenderContentProps } from './types';
3
- import './styles/index.less';
4
- declare const ContentPanel: React.ForwardRefExoticComponent<RenderContentProps & React.RefAttributes<any>>;
5
- export default ContentPanel;
@@ -1,92 +0,0 @@
1
- function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
2
- 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."); }
3
- function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
4
- function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
5
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
6
- 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."); }
7
- 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); }
8
- 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; }
9
- 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; } }
10
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
11
- import { BizChart } from '@zgfe/business-lib';
12
- import { Spin } from 'antd';
13
- import React, { useEffect, useState } from 'react';
14
- import { chartColors } from "../../constants";
15
- import { getShowColor } from "../../utils/formData";
16
- import { InsightTable, MiNone, MiSpin } from '..';
17
- import "./styles/index.less";
18
- import _ from 'lodash';
19
- var classPrefix = 'render-content';
20
- var ContentPanel = /*#__PURE__*/React.forwardRef(function (props, ref) {
21
- var loading = props.loading,
22
- insightData = props.insightData,
23
- searchData = props.searchData;
24
- // 显示内容
25
- var _useState = useState(props.showList || []),
26
- _useState2 = _slicedToArray(_useState, 2),
27
- showList = _useState2[0],
28
- setShowList = _useState2[1];
29
- // 图表的颜色系列
30
- var _useState3 = useState(chartColors),
31
- _useState4 = _slicedToArray(_useState3, 2),
32
- showColors = _useState4[0],
33
- setShowColors = _useState4[1];
34
- useEffect(function () {
35
- setShowList(props.showList);
36
- setShowColors(chartColors);
37
- }, [insightData]);
38
-
39
- // 表格中显示点击,改变展示状态
40
- var onChangeShowByName = function onChangeShowByName(nameGroup) {
41
- setShowList(function (list) {
42
- var showList = _.cloneDeep(list);
43
- var index = showList === null || showList === void 0 ? void 0 : showList.indexOf(nameGroup);
44
- if (index < 0) {
45
- showList.push(nameGroup);
46
- } else {
47
- showList.splice(index, 1);
48
- }
49
- setShowColors(getShowColor(insightData, showList));
50
- if (props.onChangeShow) props.onChangeShow(showList);
51
- return _toConsumableArray(showList);
52
- });
53
- };
54
- // 表格筛选,取前10个
55
- var onChangeShow = function onChangeShow(names) {
56
- setShowList(names);
57
- if (props.onChangeShow) props.onChangeShow(names);
58
- setShowColors(chartColors);
59
- };
60
- return /*#__PURE__*/React.createElement("div", {
61
- className: classPrefix
62
- }, /*#__PURE__*/React.createElement("div", {
63
- className: "".concat(classPrefix, "-chart-container")
64
- }, props.children, /*#__PURE__*/React.createElement("div", {
65
- className: "".concat(classPrefix, "-chart")
66
- }, loading ? /*#__PURE__*/React.createElement(Spin, {
67
- tip: "\u67E5\u8BE2\u4E2D...",
68
- indicator: /*#__PURE__*/React.createElement(MiSpin, null)
69
- }) : insightData ? insightData.x_axis.length || insightData.series.length ? /*#__PURE__*/React.createElement(BizChart, {
70
- ref: ref,
71
- type: searchData === null || searchData === void 0 ? void 0 : searchData.chartType,
72
- data: insightData,
73
- showList: showList,
74
- colors: showColors,
75
- xRotate: (searchData === null || searchData === void 0 ? void 0 : searchData.chartType) === 'bar' && insightData.series.length > 5 ? 40 : 0,
76
- reverseXAxis: (searchData === null || searchData === void 0 ? void 0 : searchData.chartType) === 'bar',
77
- isCity: props.isCity
78
- }) : /*#__PURE__*/React.createElement(MiNone, {
79
- label: "\u6682\u65E0\u6570\u636E"
80
- }) : /*#__PURE__*/React.createElement(MiNone, {
81
- label: "\u6682\u65E0\u6570\u636E"
82
- }))), !loading && insightData && /*#__PURE__*/React.createElement(InsightTable, {
83
- dataSource: insightData,
84
- searchData: searchData,
85
- showList: showList,
86
- isOverview: (searchData === null || searchData === void 0 ? void 0 : searchData.targets) && (searchData === null || searchData === void 0 ? void 0 : searchData.targets[0].eventId) === -100,
87
- changeShow: onChangeShow,
88
- changeShowByName: onChangeShowByName,
89
- onChange: props.onChangeTag
90
- }));
91
- });
92
- export default ContentPanel;
@@ -1,21 +0,0 @@
1
- @import '~@zgfe/business-lib/es/assets/styles/variable.less';
2
-
3
- .render-content {
4
- &-chart-container {
5
- height: 432px;
6
- border: 1px solid @border-color-base;
7
- border-radius: @border-radius-normal;
8
- }
9
-
10
- &-chart {
11
- display: flex;
12
- align-items: center;
13
- justify-content: center;
14
- height: calc(100% - 64px);
15
- padding: @padding-lg @padding-md;
16
-
17
- .echarts-for-react {
18
- width: 100%;
19
- }
20
- }
21
- }
@@ -1,15 +0,0 @@
1
- import { TargetConditionTypes } from '@zgfe/business-lib';
2
- import { ReactNode } from 'react';
3
- import { SearchValue } from '../../types';
4
- export interface RenderContentProps {
5
- loading?: boolean;
6
- insightData?: any;
7
- searchData?: SearchValue;
8
- showList: string[];
9
- isCity?: boolean;
10
- children: ReactNode;
11
- onChangeTag: (targets: Array<TargetConditionTypes.Value>) => void;
12
- onClickGenerateReport?: (value: any) => void;
13
- afterEditTarget?: (type: string, value?: any) => void;
14
- onChangeShow?: (data: string[]) => void;
15
- }
@@ -1,124 +0,0 @@
1
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
2
- 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."); }
3
- 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); }
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
- 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
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
7
- import { BizDatePicker } from '@zgfe/business-lib';
8
- import { Form, Select, InputNumber } from 'antd';
9
- import React, { useContext, useEffect, useState } from 'react';
10
- import { chartTypeOptions, getInitDate } from "../../constants";
11
- import { AttributionContext } from "../../types";
12
- import "./styles/index.less";
13
- var Option = Select.Option;
14
- var classPrefix = 'search-panel';
15
- var SearchPanel = function SearchPanel(props) {
16
- var _useContext = useContext(AttributionContext),
17
- includeToday = _useContext.includeToday;
18
- // 当前时间段
19
- var _useState = useState(props.time || getInitDate(includeToday)),
20
- _useState2 = _slicedToArray(_useState, 2),
21
- time = _useState2[0],
22
- setTime = _useState2[1];
23
- // 当前图表类型
24
- var _useState3 = useState(chartTypeOptions[0]),
25
- _useState4 = _slicedToArray(_useState3, 2),
26
- chart = _useState4[0],
27
- setChart = _useState4[1];
28
- var _useState5 = useState(0),
29
- _useState6 = _slicedToArray(_useState5, 2),
30
- timer = _useState6[0],
31
- setTimer = _useState6[1];
32
- useEffect(function () {
33
- if (props.chart && props.chart !== chart.value) {
34
- setChart({
35
- value: props.chart
36
- });
37
- }
38
- }, [props.chart]);
39
-
40
- // 时间改变
41
- var onChangeTime = function onChangeTime(val) {
42
- if (timer) clearTimeout(timer);
43
- setTimer(setTimeout(function () {
44
- setTime(val);
45
- props.onChange({
46
- time: val,
47
- chartType: chart.value
48
- });
49
- }, 10));
50
- };
51
-
52
- // 类型发生变化
53
- var onChange = function onChange(val) {
54
- setChart(val);
55
- props.onChange({
56
- time: time,
57
- chartType: val.value
58
- });
59
- };
60
- var _useState7 = useState(0),
61
- _useState8 = _slicedToArray(_useState7, 2),
62
- flag = _useState8[0],
63
- setFlag = _useState8[1];
64
- var onChangGuiYin = function onChangGuiYin(data) {
65
- // console.log(data)
66
- setFlag(data);
67
- };
68
- return /*#__PURE__*/React.createElement("div", {
69
- className: classPrefix
70
- }, /*#__PURE__*/React.createElement("div", {
71
- className: "top-header"
72
- }, ' ', /*#__PURE__*/React.createElement(BizDatePicker, {
73
- defaultValue: time,
74
- onChange: onChangeTime
75
- })), /*#__PURE__*/React.createElement("div", {
76
- className: "".concat(classPrefix, "-search-right")
77
- }, /*#__PURE__*/React.createElement(Form
78
- // style={{ maxWidth: 600 }}
79
- , null, /*#__PURE__*/React.createElement(Form.Item, {
80
- label: "\u5F52\u56E0\u7A97\u53E3\u671F",
81
- style: {
82
- marginTop: '27px'
83
- }
84
- }, /*#__PURE__*/React.createElement(Select, {
85
- placeholder: "\u8BF7\u9009\u62E9",
86
- allowClear: true,
87
- defaultValue: 0,
88
- style: {
89
- width: '100px'
90
- },
91
- onChange: onChangGuiYin
92
- }, /*#__PURE__*/React.createElement(Option, {
93
- value: 0
94
- }, "\u4ECA\u5929"), /*#__PURE__*/React.createElement(Option, {
95
- value: 1
96
- }, "\u81EA\u5B9A\u4E49"))), flag == 1 && /*#__PURE__*/React.createElement("div", {
97
- className: "shuru"
98
- }, /*#__PURE__*/React.createElement(InputNumber, {
99
- defaultValue: 1
100
- }), "\u5929"), /*#__PURE__*/React.createElement(Form.Item, {
101
- label: "\u5F52\u56E0\u8BBE\u7F6E",
102
- className: "guiyin",
103
- style: {
104
- marginTop: '27px'
105
- }
106
- }, /*#__PURE__*/React.createElement(Select, {
107
- placeholder: "\u8BF7\u9009\u62E9",
108
- allowClear: true,
109
- style: {
110
- width: '150px'
111
- }
112
- }, /*#__PURE__*/React.createElement(Option, {
113
- value: "0"
114
- }, "\u9996\u6B21\u89E6\u70B9\u5F52\u56E0"), /*#__PURE__*/React.createElement(Option, {
115
- value: "1"
116
- }, "\u672B\u6B21\u89E6\u70B9\u5F52\u56E0"), /*#__PURE__*/React.createElement(Option, {
117
- value: "2"
118
- }, "\u65F6\u95F4\u8870\u51CF\u5F52\u56E0"), /*#__PURE__*/React.createElement(Option, {
119
- value: "3"
120
- }, "\u7EBF\u6027\u5F52\u56E0"), /*#__PURE__*/React.createElement(Option, {
121
- value: "4"
122
- }, "\u4F4D\u7F6E\u5F52\u56E0"))))));
123
- };
124
- export default SearchPanel;
@@ -1,44 +0,0 @@
1
- @import '~@zgfe/business-lib/es/assets/styles/variable.less';
2
-
3
- .search-panel {
4
- display: flex;
5
- align-items: center;
6
- // justify-content: space-between;
7
- height: 64px;
8
- padding: 0 @padding-md;
9
- border-bottom: 1px solid @border-color-base;
10
- .top-header {
11
- .biz-date-picker {
12
- > :first-child {
13
- display: none;
14
- }
15
- }
16
- }
17
- &-search-right {
18
- display: flex;
19
- margin-left: 30px;
20
- .ant-form {
21
- display: flex;
22
- .guiyin {
23
- position: absolute;
24
- right: 50px;
25
- }
26
- .shuru {
27
- display: flex;
28
- margin-top: 30px;
29
- margin-left: 20px;
30
- line-height: 30px;
31
- .ant-input-number {
32
- width: 60px;
33
- height: 32px;
34
- margin-top: -2px;
35
- margin-right: 10px;
36
- }
37
- }
38
- }
39
- }
40
-
41
- &-select {
42
- width: 112px;
43
- }
44
- }
@@ -1,10 +0,0 @@
1
- import React from 'react';
2
- import './styles/index.less';
3
- import { ResponseDataProps } from '../../types';
4
- export declare const classPrefix = "mi-show";
5
- declare const ShowList: React.FC<{
6
- value?: string[];
7
- options?: ResponseDataProps;
8
- onChange?: (value: string[]) => void;
9
- }>;
10
- export default ShowList;
@@ -1,92 +0,0 @@
1
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
2
- 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."); }
3
- 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); }
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
- 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
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
7
- import { Button, Dropdown } from 'antd';
8
- import React, { useEffect, useState } from 'react';
9
- import "./styles/index.less";
10
- import { chartColors } from "../../constants/color";
11
- import _ from 'lodash';
12
- import { IconFont } from '@zgfe/business-lib';
13
- import ListPanel from "./listPanel";
14
- export var classPrefix = 'mi-show';
15
- var ShowList = function ShowList(props) {
16
- // 展示列表
17
- var _useState = useState([]),
18
- _useState2 = _slicedToArray(_useState, 2),
19
- nameList = _useState2[0],
20
- setNameList = _useState2[1];
21
- // 显示(选中)内容
22
- var _useState3 = useState(props.value || []),
23
- _useState4 = _slicedToArray(_useState3, 2),
24
- showList = _useState4[0],
25
- setShowList = _useState4[1];
26
- useEffect(function () {
27
- if (props.options) {
28
- setNameList(revertNames(props.options));
29
- } else {
30
- setNameList([]);
31
- }
32
- setShowList(props.value || []);
33
- }, [props.options]);
34
-
35
- // 转换【属性1,属性2,...,,用户群,指标名称】 为父子结构
36
- function revertNames(option) {
37
- var data = _.cloneDeep(option);
38
- if (!data.series) return [];
39
- var result = [];
40
- var count = 0;
41
- var nameMap = [];
42
- data.series.forEach(function (item) {
43
- if (!item.names) return;
44
- var len = item.names.length;
45
- var name = item.names[len - 1];
46
- var text = item.names.join(',');
47
- var attrs = item.names.splice(0, len - 1);
48
- var obj = {
49
- id: Math.random(),
50
- name: name,
51
- text: name
52
- };
53
- if (attrs.length) {
54
- obj.children = [{
55
- id: Math.random(),
56
- name: attrs.join(','),
57
- text: text,
58
- color: chartColors[count++ % 20]
59
- }];
60
- }
61
- var index = nameMap.indexOf(name);
62
- if (index > -1) {
63
- if (obj.children && obj.children.length) {
64
- var _result$index$childre;
65
- (_result$index$childre = result[index].children) === null || _result$index$childre === void 0 ? void 0 : _result$index$childre.push(obj.children[0]);
66
- }
67
- } else {
68
- nameMap.push(name);
69
- result.push(obj);
70
- }
71
- });
72
- return result;
73
- }
74
- return /*#__PURE__*/React.createElement("div", {
75
- className: classPrefix
76
- }, /*#__PURE__*/React.createElement(Dropdown, {
77
- overlay: /*#__PURE__*/React.createElement(ListPanel, {
78
- options: nameList,
79
- value: showList,
80
- onChange: props.onChange
81
- }),
82
- trigger: ['click'],
83
- overlayClassName: "".concat(classPrefix, "-drop")
84
- }, /*#__PURE__*/React.createElement(Button, {
85
- className: "".concat(classPrefix, "-btn"),
86
- icon: /*#__PURE__*/React.createElement(IconFont, {
87
- className: "".concat(classPrefix, "-icon"),
88
- type: "xianshi"
89
- })
90
- }, "\u663E\u793A\u8BBE\u7F6E")));
91
- };
92
- export default ShowList;
@@ -1,9 +0,0 @@
1
- import React from 'react';
2
- import '../styles/show.less';
3
- import { SeriesNames } from './types';
4
- declare const ListPanel: React.FC<{
5
- value?: string[];
6
- options?: SeriesNames[];
7
- onChange?: (value: string[]) => void;
8
- }>;
9
- export default ListPanel;