@zgfe/business-lib 1.1.34-alpha.2 → 1.1.34-alpha.21

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 (100) hide show
  1. package/es/addToPanel/index.js +7 -1
  2. package/es/addToScene/index.js +1 -1
  3. package/es/assets/colorIcon/demo.css +539 -0
  4. package/es/assets/colorIcon/demo_index.html +741 -0
  5. package/es/assets/colorIcon/iconfont.css +112 -0
  6. package/es/assets/colorIcon/iconfont.js +43 -0
  7. package/es/assets/colorIcon/iconfont.json +177 -0
  8. package/es/assets/colorIcon/iconfont.svg +67 -0
  9. package/es/assets/colorIcon/iconfont.ttf +0 -0
  10. package/es/assets/colorIcon/iconfont.woff +0 -0
  11. package/es/assets/colorIcon/iconfont.woff2 +0 -0
  12. package/es/assets/iconfont/demo_index.html +95 -3
  13. package/es/assets/iconfont/iconfont.css +19 -3
  14. package/es/assets/iconfont/iconfont.js +1 -1
  15. package/es/assets/iconfont/iconfont.json +28 -0
  16. package/es/assets/iconfont/iconfont.ttf +0 -0
  17. package/es/assets/iconfont/iconfont.woff +0 -0
  18. package/es/assets/iconfont/iconfont.woff2 +0 -0
  19. package/es/assets/theme.js +1 -2
  20. package/es/attrConditions/components/stringList.js +0 -1
  21. package/es/attrConditions/components/valuesList.js +1 -0
  22. package/es/attrConditions/demo/group.js +3 -2
  23. package/es/attrConditions/demo/index.js +1 -11
  24. package/es/attrConditions/index.d.ts +3 -1
  25. package/es/attrConditions/index.js +24 -19
  26. package/es/attrConditions/types.d.ts +1 -1
  27. package/es/attributeSelector/index.js +10 -8
  28. package/es/attributeSelector/types.d.ts +4 -0
  29. package/es/attributeSelector/util.js +5 -1
  30. package/es/chart/util/formatOption.js +1 -1
  31. package/es/colorIcon/demo/index.d.ts +3 -0
  32. package/es/colorIcon/demo/index.js +10 -0
  33. package/es/colorIcon/index.d.ts +9 -0
  34. package/es/colorIcon/index.js +19 -0
  35. package/es/constants/apis.d.ts +6 -0
  36. package/es/constants/apis.js +7 -1
  37. package/es/constants/common.d.ts +11 -0
  38. package/es/constants/common.js +35 -0
  39. package/es/context/index.d.ts +4 -1
  40. package/es/cycleTime/month.js +17 -15
  41. package/es/datePicker/index.d.ts +1 -1
  42. package/es/datePicker/index.js +1 -1
  43. package/es/datePicker/styles/index.less +1 -1
  44. package/es/demoWrapper/content.d.ts +2 -1
  45. package/es/demoWrapper/content.js +25 -12
  46. package/es/demoWrapper/demo/index.js +5 -3
  47. package/es/demoWrapper/head.d.ts +3 -1
  48. package/es/demoWrapper/head.js +17 -5
  49. package/es/demoWrapper/index.js +18 -10
  50. package/es/dialog/index.js +1 -1
  51. package/es/eventSelector/demo/index.js +1 -0
  52. package/es/eventSelector/index.js +15 -10
  53. package/es/eventSelector/listPanel.js +33 -7
  54. package/es/eventSelector/types.d.ts +2 -0
  55. package/es/index.d.ts +3 -1
  56. package/es/index.js +3 -1
  57. package/es/select/handle.js +6 -2
  58. package/es/select/index.js +13 -11
  59. package/es/socket/demo/demo.d.ts +2 -0
  60. package/es/socket/demo/demo.js +145 -0
  61. package/es/socket/demo/index.less +27 -0
  62. package/es/socket/index.d.ts +33 -0
  63. package/es/socket/index.js +304 -0
  64. package/es/socket/types.d.ts +38 -0
  65. package/es/socket/types.js +28 -0
  66. package/es/targetConditionGroup/components/targetDimension.js +29 -27
  67. package/es/targetConditionGroup/data/operates.js +0 -3
  68. package/es/targetConditionGroup/demo/index.js +2 -1
  69. package/es/targetConditionGroup/index.js +65 -34
  70. package/es/targetConditionGroup/types.d.ts +1 -0
  71. package/es/targetSelector/index.js +9 -7
  72. package/es/userCondition/conditionTypeList.js +11 -8
  73. package/es/userCondition/conditions/business/operatorCondition.d.ts +11 -0
  74. package/es/userCondition/conditions/business/operatorCondition.js +181 -0
  75. package/es/userCondition/conditions/business/paramsCondition.d.ts +9 -0
  76. package/es/userCondition/conditions/business/paramsCondition.js +79 -0
  77. package/es/userCondition/conditions/businessCondition.d.ts +2 -8
  78. package/es/userCondition/conditions/businessCondition.js +37 -203
  79. package/es/userCondition/conditions/cdpCondition.js +1 -1
  80. package/es/userCondition/conditions/dataAttribute.js +78 -274
  81. package/es/userCondition/conditions/eventCondition.js +7 -4
  82. package/es/userCondition/conditions/order/runPeriodCondition.d.ts +11 -0
  83. package/es/userCondition/conditions/order/runPeriodCondition.js +142 -0
  84. package/es/userCondition/conditions/order/runTimesCondition.d.ts +11 -0
  85. package/es/userCondition/conditions/order/runTimesCondition.js +112 -0
  86. package/es/userCondition/conditions/textDesc.d.ts +1 -1
  87. package/es/userCondition/conditions/textDesc.js +160 -2
  88. package/es/userCondition/conditions/timeDimension.d.ts +1 -0
  89. package/es/userCondition/conditions/timeDimension.js +26 -76
  90. package/es/userCondition/demo/business.d.ts +3 -0
  91. package/es/userCondition/demo/business.js +71 -0
  92. package/es/userCondition/index.js +14 -2
  93. package/es/userCondition/orConditions.js +9 -4
  94. package/es/userCondition/types.d.ts +42 -8
  95. package/es/userCondition/types.js +8 -1
  96. package/es/userCondition/util.d.ts +1 -1
  97. package/es/userCondition/util.js +7 -4
  98. package/es/userTagsSelector/index.js +5 -3
  99. package/es/utils/ajax.js +0 -1
  100. package/package.json +60 -60
