@zgfe/business-lib 1.0.18 → 1.0.19

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 (104) hide show
  1. package/es/addToPanel/index.js +1 -0
  2. package/es/addToScene/index.js +1 -0
  3. package/es/assets/styles/chunks.less +3 -4
  4. package/es/assets/styles/resetAntd.less +47 -11
  5. package/es/attrConditions/components/operateList.d.ts +1 -0
  6. package/es/attrConditions/components/operateList.js +2 -2
  7. package/es/attrConditions/components/stringList.d.ts +1 -0
  8. package/es/attrConditions/components/stringList.js +2 -2
  9. package/es/attrConditions/components/valuesList.d.ts +1 -1
  10. package/es/attrConditions/components/valuesList.js +11 -12
  11. package/es/attrConditions/demo/group.js +13 -1
  12. package/es/attrConditions/group.js +14 -0
  13. package/es/attrConditions/index.js +16 -5
  14. package/es/attrConditions/styles/index.less +39 -5
  15. package/es/attrConditions/types.d.ts +4 -0
  16. package/es/attrConditions/utils/operates.js +2 -2
  17. package/es/attributeSelector/index.js +8 -4
  18. package/es/attributeSelector/listPanel.js +32 -19
  19. package/es/attributeSelector/styles/index.less +3 -3
  20. package/es/attributeSelector/types.d.ts +7 -0
  21. package/es/attributeSelector/types.js +8 -1
  22. package/es/attributeSelector/util.js +3 -2
  23. package/es/eventSelector/index.js +10 -4
  24. package/es/eventSelector/listPanel.js +18 -23
  25. package/es/eventSelector/styles/index.less +5 -5
  26. package/es/eventSelector/types.d.ts +4 -0
  27. package/es/index.d.ts +2 -1
  28. package/es/index.js +2 -1
  29. package/es/mock/event.js +214 -0
  30. package/es/select/demo/children.d.ts +2 -0
  31. package/es/select/demo/children.js +81 -0
  32. package/es/select/demo/customLabel.d.ts +2 -0
  33. package/es/select/demo/customLabel.js +23 -0
  34. package/es/select/demo/index.js +10 -4
  35. package/es/select/demo/multiple.js +10 -3
  36. package/es/select/handle.js +4 -2
  37. package/es/select/index.d.ts +2 -2
  38. package/es/select/index.js +7 -5
  39. package/es/select/option.js +8 -2
  40. package/es/select/overlay.js +5 -3
  41. package/es/select/styles/handle.less +23 -13
  42. package/es/select/types.d.ts +5 -1
  43. package/es/userCondition/conditionTypeList.js +29 -6
  44. package/es/userCondition/conditionWrap.js +4 -2
  45. package/es/userCondition/conditions/constants.d.ts +24 -0
  46. package/es/userCondition/conditions/constants.js +41 -0
  47. package/es/userCondition/conditions/eventCondition.js +13 -4
  48. package/es/userCondition/conditions/periodCondition.js +21 -10
  49. package/es/userCondition/conditions/propCondition.js +25 -6
  50. package/es/userCondition/conditions/runTimesCondition.js +2 -2
  51. package/es/userCondition/conditions/styles/eventCondition.less +9 -7
  52. package/es/userCondition/conditions/styles/periodCondition.less +12 -0
  53. package/es/userCondition/conditions/styles/propCondition.less +11 -3
  54. package/es/userCondition/conditions/styles/runTimesCondition.less +3 -0
  55. package/es/userCondition/conditions/styles/tagsCondition.less +20 -0
  56. package/es/userCondition/conditions/styles/textDesc.less +17 -0
  57. package/es/userCondition/conditions/tagsCondition.d.ts +9 -0
  58. package/es/userCondition/conditions/tagsCondition.js +107 -0
  59. package/es/userCondition/conditions/textDesc.d.ts +9 -0
  60. package/es/userCondition/conditions/textDesc.js +241 -0
  61. package/es/userCondition/demo/index.js +259 -31
  62. package/es/userCondition/index.d.ts +1 -1
  63. package/es/userCondition/index.js +52 -10
  64. package/es/userCondition/orConditions.js +69 -28
  65. package/es/userCondition/relationLabel.js +6 -1
  66. package/es/userCondition/styles/conditionTypeList.less +1 -1
  67. package/es/userCondition/styles/conditionWrap.less +3 -0
  68. package/es/userCondition/styles/index.less +21 -1
  69. package/es/userCondition/styles/orConditions.less +20 -2
  70. package/es/userCondition/styles/relationLabel.less +5 -4
  71. package/es/userCondition/types.d.ts +28 -2
  72. package/es/userCondition/util.d.ts +5 -1
  73. package/es/userCondition/util.js +42 -0
  74. package/es/userTagsSelector/cascaderOverlay.d.ts +5 -0
  75. package/es/userTagsSelector/cascaderOverlay.js +114 -0
  76. package/es/userTagsSelector/components/search/index.d.ts +8 -0
  77. package/es/userTagsSelector/components/search/index.js +16 -0
  78. package/es/userTagsSelector/components/search/index.less +6 -0
  79. package/es/userTagsSelector/context.d.ts +3 -0
  80. package/es/userTagsSelector/context.js +2 -0
  81. package/es/userTagsSelector/demo/index.d.ts +2 -0
  82. package/es/userTagsSelector/demo/index.js +48 -0
  83. package/es/userTagsSelector/groups/groupOption.d.ts +5 -0
  84. package/es/userTagsSelector/groups/groupOption.js +42 -0
  85. package/es/userTagsSelector/groups/index.d.ts +4 -0
  86. package/es/userTagsSelector/groups/index.js +86 -0
  87. package/es/userTagsSelector/groups/styles/index.less +0 -0
  88. package/es/userTagsSelector/groups/styles/option.less +50 -0
  89. package/es/userTagsSelector/index.d.ts +6 -0
  90. package/es/userTagsSelector/index.js +110 -0
  91. package/es/userTagsSelector/multipleCheckPanel/checkOption.d.ts +5 -0
  92. package/es/userTagsSelector/multipleCheckPanel/checkOption.js +45 -0
  93. package/es/userTagsSelector/multipleCheckPanel/index.d.ts +4 -0
  94. package/es/userTagsSelector/multipleCheckPanel/index.js +80 -0
  95. package/es/userTagsSelector/multipleCheckPanel/styles/index.less +0 -0
  96. package/es/userTagsSelector/multipleCheckPanel/styles/option.less +40 -0
  97. package/es/userTagsSelector/styles/cascaderOverlay.less +27 -0
  98. package/es/userTagsSelector/styles/index.less +10 -0
  99. package/es/userTagsSelector/types.d.ts +67 -0
  100. package/es/userTagsSelector/types.js +1 -0
  101. package/es/userTagsSelector/util.d.ts +4 -0
  102. package/es/userTagsSelector/util.js +38 -0
  103. package/es/utils/type.d.ts +2 -2
  104. package/package.json +6 -7
