@zgfe/business-lib 1.0.14 → 1.0.15-user.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 (96) hide show
  1. package/es/assets/styles/chunks.less +3 -4
  2. package/es/assets/styles/resetAntd.less +36 -1
  3. package/es/attrConditions/components/operateList.d.ts +1 -0
  4. package/es/attrConditions/components/operateList.js +2 -2
  5. package/es/attrConditions/components/stringList.d.ts +1 -0
  6. package/es/attrConditions/components/stringList.js +2 -2
  7. package/es/attrConditions/components/valuesList.d.ts +1 -0
  8. package/es/attrConditions/components/valuesList.js +5 -4
  9. package/es/attrConditions/demo/index.js +7 -8
  10. package/es/attrConditions/index.js +14 -4
  11. package/es/attrConditions/styles/index.less +3 -2
  12. package/es/attrConditions/types.d.ts +3 -0
  13. package/es/attrConditions/utils/operates.js +2 -2
  14. package/es/attributeSelector/index.js +8 -4
  15. package/es/attributeSelector/listPanel.js +32 -19
  16. package/es/attributeSelector/styles/index.less +3 -3
  17. package/es/attributeSelector/types.d.ts +7 -0
  18. package/es/attributeSelector/types.js +8 -1
  19. package/es/attributeSelector/util.js +3 -2
  20. package/es/eventSelector/demo/index.js +11 -2
  21. package/es/eventSelector/index.js +40 -7
  22. package/es/eventSelector/listPanel.js +37 -22
  23. package/es/eventSelector/styles/index.less +5 -3
  24. package/es/eventSelector/types.d.ts +7 -1
  25. package/es/index.d.ts +2 -1
  26. package/es/index.js +2 -1
  27. package/es/mock/event.js +214 -0
  28. package/es/select/demo/children.d.ts +2 -0
  29. package/es/select/demo/children.js +81 -0
  30. package/es/select/demo/index.js +10 -4
  31. package/es/select/demo/multiple.js +10 -3
  32. package/es/select/handle.js +4 -2
  33. package/es/select/index.d.ts +2 -2
  34. package/es/select/index.js +14 -7
  35. package/es/select/overlay.js +1 -1
  36. package/es/select/styles/handle.less +22 -13
  37. package/es/select/types.d.ts +3 -1
  38. package/es/userCondition/conditionTypeList.js +14 -3
  39. package/es/userCondition/conditionWrap.js +4 -2
  40. package/es/userCondition/conditions/constants.d.ts +21 -0
  41. package/es/userCondition/conditions/constants.js +21 -0
  42. package/es/userCondition/conditions/eventCondition.js +13 -4
  43. package/es/userCondition/conditions/periodCondition.js +20 -10
  44. package/es/userCondition/conditions/propCondition.js +28 -8
  45. package/es/userCondition/conditions/runTimesCondition.js +2 -2
  46. package/es/userCondition/conditions/styles/eventCondition.less +7 -5
  47. package/es/userCondition/conditions/styles/propCondition.less +3 -3
  48. package/es/userCondition/conditions/styles/tagsCondition.less +18 -0
  49. package/es/userCondition/conditions/styles/textDesc.less +17 -0
  50. package/es/userCondition/conditions/tagsCondition.d.ts +9 -0
  51. package/es/userCondition/conditions/tagsCondition.js +107 -0
  52. package/es/userCondition/conditions/textDesc.d.ts +9 -0
  53. package/es/userCondition/conditions/textDesc.js +197 -0
  54. package/es/userCondition/demo/index.js +200 -31
  55. package/es/userCondition/index.d.ts +1 -1
  56. package/es/userCondition/index.js +31 -10
  57. package/es/userCondition/orConditions.js +64 -17
  58. package/es/userCondition/relationLabel.js +6 -1
  59. package/es/userCondition/styles/conditionTypeList.less +1 -1
  60. package/es/userCondition/styles/conditionWrap.less +3 -0
  61. package/es/userCondition/styles/index.less +19 -0
  62. package/es/userCondition/styles/orConditions.less +13 -0
  63. package/es/userCondition/types.d.ts +21 -2
  64. package/es/userCondition/util.d.ts +5 -1
  65. package/es/userCondition/util.js +42 -0
  66. package/es/userTagsSelector/cascaderOverlay.d.ts +5 -0
  67. package/es/userTagsSelector/cascaderOverlay.js +114 -0
  68. package/es/userTagsSelector/components/search/index.d.ts +8 -0
  69. package/es/userTagsSelector/components/search/index.js +16 -0
  70. package/es/userTagsSelector/components/search/index.less +6 -0
  71. package/es/userTagsSelector/context.d.ts +3 -0
  72. package/es/userTagsSelector/context.js +2 -0
  73. package/es/userTagsSelector/demo/index.d.ts +2 -0
  74. package/es/userTagsSelector/demo/index.js +48 -0
  75. package/es/userTagsSelector/groups/groupOption.d.ts +5 -0
  76. package/es/userTagsSelector/groups/groupOption.js +42 -0
  77. package/es/userTagsSelector/groups/index.d.ts +4 -0
  78. package/es/userTagsSelector/groups/index.js +86 -0
  79. package/es/userTagsSelector/groups/styles/index.less +0 -0
  80. package/es/userTagsSelector/groups/styles/option.less +50 -0
  81. package/es/userTagsSelector/index.d.ts +6 -0
  82. package/es/userTagsSelector/index.js +110 -0
  83. package/es/userTagsSelector/multipleCheckPanel/checkOption.d.ts +5 -0
  84. package/es/userTagsSelector/multipleCheckPanel/checkOption.js +45 -0
  85. package/es/userTagsSelector/multipleCheckPanel/index.d.ts +4 -0
  86. package/es/userTagsSelector/multipleCheckPanel/index.js +80 -0
  87. package/es/userTagsSelector/multipleCheckPanel/styles/index.less +0 -0
  88. package/es/userTagsSelector/multipleCheckPanel/styles/option.less +39 -0
  89. package/es/userTagsSelector/styles/cascaderOverlay.less +27 -0
  90. package/es/userTagsSelector/styles/index.less +10 -0
  91. package/es/userTagsSelector/types.d.ts +67 -0
  92. package/es/userTagsSelector/types.js +1 -0
  93. package/es/userTagsSelector/util.d.ts +4 -0
  94. package/es/userTagsSelector/util.js +38 -0
  95. package/es/utils/type.d.ts +2 -2
  96. package/package.json +4 -2