@@ -1,6 +1,8 @@
1
1
  import React from 'react';
2
+ import { AttributeSelect } from '../attributeSelector/types';
2
3
  import './styles/index.less';
3
- import { AttrConditionTypes } from './types';
4
+ import { AttrConditionTypes, OperateTypes } from './types';
4
5
  export declare const classPrefix = "biz-condition-item";
6
+ export declare function getCondition(attr: AttributeSelect.Value, operate: OperateTypes, values: string[]): AttrConditionTypes.ItemValue | undefined;
5
7
  declare const BizConditionItem: React.FC<AttrConditionTypes.ItemProp>;
6
8
  export default BizConditionItem;
@@ -12,6 +12,28 @@ import BizOperateList from './components/operateList';
12
12
  import ValuesList from './components/valuesList';
13
13
  import { Skeleton } from 'antd';
14
14
  export var classPrefix = 'biz-condition-item';
15
+ export function getCondition(attr, operate, values) {
16
+ if (!attr) return;
17
+ var responseData = {
18
+ attrId: attr.id,
19
+ propCategory: attr.propCategory,
20
+ type: attr.type,
21
+ operator: operate,
22
+ values: values || [],
23
+ dimensionSub: attr.dimensionSub,
24
+ label: attr.label
25
+ };
26
+ if (attr.propCategory === PropCategory.EventProp) {
27
+ responseData.attrName = attr.label;
28
+ } else {
29
+ responseData.attrName = attr.name;
30
+ responseData.category = attr.category;
31
+ if (attr.propCategory === PropCategory.UserProp && attr.subtype) {
32
+ responseData.subtype = attr.subtype;
33
+ }
34
+ }
35
+ return responseData;
36
+ }
15
37
  var BizConditionItem = function BizConditionItem(props) {
16
38
  var _props$defaultValue, _props$value, _props$defaultValue2, _props$value2;
17
39
  var defaultValue = props.defaultValue,
@@ -50,6 +72,7 @@ var BizConditionItem = function BizConditionItem(props) {
50
72
  propCategory: data.propCategory,
51
73
  type: data.type,
52
74
  key: data.attrId,
75
+ label: data.label,
53
76
  dimensionSub: data.dimensionSub || 'event_attr'
54
77
  };
55
78
  }