@@ -10,11 +10,221 @@ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Sy
10
10
 
11
11
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
12
12
 
13
- import React, { useEffect, useState } from 'react';
13
+ import React, { useEffect, useMemo, useState } from 'react';
14
14
  import eventData from '../../mock/event';
15
15
  import envData from '../../mock/env';
16
16
  import userData from '../../mock/user';
17
17
  import { BizUserCondition, BizGlobalDataContext, convertAttributeData } from '@zgfe/business-lib';
18
+ var getTagList = Promise.resolve([{
19
+ appId: 51,
20
+ createTime: '2022-07-05T13:48:51',
21
+ del: 0,
22
+ id: 286,
23
+ isInner: 0,
24
+ isStartup: 0,
25
+ labelGroup: '行为标签',
26
+ labelId: 66284406603776,
27
+ labelName: 'test8(新增)',
28
+ labelStatus: 1,
29
+ updateTime: '2022-07-05T13:48:51'
30
+ }, {
31
+ appId: 51,
32
+ createTime: '2022-07-05T13:47:38',
33
+ del: 0,
34
+ id: 285,
35
+ isInner: 0,
36
+ isStartup: 0,
37
+ labelGroup: '预测标签',
38
+ labelId: 66283215683584,
39
+ labelName: 'test7(新增)',
40
+ labelStatus: 1,
41
+ updateTime: '2022-07-05T13:47:38'
42
+ }, {
43
+ appId: 51,
44
+ createTime: '2022-07-05T13:47:10',
45
+ del: 0,
46
+ id: 284,
47
+ isInner: 0,
48
+ isStartup: 0,
49
+ labelGroup: '其他标签',
50
+ labelId: 66282747314176,
51
+ labelName: 'test6(新增)',
52
+ labelStatus: 1,
53
+ updateTime: '2022-07-05T13:47:10'
54
+ }, {
55
+ appId: 51,
56
+ createTime: '2022-07-05T13:44:20',
57
+ del: 0,
58
+ id: 283,
59
+ isInner: 0,
60
+ isStartup: 0,
61
+ labelGroup: '其他标签',
62
+ labelId: 66279963361280,
63
+ labelName: 'test5(新增)',
64
+ labelStatus: 1,
65
+ updateTime: '2022-07-05T13:44:20'
66
+ }, {
67
+ appId: 51,
68
+ createTime: '2022-07-05T13:43:08',
69
+ del: 0,
70
+ id: 282,
71
+ isInner: 0,
72
+ isStartup: 0,
73
+ labelGroup: '活跃标签',
74
+ labelId: 66278784057344,
75
+ labelName: 'test3(新增)',
76
+ labelStatus: 1,
77
+ updateTime: '2022-07-05T13:43:08'
78
+ }, {
79
+ appId: 51,
80
+ createTime: '2022-07-05T13:42:44',
81
+ del: 0,
82
+ id: 281,
83
+ isInner: 0,
84
+ isStartup: 0,
85
+ labelGroup: '其他标签',
86
+ labelId: 66278393724928,
87
+ labelName: 'test2(新增)',
88
+ labelStatus: 1,
89
+ updateTime: '2022-07-05T13:42:44'
90
+ }, {
91
+ appId: 51,
92
+ createTime: '2022-07-05T13:42:30',
93
+ del: 0,
94
+ id: 280,
95
+ isInner: 0,
96
+ isStartup: 0,
97
+ labelGroup: '预测标签',
98
+ labelId: 66278158696448,
99
+ labelName: 'test1(新增)',
100
+ labelStatus: 1,
101
+ updateTime: '2022-07-05T13:42:30'
102
+ }, {
103
+ appId: 51,
104
+ createTime: '2022-06-21T15:04:24',
105
+ del: 0,
106
+ id: 277,
107
+ isInner: 0,
108
+ isStartup: 0,
109
+ labelGroup: '活跃标签',
110
+ labelId: 46540583010304,
111
+ labelName: '匿名用户',
112
+ labelStatus: 0,
113
+ updateTime: '2022-06-21T15:04:24'
114
+ }, {
115
+ appId: 51,
116
+ createTime: '2022-06-10T11:10:52',
117
+ del: 0,
118
+ id: 197,
119
+ isInner: 0,
120
+ isStartup: 0,
121
+ labelGroup: '活跃标签',
122
+ labelId: 77384417755136,
123
+ labelName: '手动更新1',
124
+ labelStatus: 0,
125
+ updateTime: '2022-06-10T11:32:31'
126
+ }, {
127
+ appId: 51,
128
+ createTime: '2022-06-10T11:10:36',
129
+ del: 0,
130
+ id: 196,
131
+ isInner: 0,
132
+ isStartup: 0,
133
+ labelGroup: '活跃标签',
134
+ labelId: 77383474429952,
135
+ labelName: '自动更新修改',
136
+ labelStatus: 0,
137
+ updateTime: '2022-06-10T11:11:13'
138
+ }, {
139
+ appId: 51,
140
+ createTime: '2022-06-10T10:49:57',
141
+ del: 0,
142
+ id: 191,
143
+ isInner: 0,
144
+ isStartup: 0,
145
+ labelGroup: '基本标签',
146
+ labelId: 77388914425856,
147
+ labelName: '一般价值',
148
+ labelStatus: 0,
149
+ updateTime: '2022-06-10T10:49:57'
150
+ }]);
151
+ var data = {
152
+ json: [[{
153
+ eventId: '-4',
154
+ attrs: [],
155
+ runPeriod: {
156
+ operator: 'relative',
157
+ values: ['30', '1']
158
+ },
159
+ runTimes: {
160
+ operator: '>=',
161
+ values: ['1']
162
+ }
163
+ }, {
164
+ eventId: '-3',
165
+ attrs: [],
166
+ runPeriod: {
167
+ operator: 'absolute',
168
+ values: ['2022-07-13', '2022-07-19']
169
+ },
170
+ runTimes: {
171
+ operator: '>=',
172
+ values: ['1']
173
+ }
174
+ }], [{
175
+ attrs: [{
176
+ attrId: 0,
177
+ attrName: 'zg_id',
178
+ operator: '>',
179
+ params: ['20'],
180
+ attrType: 'cont-num',
181
+ category: 'fixed'
182
+ }]
183
+ }, {
184
+ attrs: [{
185
+ attrId: 0,
186
+ attrName: 'app_user_id',
187
+ operator: 'equal',
188
+ params: ['20'],
189
+ attrType: 'cont-string',
190
+ category: 'fixed'
191
+ }]
192
+ }], [{
193
+ attrs: [{
194
+ attrId: 0,
195
+ attrName: 'duration',
196
+ operator: 'not equal',
197
+ params: [1198800, '1'],
198
+ attrType: 'cont-num',
199
+ category: 'fixed'
200
+ }]
201
+ }, {
202
+ eventId: 24143017,
203
+ runTimes: {
204
+ operator: '>=',
205
+ values: ['1']
206
+ },
207
+ attrs: [{
208
+ attrId: 0,
209
+ attrName: 'resolution_l',
210
+ category: 'fixed',
211
+ operator: '>',
212
+ params: ['10'],
213
+ attrType: 'cont-num'
214
+ }, {
215
+ attrId: 30183430,
216
+ attrName: '扫码场景描述',
217
+ category: 'custom',
218
+ operator: 'equal',
219
+ params: ['Microsoft Edge', 'Safari', 'Apple WebKit'],
220
+ attrType: 'cont-string'
221
+ }],
222
+ runPeriod: {
223
+ operator: 'relative',
224
+ values: ['30', '0']
225
+ }
226
+ }]]
227
+ };
18
228
  export default (function () {
19
229
  var _useState = useState({
20
230
  eventGroupList: [],
@@ -24,6 +234,11 @@ export default (function () {
24
234
  _useState2 = _slicedToArray(_useState, 2),
25
235
  setStore = _useState2[1];
26
236
 
237
+ var _useState3 = useState([]),
238
+ _useState4 = _slicedToArray(_useState3, 2),
239
+ userTagsData = _useState4[0],
240
+ setUserTagsData = _useState4[1];
241
+
27
242
  var newStore = convertAttributeData({
28
243
  eventList: eventData,
29
244
  userPropList: userData,
@@ -32,42 +247,55 @@ export default (function () {
32
247
  useEffect(function () {
33
248
  setStore(newStore);
34
249
  }, []);
250
+ useEffect(function () {
251
+ var tagsMap = {};
252
+ getTagList.then(function (list) {
253
+ var data = [];
254
+ list.forEach(function (item) {
255
+ var labelGroup = item.labelGroup;
256
+
257
+ if (tagsMap[labelGroup]) {
258
+ tagsMap[labelGroup].push(item);
259
+ } else {
260
+ tagsMap[labelGroup] = [item];
261
+ data.push({
262
+ labelGroup: labelGroup,
263
+ children: tagsMap[labelGroup]
264
+ });
265
+ }
266
+ });
267
+ setUserTagsData(data);
268
+ });
269
+ }, []);
270
+ var defaultValue = useMemo(function () {
271
+ return data.json;
272
+ }, [data]);
35
273
 
36
- function onChange(data) {
37
- console.log(JSON.stringify(data));
274
+ function onChange(value) {
275
+ console.log(JSON.stringify(value));
38
276
  }
39
277
 
40
- var defaultValue = [[{
41
- eventId: 7086293,
42
- runTimes: {
43
- operator: '>=',
44
- values: ['1']
45
- },
46
- attrs: [{
47
- attrId: 30183425,
48
- operator: '=',
49
- params: ['Apple WebKit', 'Unknown'],
50
- attrType: 'cont-string'
51
- }, {
52
- attrId: 5461057,
53
- operator: '>',
54
- params: ['123'],
55
- attrType: 'cont-num'
56
- }],
57
- runPeriod: {
58
- operator: 'relative',
59
- values: ['30', '0']
60
- }
61
- }]];
278
+ var descDom = /*#__PURE__*/React.createElement(BizUserCondition, {
279
+ defaultValue: defaultValue,
280
+ onChange: onChange,
281
+ eventAttrNum: 3,
282
+ openTagCondition: true,
283
+ userTagsData: userTagsData,
284
+ isRealTime: true
285
+ });
62
286
  return /*#__PURE__*/React.createElement(BizGlobalDataContext.Provider, {
63
287
  value: {
64
288
  eventGroupList: newStore.eventGroupList,
65
289
  userPropList: newStore.userPropList,
66
- eventEnvList: newStore.envPropList
290
+ eventEnvList: newStore.envPropList,
291
+ currentApp: {
292
+ appId: 160,
293
+ platform: 0
294
+ }
67
295
  }
68
- }, /*#__PURE__*/React.createElement(BizUserCondition, {
69
- defaultValue: defaultValue,
70
- onChange: onChange,
71
- eventAttrNum: 3
72
- }));
296
+ }, /*#__PURE__*/React.createElement("div", {
297
+ style: {
298
+ display: 'inline-block'
299
+ }
300
+ }, descDom));
73
301
  });
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import { BizUserConditionT } from './types';
3
3
  import './styles/index.less';
4
- export declare const BizUserConditionContext: React.Context<Pick<BizUserConditionT.PropsI, "eventAttrNum" | "orConditionNum">>;
4
+ export declare const BizUserConditionContext: React.Context<BizUserConditionT.GlobalContext>;
5
5
  export declare const classPrefix = "biz-user-condition";
6
6
  declare const BizUserCondition: React.FC<BizUserConditionT.PropsI>;
7
7
  export default BizUserCondition;
@@ -18,21 +18,34 @@ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Sy
18
18
 
19
19
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
20
20
 
21
- import React, { createContext, useEffect, useState } from 'react';
21
+ import React, { createContext, useContext, useEffect, useMemo, useState } from 'react';
22
22
  import ConditionTypeList from './conditionTypeList';
23
23
  import RelationLabel from './relationLabel';
24
24
  import OrConditions from './orConditions';
25
25
  import './styles/index.less';
26
26
  import { buildCondition } from './util';
27
+ import _ from 'lodash';
28
+ import BizGlobalDataContext from '../context';
27
29
  export var BizUserConditionContext = /*#__PURE__*/createContext({
28
30
  orConditionNum: 2,
29
- eventAttrNum: 1
31
+ eventAttrNum: 1,
32
+ textMode: false,
33
+ openTagCondition: false,
34
+ userTagsData: [],
35
+ envNameList: [],
36
+ userPropsMap: {}
30
37
  });
31
38
  export var classPrefix = 'biz-user-condition';
32
39
 
33
40
  var BizUserCondition = function BizUserCondition(props) {
41
+ var _useContext = useContext(BizGlobalDataContext),
42
+ eventEnvList = _useContext.eventEnvList,
43
+ userPropList = _useContext.userPropList;
44
+
34
45
  var andConditionNum = props.andConditionNum,
35
- defaultValue = props.defaultValue;
46
+ defaultValue = props.defaultValue,
47
+ openTagCondition = props.openTagCondition,
48
+ userTagsData = props.userTagsData;
36
49
 
37
50
  var _useState = useState([]),
38
51
  _useState2 = _slicedToArray(_useState, 2),
@@ -44,18 +57,36 @@ var BizUserCondition = function BizUserCondition(props) {
44
57
  dataList = _useState4[0],
45
58
  setDataList = _useState4[1];
46
59
 
47
- var _useState5 = useState(defaultValue || []),
60
+ var _useState5 = useState(function () {
61
+ if (defaultValue) {
62
+ return _.cloneDeep(defaultValue);
63
+ }
64
+
65
+ return [];
66
+ }),
48
67
  _useState6 = _slicedToArray(_useState5, 2),
49
68
  value = _useState6[0],
50
69
  setValue = _useState6[1];
51
70
 
71
+ var envNameList = useMemo(function () {
72
+ return eventEnvList ? eventEnvList.map(function (env) {
73
+ return env.name;
74
+ }) : [];
75
+ }, [eventEnvList]);
76
+ var userPropsMap = useMemo(function () {
77
+ if (!userPropList) return {};
78
+ return userPropList.reduce(function (pre, curr) {
79
+ pre[curr.name] = curr;
80
+ return pre;
81
+ }, {});
82
+ }, [userPropList]);
52
83
  useEffect(function () {
53
84
  initShowList();
54
85
  }, []);
55
86
 
56
87
  function initShowList() {
57
88
  var showList = [];
58
- defaultValue.forEach(function (item) {
89
+ value.forEach(function (item) {
59
90
  showList.push({
60
91
  id: Math.random(),
61
92
  orConditions: item
@@ -106,13 +137,19 @@ var BizUserCondition = function BizUserCondition(props) {
106
137
 
107
138
  setValue(newValue);
108
139
  setDataList(newDataList);
109
- props.onChange(newValue);
140
+ props.onChange && props.onChange(newValue);
110
141
  }
111
142
 
112
143
  return /*#__PURE__*/React.createElement(BizUserConditionContext.Provider, {
113
144
  value: {
114
145
  orConditionNum: props.orConditionNum || 2,
115
- eventAttrNum: props.eventAttrNum || 1
146
+ eventAttrNum: props.eventAttrNum || 1,
147
+ textMode: props.textMode,
148
+ openTagCondition: openTagCondition,
149
+ userTagsData: userTagsData !== null && userTagsData !== void 0 ? userTagsData : [],
150
+ isRealTime: props.isRealTime,
151
+ envNameList: envNameList,
152
+ userPropsMap: userPropsMap
116
153
  }
117
154
  }, /*#__PURE__*/React.createElement("div", {
118
155
  className: classPrefix
@@ -121,9 +158,10 @@ var BizUserCondition = function BizUserCondition(props) {
121
158
  }, /*#__PURE__*/React.createElement(RelationLabel, {
122
159
  show: value.length >= 2
123
160
  }, "\u4E14"), showList.length ? /*#__PURE__*/React.createElement("div", {
124
- className: "".concat(classPrefix, "-and-conditions-wrap")
125
- }, showList.map(function (item) {
161
+ className: ["".concat(classPrefix, "-and-conditions-wrap"), props.textMode ? 'text-mode' : ''].join(' ')
162
+ }, showList.map(function (item, i) {
126
163
  return /*#__PURE__*/React.createElement(OrConditions, {
164
+ showAndDesc: i > 0,
127
165
  orConditions: item.orConditions,
128
166
  key: item.id,
129
167
  onChange: function onChange(data) {
@@ -138,6 +176,10 @@ var BizUserCondition = function BizUserCondition(props) {
138
176
  };
139
177
 
140
178
  BizUserCondition.defaultProps = {
141
- andConditionNum: 5
179
+ andConditionNum: 5,
180
+ textMode: false,
181
+ openTagCondition: false,
182
+ userTagsData: [],
183
+ isRealTime: false
142
184
  };
143
185
  export default BizUserCondition;
@@ -29,27 +29,26 @@ import { buildCondition } from './util';
29
29
  import ConditionWrap from './conditionWrap';
30
30
  import PropCondition from './conditions/propCondition';
31
31
  import EventCondition from './conditions/eventCondition';
32
+ import TagsCondition from './conditions/tagsCondition';
32
33
  import { classPrefix } from '.';
34
+ import Text from './conditions/textDesc';
33
35
 
34
36
  var OrConditions = function OrConditions(props) {
35
37
  var _useContext = useContext(BizUserConditionContext),
36
- orConditionNum = _useContext.orConditionNum;
38
+ orConditionNum = _useContext.orConditionNum,
39
+ textMode = _useContext.textMode,
40
+ openTagCondition = _useContext.openTagCondition;
37
41
 
38
- var orConditions = props.orConditions;
42
+ var orConditions = props.orConditions,
43
+ showAndDesc = props.showAndDesc;
39
44
 
40
45
  var _useState = useState([]),
41
46
  _useState2 = _slicedToArray(_useState, 2),
42
47
  showList = _useState2[0],
43
48
  setShowList = _useState2[1];
44
49
 
45
- var _useState3 = useState(orConditions),
46
- _useState4 = _slicedToArray(_useState3, 2),
47
- value = _useState4[0],
48
- setValue = _useState4[1];
49
-
50
50
  useEffect(function () {
51
51
  if (orConditions) {
52
- setValue(orConditions);
53
52
  initShowList();
54
53
  }
55
54
  }, [orConditions]);
@@ -72,8 +71,9 @@ var OrConditions = function OrConditions(props) {
72
71
  id: Math.random(),
73
72
  condition: condition
74
73
  };
75
- var newValue = [].concat(_toConsumableArray(value), [condition]);
76
- setValue(newValue);
74
+ var newValue = showList.map(function (item) {
75
+ return item.condition;
76
+ }).concat([condition]);
77
77
  setShowList([].concat(_toConsumableArray(showList), [newData]));
78
78
  props.onChange(newValue);
79
79
  }
@@ -117,6 +117,31 @@ var OrConditions = function OrConditions(props) {
117
117
  props.onChange(newValue);
118
118
  }
119
119
 
120
+ function onChangeTags(id, newTags) {
121
+ changeData('tag', id, newTags);
122
+ }
123
+
124
+ function changeData(type, id, newData) {
125
+ var newValue = [];
126
+ showList.forEach(function (data) {
127
+ if (id === data.id) {
128
+ if (type === 'period') {
129
+ data.condition.runPeriod = newData;
130
+ } else if (type === 'attr') {
131
+ data.condition.attrs = newData;
132
+ } else if (type === 'event') {
133
+ data.condition = newData;
134
+ } else if (type === 'tag') {
135
+ data.condition.labels = newData;
136
+ }
137
+ }
138
+
139
+ newValue.push(data.condition);
140
+ });
141
+ setShowList(_toConsumableArray(showList));
142
+ props.onChange(newValue);
143
+ }
144
+
120
145
  function onDelete(id) {
121
146
  var index = showList.findIndex(function (item) {
122
147
  return item.id === id;
@@ -129,34 +154,52 @@ var OrConditions = function OrConditions(props) {
129
154
  var newValue = newList.map(function (item) {
130
155
  return item.condition;
131
156
  });
132
- setValue(newValue);
133
157
  props.onChange(newValue);
134
158
  }
135
159
 
136
- function renderCondition(data) {
160
+ if (textMode) {
161
+ return /*#__PURE__*/React.createElement(React.Fragment, null, textMode && showAndDesc ? /*#__PURE__*/React.createElement("span", {
162
+ className: "".concat(classPrefix, "-and-desc")
163
+ }, "\u4E14") : null, /*#__PURE__*/React.createElement("span", null, "("), showList.map(function (item, i) {
164
+ return renderCondition(item, i);
165
+ }), /*#__PURE__*/React.createElement("span", null, ")"));
166
+ }
167
+
168
+ function renderCondition(data, i) {
137
169
  var condition = data.condition,
138
170
  id = data.id;
139
171
  var conditionDom = null;
140
172
 
141
- if (condition.eventId === undefined) {
173
+ if (textMode) {
174
+ return /*#__PURE__*/React.createElement(Text, {
175
+ showOrDesc: i > 0,
176
+ key: id,
177
+ condition: condition
178
+ });
179
+ }
180
+
181
+ if (condition.labels) {
182
+ if (!openTagCondition) return null;
183
+ conditionDom = /*#__PURE__*/React.createElement(TagsCondition, {
184
+ labels: condition.labels,
185
+ dataId: id,
186
+ onChange: onChangeTags
187
+ });
188
+ } else if (condition.eventId === undefined) {
142
189
  conditionDom = /*#__PURE__*/React.createElement(PropCondition, {
143
190
  label: "\u5C5E\u6027",
144
191
  attrs: condition.attrs,
145
192
  dataId: id,
146
193
  onChange: onChangeAttrs
147
194
  });
148
- }
149
-
150
- if (condition.eventId === '-3') {
195
+ } else if (condition.eventId === '-3') {
151
196
  conditionDom = /*#__PURE__*/React.createElement(PeriodCondition, {
152
197
  label: "\u65B0\u589E\u4E8E",
153
198
  dataId: id,
154
199
  onChange: onChangeRunPeriod,
155
200
  runPeriod: condition.runPeriod
156
201
  });
157
- }
158
-
159
- if (condition.eventId === '-4') {
202
+ } else if (condition.eventId === '-4') {
160
203
  conditionDom = /*#__PURE__*/React.createElement(PeriodCondition, {
161
204
  label: "\u6D3B\u8DC3\u4E8E",
162
205
  isRealTime: true,
@@ -164,14 +207,12 @@ var OrConditions = function OrConditions(props) {
164
207
  onChange: onChangeRunPeriod,
165
208
  runPeriod: condition.runPeriod
166
209
  });
167
- }
168
-
169
- if (util.isNumber(condition.eventId)) {
170
- conditionDom = /*#__PURE__*/React.createElement(EventCondition, {
210
+ } else if (util.isNumber(condition.eventId)) {
211
+ conditionDom = /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(EventCondition, {
171
212
  dataId: id,
172
213
  onChange: onChangeEvent,
173
214
  condition: condition
174
- });
215
+ }));
175
216
  }
176
217
 
177
218
  return /*#__PURE__*/React.createElement(ConditionWrap, {
@@ -183,15 +224,15 @@ var OrConditions = function OrConditions(props) {
183
224
  }
184
225
 
185
226
  return /*#__PURE__*/React.createElement("div", {
186
- className: "".concat(classPrefix, "-or")
227
+ className: ["".concat(classPrefix, "-or"),, textMode ? 'text-mode' : ''].join(' ')
187
228
  }, /*#__PURE__*/React.createElement("div", {
188
- className: "".concat(classPrefix, "-or-content")
229
+ className: ["".concat(classPrefix, "-or-content")].join(' ')
189
230
  }, /*#__PURE__*/React.createElement(RelationLabel, {
190
231
  show: showList.length >= 2
191
232
  }, "\u6216"), /*#__PURE__*/React.createElement("div", {
192
233
  className: "".concat(classPrefix, "-conditions")
193
- }, showList.map(function (item) {
194
- return renderCondition(item);
234
+ }, showList.map(function (item, i) {
235
+ return renderCondition(item, i);
195
236
  }))), /*#__PURE__*/React.createElement(ConditionTypeList, {
196
237
  label: "\u6216",
197
238
  onAdd: onAdd,
@@ -1,7 +1,12 @@
1
- import React from 'react';
1
+ import React, { useContext } from 'react';
2
+ import { BizUserConditionContext } from '.';
2
3
  import './styles/relationLabel.less';
3
4
 
4
5
  var RelationLabel = function RelationLabel(props) {
6
+ var _useContext = useContext(BizUserConditionContext),
7
+ textMode = _useContext.textMode;
8
+
9
+ if (textMode) return null;
5
10
  return /*#__PURE__*/React.createElement("div", {
6
11
  className: "biz-user-condition-relation"
7
12
  }, props.show ? /*#__PURE__*/React.createElement("div", {
@@ -13,7 +13,7 @@
13
13
  list-style: none;
14
14
  .condition-type {
15
15
  padding: @padding-xss 12px;
16
- border: 1px solid @border-color-base;
16
+ background-color: @background-color-base;
17
17
  border-radius: @border-radius-large;
18
18
  cursor: pointer;
19
19
  &:nth-child(n + 2) {
@@ -8,6 +8,9 @@
8
8
  flex: 1;
9
9
  }
10
10
  .biz-user-condition-item-delete {
11
+ display: flex;
12
+ align-items: center;
13
+ height: 40px;
11
14
  margin-left: @margin-lg;
12
15
  cursor: pointer;
13
16
  }
@@ -1,13 +1,33 @@
1
1
  @import '../../assets/styles/variable.less';
2
2
  .biz-user-condition {
3
+ width: 100%;
4
+ min-width: 0;
3
5
  &-conditions-content {
4
6
  display: flex;
5
7
  .biz-user-condition-and-conditions-wrap {
6
8
  flex: 1;
7
- margin-bottom: @margin-md;
9
+ margin-bottom: @margin-lg;
10
+ &.text-mode {
11
+ display: flex;
12
+ flex-wrap: wrap;
13
+ min-width: 0;
14
+ margin-bottom: 0;
15
+ line-height: 32px;
16
+ border: none;
17
+ .biz-user-condition-and-desc {
18
+ margin: 0 @margin-xs;
19
+ }
20
+ }
8
21
  }
9
22
  .biz-user-condition-and-conditions-empty {
10
23
  margin-bottom: 0;
11
24
  }
25
+ .biz-select-handle-input-multiple {
26
+ min-height: 40px;
27
+ padding: calc(@margin-xs - 2px) @margin-xs calc(@margin-xs - 2px) @margin-sm;
28
+ .biz-select-handle-holder {
29
+ line-height: 28px;
30
+ }
31
+ }
12
32
  }
13
33
  }