@@ -24,11 +24,13 @@ import React, { useContext, useEffect, useState } from 'react';
24
24
  import InfiniteScroll from 'react-infinite-scroll-component';
25
25
  import { classPrefix } from '.';
26
26
  import { BizGlobalDataContext } from '..';
27
+ import { ShowStatus } from '../attributeSelector/types';
27
28
  import BizSearchInput from '../searchInput';
28
29
  import EventListOption from './option';
29
30
 
30
31
  var EventListPanel = function EventListPanel(props) {
31
- var showOverview = props.showOverview;
32
+ var showOverview = props.showOverview,
33
+ defaultSelectAble = props.defaultSelectAble;
32
34
 
33
35
  var _useState = useState(''),
34
36
  _useState2 = _slicedToArray(_useState, 2),
@@ -48,20 +50,25 @@ var EventListPanel = function EventListPanel(props) {
48
50
  currentGroup = _useState6[0],
49
51
  setCurrentGroup = _useState6[1];
50
52
 
51
- var _useState7 = useState([]),
53
+ var _useState7 = useState(),
52
54
  _useState8 = _slicedToArray(_useState7, 2),
53
- searchEventList = _useState8[0],
54
- setSearchEventList = _useState8[1];
55
+ currentSelectGroup = _useState8[0],
56
+ setCurrentSelectGroup = _useState8[1];
55
57
 
56
58
  var _useState9 = useState([]),
57
59
  _useState10 = _slicedToArray(_useState9, 2),
58
- showList = _useState10[0],
59
- setShowList = _useState10[1];
60
+ searchEventList = _useState10[0],
61
+ setSearchEventList = _useState10[1];
60
62
 
61
- var _useState11 = useState(),
63
+ var _useState11 = useState([]),
62
64
  _useState12 = _slicedToArray(_useState11, 2),
63
- currentValue = _useState12[0],
64
- setCurrentValue = _useState12[1];
65
+ showList = _useState12[0],
66
+ setShowList = _useState12[1];
67
+
68
+ var _useState13 = useState(),
69
+ _useState14 = _slicedToArray(_useState13, 2),
70
+ currentValue = _useState14[0],
71
+ setCurrentValue = _useState14[1];
65
72
 
66
73
  var overviewData = {
67
74
  id: -100,
@@ -74,8 +81,14 @@ var EventListPanel = function EventListPanel(props) {
74
81
  id: 0,
75
82
  eventList: function () {
76
83
  var list = [];
84
+ var listObj = {};
77
85
  eventGroupList === null || eventGroupList === void 0 ? void 0 : eventGroupList.forEach(function (group) {
78
- list = list.concat(group.eventList);
86
+ group.eventList.forEach(function (item) {
87
+ if (!listObj[item.id]) {
88
+ list.push(item);
89
+ listObj[item.id] = 1;
90
+ }
91
+ });
79
92
  });
80
93
  return list;
81
94
  }(),
@@ -85,6 +98,7 @@ var EventListPanel = function EventListPanel(props) {
85
98
  return [group].concat(_toConsumableArray(list));
86
99
  });
87
100
  setCurrentGroup(group);
101
+ setCurrentSelectGroup(group);
88
102
  }, []);
89
103
  useEffect(function () {
90
104
  setCurrentValue(props.value);
@@ -119,11 +133,16 @@ var EventListPanel = function EventListPanel(props) {
119
133
  }
120
134
 
121
135
  function onClickGroup(g) {
122
- var resVal = _.cloneDeep(currentValue) || {};
123
- resVal.group = g;
124
- resVal.event = searchEventList[0];
125
- setCurrentValue(resVal);
126
- if (props.onChange) props.onChange(resVal);
136
+ if (defaultSelectAble) {
137
+ var resVal = _.cloneDeep(currentValue) || {};
138
+ resVal.group = g;
139
+ resVal.event = searchEventList[0];
140
+ setCurrentValue(resVal);
141
+ setCurrentSelectGroup(g);
142
+ if (props.onChange) props.onChange(resVal);
143
+ } else {
144
+ setCurrentSelectGroup(g);
145
+ }
127
146
  }
128
147
 
129
148
  function onHoverGroup(g) {
@@ -131,7 +150,7 @@ var EventListPanel = function EventListPanel(props) {
131
150
  }
132
151
 
133
152
  function onMouseLeaveGroup() {
134
- setCurrentGroup(currentValue === null || currentValue === void 0 ? void 0 : currentValue.group);
153
+ setCurrentGroup(currentSelectGroup);
135
154
  }
136
155
 
137
156
  if (!groupList || !groupList.length || !groupList[0].eventList || !groupList[0].eventList.length) {
@@ -147,15 +166,13 @@ var EventListPanel = function EventListPanel(props) {
147
166
  }, /*#__PURE__*/React.createElement("div", {
148
167
  className: "".concat(classPrefix, "-left")
149
168
  }, groupList === null || groupList === void 0 ? void 0 : groupList.map(function (group) {
150
- var _currentValue$group;
151
-
152
169
  if (!group.eventList.length) return;
153
170
  return /*#__PURE__*/React.createElement(EventListOption, {
154
171
  showCount: true,
155
172
  count: group.eventList.length,
156
173
  label: group.name || '未分组',
157
174
  key: group.id || 'overview',
158
- checked: (currentValue === null || currentValue === void 0 ? void 0 : (_currentValue$group = currentValue.group) === null || _currentValue$group === void 0 ? void 0 : _currentValue$group.id) === group.id,
175
+ checked: (currentSelectGroup === null || currentSelectGroup === void 0 ? void 0 : currentSelectGroup.id) === group.id,
159
176
  data: group,
160
177
  onClick: onClickGroup,
161
178
  onMouseOver: onHoverGroup,
@@ -185,6 +202,7 @@ var EventListPanel = function EventListPanel(props) {
185
202
  }, showList === null || showList === void 0 ? void 0 : showList.map(function (e) {
186
203
  var _currentValue$event;
187
204
 
205
+ if (e.eventHidden === ShowStatus.hidden) return null;
188
206
  return /*#__PURE__*/React.createElement(EventListOption, {
189
207
  label: e.alias || e.name,
190
208
  key: "".concat(currentGroup === null || currentGroup === void 0 ? void 0 : currentGroup.id, "-").concat(e.id),
@@ -199,7 +217,4 @@ var EventListPanel = function EventListPanel(props) {
199
217
  })))));
200
218
  };
201
219
 
202
- EventListPanel.defaultProps = {
203
- showOverview: true
204
- };
205
220
  export default EventListPanel;
@@ -1,10 +1,12 @@
1
1
  @import '../../assets/styles/inner.less';
2
2
 
3
3
  .biz-event-select {
4
- &-handle {
5
- .__select-handle();
4
+ &.border {
5
+ .biz-event-select-handle {
6
+ .__select-handle();
7
+ }
6
8
  }
7
-
9
+ position: relative;
8
10
  &-list-panel {
9
11
  display: flex;
10
12
  flex-direction: row;
@@ -20,12 +20,18 @@ export declare namespace EventSelectTypes {
20
20
  alias?: string;
21
21
  placeholder?: string;
22
22
  showAllEvent?: boolean;
23
- onChange?: (val: Value) => void;
23
+ defaultSelectAble?: boolean;
24
+ popupContainer?: boolean;
24
25
  onVisibleChange?: (visible: boolean) => void;
26
+ border?: boolean;
27
+ theme?: string;
28
+ destroyPopupOnHide?: boolean;
29
+ onChange?: (val: Value) => void;
25
30
  }
26
31
  interface DropdownProps {
27
32
  value?: Value;
28
33
  showOverview?: boolean;
34
+ defaultSelectAble?: boolean;
29
35
  onChange?: (value: Value) => void;
30
36
  }
31
37
  }
package/es/index.d.ts CHANGED
@@ -19,10 +19,11 @@ import convertAttributeData from './attributeSelector/util';
19
19
  import BizGlobalDataContext from './context';
20
20
  import BizUserCondition from './userCondition';
21
21
  import BizSearchInput from './searchInput';
22
+ import BizUserTagsSelect from './userTagsSelector';
22
23
  import BizAddToScene from './addToScene';
23
24
  import BizAddToPanel from './addToPanel';
24
25
  import setGlobalConfig from './config';
25
- export { BizSearchInput, BizSelect, BizDialog, BizChart, BizTable, BizAnalysisLayout, BizUserGroup, IconFont, BizTargetSelector, BizEventSelector, BizAttributeSelector, BizGlobalDataContext, BizTargetCondition, BizDatePicker, BizConditionItem, BizConditionGroup, BizUserCondition, BizAddToScene, BizAddToPanel, ajax, util, theme, convertAttributeData, setGlobalConfig, };
26
+ export { BizSearchInput, BizSelect, BizDialog, BizChart, BizTable, BizAnalysisLayout, BizUserGroup, IconFont, BizTargetSelector, BizEventSelector, BizAttributeSelector, BizGlobalDataContext, BizTargetCondition, BizDatePicker, BizConditionItem, BizConditionGroup, BizUserCondition, BizAddToScene, BizAddToPanel, ajax, util, theme, convertAttributeData, BizUserTagsSelect, setGlobalConfig, };
26
27
  export type { UserGroupTypes } from './userGroup/types';
27
28
  export type { BizSelectTypes } from './select/types';
28
29
  export type { AttributeSelect } from './attributeSelector/types';
package/es/index.js CHANGED
@@ -18,7 +18,8 @@ import convertAttributeData from './attributeSelector/util';
18
18
  import BizGlobalDataContext from './context';
19
19
  import BizUserCondition from './userCondition';
20
20
  import BizSearchInput from './searchInput';
21
+ import BizUserTagsSelect from './userTagsSelector';
21
22
  import BizAddToScene from './addToScene';
22
23
  import BizAddToPanel from './addToPanel';
23
24
  import setGlobalConfig from './config';
24
- export { BizSearchInput, BizSelect, BizDialog, BizChart, BizTable, BizAnalysisLayout, BizUserGroup, IconFont, BizTargetSelector, BizEventSelector, BizAttributeSelector, BizGlobalDataContext, BizTargetCondition, BizDatePicker, BizConditionItem, BizConditionGroup, BizUserCondition, BizAddToScene, BizAddToPanel, ajax, util, theme, convertAttributeData, setGlobalConfig };
25
+ export { BizSearchInput, BizSelect, BizDialog, BizChart, BizTable, BizAnalysisLayout, BizUserGroup, IconFont, BizTargetSelector, BizEventSelector, BizAttributeSelector, BizGlobalDataContext, BizTargetCondition, BizDatePicker, BizConditionItem, BizConditionGroup, BizUserCondition, BizAddToScene, BizAddToPanel, ajax, util, theme, convertAttributeData, BizUserTagsSelect, setGlobalConfig };
package/es/mock/event.js CHANGED
@@ -131,6 +131,139 @@ export default [{
131
131
  insert_time: '2018-11-26 14:46:48',
132
132
  owner: 'zg'
133
133
  }]
134
+ }, {
135
+ groupId: 6666,
136
+ groupName: '微信2',
137
+ eventList: [{
138
+ plats: [3],
139
+ click_analysis: false,
140
+ mark_type: null,
141
+ event_id: 24143017,
142
+ event_name: '微信-关注公众号',
143
+ event_hidden: 0,
144
+ event_type: 0,
145
+ is_stop: 0,
146
+ is_delete: 0,
147
+ alias_name: null,
148
+ event_attrs: [{
149
+ hidden: 0,
150
+ dimension_sub: 'event_attr',
151
+ encryption_type: 0,
152
+ alias_name: '',
153
+ value_dict: false,
154
+ attr_id: 30183430,
155
+ attr_name: '扫码场景描述',
156
+ event_id: 24143017,
157
+ prop_type: 1,
158
+ is_stop: 0
159
+ }, {
160
+ hidden: 0,
161
+ dimension_sub: 'event_attr',
162
+ encryption_type: 0,
163
+ alias_name: '',
164
+ value_dict: false,
165
+ attr_id: 30183425,
166
+ attr_name: '二维码ticket',
167
+ event_id: 24143017,
168
+ prop_type: 1,
169
+ is_stop: 0
170
+ }, {
171
+ hidden: 0,
172
+ dimension_sub: 'event_attr',
173
+ encryption_type: 0,
174
+ alias_name: '',
175
+ value_dict: false,
176
+ attr_id: 30183429,
177
+ attr_name: '公众号app_id',
178
+ event_id: 24143017,
179
+ prop_type: 1,
180
+ is_stop: 0
181
+ }, {
182
+ hidden: 0,
183
+ dimension_sub: 'event_attr',
184
+ encryption_type: 0,
185
+ alias_name: '',
186
+ value_dict: true,
187
+ attr_id: 30183423,
188
+ attr_name: '关注来源',
189
+ event_id: 24143017,
190
+ prop_type: 1,
191
+ is_stop: 0
192
+ }, {
193
+ hidden: 0,
194
+ dimension_sub: 'event_attr',
195
+ encryption_type: 0,
196
+ alias_name: '',
197
+ value_dict: false,
198
+ attr_id: 30183428,
199
+ attr_name: '用户open_id',
200
+ event_id: 24143017,
201
+ prop_type: 1,
202
+ is_stop: 0
203
+ }, {
204
+ hidden: 0,
205
+ dimension_sub: 'event_attr',
206
+ encryption_type: 0,
207
+ alias_name: '',
208
+ value_dict: false,
209
+ attr_id: 30183427,
210
+ attr_name: '公众号名称',
211
+ event_id: 24143017,
212
+ prop_type: 1,
213
+ is_stop: 0
214
+ }],
215
+ stop_date_time: null,
216
+ insert_time: '2018-11-26 14:46:48',
217
+ owner: 'zg'
218
+ }, {
219
+ plats: [3],
220
+ click_analysis: false,
221
+ mark_type: null,
222
+ event_id: 24143016,
223
+ event_name: '微信-取消关注公众号',
224
+ event_hidden: 0,
225
+ event_type: 0,
226
+ is_stop: 0,
227
+ is_delete: 0,
228
+ alias_name: null,
229
+ event_attrs: [{
230
+ hidden: 0,
231
+ dimension_sub: 'event_attr',
232
+ encryption_type: 0,
233
+ alias_name: '',
234
+ value_dict: false,
235
+ attr_id: 30183431,
236
+ attr_name: '用户open_id',
237
+ event_id: 24143016,
238
+ prop_type: 1,
239
+ is_stop: 0
240
+ }, {
241
+ hidden: 0,
242
+ dimension_sub: 'event_attr',
243
+ encryption_type: 0,
244
+ alias_name: '',
245
+ value_dict: false,
246
+ attr_id: 30183426,
247
+ attr_name: '公众号名称',
248
+ event_id: 24143016,
249
+ prop_type: 1,
250
+ is_stop: 0
251
+ }, {
252
+ hidden: 0,
253
+ dimension_sub: 'event_attr',
254
+ encryption_type: 0,
255
+ alias_name: '',
256
+ value_dict: false,
257
+ attr_id: 30183424,
258
+ attr_name: '公众号app_id',
259
+ event_id: 24143016,
260
+ prop_type: 1,
261
+ is_stop: 0
262
+ }],
263
+ stop_date_time: null,
264
+ insert_time: '2018-11-26 14:46:48',
265
+ owner: 'zg'
266
+ }]
134
267
  }, {
135
268
  groupId: 4200,
136
269
  groupName: '注册',
@@ -221,6 +354,87 @@ export default [{
221
354
  groupId: 4199,
222
355
  groupName: '官网',
223
356
  eventList: [{
357
+ plats: [3],
358
+ click_analysis: false,
359
+ mark_type: null,
360
+ event_id: 24143017,
361
+ event_name: '微信-关注公众号',
362
+ event_hidden: 0,
363
+ event_type: 0,
364
+ is_stop: 0,
365
+ is_delete: 0,
366
+ alias_name: null,
367
+ event_attrs: [{
368
+ hidden: 0,
369
+ dimension_sub: 'event_attr',
370
+ encryption_type: 0,
371
+ alias_name: '',
372
+ value_dict: false,
373
+ attr_id: 30183430,
374
+ attr_name: '扫码场景描述',
375
+ event_id: 24143017,
376
+ prop_type: 1,
377
+ is_stop: 0
378
+ }, {
379
+ hidden: 0,
380
+ dimension_sub: 'event_attr',
381
+ encryption_type: 0,
382
+ alias_name: '',
383
+ value_dict: false,
384
+ attr_id: 30183425,
385
+ attr_name: '二维码ticket',
386
+ event_id: 24143017,
387
+ prop_type: 1,
388
+ is_stop: 0
389
+ }, {
390
+ hidden: 0,
391
+ dimension_sub: 'event_attr',
392
+ encryption_type: 0,
393
+ alias_name: '',
394
+ value_dict: false,
395
+ attr_id: 30183429,
396
+ attr_name: '公众号app_id',
397
+ event_id: 24143017,
398
+ prop_type: 1,
399
+ is_stop: 0
400
+ }, {
401
+ hidden: 0,
402
+ dimension_sub: 'event_attr',
403
+ encryption_type: 0,
404
+ alias_name: '',
405
+ value_dict: true,
406
+ attr_id: 30183423,
407
+ attr_name: '关注来源',
408
+ event_id: 24143017,
409
+ prop_type: 1,
410
+ is_stop: 0
411
+ }, {
412
+ hidden: 0,
413
+ dimension_sub: 'event_attr',
414
+ encryption_type: 0,
415
+ alias_name: '',
416
+ value_dict: false,
417
+ attr_id: 30183428,
418
+ attr_name: '用户open_id',
419
+ event_id: 24143017,
420
+ prop_type: 1,
421
+ is_stop: 0
422
+ }, {
423
+ hidden: 0,
424
+ dimension_sub: 'event_attr',
425
+ encryption_type: 0,
426
+ alias_name: '',
427
+ value_dict: false,
428
+ attr_id: 30183427,
429
+ attr_name: '公众号名称',
430
+ event_id: 24143017,
431
+ prop_type: 1,
432
+ is_stop: 0
433
+ }],
434
+ stop_date_time: null,
435
+ insert_time: '2018-11-26 14:46:48',
436
+ owner: 'zg'
437
+ }, {
224
438
  plats: [3],
225
439
  click_analysis: false,
226
440
  mark_type: null,
@@ -0,0 +1,2 @@
1
+ declare const _default: () => JSX.Element;
2
+ export default _default;
@@ -0,0 +1,81 @@
1
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
2
+
3
+ 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."); }
4
+
5
+ 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); }
6
+
7
+ 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; }
8
+
9
+ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
10
+
11
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
12
+
13
+ import React, { useState } from 'react';
14
+ import { BizSelect } from '@zgfe/business-lib';
15
+ import { Button } from 'antd';
16
+ var stringOperate = [{
17
+ name: '是',
18
+ value: 'equal'
19
+ }, {
20
+ name: '包含',
21
+ value: 'contains'
22
+ }, {
23
+ name: '不是',
24
+ value: 'not equal'
25
+ }, {
26
+ name: '不包含',
27
+ value: 'not contains'
28
+ }, {
29
+ name: '开头是',
30
+ value: 'begin with'
31
+ }, {
32
+ name: '结尾是',
33
+ value: 'end with'
34
+ }, {
35
+ name: '开头不是',
36
+ value: 'not begin with'
37
+ }, {
38
+ name: '结尾不是',
39
+ value: 'not end with'
40
+ }, {
41
+ name: '是空值',
42
+ value: 'is null'
43
+ }, {
44
+ name: '不是空值',
45
+ value: 'is not null'
46
+ }];
47
+ var disabledList = [{
48
+ value: 'not equal'
49
+ }, {
50
+ value: 'not begin with'
51
+ }];
52
+ export default (function () {
53
+ var _useState = useState([{
54
+ name: '不是',
55
+ value: 'not equal'
56
+ }]),
57
+ _useState2 = _slicedToArray(_useState, 2),
58
+ data = _useState2[0],
59
+ setData = _useState2[1];
60
+
61
+ var onChange = function onChange(value) {
62
+ console.log(value);
63
+ setData(function () {
64
+ return value;
65
+ });
66
+ };
67
+
68
+ return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(BizSelect, {
69
+ options: stringOperate,
70
+ value: data,
71
+ labelField: "name",
72
+ keyField: "value",
73
+ theme: "secondary",
74
+ popupContainer: true,
75
+ onChange: onChange,
76
+ disableItemList: disabledList,
77
+ multiple: true
78
+ }, /*#__PURE__*/React.createElement(Button, {
79
+ type: "primary"
80
+ }, "\u70B9\u51FB\u6253\u5F00\u4E0B\u62C9")));
81
+ });
@@ -48,12 +48,18 @@ var disabledList = [{
48
48
  value: 'not equal'
49
49
  }, {
50
50
  value: 'not begin with'
51
+ }, {
52
+ name: '不是',
53
+ value: 'not equal'
51
54
  }];
52
55
  export default (function () {
53
- var _useState = useState({
54
- name: '不是',
55
- value: 'not equal'
56
- }),
56
+ var _useState = useState([].concat(disabledList, [{
57
+ name: '不是空值',
58
+ value: 'is not null'
59
+ }, {
60
+ name: '是',
61
+ value: 'equal'
62
+ }])),
57
63
  _useState2 = _slicedToArray(_useState, 2),
58
64
  data = _useState2[0],
59
65
  setData = _useState2[1];
@@ -40,10 +40,13 @@ var stringOperate = [{
40
40
  name: '是空值',
41
41
  value: 'is null'
42
42
  }, {
43
- name: '不是空值',
43
+ name: '不是空值aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
44
44
  value: 'is not null'
45
45
  }];
46
46
  var disabledList = [{
47
+ name: '是',
48
+ value: 'equal'
49
+ }, {
47
50
  name: '不包含',
48
51
  value: 'not contains'
49
52
  }, {
@@ -51,7 +54,10 @@ var disabledList = [{
51
54
  value: 'not begin with'
52
55
  }];
53
56
  export default (function () {
54
- var _useState = useState(),
57
+ var _useState = useState([].concat(disabledList, [{
58
+ name: '包含',
59
+ value: 'contains'
60
+ }])),
55
61
  _useState2 = _slicedToArray(_useState, 2),
56
62
  data = _useState2[0],
57
63
  setData = _useState2[1];
@@ -73,6 +79,7 @@ export default (function () {
73
79
  onChange: onChange,
74
80
  disableItemList: disabledList,
75
81
  multiple: true,
76
- enableCreate: true
82
+ enableCreate: true,
83
+ value: data
77
84
  }), /*#__PURE__*/React.createElement("br", null), /*#__PURE__*/React.createElement("br", null), /*#__PURE__*/React.createElement("p", null, "\u5F53\u524D\u9009\u62E9\u7684\u503C\u662F\uFF1A", JSON.stringify(data)));
78
85
  });
@@ -81,11 +81,13 @@ var SelectHandle = /*#__PURE__*/React.forwardRef(function (props, ref) {
81
81
  color: "#fff"
82
82
  }, /*#__PURE__*/React.createElement(Tag, {
83
83
  closable: true,
84
- className: "".concat(classPrefix, "-tag"),
84
+ id: "".concat(classPrefix, "-tag"),
85
85
  onClose: function onClose() {
86
86
  onDelete(item);
87
87
  }
88
- }, item[labelField]));
88
+ }, /*#__PURE__*/React.createElement("div", {
89
+ className: "".concat(classPrefix, "-tag-label")
90
+ }, item[labelField])));
89
91
  }) : !focus ? /*#__PURE__*/React.createElement("span", {
90
92
  className: "".concat(classPrefix, "-holder")
91
93
  }, placeholder || '请选择') : '', /*#__PURE__*/React.createElement(Input, {
@@ -1,6 +1,6 @@
1
- import React from 'react';
1
+ import React, { PropsWithChildren } from 'react';
2
2
  import './styles/index.less';
3
3
  import { BizSelectTypes } from './types';
4
4
  export declare const classPrefix = "biz-select";
5
- declare const BizSelect: React.FC<BizSelectTypes.Props>;
5
+ declare const BizSelect: React.FC<PropsWithChildren<BizSelectTypes.Props>>;
6
6
  export default BizSelect;
@@ -62,15 +62,19 @@ var BizSelect = function BizSelect(props) {
62
62
  setWidth = _useState8[1];
63
63
 
64
64
  useEffect(function () {
65
- setWidth(boxRef.current.width || 200);
65
+ var _boxRef$current;
66
+
67
+ setWidth((boxRef === null || boxRef === void 0 ? void 0 : (_boxRef$current = boxRef.current) === null || _boxRef$current === void 0 ? void 0 : _boxRef$current.width) || 200);
66
68
 
67
69
  if (props.defaultValue) {
68
70
  setCurrent(getValue(props.defaultValue));
69
71
  }
70
72
 
71
73
  var handleClick = function handleClick(e) {
72
- var clicked = selectRef.current.contains(e.target);
73
- boxRef.current.create(clicked);
74
+ var _selectRef$current, _boxRef$current2;
75
+
76
+ var clicked = (_selectRef$current = selectRef.current) === null || _selectRef$current === void 0 ? void 0 : _selectRef$current.contains(e.target);
77
+ (_boxRef$current2 = boxRef.current) === null || _boxRef$current2 === void 0 ? void 0 : _boxRef$current2.create(clicked);
74
78
 
75
79
  if (!clicked && !props.enableCreate) {
76
80
  setSearchValue('');
@@ -155,7 +159,7 @@ var BizSelect = function BizSelect(props) {
155
159
  setSearchValue('');
156
160
 
157
161
  if (!props.multiple) {
158
- setVisible(false);
162
+ onVisibleChange(false);
159
163
  }
160
164
 
161
165
  if (props.onChange) props.onChange(option);
@@ -163,6 +167,7 @@ var BizSelect = function BizSelect(props) {
163
167
 
164
168
  var onVisibleChange = function onVisibleChange(flag) {
165
169
  setVisible(flag);
170
+ props.onVisibleChange && props.onVisibleChange(flag);
166
171
  };
167
172
 
168
173
  return /*#__PURE__*/React.createElement(Dropdown, {
@@ -174,7 +179,7 @@ var BizSelect = function BizSelect(props) {
174
179
  onChange: onChange
175
180
  })),
176
181
  disabled: props.disable,
177
- destroyPopupOnHide: true,
182
+ destroyPopupOnHide: props.destroyPopupOnHide,
178
183
  overlayStyle: {
179
184
  minWidth: minDropdownWidth || 0,
180
185
  width: overlayWidth || width
@@ -189,7 +194,7 @@ var BizSelect = function BizSelect(props) {
189
194
  className: "".concat(classPrefix, "-handle ").concat(props.className ? props.className : ''),
190
195
  ref: selectRef,
191
196
  id: selectId
192
- }, /*#__PURE__*/React.createElement(SelectHandle, {
197
+ }, props.children ? props.children : /*#__PURE__*/React.createElement(SelectHandle, {
193
198
  ref: boxRef,
194
199
  value: current,
195
200
  labelField: labelField,
@@ -209,6 +214,8 @@ var BizSelect = function BizSelect(props) {
209
214
 
210
215
  BizSelect.defaultProps = {
211
216
  labelField: 'label',
212
- keyField: 'id'
217
+ keyField: 'id',
218
+ popupContainer: true,
219
+ destroyPopupOnHide: true
213
220
  };
214
221
  export default BizSelect;
@@ -100,7 +100,7 @@ var SelectOverlay = function SelectOverlay(props) {
100
100
  if (searchValue && !new RegExp(searchValue, 'i').test(option[labelField])) return;
101
101
  var disabled = false;
102
102
  disableItemList === null || disableItemList === void 0 ? void 0 : disableItemList.forEach(function (item) {
103
- if (item[keyField] === option[keyField] && (!current || current && ids.indexOf(option[keyField]) < 0)) {
103
+ if (item[keyField] === option[keyField]) {
104
104
  disabled = true;
105
105
  }
106
106
  });