@@ -78,25 +101,7 @@ var BizConditionItem = function BizConditionItem(props) {
78
101
  useEffect(function () {
79
102
  if (props.onChange) {
80
103
  if (!attr) return;
81
- var responseData = {
82
- attrId: attr.id,
83
- propCategory: attr.propCategory,
84
- type: attr.type,
85
- operator: operate,
86
- values: values || [],
87
- dimensionSub: attr.dimensionSub,
88
- label: attr.label
89
- };
90
- if (attr.propCategory === PropCategory.EventProp) {
91
- responseData.attrName = attr.label;
92
- } else {
93
- responseData.attrName = attr.name;
94
- responseData.category = attr.category;
95
- if (attr.propCategory === PropCategory.UserProp && attr.subtype) {
96
- responseData.subtype = attr.subtype;
97
- }
98
- }
99
- props.onChange(responseData);
104
+ props.onChange(getCondition(attr, operate, values));
100
105
  }
101
106
  }, [attr, operate, values]);
102
107
  var onChangeAttr = function onChangeAttr(attrData) {
@@ -18,7 +18,7 @@ export declare namespace AttrConditionTypes {
18
18
  propCategory?: 'userProp' | 'eventProp' | 'envProp';
19
19
  category?: 'fixed' | 'custom';
20
20
  dimensionSub?: string;
21
- operator?: string;
21
+ operator?: OperateTypes;
22
22
  values?: string[];
23
23
  }
24
24
  interface GroupValue {
@@ -87,19 +87,21 @@ var BizAttributeSelector = function BizAttributeSelector(props) {
87
87
  }, /*#__PURE__*/React.createElement("div", {
88
88
  className: "".concat(classPrefix, "-handle")
89
89
  }, /*#__PURE__*/React.createElement(Dropdown, {
90
- overlay: /*#__PURE__*/React.createElement(AttrListPanel, _objectSpread(_objectSpread({
91
- id: id
92
- }, props), {}, {
93
- value: currentAttr,
94
- onChange: onChange
95
- })),
90
+ dropdownRender: function dropdownRender() {
91
+ return /*#__PURE__*/React.createElement(AttrListPanel, _objectSpread(_objectSpread({
92
+ id: id
93
+ }, props), {}, {
94
+ value: currentAttr,
95
+ onChange: onChange
96
+ }));
97
+ },
96
98
  trigger: ['click'],
97
99
  overlayStyle: {
98
100
  minWidth: 284,
99
101
  width: width
100
102
  },
101
- visible: visible,
102
- onVisibleChange: onVisibleChange,
103
+ open: visible,
104
+ onOpenChange: onVisibleChange,
103
105
  destroyPopupOnHide: props.destroyPopupOnHide
104
106
  }, /*#__PURE__*/React.createElement("div", {
105
107
  style: {
@@ -24,6 +24,8 @@ export interface AnalysisEvent {
24
24
  isOverview?: boolean;
25
25
  eventHidden?: ShowStatus;
26
26
  marked?: boolean;
27
+ isBuiltIn?: boolean;
28
+ type?: string;
27
29
  }
28
30
  export interface EventGroup {
29
31
  id: number;
@@ -61,6 +63,8 @@ export interface PropGroups {
61
63
  eventGroupList?: EventGroup[];
62
64
  userPropList?: UserProp[];
63
65
  envPropList?: EnvProp[];
66
+ eventNameMap?: Record<string, AnalysisEvent>;
67
+ eventIdMap?: Record<number, AnalysisEvent>;
64
68
  }
65
69
  export declare namespace AttributeSelect {
66
70
  type Value = EventProp | UserProp | EnvProp | null;
@@ -3,7 +3,9 @@ export default function convertAttributeData(store) {
3
3
  var res = {
4
4
  envPropList: [],
5
5
  eventGroupList: [],
6
- userPropList: []
6
+ userPropList: [],
7
+ eventNameMap: {},
8
+ eventIdMap: {}
7
9
  };
8
10
  (_store$eventList = store.eventList) === null || _store$eventList === void 0 ? void 0 : _store$eventList.forEach(function (group_) {
9
11
  var _res$eventGroupList;
@@ -39,6 +41,8 @@ export default function convertAttributeData(store) {
39
41
  eventHidden: e.event_hidden,
40
42
  marked: Boolean(e.mark_type)
41
43
  };
44
+ res.eventNameMap[event.name] = event;
45
+ res.eventIdMap[event.id] = event;
42
46
  if (event.marked) {
43
47
  markList.push(event);
44
48
  } else {
@@ -21,7 +21,7 @@ var tooltipFormatterDefault = function tooltipFormatterDefault(params) {
21
21
  } else {
22
22
  lineLabel = util.toThousands(lineLabel);
23
23
  }
24
- var name = (params.length > 1 ? item.seriesName : item.data && item.data.label ? item.data.label : item.name).trim();
24
+ var name = item.seriesName.trim();
25
25
  htmlArray.push("<div class=\"biz-chart-tooltip-item\">\n <div class=\"biz-chart-tooltip-content\">\n <span class=\"biz-tooltip-marker\" style=\"background:".concat(item.color, "\"></span>\n <div class=\"biz-tooltip-name\">").concat(name, "</div>\n </div> \n <span class=\"biz-chart-tooltip-value\">").concat(lineLabel, "</span>\n </div>"));
26
26
  });
27
27
  return htmlArray.join('');
@@ -0,0 +1,3 @@
1
+ import '../../assets/colorIcon/iconfont.js';
2
+ declare const _default: () => JSX.Element;
3
+ export default _default;
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ import { ColorIcon } from '@zgfe/business-lib';
3
+ import '../../assets/colorIcon/iconfont.js';
4
+ export default (function () {
5
+ return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(ColorIcon, {
6
+ width: 50,
7
+ height: 50,
8
+ type: "icon-caidan-guanggaojiance"
9
+ }));
10
+ });
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ interface Props {
3
+ type: string;
4
+ width?: number;
5
+ height?: number;
6
+ className?: string;
7
+ }
8
+ declare const ColorIcon: React.FC<Props>;
9
+ export default ColorIcon;
@@ -0,0 +1,19 @@
1
+ import React from 'react';
2
+ var ColorIcon = function ColorIcon(props) {
3
+ var className = props.className,
4
+ type = props.type;
5
+ return /*#__PURE__*/React.createElement("svg", {
6
+ className: className,
7
+ "aria-hidden": "true",
8
+ style: {
9
+ width: props.width ? "".concat(props.width, "px") : 'auto',
10
+ height: props.height ? "".concat(props.height, "px") : 'auto'
11
+ }
12
+ }, /*#__PURE__*/React.createElement("use", {
13
+ xlinkHref: "#".concat(type)
14
+ }));
15
+ };
16
+ ColorIcon.defaultProps = {
17
+ className: ''
18
+ };
19
+ export default ColorIcon;
@@ -7,5 +7,11 @@ declare const Apis: {
7
7
  queryPanelGroup: string;
8
8
  queryDatasetList: string;
9
9
  queryDatasetDetail: string;
10
+ getSocketToken: string;
11
+ bizDataTypeList: string;
12
+ orderAttributeMaster: string;
13
+ orderAttributeSon: string;
14
+ bizDataAttrList: string;
15
+ dataAttrValue: string;
10
16
  };
11
17
  export default Apis;
@@ -6,6 +6,12 @@ var Apis = {
6
6
  updatePanelTarget: '/apppanel/updateElemet.jsp',
7
7
  queryPanelGroup: '/apppanel/panels.jsp',
8
8
  queryDatasetList: '/zg/web/cdp/inner/dataset/list',
9
- queryDatasetDetail: '/zg/web/cdp/inner/dataset/detail'
9
+ queryDatasetDetail: '/zg/web/cdp/inner/dataset/detail',
10
+ getSocketToken: '/zg/web/v2/tracking/view/websocket/token',
11
+ bizDataTypeList: '/cep-console/api/v1/bizdata/type/list',
12
+ orderAttributeMaster: '/cep-console/api/v1/cdp/orderAttribute/master',
13
+ orderAttributeSon: '/cep-console/api/v1/cdp/orderAttribute/son',
14
+ bizDataAttrList: '/cep-console/api/v1/bizdata/attr/list',
15
+ dataAttrValue: '/cep-console/api/v1/es/data/attr/value'
10
16
  };
11
17
  export default Apis;
@@ -0,0 +1,11 @@
1
+ export declare const BuiltinIndicators: {
2
+ id: number;
3
+ name: string;
4
+ eventList: {
5
+ name: string;
6
+ id: number;
7
+ type: string;
8
+ isBuiltIn: boolean;
9
+ attrList: never[];
10
+ }[];
11
+ };
@@ -0,0 +1,35 @@
1
+ export var BuiltinIndicators = {
2
+ id: -2,
3
+ name: '整体',
4
+ eventList: [{
5
+ name: '新增用户',
6
+ id: -201,
7
+ type: 'add',
8
+ isBuiltIn: true,
9
+ attrList: []
10
+ }, {
11
+ name: '活跃用户',
12
+ id: -202,
13
+ type: 'active',
14
+ isBuiltIn: true,
15
+ attrList: []
16
+ }, {
17
+ name: '访问次数',
18
+ id: -203,
19
+ type: 'times',
20
+ isBuiltIn: true,
21
+ attrList: []
22
+ }, {
23
+ name: '平均使用时长',
24
+ id: -204,
25
+ type: 'duration_avg',
26
+ isBuiltIn: true,
27
+ attrList: []
28
+ }, {
29
+ name: '使用时长分布',
30
+ id: -205,
31
+ type: 'duration',
32
+ isBuiltIn: true,
33
+ attrList: []
34
+ }]
35
+ };
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
- import { EventGroup, UserProp, EnvProp } from '../attributeSelector/types';
2
+ import { EventGroup, UserProp, EnvProp, AnalysisEvent } from '../attributeSelector/types';
3
3
  export interface AppInfoProps {
4
4
  appId?: string | number;
5
5
  platform?: string | number;
@@ -10,6 +10,7 @@ export interface UserInfo {
10
10
  username: string;
11
11
  email: string;
12
12
  companyId: number;
13
+ serviceType: number;
13
14
  companyName: string;
14
15
  }
15
16
  export interface Menu {
@@ -24,6 +25,8 @@ export interface Menu {
24
25
  export interface GlobalContextProps {
25
26
  userGroupList?: Array<any>;
26
27
  eventGroupList?: EventGroup[];
28
+ eventNameMap?: Record<string, AnalysisEvent>;
29
+ eventIdMap?: Record<number, AnalysisEvent>;
27
30
  userPropList?: UserProp[];
28
31
  eventEnvList?: EnvProp[];
29
32
  menuNameMap?: {
@@ -69,21 +69,23 @@ var MonthDay = function MonthDay(props) {
69
69
  }
70
70
  return /*#__PURE__*/React.createElement(Dropdown, {
71
71
  disabled: disable,
72
- overlay: /*#__PURE__*/React.createElement("div", {
73
- className: "".concat(classPrefix, "-overlay")
74
- }, dayList.map(function (item) {
75
- return /*#__PURE__*/React.createElement("span", {
76
- key: item.value,
77
- className: "".concat(classPrefix, "-day ").concat(chosenDayList.map(function (v) {
78
- return v.value;
79
- }).indexOf(item.value) > -1 ? 'active' : '', " ").concat(item.value === 32 ? 'lastday' : ''),
80
- onClick: function onClick() {
81
- onClickMonthDay(item.value);
82
- }
83
- }, item.label);
84
- })),
85
- visible: visible,
86
- onVisibleChange: setVisible,
72
+ dropdownRender: function dropdownRender() {
73
+ return /*#__PURE__*/React.createElement("div", {
74
+ className: "".concat(classPrefix, "-overlay")
75
+ }, dayList.map(function (item) {
76
+ return /*#__PURE__*/React.createElement("span", {
77
+ key: item.value,
78
+ className: "".concat(classPrefix, "-day ").concat(chosenDayList.map(function (v) {
79
+ return v.value;
80
+ }).indexOf(item.value) > -1 ? 'active' : '', " ").concat(item.value === 32 ? 'lastday' : ''),
81
+ onClick: function onClick() {
82
+ onClickMonthDay(item.value);
83
+ }
84
+ }, item.label);
85
+ }));
86
+ },
87
+ open: visible,
88
+ onOpenChange: setVisible,
87
89
  trigger: ['click']
88
90
  }, /*#__PURE__*/React.createElement("div", {
89
91
  className: "".concat(classPrefix, "-wrapper")
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import { DatePickerTypes } from './types';
3
3
  import './styles/index.less';
4
- export declare const classPrefix = "biz-date-picker";
4
+ export declare const classPrefix = "biz-date-picker-wrap";
5
5
  declare const BizDatePicker: React.FC<DatePickerTypes.Props>;
6
6
  export default BizDatePicker;
@@ -16,7 +16,7 @@ import BizSelect from '../select';
16
16
  import BizDate from './datePicker';
17
17
  import './styles/index.less';
18
18
  import { Skeleton } from 'antd';
19
- export var classPrefix = 'biz-date-picker';
19
+ export var classPrefix = 'biz-date-picker-wrap';
20
20
  var BizDatePicker = function BizDatePicker(props) {
21
21
  var dateList = getDateList(props.mode, props.dateTypeList);
22
22
  var _useState = useState(dateList[0]),
@@ -1,6 +1,6 @@
1
1
  @import '../../assets/styles/inner.less';
2
2
 
3
- .biz-date-picker {
3
+ .biz-date-picker-wrap {
4
4
  display: flex;
5
5
 
6
6
  &-type {
@@ -1,7 +1,8 @@
1
1
  import React, { ReactNode } from 'react';
2
+ import { AppInfoProps } from '../context';
2
3
  declare const DemoContent: React.FC<{
3
4
  children?: ReactNode;
4
5
  needMeta?: boolean;
5
- currentApp?: number;
6
+ currentApp?: AppInfoProps;
6
7
  }>;
7
8
  export default DemoContent;
@@ -1,3 +1,9 @@
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); }
1
7
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
2
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."); }
3
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); }
@@ -82,10 +88,16 @@ var DemoContent = function DemoContent(_ref3) {
82
88
  setStore = _useState18[1];
83
89
  useEffect(function () {
84
90
  if (!needMeta || !currentApp) return;
85
- loadUserProps();
86
- loadEvents();
87
- loadEnvList();
88
- loadUserGroup();
91
+ if (currentApp.appsHasData && currentApp.appsHasData.length) {
92
+ loadUserProps();
93
+ loadEvents();
94
+ loadEnvList();
95
+ loadUserGroup();
96
+ } else {
97
+ setLoadEnv(false);
98
+ setLoadEvent(false);
99
+ setLoadUsers(false);
100
+ }
89
101
  }, [currentApp, needMeta]);
90
102
  useEffect(function () {
91
103
  if (loadEnv || loadEvent || loadUsers || loadUserGroups) return;
@@ -100,7 +112,7 @@ var DemoContent = function DemoContent(_ref3) {
100
112
  ajax('/analysis/api/common/proxy/usergroup/getAll.jsp', {
101
113
  method: 'post',
102
114
  params: {
103
- appId: currentApp,
115
+ appId: currentApp === null || currentApp === void 0 ? void 0 : currentApp.id,
104
116
  platform: 0,
105
117
  includeDefault: true,
106
118
  includeToday: true
@@ -115,7 +127,7 @@ var DemoContent = function DemoContent(_ref3) {
115
127
  ajax('/analysis/api/common/proxy/appusergroup/getUserPropMeta.jsp', {
116
128
  method: 'post',
117
129
  params: {
118
- app_id: currentApp,
130
+ app_id: currentApp === null || currentApp === void 0 ? void 0 : currentApp.id,
119
131
  platform: 0
120
132
  }
121
133
  }).then(function (res) {
@@ -128,7 +140,7 @@ var DemoContent = function DemoContent(_ref3) {
128
140
  ajax('/analysis/api/common/proxy/data/queryEventMetasOfGroup.jsp', {
129
141
  method: 'post',
130
142
  params: {
131
- app_id: currentApp,
143
+ app_id: currentApp === null || currentApp === void 0 ? void 0 : currentApp.id,
132
144
  platform: 0,
133
145
  is_all: true
134
146
  }
@@ -142,7 +154,7 @@ var DemoContent = function DemoContent(_ref3) {
142
154
  ajax('/analysis/api/common/proxy/appusergroup/getEventEnvData.jsp', {
143
155
  method: 'post',
144
156
  params: {
145
- app_id: currentApp,
157
+ app_id: currentApp === null || currentApp === void 0 ? void 0 : currentApp.id,
146
158
  platform: 0
147
159
  }
148
160
  }).then(function (res) {
@@ -157,13 +169,14 @@ var DemoContent = function DemoContent(_ref3) {
157
169
  }
158
170
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(BizGlobalDataContext.Provider, {
159
171
  value: {
160
- currentApp: {
161
- appId: currentApp,
162
- platform: 0
163
- },
172
+ currentApp: _objectSpread(_objectSpread({}, currentApp), {}, {
173
+ appId: currentApp === null || currentApp === void 0 ? void 0 : currentApp.id
174
+ }),
164
175
  eventGroupList: store === null || store === void 0 ? void 0 : store.eventGroupList,
165
176
  userPropList: store === null || store === void 0 ? void 0 : store.userPropList,
166
177
  eventEnvList: store === null || store === void 0 ? void 0 : store.envPropList,
178
+ eventIdMap: store === null || store === void 0 ? void 0 : store.eventIdMap,
179
+ eventNameMap: store === null || store === void 0 ? void 0 : store.eventNameMap,
167
180
  userGroupList: userGroups
168
181
  }
169
182
  }, children));
@@ -1,8 +1,10 @@
1
1
  import React from 'react';
2
- import { DemoWrapper } from '@zgfe/business-lib';
2
+ import { DemoWrapper, BizGlobalDataContext } from '@zgfe/business-lib';
3
3
  export default (function () {
4
4
  return /*#__PURE__*/React.createElement(DemoWrapper, {
5
- defaultApp: 3,
6
5
  needMeta: true
7
- }, "xxx");
6
+ }, /*#__PURE__*/React.createElement(BizGlobalDataContext.Consumer, null, function (_ref) {
7
+ var currentApp = _ref.currentApp;
8
+ return /*#__PURE__*/React.createElement(React.Fragment, null, "\u5F53\u524D\u5E94\u7528\uFF1A", currentApp.appName, "(id: ", currentApp.id, ")");
9
+ }));
8
10
  });
@@ -1,6 +1,8 @@
1
1
  import React from 'react';
2
+ import { AppInfoProps } from '../context';
2
3
  declare const DemoHeader: React.FC<{
3
4
  defaultApp?: number;
4
- onChangeApp?: (appId: number) => void;
5
+ onChangeApp?: (app: AppInfoProps) => void;
6
+ onLoading?: (loading: boolean) => void;
5
7
  }>;
6
8
  export default DemoHeader;
@@ -9,7 +9,8 @@ import React, { useEffect, useState } from 'react';
9
9
  import request from '../utils/ajax';
10
10
  var DemoHeader = function DemoHeader(_ref) {
11
11
  var defaultApp = _ref.defaultApp,
12
- onChangeApp = _ref.onChangeApp;
12
+ onChangeApp = _ref.onChangeApp,
13
+ onLoading = _ref.onLoading;
13
14
  var _useState = useState([]),
14
15
  _useState2 = _slicedToArray(_useState, 2),
15
16
  appList = _useState2[0],
@@ -21,17 +22,25 @@ var DemoHeader = function DemoHeader(_ref) {
21
22
  useEffect(function () {
22
23
  queryAppList();
23
24
  }, []);
25
+ useEffect(function () {
26
+ if (onLoading) onLoading(loading);
27
+ }, [loading, appList]);
24
28
  function queryAppList() {
25
29
  setLoading(true);
26
30
  request('/analysis/api/common/proxy/data/v2ajaxGetDataByApp.jsp').then(function (res) {
27
31
  setAppList(res.applist);
28
- if (!defaultApp && res.applist.length) onChange(res.applist[0].id);
32
+ if (defaultApp) {
33
+ _onChange(res.applist.find(function (item) {
34
+ return item.id === defaultApp;
35
+ }));
36
+ }
37
+ if (!defaultApp && res.applist.length) _onChange(res.applist[0]);
29
38
  }).finally(function () {
30
39
  setLoading(false);
31
40
  });
32
41
  }
33
- function onChange(id) {
34
- if (onChangeApp) onChangeApp(id);
42
+ function _onChange(item) {
43
+ if (onChangeApp) onChangeApp(item);
35
44
  }
36
45
  if (loading) return /*#__PURE__*/React.createElement(Skeleton.Input, null);
37
46
  return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Select, {
@@ -41,7 +50,10 @@ var DemoHeader = function DemoHeader(_ref) {
41
50
  label: 'appName',
42
51
  value: 'id'
43
52
  },
44
- onChange: onChange,
53
+ onChange: function onChange(_id, app) {
54
+ console.log('默认应用', app);
55
+ _onChange(app);
56
+ },
45
57
  style: {
46
58
  width: '200px'
47
59
  }
@@ -20,14 +20,18 @@ var DemoWrapper = function DemoWrapper(_ref) {
20
20
  _useState2 = _slicedToArray(_useState, 2),
21
21
  loading = _useState2[0],
22
22
  setLoading = _useState2[1];
23
- var _useState3 = useState(false),
23
+ var _useState3 = useState(true),
24
24
  _useState4 = _slicedToArray(_useState3, 2),
25
- notLogin = _useState4[0],
26
- setNotLogin = _useState4[1];
27
- var _useState5 = useState(defaultApp),
25
+ appListLoading = _useState4[0],
26
+ setAppListLoading = _useState4[1];
27
+ var _useState5 = useState(false),
28
28
  _useState6 = _slicedToArray(_useState5, 2),
29
- appId = _useState6[0],
30
- setAppId = _useState6[1];
29
+ notLogin = _useState6[0],
30
+ setNotLogin = _useState6[1];
31
+ var _useState7 = useState(),
32
+ _useState8 = _slicedToArray(_useState7, 2),
33
+ app = _useState8[0],
34
+ setApp = _useState8[1];
31
35
  useEffect(function () {
32
36
  getCurrentUser();
33
37
  }, []);
@@ -53,15 +57,19 @@ var DemoWrapper = function DemoWrapper(_ref) {
53
57
  return /*#__PURE__*/React.createElement(Card, {
54
58
  title: /*#__PURE__*/React.createElement(DemoHeader, {
55
59
  defaultApp: defaultApp,
56
- onChangeApp: setAppId
60
+ onChangeApp: setApp,
61
+ onLoading: setAppListLoading
57
62
  }),
58
63
  className: className,
59
64
  bodyStyle: {
60
65
  background: '#FAFAFB'
61
66
  }
62
- }, /*#__PURE__*/React.createElement(DemoContent, {
63
- currentApp: appId,
64
- needMeta: needMeta
67
+ }, appListLoading ? /*#__PURE__*/React.createElement(Spin, {
68
+ tip: "\u5E94\u7528\u4FE1\u606F\u521D\u59CB\u5316\u4E2D"
69
+ }) : /*#__PURE__*/React.createElement(DemoContent, {
70
+ currentApp: app,
71
+ needMeta: needMeta,
72
+ key: app === null || app === void 0 ? void 0 : app.appId
65
73
  }, children));
66
74
  };
67
75
  export default DemoWrapper;
@@ -23,7 +23,7 @@ var BizDialog = function BizDialog(props) {
23
23
  };
24
24
  BizDialog.defaultProps = {
25
25
  width: 520,
26
- visible: false,
26
+ open: false,
27
27
  cancelText: '取消',
28
28
  okText: '确定',
29
29
  closable: false,
@@ -39,6 +39,7 @@ var EventDemo = function EventDemo() {
39
39
  eventGroupList: store.eventGroupList
40
40
  }
41
41
  }, /*#__PURE__*/React.createElement(BizEventSelector, {
42
+ showBuiltInTarget: true,
42
43
  defaultValue: value,
43
44
  alias: "\u522B\u540D",
44
45
  onChange: onChange