@zgfe/business-lib 1.2.58-ljy.0 → 1.2.70-hxd.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 (95) hide show
  1. package/README.md +1 -1
  2. package/es/AUMFormulaTarget/components/formula/index.less +5 -1
  3. package/es/AUMFormulaTarget/components/formulaItem/index.js +52 -13
  4. package/es/AUMFormulaTarget/demo/index.js +1 -1
  5. package/es/assets/iconfont/demo_index.html +233 -3
  6. package/es/assets/iconfont/iconfont.css +43 -3
  7. package/es/assets/iconfont/iconfont.js +8 -8
  8. package/es/assets/iconfont/iconfont.json +70 -0
  9. package/es/assets/iconfont/iconfont.ttf +0 -0
  10. package/es/assets/iconfont/iconfont.woff +0 -0
  11. package/es/assets/iconfont/iconfont.woff2 +0 -0
  12. package/es/assets/images/attention.png +0 -0
  13. package/es/assets/styles/resetAntd.less +20 -7
  14. package/es/attrCondition/group.js +5 -2
  15. package/es/attrCondition/index.js +6 -2
  16. package/es/attrConditions/components/operateList.js +4 -4
  17. package/es/attrConditions/components/stringList.d.ts +10 -0
  18. package/es/attrConditions/components/stringList.js +57 -27
  19. package/es/attrConditions/components/valuesList.d.ts +10 -0
  20. package/es/attrConditions/components/valuesList.js +7 -3
  21. package/es/attrConditions/types.d.ts +17 -0
  22. package/es/attributeSelector/index.js +9 -3
  23. package/es/attributeSelector/listPanel.js +8 -4
  24. package/es/attributeSelector/types.d.ts +3 -0
  25. package/es/attributeSelector/util.js +1 -0
  26. package/es/chart/demo/data/data7.d.ts +54 -0
  27. package/es/chart/demo/data/data7.js +1527 -0
  28. package/es/chart/demo/index.js +2 -3
  29. package/es/chart/demo/stack.d.ts +3 -0
  30. package/es/chart/demo/stack.js +31 -0
  31. package/es/chart/index.js +16 -6
  32. package/es/chart/types.d.ts +4 -1
  33. package/es/chart/util/chartOptionConfig.d.ts +4 -3
  34. package/es/chart/util/chartOptionConfig.js +84 -4
  35. package/es/chart/util/formatData.d.ts +1 -0
  36. package/es/chart/util/formatData.js +13 -0
  37. package/es/chart/util/formatOption.js +1 -1
  38. package/es/constants/apis.d.ts +3 -0
  39. package/es/constants/apis.js +4 -1
  40. package/es/cycleTime/index.js +1 -1
  41. package/es/datePicker/index.js +6 -6
  42. package/es/datePickerV2/index.js +6 -3
  43. package/es/datePickerV2/popoverContent.d.ts +1 -0
  44. package/es/datePickerV2/popoverContent.js +3 -1
  45. package/es/datePickerV2/shortcut.d.ts +2 -0
  46. package/es/datePickerV2/shortcut.js +4 -3
  47. package/es/datePickerV2/types.d.ts +2 -0
  48. package/es/datePickerV2/utils.d.ts +1 -1
  49. package/es/datePickerV2/utils.js +5 -5
  50. package/es/empty/demo/index.d.ts +4 -0
  51. package/es/empty/demo/index.js +16 -0
  52. package/es/empty/index.d.ts +4 -0
  53. package/es/empty/index.js +19 -0
  54. package/es/empty/types.d.ts +7 -0
  55. package/es/empty/types.js +1 -0
  56. package/es/hooks/useBizStore.d.ts +4 -2
  57. package/es/hooks/useBizStore.js +18 -14
  58. package/es/index.d.ts +6 -1
  59. package/es/index.js +6 -1
  60. package/es/platformSelector/index.js +42 -9
  61. package/es/platformSelector/styles/index.less +6 -2
  62. package/es/platformSelector/util.d.ts +1 -1
  63. package/es/platformSelector/util.js +8 -1
  64. package/es/productCondition/conditions/order/runPeriodCondition.js +1 -1
  65. package/es/productCondition/conditions/periodCondition.js +1 -1
  66. package/es/productCondition/conditions/runTimesCondition.js +1 -1
  67. package/es/select/index.js +9 -1
  68. package/es/select/types.d.ts +3 -2
  69. package/es/subjectWrapper/demo/index.d.ts +3 -0
  70. package/es/subjectWrapper/demo/index.js +28 -0
  71. package/es/subjectWrapper/index.d.ts +5 -0
  72. package/es/subjectWrapper/index.js +98 -0
  73. package/es/subjectWrapper/index.less +12 -0
  74. package/es/subjectWrapper/types.d.ts +14 -0
  75. package/es/subjectWrapper/types.js +4 -0
  76. package/es/targetConditionGroup/index.js +5 -4
  77. package/es/userCondition/conditionTypeList.js +1 -10
  78. package/es/userCondition/conditions/businessCondition.js +3 -10
  79. package/es/userCondition/conditions/cdpCshCondition.js +0 -1
  80. package/es/userCondition/conditions/eventCondition.js +36 -4
  81. package/es/userCondition/conditions/order/runPeriodCondition.js +1 -1
  82. package/es/userCondition/conditions/periodCondition.js +1 -1
  83. package/es/userCondition/conditions/runTimesCondition.js +1 -1
  84. package/es/userCondition/conditions/styles/eventCondition.less +6 -0
  85. package/es/userCondition/conditions/textDesc.js +1 -24
  86. package/es/userCondition/orConditions.js +0 -7
  87. package/es/userGroup/index.js +2 -2
  88. package/es/userGroupHeader/demo/index.js +1 -1
  89. package/es/userTagsSelector/cascaderOverlay.js +13 -6
  90. package/es/userTagsSelector/demo/index.js +1 -0
  91. package/es/userTagsSelector/index.js +6 -3
  92. package/es/userTagsSelector/types.d.ts +2 -0
  93. package/es/utils/util.d.ts +3 -0
  94. package/es/utils/util.js +10 -0
  95. package/package.json +4 -4
