@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
@@ -64,7 +64,7 @@ var BizSelect = function BizSelect(props) {
64
64
  useEffect(function () {
65
65
  var _boxRef$current;
66
66
 
67
- setWidth(((_boxRef$current = boxRef.current) === null || _boxRef$current === void 0 ? void 0 : _boxRef$current.width) || 200);
67
+ setWidth((boxRef === null || boxRef === void 0 ? void 0 : (_boxRef$current = boxRef.current) === null || _boxRef$current === void 0 ? void 0 : _boxRef$current.width) || 200);
68
68
 
69
69
  if (props.defaultValue) {
70
70
  setCurrent(getValue(props.defaultValue));
@@ -137,7 +137,7 @@ var BizSelect = function BizSelect(props) {
137
137
  setSearchValue('');
138
138
 
139
139
  if (!props.multiple) {
140
- setVisible(false);
140
+ onVisibleChange(false);
141
141
  }
142
142
 
143
143
  if (props.onChange) props.onChange(option);
@@ -146,6 +146,7 @@ var BizSelect = function BizSelect(props) {
146
146
  var onVisibleChange = function onVisibleChange(flag) {
147
147
  setSearchValue('');
148
148
  setVisible(flag);
149
+ props.onVisibleChange && props.onVisibleChange(flag);
149
150
  };
150
151
 
151
152
  return /*#__PURE__*/React.createElement(Dropdown, {
@@ -157,7 +158,7 @@ var BizSelect = function BizSelect(props) {
157
158
  onChange: onChange
158
159
  })),
159
160
  disabled: props.disable,
160
- destroyPopupOnHide: true,
161
+ destroyPopupOnHide: props.destroyPopupOnHide,
161
162
  overlayStyle: {
162
163
  minWidth: minDropdownWidth || 0,
163
164
  width: overlayWidth || width
@@ -172,7 +173,7 @@ var BizSelect = function BizSelect(props) {
172
173
  className: "".concat(classPrefix, "-handle ").concat(props.className ? props.className : ''),
173
174
  ref: selectRef,
174
175
  id: selectId
175
- }, /*#__PURE__*/React.createElement(SelectHandle, {
176
+ }, props.children ? props.children : /*#__PURE__*/React.createElement(SelectHandle, {
176
177
  ref: boxRef,
177
178
  value: current,
178
179
  labelField: labelField,
@@ -194,6 +195,7 @@ var BizSelect = function BizSelect(props) {
194
195
  BizSelect.defaultProps = {
195
196
  labelField: 'label',
196
197
  keyField: 'id',
197
- popupContainer: true
198
+ popupContainer: true,
199
+ destroyPopupOnHide: true
198
200
  };
199
201
  export default BizSelect;
@@ -8,7 +8,8 @@ var SelectOption = function SelectOption(props) {
8
8
  group = props.group,
9
9
  checked = props.checked,
10
10
  disabled = props.disabled,
11
- multiple = props.multiple;
11
+ multiple = props.multiple,
12
+ customLabel = props.customLabel;
12
13
 
13
14
  function onClick() {
14
15
  if (disabled) return;
@@ -29,6 +30,11 @@ var SelectOption = function SelectOption(props) {
29
30
  });
30
31
  }
31
32
 
33
+ function renderLabel(option) {
34
+ var dom = getLabel(option[props.labelField]);
35
+ return customLabel ? customLabel(dom, option) : dom;
36
+ }
37
+
32
38
  if (group) {
33
39
  return /*#__PURE__*/React.createElement("div", {
34
40
  className: "".concat(classPrefix, "-group")
@@ -51,7 +57,7 @@ var SelectOption = function SelectOption(props) {
51
57
  className: "".concat(classPrefix, "-option-icon")
52
58
  }, option === null || option === void 0 ? void 0 : option.icon), /*#__PURE__*/React.createElement("span", {
53
59
  className: "".concat(classPrefix, "-option-label")
54
- }, getLabel(option[props.labelField])), !disabled && /*#__PURE__*/React.createElement("span", {
60
+ }, renderLabel(option)), !disabled && /*#__PURE__*/React.createElement("span", {
55
61
  className: "".concat(classPrefix, "-option-btn")
56
62
  }, props.extra && props.extra(option)));
57
63
  };
@@ -27,7 +27,8 @@ var SelectOverlay = function SelectOverlay(props) {
27
27
  multiple = props.multiple,
28
28
  disableItemList = props.disableItemList,
29
29
  dropdownExtra = props.dropdownExtra,
30
- loading = props.loading;
30
+ loading = props.loading,
31
+ customLabel = props.customLabel;
31
32
 
32
33
  var _useState = useState(),
33
34
  _useState2 = _slicedToArray(_useState, 2),
@@ -114,7 +115,7 @@ var SelectOverlay = function SelectOverlay(props) {
114
115
  if (searchValue && searchValue === option[labelField] && !option.isTemp) useTemp = false;
115
116
  var disabled = false;
116
117
  disableItemList === null || disableItemList === void 0 ? void 0 : disableItemList.forEach(function (item) {
117
- if (item[keyField] === option[keyField] && (!current || current && ids.indexOf(option[keyField]) < 0)) {
118
+ if (item[keyField] === option[keyField]) {
118
119
  disabled = true;
119
120
  }
120
121
  });
@@ -130,7 +131,8 @@ var SelectOverlay = function SelectOverlay(props) {
130
131
  multiple: multiple,
131
132
  onClick: onClick,
132
133
  disabled: disabled,
133
- key: option[keyField] || String(Math.random())
134
+ key: option[keyField] || String(Math.random()),
135
+ customLabel: customLabel
134
136
  });
135
137
 
136
138
  if (option.isTemp) {
@@ -45,7 +45,7 @@
45
45
  height: auto;
46
46
  min-height: @height-lg;
47
47
  overflow: visible;
48
-
48
+ line-height: 1;
49
49
  &.sm {
50
50
  height: auto;
51
51
  min-height: @height-sm;
@@ -93,19 +93,29 @@
93
93
  font-size: @font-size-lg;
94
94
  transform: translateY(-50%);
95
95
  }
96
+ &-input {
97
+ #biz-select-handle-tag {
98
+ display: flex;
99
+ align-items: center;
100
+ margin: 2px 4px 2px 0;
101
+ padding: 0 4px;
102
+ padding-top: 1px;
103
+ padding-bottom: 1px;
104
+ background: none;
105
+ border-color: #cacdd4;
106
+ border-radius: @border-radius-small;
107
+ &-label {
108
+ min-width: 0;
109
+ max-width: 100px;
110
+ overflow: hidden;
111
+ text-overflow: ellipsis;
112
+ }
113
+ &:hover {
114
+ .__default-hover();
96
115
 
97
- &-tag {
98
- display: flex;
99
- align-items: center;
100
- margin: 2px 4px 2px 0;
101
- background: none;
102
- border-color: #cacdd4;
103
-
104
- &:hover {
105
- .__default-hover();
106
-
107
- .anticon {
108
- color: @primary-color;
116
+ .anticon {
117
+ color: @primary-color;
118
+ }
109
119
  }
110
120
  }
111
121
  }
@@ -6,7 +6,7 @@ export declare namespace BizSelectTypes {
6
6
  }
7
7
  interface Option {
8
8
  icon?: ReactNode;
9
- [otherProp: string]: any;
9
+ [otherProp: string | symbol | number]: any;
10
10
  }
11
11
  interface Props {
12
12
  disable?: boolean;
@@ -34,6 +34,9 @@ export declare namespace BizSelectTypes {
34
34
  notFound?: string | ReactNode;
35
35
  loading?: boolean;
36
36
  onChange?: (val: Option) => void;
37
+ onVisibleChange?: (visible: boolean) => void;
38
+ destroyPopupOnHide?: boolean;
39
+ customLabel?: (node: ReactNode, option: Option) => ReactNode;
37
40
  onSearch?: (val: string) => void;
38
41
  }
39
42
  interface OverlayProps {
@@ -50,6 +53,7 @@ export declare namespace BizSelectTypes {
50
53
  labelField?: string;
51
54
  extra?: (option: Option) => ReactNode;
52
55
  onClick?: (option: Option) => void;
56
+ customLabel?: (node: ReactNode, option: Option) => ReactNode;
53
57
  }
54
58
  }
55
59
  export interface HandlerTypes {
@@ -1,13 +1,19 @@
1
- import React from 'react';
1
+ import React, { useContext } from 'react';
2
2
  import { Space } from 'antd';
3
3
  import { PlusOutlined } from '@ant-design/icons';
4
4
  import './styles/conditionTypeList.less';
5
+ import { BizUserConditionContext } from '.';
5
6
 
6
7
  var ConditionTypeList = function ConditionTypeList(props) {
7
8
  var onAdd = props.onAdd,
8
9
  label = props.label,
9
10
  show = props.show;
10
- if (!show) return null;
11
+
12
+ var _useContext = useContext(BizUserConditionContext),
13
+ textMode = _useContext.textMode,
14
+ openTagCondition = _useContext.openTagCondition;
15
+
16
+ if (!show || textMode) return null;
11
17
  return /*#__PURE__*/React.createElement("div", {
12
18
  className: "biz-user-condition-type-list"
13
19
  }, label ? /*#__PURE__*/React.createElement("div", {
@@ -16,25 +22,42 @@ var ConditionTypeList = function ConditionTypeList(props) {
16
22
  className: "biz-user-condition-type-container"
17
23
  }, /*#__PURE__*/React.createElement("li", {
18
24
  className: "condition-type",
25
+ key: "event",
19
26
  onClick: function onClick() {
20
27
  return onAdd('event');
21
28
  }
22
- }, /*#__PURE__*/React.createElement(Space, null, /*#__PURE__*/React.createElement(PlusOutlined, null), /*#__PURE__*/React.createElement("span", null, "\u505A\u8FC7\uFF08\u6CA1\u505A\u8FC7\uFF09\u2026"))), /*#__PURE__*/React.createElement("li", {
29
+ }, /*#__PURE__*/React.createElement(Space, {
30
+ key: "event"
31
+ }, /*#__PURE__*/React.createElement(PlusOutlined, null), /*#__PURE__*/React.createElement("span", null, "\u505A\u8FC7\uFF08\u6CA1\u505A\u8FC7\uFF09\u2026"))), /*#__PURE__*/React.createElement("li", {
23
32
  className: "condition-type",
33
+ key: "add",
24
34
  onClick: function onClick() {
25
35
  return onAdd('add');
26
36
  }
27
- }, /*#__PURE__*/React.createElement(Space, null, /*#__PURE__*/React.createElement(PlusOutlined, null), /*#__PURE__*/React.createElement("span", null, "\u65B0\u589E\u4E8E"))), /*#__PURE__*/React.createElement("li", {
37
+ }, /*#__PURE__*/React.createElement(Space, {
38
+ key: "add"
39
+ }, /*#__PURE__*/React.createElement(PlusOutlined, null), /*#__PURE__*/React.createElement("span", null, "\u65B0\u589E\u4E8E"))), /*#__PURE__*/React.createElement("li", {
28
40
  className: "condition-type",
41
+ key: "active",
29
42
  onClick: function onClick() {
30
43
  return onAdd('active');
31
44
  }
32
- }, /*#__PURE__*/React.createElement(Space, null, /*#__PURE__*/React.createElement(PlusOutlined, null), /*#__PURE__*/React.createElement("span", null, "\u6D3B\u8DC3\u4E8E"))), /*#__PURE__*/React.createElement("li", {
45
+ }, /*#__PURE__*/React.createElement(Space, {
46
+ key: "active"
47
+ }, /*#__PURE__*/React.createElement(PlusOutlined, null), /*#__PURE__*/React.createElement("span", null, "\u6D3B\u8DC3\u4E8E"))), /*#__PURE__*/React.createElement("li", {
33
48
  className: "condition-type",
49
+ key: "prop",
34
50
  onClick: function onClick() {
35
51
  return onAdd('prop');
36
52
  }
37
- }, /*#__PURE__*/React.createElement(Space, null, /*#__PURE__*/React.createElement(PlusOutlined, null), /*#__PURE__*/React.createElement("span", null, "\u7528\u6237\u5C5E\u6027\u6EE1\u8DB3")))));
53
+ }, /*#__PURE__*/React.createElement(Space, {
54
+ key: "prop"
55
+ }, /*#__PURE__*/React.createElement(PlusOutlined, null), /*#__PURE__*/React.createElement("span", null, "\u7528\u6237\u5C5E\u6027\u6EE1\u8DB3"))), openTagCondition ? /*#__PURE__*/React.createElement("li", {
56
+ className: "condition-type",
57
+ onClick: function onClick() {
58
+ return onAdd('tag');
59
+ }
60
+ }, /*#__PURE__*/React.createElement(Space, null, /*#__PURE__*/React.createElement(PlusOutlined, null), /*#__PURE__*/React.createElement("span", null, "\u7528\u6237\u6807\u7B7E"))) : null));
38
61
  };
39
62
 
40
63
  ConditionTypeList.defaultProps = {
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { CloseOutlined } from '@ant-design/icons';
2
+ import IconFont from '../icon/iconFont';
3
3
  import './styles/conditionWrap.less';
4
4
 
5
5
  var ConditionWrap = function ConditionWrap(props) {
@@ -12,7 +12,9 @@ var ConditionWrap = function ConditionWrap(props) {
12
12
  onClick: function onClick() {
13
13
  return props.onDelte();
14
14
  }
15
- }, /*#__PURE__*/React.createElement(CloseOutlined, null)));
15
+ }, /*#__PURE__*/React.createElement(IconFont, {
16
+ type: "qingchu"
17
+ })));
16
18
  };
17
19
 
18
20
  export default ConditionWrap;
@@ -0,0 +1,24 @@
1
+ export declare const operatorMap: {
2
+ relative: string;
3
+ absolute: string;
4
+ unlimited_time: string;
5
+ join_time: string;
6
+ 'is not null': string;
7
+ 'is null': string;
8
+ 'not contains': string;
9
+ contains: string;
10
+ equal: string;
11
+ 'not equal': string;
12
+ 'begin with': string;
13
+ 'not begin with': string;
14
+ 'end with': string;
15
+ 'not end with': string;
16
+ '=': string;
17
+ '<': string;
18
+ '>': string;
19
+ '>=': string;
20
+ '<=': string;
21
+ };
22
+ export declare const durationHandler: {
23
+ [key: string]: any;
24
+ };
@@ -0,0 +1,41 @@
1
+ export var operatorMap = {
2
+ relative: '最近',
3
+ absolute: '固定时段',
4
+ unlimited_time: '任意时间',
5
+ join_time: '新增后',
6
+ 'is not null': '不是空值',
7
+ 'is null': '是空值',
8
+ 'not contains': '不包含',
9
+ contains: '包含',
10
+ equal: '是',
11
+ 'not equal': '不是',
12
+ 'begin with': '开头是',
13
+ 'not begin with': '开头不是',
14
+ 'end with': '结尾是',
15
+ 'not end with': '结尾不是',
16
+ '=': '=',
17
+ '<': '<',
18
+ '>': '>',
19
+ '>=': '≥',
20
+ '<=': '≤'
21
+ };
22
+ export var durationHandler = {
23
+ 1: {
24
+ unit: '时',
25
+ format: function format(s) {
26
+ return Number(s) / 3600;
27
+ }
28
+ },
29
+ 2: {
30
+ unit: '分',
31
+ format: function format(s) {
32
+ return Number(s) / 60;
33
+ }
34
+ },
35
+ 3: {
36
+ unit: '秒',
37
+ format: function format(s) {
38
+ return s;
39
+ }
40
+ }
41
+ };
@@ -4,16 +4,19 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
4
4
 
5
5
  function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
6
6
 
7
- import React from 'react';
7
+ import React, { useContext } from 'react';
8
8
  import { RightOutlined } from '@ant-design/icons';
9
9
  import BizEventSelector from '../../eventSelector';
10
10
  import RunTimesCondition from './runTimesCondition';
11
11
  import PeriodCondition from './periodCondition';
12
12
  import PropCondition from './propCondition';
13
13
  import './styles/eventCondition.less';
14
- import { classPrefix } from '..';
14
+ import { BizUserConditionContext, classPrefix } from '..';
15
15
 
16
16
  var EventCondition = function EventCondition(props) {
17
+ var _useContext = useContext(BizUserConditionContext),
18
+ isRealTime = _useContext.isRealTime;
19
+
17
20
  var condition = props.condition,
18
21
  dataId = props.dataId;
19
22
 
@@ -70,7 +73,12 @@ var EventCondition = function EventCondition(props) {
70
73
  id: condition.eventId
71
74
  }
72
75
  },
73
- onChange: onEventChange
76
+ onChange: onEventChange,
77
+ border: false,
78
+ theme: "normal",
79
+ placeholder: "\u9009\u62E9\u4E00\u4E2A\u4E8B\u4EF6",
80
+ destroyPopupOnHide: true,
81
+ defaultSelectAble: false
74
82
  })), /*#__PURE__*/React.createElement("div", {
75
83
  className: "".concat(classPrefix, "-event-condition-expand-attr"),
76
84
  onClick: onAddAttr
@@ -97,7 +105,8 @@ var EventCondition = function EventCondition(props) {
97
105
  dataId: dataId,
98
106
  runPeriod: condition.runPeriod,
99
107
  onChange: onPeriodChange,
100
- isEvent: true
108
+ isEvent: true,
109
+ isRealTime: isRealTime
101
110
  })))));
102
111
  };
103
112
 
@@ -4,19 +4,14 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
4
4
 
5
5
  function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
6
6
 
7
- import React from 'react';
7
+ import React, { useMemo } from 'react';
8
8
  import BizSelect from '../../select';
9
9
  import { Input, DatePicker, Checkbox } from 'antd';
10
10
  import moment from 'moment';
11
11
  import './styles/periodCondition.less';
12
12
  import { classPrefix } from '..';
13
+ import { operatorMap } from './constants';
13
14
  var RangePicker = DatePicker.RangePicker;
14
- var operatorMap = {
15
- relative: '最近',
16
- absolute: '固定时段',
17
- unlimited_time: '任意时间',
18
- join_time: '新增后'
19
- };
20
15
 
21
16
  var PeriodCondition = function PeriodCondition(props) {
22
17
  var dataId = props.dataId,
@@ -36,11 +31,21 @@ var PeriodCondition = function PeriodCondition(props) {
36
31
  text: '任意时间',
37
32
  value: 'unlimited_time'
38
33
  }, {
39
- text: '新增后',
34
+ text: '新增后*',
40
35
  value: 'join_time'
41
36
  }]);
42
37
  }
43
38
 
39
+ var unit = useMemo(function () {
40
+ if (runPeriod.operator === 'absolute' || runPeriod.operator === 'unlimited_time') {
41
+ return '';
42
+ } else if (runPeriod.operator === 'relative') {
43
+ return '天';
44
+ } else if (runPeriod.operator === 'join_time') {
45
+ return '天内';
46
+ }
47
+ }, [runPeriod.operator]);
48
+
44
49
  function onChange(data) {
45
50
  props.onChange(dataId, data);
46
51
  }
@@ -113,6 +118,7 @@ var PeriodCondition = function PeriodCondition(props) {
113
118
 
114
119
  if (operator === 'absolute') {
115
120
  return /*#__PURE__*/React.createElement(RangePicker, {
121
+ size: "large",
116
122
  defaultValue: [moment(values[0]), moment(values[1])],
117
123
  onChange: onDateChange,
118
124
  allowClear: false
@@ -127,7 +133,12 @@ var PeriodCondition = function PeriodCondition(props) {
127
133
  }, label) : null, /*#__PURE__*/React.createElement("div", {
128
134
  className: "".concat(classPrefix, "-period-condition-operator")
129
135
  }, /*#__PURE__*/React.createElement(BizSelect, {
130
- overlayWidth: 129,
136
+ dropdownExtra: isEvent ? /*#__PURE__*/React.createElement("div", {
137
+ style: {
138
+ lineHeight: '29px'
139
+ }
140
+ }, "*\u7528\u6237\u65B0\u589E\u6570\u636E\u4E3A\u6BCF\u65E5\u51CC\u6668\u751F\u6210") : null,
141
+ overlayWidth: isEvent ? 210 : 114,
131
142
  options: options,
132
143
  labelField: "text",
133
144
  keyField: "value",
@@ -140,7 +151,7 @@ var PeriodCondition = function PeriodCondition(props) {
140
151
  className: "".concat(classPrefix, "-period-condition-values")
141
152
  }, renderValues()), /*#__PURE__*/React.createElement("div", {
142
153
  className: "".concat(classPrefix, "-period-condition-unit")
143
- }, "\u5929"), props.isRealTime && runPeriod.operator === 'relative' ? /*#__PURE__*/React.createElement("div", {
154
+ }, unit), props.isRealTime && runPeriod.operator === 'relative' ? /*#__PURE__*/React.createElement("div", {
144
155
  className: "".concat(classPrefix, "-period-condition-today")
145
156
  }, /*#__PURE__*/React.createElement(Checkbox, {
146
157
  checked: runPeriod.values[1] === '1',
@@ -31,6 +31,7 @@ import './styles/propCondition.less';
31
31
  import { useContext } from 'react';
32
32
  import { BizUserConditionContext, classPrefix } from '..';
33
33
  import { transformNumberOperate } from '../util';
34
+ import { PropType } from '../../attributeSelector/types';
34
35
  var numAttrTypeMap = {
35
36
  1: 'cont-string',
36
37
  2: 'cont-num',
@@ -44,12 +45,17 @@ var attrNumTypeMap = {
44
45
 
45
46
  var PropCondition = function PropCondition(props) {
46
47
  var _useContext = useContext(BizUserConditionContext),
47
- eventAttrNum = _useContext.eventAttrNum;
48
+ envNameList = _useContext.envNameList,
49
+ userPropsMap = _useContext.userPropsMap;
50
+
51
+ var _useContext2 = useContext(BizUserConditionContext),
52
+ eventAttrNum = _useContext2.eventAttrNum;
48
53
 
49
54
  var isEvent = props.isEvent,
50
55
  label = props.label,
51
56
  attrs = props.attrs,
52
- dataId = props.dataId;
57
+ dataId = props.dataId,
58
+ eventId = props.eventId;
53
59
 
54
60
  var _useState = useState([]),
55
61
  _useState2 = _slicedToArray(_useState, 2),
@@ -97,8 +103,8 @@ var PropCondition = function PropCondition(props) {
97
103
  var newAttr = {
98
104
  attrName: attrName,
99
105
  attrId: attrId,
100
- category: category,
101
- operator: transformNumberOperate(operator),
106
+ category: category || 'custom',
107
+ operator: type === PropType.NUMBER ? transformNumberOperate(operator) : operator,
102
108
  params: values,
103
109
  attrType: numAttrTypeMap[type]
104
110
  };
@@ -130,7 +136,9 @@ var PropCondition = function PropCondition(props) {
130
136
 
131
137
  function getPropCategory(attrName) {
132
138
  if (!isEvent) return 'userProp';
133
- return attrName === undefined ? 'eventProp' : 'envProp';
139
+ if (attrName === undefined) return 'eventProp';
140
+ if (envNameList.includes(attrName)) return 'envProp';
141
+ return 'eventProp';
134
142
  }
135
143
 
136
144
  function renderAttr(item, i) {
@@ -154,6 +162,14 @@ var PropCondition = function PropCondition(props) {
154
162
  type: attrNumTypeMap[attrType]
155
163
  };
156
164
  attrId && (props.defaultValue.attrId = attrId);
165
+
166
+ if (userPropsMap[attrName] && userPropsMap[attrName].subtype) {
167
+ props.defaultValue.subtype = userPropsMap[attrName].subtype;
168
+ }
169
+ }
170
+
171
+ if (isEvent) {
172
+ props.eventIdList = [eventId];
157
173
  }
158
174
 
159
175
  return /*#__PURE__*/React.createElement("div", {
@@ -171,7 +187,10 @@ var PropCondition = function PropCondition(props) {
171
187
  onDelete: function onDelete() {
172
188
  return onRemoveAttr(i);
173
189
  },
174
- enableDelete: isEvent
190
+ enableDelete: isEvent,
191
+ border: false,
192
+ destroyPopupOnHide: true,
193
+ theme: "normal"
175
194
  }, props))));
176
195
  }
177
196
 
@@ -21,10 +21,10 @@ var options = [{
21
21
  text: '<'
22
22
  }, {
23
23
  value: '>=',
24
- text: '>='
24
+ text: ''
25
25
  }, {
26
26
  value: '<=',
27
- text: '<='
27
+ text: ''
28
28
  }, {
29
29
  value: 'not equal',
30
30
  text: '≠'
@@ -8,10 +8,13 @@
8
8
  flex: 1;
9
9
  }
10
10
  .biz-user-condition-event {
11
- width: 355px;
11
+ width: 200px;
12
12
  .biz-event-select-handle {
13
13
  border-top-right-radius: 0;
14
14
  border-bottom-right-radius: 0;
15
+ .biz-select-handle-input {
16
+ background-color: @background-color-gray;
17
+ }
15
18
  }
16
19
  }
17
20
  &-times-period-wrap {
@@ -21,14 +24,12 @@
21
24
  display: flex;
22
25
  align-items: center;
23
26
  justify-content: center;
24
- width: 30px;
25
- height: 42px;
27
+ width: 38px;
28
+ height: 40px;
26
29
  margin-right: @margin-xs;
27
- border: 1px solid @border-color-base;
28
- border-left: none;
30
+ margin-left: @border-radius-small;
31
+ background-color: @background-color-gray;
29
32
  border-radius: @border-radius-small;
30
- border-top-left-radius: 0;
31
- border-bottom-left-radius: 0;
32
33
  cursor: pointer;
33
34
  }
34
35
  &-attrs {
@@ -40,6 +41,7 @@
40
41
  &-label {
41
42
  display: flex;
42
43
  align-items: center;
44
+ min-width: 28px;
43
45
  height: 42px;
44
46
  margin-right: @margin-xs;
45
47
  }
@@ -7,8 +7,20 @@
7
7
  &-values,
8
8
  &-unit {
9
9
  margin-right: @margin-xs;
10
+ > input {
11
+ border: none !important;
12
+ }
10
13
  }
11
14
  &-operator {
12
15
  width: 129px;
13
16
  }
17
+ &-values {
18
+ .ant-picker-range.ant-picker-larg {
19
+ min-width: 255px;
20
+ }
21
+ }
22
+ &-today {
23
+ margin-left: @margin-xs;
24
+ white-space: nowrap;
25
+ }
14
26
  }
@@ -26,11 +26,19 @@
26
26
  display: flex;
27
27
  align-items: center;
28
28
  justify-content: center;
29
- width: 30px;
30
- height: 30px;
31
- border: 1px solid @border-color-base;
29
+ width: 40px;
30
+ height: 40px;
31
+ background-color: @background-color-gray;
32
32
  border-radius: @border-radius-sx;
33
33
  cursor: pointer;
34
34
  }
35
35
  }
36
+ .biz-condition-item-panel {
37
+ .biz-condition-item-input {
38
+ .ant-input {
39
+ height: 40px;
40
+ border: none;
41
+ }
42
+ }
43
+ }
36
44
  }
@@ -9,6 +9,9 @@
9
9
  &-value {
10
10
  width: 58px;
11
11
  margin-right: @margin-xs;
12
+ > input {
13
+ border: none !important;
14
+ }
12
15
  }
13
16
  .biz-user-condition-runtimes-tip {
14
17
  color: @primary-color;
@@ -0,0 +1,20 @@
1
+ @import '../../../assets/styles/variable.less';
2
+ .biz-user-condition-tags-condition {
3
+ display: flex;
4
+ &-label {
5
+ margin-right: @margin-xs;
6
+ }
7
+ &-value {
8
+ margin-left: @margin-xs;
9
+ }
10
+ &-label {
11
+ line-height: 40px;
12
+ }
13
+ &-value {
14
+ flex: 1;
15
+ min-width: 0;
16
+ }
17
+ &-operator {
18
+ width: 96px;
19
+ }
20
+ }