@@ -14,7 +14,8 @@ import { useEffect, useState, useCallback } from 'react';
14
14
  import { ajax } from '../utils';
15
15
  import Apis from '../constants/apis';
16
16
  import convertAttributeData from '../attributeSelector/util';
17
- function useBizStore(appId) {
17
+ function useBizStore(_ref) {
18
+ var currentApp = _ref.currentApp;
18
19
  var _useState = useState([]),
19
20
  _useState2 = _slicedToArray(_useState, 2),
20
21
  userGroupList = _useState2[0],
@@ -71,7 +72,7 @@ function useBizStore(appId) {
71
72
  ajax(Apis.queryUserGroup, {
72
73
  method: 'post',
73
74
  data: {
74
- appId: appId,
75
+ appId: currentApp === null || currentApp === void 0 ? void 0 : currentApp.appId,
75
76
  platform: 0,
76
77
  includeDefault: true,
77
78
  includeToday: true
@@ -82,13 +83,13 @@ function useBizStore(appId) {
82
83
  }).finally(function () {
83
84
  setGroupLoading(false);
84
85
  });
85
- }, [appId]);
86
+ }, [currentApp === null || currentApp === void 0 ? void 0 : currentApp.appId]);
86
87
  var queryTags = useCallback(function () {
87
88
  setTagLoading(true);
88
89
  ajax(Apis.queryAllTags, {
89
90
  method: 'post',
90
91
  data: {
91
- appId: appId,
92
+ appId: currentApp === null || currentApp === void 0 ? void 0 : currentApp.appId,
92
93
  platform: 0
93
94
  }
94
95
  }).then(function (res) {
@@ -97,13 +98,13 @@ function useBizStore(appId) {
97
98
  }).finally(function () {
98
99
  setTagLoading(false);
99
100
  });
100
- }, [appId]);
101
+ }, [currentApp === null || currentApp === void 0 ? void 0 : currentApp.appId]);
101
102
  var loadEvents = useCallback(function () {
102
103
  setLoadEvent(true);
103
104
  ajax('/zg/web/v2/data/queryEventMetasOfGroup', {
104
105
  method: 'post',
105
106
  data: {
106
- appId: appId,
107
+ appId: currentApp === null || currentApp === void 0 ? void 0 : currentApp.appId,
107
108
  platform: 0,
108
109
  isAll: true
109
110
  }
@@ -111,33 +112,33 @@ function useBizStore(appId) {
111
112
  setEventGroups(res.data);
112
113
  setLoadEvent(false);
113
114
  });
114
- }, [appId]);
115
+ }, [currentApp === null || currentApp === void 0 ? void 0 : currentApp.appId]);
115
116
  var loadUserProps = useCallback(function () {
116
117
  setLoadUsers(true);
117
118
  ajax('/zg/web/v2/appusergroup/getUserPropMeta', {
118
119
  method: 'post',
119
120
  data: {
120
- appId: appId,
121
+ appId: currentApp === null || currentApp === void 0 ? void 0 : currentApp.appId,
121
122
  platform: 0
122
123
  }
123
124
  }).then(function (res) {
124
125
  setUserProps(res.data);
125
126
  setLoadUsers(false);
126
127
  });
127
- }, [appId]);
128
+ }, [currentApp === null || currentApp === void 0 ? void 0 : currentApp.appId]);
128
129
  var loadEnvList = useCallback(function () {
129
130
  setLoadEnv(true);
130
131
  ajax('/zg/web/v2/appusergroup/getEventEnvData', {
131
132
  method: 'post',
132
133
  data: {
133
- appId: appId,
134
+ appId: currentApp === null || currentApp === void 0 ? void 0 : currentApp.appId,
134
135
  platform: 0
135
136
  }
136
137
  }).then(function (res) {
137
138
  setEnvList(res.data.eventEnv);
138
139
  setLoadEnv(false);
139
140
  });
140
- }, [appId]);
141
+ }, [currentApp === null || currentApp === void 0 ? void 0 : currentApp.appId]);
141
142
  useEffect(function () {
142
143
  if (loadEnv || loadEvent || loadUsers) return;
143
144
  setStore(convertAttributeData({
@@ -151,12 +152,16 @@ function useBizStore(appId) {
151
152
  setUseBizStoreLoading(false);
152
153
  }, [loadEvent, loadEnv, loadUsers, groupLoading, tagLoading]);
153
154
  useEffect(function () {
154
- if (!appId) return;
155
+ if (!currentApp || !currentApp.appId) {
156
+ setUseBizStoreLoading(false);
157
+ return;
158
+ }
155
159
  setTimer(function (pre) {
156
160
  if (pre) {
157
161
  clearTimeout(pre);
158
162
  }
159
163
  return setTimeout(function () {
164
+ setUseBizStoreLoading(true);
160
165
  queryGroups();
161
166
  queryTags();
162
167
  loadUserProps();
@@ -164,10 +169,9 @@ function useBizStore(appId) {
164
169
  loadEnvList();
165
170
  }, 300);
166
171
  });
167
- }, [appId]);
172
+ }, [currentApp === null || currentApp === void 0 ? void 0 : currentApp.appId]);
168
173
  return _objectSpread({
169
174
  useBizStoreLoading: useBizStoreLoading,
170
- setUseBizStoreLoading: setUseBizStoreLoading,
171
175
  groupLoading: groupLoading,
172
176
  userGroupList: userGroupList,
173
177
  tagList: tagList,
package/es/index.d.ts CHANGED
@@ -10,6 +10,7 @@ import BizConditionGroup from './attrConditions/group';
10
10
  import BizDatePicker from './datePicker';
11
11
  import BizQuickDatePicker from './quickDatePicker';
12
12
  import BizLoading from './loading';
13
+ import BizEmpty from './empty';
13
14
  import BizSelect from './select';
14
15
  import BizDialog from './dialog';
15
16
  import BizChart from './chart';
@@ -49,7 +50,11 @@ import useSubject from './hooks/useSubject';
49
50
  import BizPlatformSelector from './platformSelector';
50
51
  import DataSetGroup from './dataSetGroup';
51
52
  import BizDatePickerV2 from './datePickerV2';
52
- export { BizTargetDimension, BizTargetFromPanel, BizSearchInput, BizSelect, BizDialog, BizChart, BizTable, BizLayout, BizAnalysisLayout, BizDetailLayout, BizUserGroup, BizUserGroupHeader, IconFont, ColorIcon, BizFormulaTarget, BizAUMFormulaTarget, BizTargetSelector, BizEventSelector, BizAttributeSelector, BizGlobalDataContext, BizTargetFromPanelContext, BizTargetCondition, BizDatePicker, BizQuickDatePicker, BizLoading, BizConditionItem, BizConditionGroup, BizAttrCondition, BizAttrConditionGroup, BizUserCondition, BizProductCondition, BizAddToScene, BizAddToPanel, BizCycleTime, BizDnd, BizLoginForm, DemoWrapper, SocketClient, ajax, util, base64, theme, convertAttributeData, BizUserTagsSelect, setGlobalConfig, chartColors, useBizStore, useChanged, useSubject, DataSetGroup, BizDatePickerV2, BizPlatformSelector, };
53
+ import SubjectWrapper from './subjectWrapper';
54
+ import StyleList from './addToPanel/components/styleList';
55
+ import BizEditText from './layout/optionTitle/components/title';
56
+ import ValuesList from './attrConditions/components/valuesList';
57
+ export { BizTargetDimension, BizTargetFromPanel, BizSearchInput, BizSelect, BizDialog, BizChart, BizTable, BizLayout, BizAnalysisLayout, BizDetailLayout, BizUserGroup, BizUserGroupHeader, IconFont, ColorIcon, BizFormulaTarget, BizAUMFormulaTarget, BizTargetSelector, BizEventSelector, BizAttributeSelector, BizGlobalDataContext, BizTargetFromPanelContext, BizTargetCondition, BizDatePicker, BizQuickDatePicker, BizLoading, BizEmpty, BizConditionItem, BizConditionGroup, BizAttrCondition, BizAttrConditionGroup, BizUserCondition, BizProductCondition, BizAddToScene, BizAddToPanel, BizCycleTime, BizDnd, BizLoginForm, DemoWrapper, SocketClient, ajax, util, base64, theme, convertAttributeData, BizUserTagsSelect, setGlobalConfig, chartColors, useBizStore, useChanged, useSubject, DataSetGroup, BizDatePickerV2, BizPlatformSelector, SubjectWrapper, StyleList, BizEditText, ValuesList, };
53
58
  export type { UserGroupTypes } from './userGroup/types';
54
59
  export type { BizProductConditionT } from './productCondition/types';
55
60
  export type { BizSelectTypes } from './select/types';
package/es/index.js CHANGED
@@ -9,6 +9,7 @@ import BizConditionGroup from './attrConditions/group';
9
9
  import BizDatePicker from './datePicker';
10
10
  import BizQuickDatePicker from './quickDatePicker';
11
11
  import BizLoading from './loading';
12
+ import BizEmpty from './empty';
12
13
  import BizSelect from './select';
13
14
  import BizDialog from './dialog';
14
15
  import BizChart from './chart';
@@ -48,4 +49,8 @@ import useSubject from './hooks/useSubject';
48
49
  import BizPlatformSelector from './platformSelector';
49
50
  import DataSetGroup from './dataSetGroup';
50
51
  import BizDatePickerV2 from './datePickerV2';
51
- export { BizTargetDimension, BizTargetFromPanel, BizSearchInput, BizSelect, BizDialog, BizChart, BizTable, BizLayout, BizAnalysisLayout, BizDetailLayout, BizUserGroup, BizUserGroupHeader, IconFont, ColorIcon, BizFormulaTarget, BizAUMFormulaTarget, BizTargetSelector, BizEventSelector, BizAttributeSelector, BizGlobalDataContext, BizTargetFromPanelContext, BizTargetCondition, BizDatePicker, BizQuickDatePicker, BizLoading, BizConditionItem, BizConditionGroup, BizAttrCondition, BizAttrConditionGroup, BizUserCondition, BizProductCondition, BizAddToScene, BizAddToPanel, BizCycleTime, BizDnd, BizLoginForm, DemoWrapper, SocketClient, ajax, util, base64, theme, convertAttributeData, BizUserTagsSelect, setGlobalConfig, chartColors, useBizStore, useChanged, useSubject, DataSetGroup, BizDatePickerV2, BizPlatformSelector };
52
+ import SubjectWrapper from './subjectWrapper';
53
+ import StyleList from './addToPanel/components/styleList';
54
+ import BizEditText from './layout/optionTitle/components/title';
55
+ import ValuesList from './attrConditions/components/valuesList';
56
+ export { BizTargetDimension, BizTargetFromPanel, BizSearchInput, BizSelect, BizDialog, BizChart, BizTable, BizLayout, BizAnalysisLayout, BizDetailLayout, BizUserGroup, BizUserGroupHeader, IconFont, ColorIcon, BizFormulaTarget, BizAUMFormulaTarget, BizTargetSelector, BizEventSelector, BizAttributeSelector, BizGlobalDataContext, BizTargetFromPanelContext, BizTargetCondition, BizDatePicker, BizQuickDatePicker, BizLoading, BizEmpty, BizConditionItem, BizConditionGroup, BizAttrCondition, BizAttrConditionGroup, BizUserCondition, BizProductCondition, BizAddToScene, BizAddToPanel, BizCycleTime, BizDnd, BizLoginForm, DemoWrapper, SocketClient, ajax, util, base64, theme, convertAttributeData, BizUserTagsSelect, setGlobalConfig, chartColors, useBizStore, useChanged, useSubject, DataSetGroup, BizDatePickerV2, BizPlatformSelector, SubjectWrapper, StyleList, BizEditText, ValuesList };
@@ -4,24 +4,57 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
4
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
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
6
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
7
- import React, { useState, useEffect } from 'react';
7
+ import React, { useState, useEffect, useContext } from 'react';
8
8
  import { BizSelect } from '@zgfe/business-lib';
9
- import { platformOption } from './util';
10
9
  import './styles/index.less';
10
+ import request from '../utils/ajax';
11
+ import Apis from '../constants/apis';
12
+ import BizGlobalDataContext from '../context';
13
+ import { platformOptionUtil } from './util';
11
14
  var BizPlatformSelector = function BizPlatformSelector(props) {
12
15
  var classPrefix = 'biz-platform-selector';
13
16
  var _useState = useState(),
14
17
  _useState2 = _slicedToArray(_useState, 2),
15
18
  currentValue = _useState2[0],
16
19
  setCurrentValue = _useState2[1];
20
+ var _useContext = useContext(BizGlobalDataContext),
21
+ currentApp = _useContext.currentApp;
22
+ var _useState3 = useState([]),
23
+ _useState4 = _slicedToArray(_useState3, 2),
24
+ platformOption = _useState4[0],
25
+ setPlatformOption = _useState4[1];
17
26
  useEffect(function () {
18
- if (props.value) {
19
- var selectValue = platformOption.find(function (item) {
20
- return item.key === props.value;
21
- });
22
- setCurrentValue(selectValue || platformOption[0]);
23
- }
24
- }, [props.value]);
27
+ queryPlatformList();
28
+ }, []);
29
+ function queryPlatformList() {
30
+ request(Apis.queryPlatformList, {
31
+ method: 'get',
32
+ params: {
33
+ appId: currentApp === null || currentApp === void 0 ? void 0 : currentApp.appId
34
+ }
35
+ }).then(function (res) {
36
+ var _res$data;
37
+ if (res === null || res === void 0 ? void 0 : (_res$data = res.data) === null || _res$data === void 0 ? void 0 : _res$data.length) {
38
+ var list = res.data.map(function (item) {
39
+ return item.sdkPlatform;
40
+ });
41
+ var options = platformOptionUtil.map(function (item) {
42
+ if (list.includes(item.key) || item.key === 0) {
43
+ return item;
44
+ }
45
+ }).filter(function (item) {
46
+ return item;
47
+ });
48
+ setPlatformOption(options || []);
49
+ if (props.value) {
50
+ var selectValue = options.find(function (item) {
51
+ return item.key === props.value;
52
+ });
53
+ setCurrentValue(selectValue || options[0]);
54
+ }
55
+ }
56
+ });
57
+ }
25
58
  return /*#__PURE__*/React.createElement("div", {
26
59
  className: classPrefix
27
60
  }, /*#__PURE__*/React.createElement(BizSelect, {
@@ -1,13 +1,17 @@
1
1
  @import '../../assets/styles/inner.less';
2
2
  .biz-platform-selector {
3
3
  width: 134px;
4
- border: 1px solid #f2f3f4;
5
- border-radius: 4px;
4
+ box-shadow: 0 2px 0 rgba(0, 0, 0, 0.015);
6
5
  .biz-platform-selector-select .biz-select-handle-input {
7
6
  background-color: #fff;
7
+ border: 1px solid #ecedf0;
8
8
  .biz-select-handle-content .biz-select-handle-icon .bsicon {
9
9
  color: #9aa1a9;
10
10
  }
11
+ .biz-select-handle-content-label {
12
+ display: flex;
13
+ align-items: center;
14
+ }
11
15
  }
12
16
  }
13
17
  .biz-platform-selector-select-overlay .biz-select-list-panel .biz-select-option {
@@ -1,2 +1,2 @@
1
1
  import { platItemProp } from './types';
2
- export declare const platformOption: platItemProp[];
2
+ export declare const platformOptionUtil: platItemProp[];
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import { IconFont } from '@zgfe/business-lib';
3
- export var platformOption = [{
3
+ export var platformOptionUtil = [{
4
4
  key: 0,
5
5
  value: '全部平台'
6
6
  }, {
@@ -38,6 +38,13 @@ export var platformOption = [{
38
38
  type: "fuwuqi",
39
39
  size: 16
40
40
  })
41
+ }, {
42
+ key: 6,
43
+ value: '鸿蒙',
44
+ icon: /*#__PURE__*/React.createElement(IconFont, {
45
+ type: "hongmeng",
46
+ size: 16
47
+ })
41
48
  }, {
42
49
  key: -1,
43
50
  value: '其他'
@@ -26,7 +26,7 @@ var RunPeriodCondition = function RunPeriodCondition(props) {
26
26
  }];
27
27
  function onOperatorChange(option) {
28
28
  var newData = {
29
- operator: option.value
29
+ operator: option === null || option === void 0 ? void 0 : option.value
30
30
  };
31
31
  if (newData.operator === 'absolute') {
32
32
  var endDate = moment().format('YYYY-MM-DD');
@@ -38,7 +38,7 @@ var PeriodCondition = function PeriodCondition(props) {
38
38
  }
39
39
  function onOperatorChange(option) {
40
40
  var newData = {
41
- operator: option.value
41
+ operator: option === null || option === void 0 ? void 0 : option.value
42
42
  };
43
43
  if (newData.operator === 'absolute') {
44
44
  var endDate = moment().format('YYYY-MM-DD');
@@ -34,7 +34,7 @@ var RunTimesCondition = function RunTimesCondition(props) {
34
34
  onChange = props.onChange;
35
35
  function onOperatorChange(data) {
36
36
  onChange(_objectSpread(_objectSpread({}, runTimes), {}, {
37
- operator: data.value
37
+ operator: data === null || data === void 0 ? void 0 : data.value
38
38
  }));
39
39
  }
40
40
  function onValueChange(e) {
@@ -1,5 +1,5 @@
1
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
- var _excluded = ["overlayWidth", "minDropdownWidth", "labelField", "aliasField", "keyField"];
2
+ var _excluded = ["overlayWidth", "minDropdownWidth", "labelField", "aliasField", "keyField", "enableClear"];
3
3
  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; }
4
4
  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; }
5
5
  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; }
@@ -27,6 +27,7 @@ var BizSelect = function BizSelect(props) {
27
27
  labelField = props.labelField,
28
28
  aliasField = props.aliasField,
29
29
  keyField = props.keyField,
30
+ enableClear = props.enableClear,
30
31
  res = _objectWithoutProperties(props, _excluded);
31
32
  var _useState = useState(),
32
33
  _useState2 = _slicedToArray(_useState, 2),
@@ -147,6 +148,12 @@ var BizSelect = function BizSelect(props) {
147
148
  setVisible(true);
148
149
  props.onVisibleChange && props.onVisibleChange(true);
149
150
  };
151
+ var onSelectDelete = function onSelectDelete() {
152
+ if (enableClear) {
153
+ setCurrent(undefined);
154
+ if (props.onChange) props.onChange(undefined);
155
+ }
156
+ };
150
157
  return /*#__PURE__*/React.createElement(Dropdown, {
151
158
  dropdownRender: function dropdownRender() {
152
159
  return /*#__PURE__*/React.createElement(SelectOverlay, _objectSpread(_objectSpread({}, res), {}, {
@@ -197,6 +204,7 @@ var BizSelect = function BizSelect(props) {
197
204
  setSearchValue(v);
198
205
  if (props.onSearch) props.onSearch(v);
199
206
  },
207
+ onSelectDelete: enableClear ? onSelectDelete : undefined,
200
208
  onCreate: onCreate,
201
209
  onVisible: onVisible,
202
210
  disableItemList: props.disableItemList
@@ -13,7 +13,7 @@ export declare namespace BizSelectTypes {
13
13
  disable?: boolean;
14
14
  placeholder?: string;
15
15
  defaultValue?: Option | Option[];
16
- value?: Option | Option[];
16
+ value?: Option | Option[] | undefined;
17
17
  className?: string;
18
18
  type?: 'group' | 'normal';
19
19
  theme?: 'secondary' | 'borderless';
@@ -42,7 +42,8 @@ export declare namespace BizSelectTypes {
42
42
  showSelectIcon?: boolean;
43
43
  loading?: boolean;
44
44
  status?: string;
45
- onChange?: (val: Option) => void;
45
+ enableClear?: boolean;
46
+ onChange?: (val: Option | any) => void;
46
47
  onVisibleChange?: (visible: boolean) => void;
47
48
  destroyPopupOnHide?: boolean;
48
49
  customLabel?: (node: ReactNode, option: Option) => ReactNode;
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ declare const _default: () => React.JSX.Element;
3
+ export default _default;
@@ -0,0 +1,28 @@
1
+ import React, { useContext } from 'react';
2
+ import { SubjectWrapper, BizGlobalDataContext, useChanged } from '@zgfe/business-lib';
3
+ function Test() {
4
+ var _useContext = useContext(BizGlobalDataContext),
5
+ currentApp = _useContext.currentApp,
6
+ currentProject = _useContext.currentProject;
7
+ useChanged(function () {
8
+ console.log('currentApp changed', currentApp);
9
+ }, currentApp);
10
+ return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
11
+ style: {
12
+ margin: '20px',
13
+ padding: '20px 20px 10px 20px',
14
+ background: 'pink'
15
+ }
16
+ }, /*#__PURE__*/React.createElement("p", null, " \u5F53\u524D\u5E94\u7528\u540D\u79F0: ", currentProject === null || currentProject === void 0 ? void 0 : currentProject.projectName), /*#__PURE__*/React.createElement("p", null, " \u5F53\u524D\u5E94\u7528id: ", currentProject === null || currentProject === void 0 ? void 0 : currentProject.projectId)), /*#__PURE__*/React.createElement("div", {
17
+ style: {
18
+ margin: '20px',
19
+ padding: '20px 20px 10px 20px',
20
+ background: '#FFEB3B'
21
+ }
22
+ }, /*#__PURE__*/React.createElement("p", null, " \u5F53\u524D\u4E3B\u4F53\u540D\u79F0: ", currentApp === null || currentApp === void 0 ? void 0 : currentApp.appName), /*#__PURE__*/React.createElement("p", null, " \u5F53\u524D\u4E3B\u4F53id: ", currentApp === null || currentApp === void 0 ? void 0 : currentApp.id)));
23
+ }
24
+ export default (function () {
25
+ return /*#__PURE__*/React.createElement(SubjectWrapper, {
26
+ needMeta: true
27
+ }, /*#__PURE__*/React.createElement(Test, null));
28
+ });
@@ -0,0 +1,5 @@
1
+ import React from 'react';
2
+ import DemoWrapperTypes from './types';
3
+ import './index.less';
4
+ declare const SubjectWrapper: React.FC<DemoWrapperTypes.Props>;
5
+ export default SubjectWrapper;
@@ -0,0 +1,98 @@
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 { Spin } from 'antd';
14
+ import BizGlobalDataContext from '../context';
15
+ import React, { useEffect, useState, useContext, Fragment } from 'react';
16
+ import useBizStore from '../hooks/useBizStore';
17
+ import './index.less';
18
+ var SubjectWrapper = function SubjectWrapper(_ref) {
19
+ var children = _ref.children,
20
+ className = _ref.className,
21
+ defaultApp = _ref.defaultApp,
22
+ needMeta = _ref.needMeta,
23
+ contextProps = _ref.contextProps;
24
+ if (!needMeta || defaultApp === undefined) {
25
+ return /*#__PURE__*/React.createElement(Fragment, null, children);
26
+ }
27
+ var globalData = useContext(BizGlobalDataContext);
28
+ var _useState = useState(true),
29
+ _useState2 = _slicedToArray(_useState, 2),
30
+ loading = _useState2[0],
31
+ setLoading = _useState2[1];
32
+ var _useState3 = useState(globalData.currentApp),
33
+ _useState4 = _slicedToArray(_useState3, 2),
34
+ currentApp = _useState4[0],
35
+ setCurrentApp = _useState4[1];
36
+ var _useBizStore = useBizStore({
37
+ currentApp: currentApp
38
+ }),
39
+ useBizStoreLoading = _useBizStore.useBizStoreLoading,
40
+ eventGroupList = _useBizStore.eventGroupList,
41
+ userPropList = _useBizStore.userPropList,
42
+ envPropList = _useBizStore.envPropList,
43
+ eventNameMap = _useBizStore.eventNameMap,
44
+ eventIdMap = _useBizStore.eventIdMap,
45
+ userGroupList = _useBizStore.userGroupList,
46
+ groupLoading = _useBizStore.groupLoading,
47
+ setUserGroupList = _useBizStore.setUserGroupList,
48
+ tagList = _useBizStore.tagList,
49
+ tagLoading = _useBizStore.tagLoading,
50
+ setTagList = _useBizStore.setTagList,
51
+ queryGroups = _useBizStore.queryGroups,
52
+ queryTags = _useBizStore.queryTags;
53
+ useEffect(function () {
54
+ appInfo(globalData.projectList);
55
+ }, [defaultApp]);
56
+ var appInfo = function appInfo(data) {
57
+ var hasDefaultApp = false;
58
+ if (defaultApp) {
59
+ data.map(function (item) {
60
+ item.appList.map(function (_item) {
61
+ if (defaultApp === _item.id) {
62
+ hasDefaultApp = true;
63
+ setCurrentApp(_item);
64
+ }
65
+ });
66
+ });
67
+ } else {
68
+ setCurrentApp(data[0].appList[0]);
69
+ }
70
+ if (!hasDefaultApp) {
71
+ setCurrentApp(data[0].appList[0]);
72
+ }
73
+ setLoading(false);
74
+ };
75
+ return /*#__PURE__*/React.createElement("div", {
76
+ className: "lib-subjectWrapper ".concat(className, " ").concat(useBizStoreLoading ? 'lib-subjectWrapper-loading' : '')
77
+ }, (useBizStoreLoading || loading) && /*#__PURE__*/React.createElement(Spin, null), !(useBizStoreLoading || loading) && /*#__PURE__*/React.createElement(BizGlobalDataContext.Provider, {
78
+ value: _objectSpread(_objectSpread({}, globalData), {}, {
79
+ currentApp: _objectSpread(_objectSpread({}, currentApp), {}, {
80
+ appId: currentApp === null || currentApp === void 0 ? void 0 : currentApp.id
81
+ }),
82
+ eventGroupList: eventGroupList,
83
+ userPropList: userPropList,
84
+ eventEnvList: envPropList,
85
+ eventIdMap: eventIdMap,
86
+ eventNameMap: eventNameMap,
87
+ userGroupList: userGroupList,
88
+ groupLoading: groupLoading,
89
+ setUserGroupList: setUserGroupList,
90
+ tagList: tagList,
91
+ tagLoading: tagLoading,
92
+ setTagList: setTagList,
93
+ queryGroups: queryGroups,
94
+ queryTags: queryTags
95
+ }, contextProps)
96
+ }, children));
97
+ };
98
+ export default SubjectWrapper;
@@ -0,0 +1,12 @@
1
+ @import '~antd/dist/antd.less';
2
+ @import '../assets/iconfont/iconfont.css';
3
+ @import '../assets/styles/resetAntd.less';
4
+ .lib-subjectWrapper {
5
+ width: 100%;
6
+ height: 100%;
7
+ &-loading {
8
+ display: flex;
9
+ align-items: center;
10
+ justify-content: center;
11
+ }
12
+ }
@@ -0,0 +1,14 @@
1
+ import React, { ReactNode } from 'react';
2
+ import { GlobalContextProps } from '../context';
3
+ declare namespace DemoWrapperTypes {
4
+ interface Props {
5
+ className?: string;
6
+ defaultApp?: number;
7
+ needMeta?: boolean;
8
+ children?: ReactNode;
9
+ contextProps?: GlobalContextProps;
10
+ projectList?: any;
11
+ }
12
+ }
13
+ export declare const Props: React.FC<DemoWrapperTypes.Props>;
14
+ export default DemoWrapperTypes;
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ export var Props = function Props() {
3
+ return /*#__PURE__*/React.createElement(React.Fragment, null);
4
+ };
@@ -21,7 +21,7 @@ import { BuiltinIndicators } from '../constants/common';
21
21
  import { BizAttrConditionGroup, IconFont } from '..';
22
22
  export var classPrefix = 'biz-target';
23
23
  var BizTargetCondition = function BizTargetCondition(props) {
24
- var _targetData$value3, _targetData$value3$gr, _targetData$value4, _targetData$value4$ev, _targetData$value5, _targetData$value5$ev, _targetData$value6, _targetData$value6$ev, _targetData$value7, _targetData$value8, _targetData$value8$ev, _targetData$value9, _targetData$value9$ev;
24
+ var _targetData$value3, _targetData$value3$gr, _targetData$value4, _targetData$value4$ev, _targetData$value5, _targetData$value5$ev, _targetData$value6, _targetData$value6$ev, _targetData$value7, _targetData$value8, _targetData$value8$ev, _targetData$value9, _targetData$value9$ev, _targetData$value10, _targetData$value10$e, _targetData$value11, _targetData$value11$e;
25
25
  var max = props.max;
26
26
  var _useState = useState(),
27
27
  _useState2 = _slicedToArray(_useState, 2),
@@ -30,7 +30,8 @@ var BizTargetCondition = function BizTargetCondition(props) {
30
30
  var _useContext = useContext(BizGlobalDataContext),
31
31
  _useContext$eventGrou = _useContext.eventGroupList,
32
32
  eventGroupList = _useContext$eventGrou === void 0 ? [] : _useContext$eventGrou,
33
- currentApp = _useContext.currentApp;
33
+ currentApp = _useContext.currentApp,
34
+ eventIdMap = _useContext.eventIdMap;
34
35
  var _useState3 = useState({
35
36
  analysisIndex: 'number'
36
37
  }),
@@ -254,13 +255,13 @@ var BizTargetCondition = function BizTargetCondition(props) {
254
255
  className: "".concat(classPrefix, "-icon delete ").concat(!(props.enableDelete !== undefined ? props.enableDelete || !(targetData === null || targetData === void 0 ? void 0 : (_targetData$value7 = targetData.value) === null || _targetData$value7 === void 0 ? void 0 : _targetData$value7.event) : enableDelete) ? 'disabled' : ''),
255
256
  type: "qingchu",
256
257
  onClick: onDelete
257
- })), (filters || isAdd) && /*#__PURE__*/React.createElement(BizAttrConditionGroup, {
258
+ })), (targetData === null || targetData === void 0 ? void 0 : (_targetData$value8 = targetData.value) === null || _targetData$value8 === void 0 ? void 0 : (_targetData$value8$ev = _targetData$value8.event) === null || _targetData$value8$ev === void 0 ? void 0 : _targetData$value8$ev.id) && eventIdMap && eventIdMap[targetData === null || targetData === void 0 ? void 0 : (_targetData$value9 = targetData.value) === null || _targetData$value9 === void 0 ? void 0 : (_targetData$value9$ev = _targetData$value9.event) === null || _targetData$value9$ev === void 0 ? void 0 : _targetData$value9$ev.id] && (filters || isAdd) && /*#__PURE__*/React.createElement(BizAttrConditionGroup, {
258
259
  ref: conditionRef,
259
260
  value: filters,
260
261
  onlyAnd: props.onlyAnd,
261
262
  enableEventProp: true,
262
263
  enableDelete: true,
263
- eventIdList: (targetData === null || targetData === void 0 ? void 0 : (_targetData$value8 = targetData.value) === null || _targetData$value8 === void 0 ? void 0 : (_targetData$value8$ev = _targetData$value8.event) === null || _targetData$value8$ev === void 0 ? void 0 : _targetData$value8$ev.id) ? [targetData === null || targetData === void 0 ? void 0 : (_targetData$value9 = targetData.value) === null || _targetData$value9 === void 0 ? void 0 : (_targetData$value9$ev = _targetData$value9.event) === null || _targetData$value9$ev === void 0 ? void 0 : _targetData$value9$ev.id] : undefined,
264
+ eventIdList: (targetData === null || targetData === void 0 ? void 0 : (_targetData$value10 = targetData.value) === null || _targetData$value10 === void 0 ? void 0 : (_targetData$value10$e = _targetData$value10.event) === null || _targetData$value10$e === void 0 ? void 0 : _targetData$value10$e.id) ? [targetData === null || targetData === void 0 ? void 0 : (_targetData$value11 = targetData.value) === null || _targetData$value11 === void 0 ? void 0 : (_targetData$value11$e = _targetData$value11.event) === null || _targetData$value11$e === void 0 ? void 0 : _targetData$value11$e.id] : undefined,
264
265
  onChange: onChangeFilters,
265
266
  onConditionsCount: setCount
266
267
  })));
@@ -14,7 +14,6 @@ var ConditionTypeList = function ConditionTypeList(props) {
14
14
  openTagCondition = _useContext.openTagCondition,
15
15
  openCdpCondition = _useContext.openCdpCondition,
16
16
  openBusinessDataCondition = _useContext.openBusinessDataCondition,
17
- openOrderDataCondition = _useContext.openOrderDataCondition,
18
17
  openCondition = _useContext.openCondition,
19
18
  cdpTip = _useContext.cdpTip;
20
19
  var _useContext2 = useContext(BizGlobalDataContext),
@@ -92,15 +91,7 @@ var ConditionTypeList = function ConditionTypeList(props) {
92
91
  }
93
92
  }, /*#__PURE__*/React.createElement(Space, {
94
93
  key: "business"
95
- }, /*#__PURE__*/React.createElement(PlusOutlined, null), /*#__PURE__*/React.createElement("span", null, "\u4E1A\u52A1\u6570\u636E"))) : null, (currentApp === null || currentApp === void 0 ? void 0 : currentApp.type) === 'user' && (openOrderDataCondition || (currentUser === null || currentUser === void 0 ? void 0 : currentUser.serviceType) === 0 || (currentUser === null || currentUser === void 0 ? void 0 : currentUser.serviceType) === 2) ? /*#__PURE__*/React.createElement("li", {
96
- className: "condition-type",
97
- key: "order",
98
- onClick: function onClick() {
99
- return onAdd('order');
100
- }
101
- }, /*#__PURE__*/React.createElement(Space, {
102
- key: "order"
103
- }, /*#__PURE__*/React.createElement(PlusOutlined, null), /*#__PURE__*/React.createElement("span", null, "\u8BA2\u5355\u6570\u636E"))) : null));
94
+ }, /*#__PURE__*/React.createElement(PlusOutlined, null), /*#__PURE__*/React.createElement("span", null, "\u4E1A\u52A1\u6570\u636E"))) : null));
104
95
  };
105
96
  ConditionTypeList.defaultProps = {
106
97
  show: true
@@ -45,12 +45,7 @@ var BusinessCondition = function BusinessCondition(props) {
45
45
  key: 'time dimension'
46
46
  }]);
47
47
  }
48
- if (label === '订单数据' && condition.attrs.length < 6) {
49
- items = items.concat([{
50
- label: '订单属性',
51
- key: 'order attribute'
52
- }]);
53
- } else if (label === '业务数据' && condition.attrs.length < 6) {
48
+ if (label === '业务数据' && condition.attrs.length < 6) {
54
49
  items = items.concat([{
55
50
  label: '业务属性',
56
51
  key: 'service attribute'
@@ -162,9 +157,7 @@ var BusinessCondition = function BusinessCondition(props) {
162
157
  },
163
158
  overlayWidth: 120,
164
159
  onChange: onServiceAttributeChange
165
- })) : null, label === '订单数据' ? /*#__PURE__*/React.createElement("div", {
166
- className: "".concat(classPrefix, "-period-condition-label")
167
- }, label) : /*#__PURE__*/React.createElement("div", {
160
+ })) : null, /*#__PURE__*/React.createElement("div", {
168
161
  className: "".concat(classPrefix, "-period-condition-label")
169
162
  }, serviceAttribute === null || serviceAttribute === void 0 ? void 0 : serviceAttribute.name), /*#__PURE__*/React.createElement("div", {
170
163
  className: "".concat(classPrefix, "-period-condition-values")
@@ -226,7 +219,7 @@ var BusinessCondition = function BusinessCondition(props) {
226
219
  }, /*#__PURE__*/React.createElement(IconFont, {
227
220
  type: "qingchu"
228
221
  }))));
229
- }), condition.typeId && label === '业务数据' || label === '订单数据' ? /*#__PURE__*/React.createElement("div", null, ((_condition$timeDimens4 = condition.timeDimensions) === null || _condition$timeDimens4 === void 0 ? void 0 : _condition$timeDimens4.length) !== 3 || ((_condition$attrs2 = condition.attrs) === null || _condition$attrs2 === void 0 ? void 0 : _condition$attrs2.length) !== 6 ? /*#__PURE__*/React.createElement("div", {
222
+ }), condition.typeId && label === '业务数据' ? /*#__PURE__*/React.createElement("div", null, ((_condition$timeDimens4 = condition.timeDimensions) === null || _condition$timeDimens4 === void 0 ? void 0 : _condition$timeDimens4.length) !== 3 || ((_condition$attrs2 = condition.attrs) === null || _condition$attrs2 === void 0 ? void 0 : _condition$attrs2.length) !== 6 ? /*#__PURE__*/React.createElement("div", {
230
223
  style: {
231
224
  margin: '2px 0 0 65px',
232
225
  color: '#4075fd',