@zgfe/business-lib 1.1.29-visual.8 → 1.1.29

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 (140) hide show
  1. package/es/addToPanel/components/addPanel.js +21 -8
  2. package/es/addToPanel/components/radioGroup.js +3 -1
  3. package/es/addToPanel/components/styleList.js +22 -5
  4. package/es/addToPanel/demo/edit.js +12 -5
  5. package/es/addToPanel/demo/index.js +12 -5
  6. package/es/addToPanel/index.js +58 -21
  7. package/es/addToScene/addGroup.js +4 -0
  8. package/es/addToScene/demo/index.js +12 -5
  9. package/es/addToScene/index.js +40 -13
  10. package/es/assets/demo/index.js +2 -0
  11. package/es/assets/demo/input.js +12 -5
  12. package/es/assets/iconfont/iconfont.js +17 -10
  13. package/es/assets/theme.js +1 -0
  14. package/es/attrConditions/components/operateList.js +27 -10
  15. package/es/attrConditions/components/stringList.js +97 -68
  16. package/es/attrConditions/components/valuesList.js +40 -14
  17. package/es/attrConditions/demo/group.js +23 -11
  18. package/es/attrConditions/demo/index.js +26 -17
  19. package/es/attrConditions/group.js +48 -17
  20. package/es/attrConditions/index.js +49 -22
  21. package/es/attrConditions/types.js +1 -0
  22. package/es/attributeSelector/demo/disable.js +16 -8
  23. package/es/attributeSelector/demo/index.js +17 -8
  24. package/es/attributeSelector/index.js +45 -22
  25. package/es/attributeSelector/listPanel.js +46 -18
  26. package/es/attributeSelector/option.js +13 -3
  27. package/es/attributeSelector/types.js +5 -0
  28. package/es/attributeSelector/util.js +3 -0
  29. package/es/chart/demo/index.js +14 -5
  30. package/es/chart/index.js +44 -30
  31. package/es/chart/util/chartOptionConfig.d.ts +3 -3
  32. package/es/chart/util/chartOptionConfig.js +37 -13
  33. package/es/chart/util/data/china.js +4 -1
  34. package/es/chart/util/formatData.d.ts +2 -2
  35. package/es/chart/util/formatData.js +5 -0
  36. package/es/chart/util/formatOption.js +13 -0
  37. package/es/chart/util/mapUtil.js +26 -5
  38. package/es/config.js +2 -0
  39. package/es/constants/apis.d.ts +0 -1
  40. package/es/constants/apis.js +1 -2
  41. package/es/cycleTime/demo/disable.js +1 -0
  42. package/es/cycleTime/index.js +46 -19
  43. package/es/cycleTime/month.js +27 -8
  44. package/es/datePicker/datePicker.js +23 -5
  45. package/es/datePicker/demo/customType.js +22 -13
  46. package/es/datePicker/demo/day.js +22 -13
  47. package/es/datePicker/demo/index.js +21 -12
  48. package/es/datePicker/index.js +41 -18
  49. package/es/datePicker/utils.js +7 -0
  50. package/es/demoWrapper/content.d.ts +1 -2
  51. package/es/demoWrapper/content.js +64 -42
  52. package/es/demoWrapper/demo/index.js +4 -5
  53. package/es/demoWrapper/head.d.ts +1 -3
  54. package/es/demoWrapper/head.js +27 -25
  55. package/es/demoWrapper/index.js +36 -28
  56. package/es/dialog/demo/index.js +12 -5
  57. package/es/dialog/index.js +6 -4
  58. package/es/dnd/demo/data.js +28 -19
  59. package/es/dnd/demo/handle.js +28 -19
  60. package/es/dnd/index.js +45 -21
  61. package/es/dnd/item.js +30 -10
  62. package/es/eventSelector/demo/index.js +23 -12
  63. package/es/eventSelector/index.js +42 -14
  64. package/es/eventSelector/listPanel.js +73 -31
  65. package/es/eventSelector/option.js +11 -6
  66. package/es/icon/iconFont.js +13 -7
  67. package/es/index.d.ts +1 -2
  68. package/es/index.js +1 -2
  69. package/es/layout/analysisLayout/demo/index.js +6 -0
  70. package/es/layout/analysisLayout/index.d.ts +1 -1
  71. package/es/layout/analysisLayout/index.js +34 -16
  72. package/es/layout/detail/index.js +3 -1
  73. package/es/loginForm/index.js +18 -7
  74. package/es/searchInput/index.js +7 -2
  75. package/es/select/demo/children.js +16 -8
  76. package/es/select/demo/customLabel.js +2 -0
  77. package/es/select/demo/group.js +17 -8
  78. package/es/select/demo/index.js +19 -11
  79. package/es/select/demo/loading.js +18 -8
  80. package/es/select/demo/multiple.js +16 -8
  81. package/es/select/handle.js +34 -14
  82. package/es/select/index.js +59 -22
  83. package/es/select/option.js +30 -10
  84. package/es/select/overlay.js +62 -25
  85. package/es/table/demo/data/table.js +2 -0
  86. package/es/table/demo/index.js +39 -13
  87. package/es/table/demo/index2.js +15 -5
  88. package/es/table/demo/index3.js +28 -7
  89. package/es/table/index.js +33 -14
  90. package/es/targetConditionGroup/components/targetDimension.js +38 -12
  91. package/es/targetConditionGroup/demo/group.js +36 -21
  92. package/es/targetConditionGroup/demo/index.js +13 -5
  93. package/es/targetConditionGroup/index.js +84 -31
  94. package/es/targetSelector/demo/index.js +28 -15
  95. package/es/targetSelector/editBox.js +20 -5
  96. package/es/targetSelector/index.js +36 -15
  97. package/es/targetSelector/optionIcon.js +5 -1
  98. package/es/targetSelector/optionMenu.js +3 -0
  99. package/es/userCondition/conditionTypeList.js +12 -7
  100. package/es/userCondition/conditionWrap.js +2 -0
  101. package/es/userCondition/conditions/cdpCondition.js +97 -51
  102. package/es/userCondition/conditions/eventCondition.js +16 -6
  103. package/es/userCondition/conditions/periodCondition.js +26 -8
  104. package/es/userCondition/conditions/propCondition.js +61 -29
  105. package/es/userCondition/conditions/runTimesCondition.js +10 -5
  106. package/es/userCondition/conditions/tagsCondition.d.ts +1 -1
  107. package/es/userCondition/conditions/tagsCondition.js +33 -15
  108. package/es/userCondition/conditions/textDesc.js +67 -16
  109. package/es/userCondition/demo/index.js +21 -11
  110. package/es/userCondition/index.js +91 -51
  111. package/es/userCondition/orConditions.js +48 -11
  112. package/es/userCondition/relationLabel.js +4 -1
  113. package/es/userCondition/types.d.ts +1 -1
  114. package/es/userCondition/types.js +1 -0
  115. package/es/userCondition/util.js +13 -4
  116. package/es/userGroup/demo/group.js +23 -14
  117. package/es/userGroup/demo/index.js +15 -5
  118. package/es/userGroup/index.js +30 -12
  119. package/es/userTagsSelector/cascaderOverlay.js +51 -19
  120. package/es/userTagsSelector/components/search/index.js +2 -0
  121. package/es/userTagsSelector/demo/index.js +3 -0
  122. package/es/userTagsSelector/groups/groupOption.js +8 -6
  123. package/es/userTagsSelector/groups/index.js +30 -15
  124. package/es/userTagsSelector/index.js +35 -17
  125. package/es/userTagsSelector/multipleCheckPanel/checkOption.js +6 -3
  126. package/es/userTagsSelector/multipleCheckPanel/index.js +21 -8
  127. package/es/userTagsSelector/util.js +2 -0
  128. package/es/utils/ajax.js +71 -45
  129. package/es/utils/base64.js +22 -3
  130. package/es/utils/type.d.ts +1 -1
  131. package/es/utils/type.js +7 -4
  132. package/es/utils/util.js +16 -0
  133. package/package.json +2 -2
  134. package/es/socket/demo/demo.d.ts +0 -2
  135. package/es/socket/demo/demo.js +0 -139
  136. package/es/socket/demo/index.less +0 -27
  137. package/es/socket/index.d.ts +0 -31
  138. package/es/socket/index.js +0 -284
  139. package/es/socket/types.d.ts +0 -37
  140. package/es/socket/types.js +0 -26
@@ -1,6 +1,7 @@
1
1
  import React from 'react';
2
2
  import IconFont from '../icon/iconFont';
3
3
  import './styles/conditionWrap.less';
4
+
4
5
  var ConditionWrap = function ConditionWrap(props) {
5
6
  return /*#__PURE__*/React.createElement("div", {
6
7
  className: "biz-user-condition-item-wrap"
@@ -15,4 +16,5 @@ var ConditionWrap = function ConditionWrap(props) {
15
16
  type: "qingchu"
16
17
  })));
17
18
  };
19
+
18
20
  export default ConditionWrap;
@@ -1,15 +1,21 @@
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
1
  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; }
2
+
3
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); }
4
+
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
+
7
7
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
8
+
8
9
  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."); }
10
+
9
11
  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
+
13
+ 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; }
14
+
15
+ 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; }
16
+
12
17
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
18
+
13
19
  import React, { useContext, useEffect, useState } from 'react';
14
20
  import BizSelect from '../../select';
15
21
  import { PropType } from '../types';
@@ -23,62 +29,74 @@ import request from '../../utils/ajax';
23
29
  import Apis from '../../constants/apis';
24
30
  import BizGlobalDataContext from '../../context';
25
31
  var classPrefix = 'biz-user-condition-cdp';
32
+
26
33
  var CdpConditionItem = function CdpConditionItem(props) {
27
34
  var _useContext = useContext(BizGlobalDataContext),
28
- currentApp = _useContext.currentApp;
35
+ currentApp = _useContext.currentApp;
36
+
29
37
  var _useContext2 = useContext(BizUserConditionContext),
30
- _useContext2$datasetL = _useContext2.datasetList,
31
- datasetList = _useContext2$datasetL === void 0 ? [] : _useContext2$datasetL;
38
+ _useContext2$datasetL = _useContext2.datasetList,
39
+ datasetList = _useContext2$datasetL === void 0 ? [] : _useContext2$datasetL;
40
+
32
41
  var _useState = useState(function () {
33
- if (props.value) {
34
- return {
35
- id: props.value.datasetId,
36
- tableName: props.value.datasetTable
37
- };
38
- }
39
- return;
40
- }),
41
- _useState2 = _slicedToArray(_useState, 2),
42
- dataset = _useState2[0],
43
- setDataset = _useState2[1];
42
+ if (props.value) {
43
+ return {
44
+ id: props.value.datasetId,
45
+ tableName: props.value.datasetTable
46
+ };
47
+ }
48
+
49
+ return;
50
+ }),
51
+ _useState2 = _slicedToArray(_useState, 2),
52
+ dataset = _useState2[0],
53
+ setDataset = _useState2[1];
54
+
44
55
  var _useState3 = useState(false),
45
- _useState4 = _slicedToArray(_useState3, 2),
46
- loading = _useState4[0],
47
- setLoading = _useState4[1];
56
+ _useState4 = _slicedToArray(_useState3, 2),
57
+ loading = _useState4[0],
58
+ setLoading = _useState4[1];
59
+
48
60
  var _useState5 = useState(),
49
- _useState6 = _slicedToArray(_useState5, 2),
50
- field = _useState6[0],
51
- setField = _useState6[1];
61
+ _useState6 = _slicedToArray(_useState5, 2),
62
+ field = _useState6[0],
63
+ setField = _useState6[1];
64
+
52
65
  var _useState7 = useState(),
53
- _useState8 = _slicedToArray(_useState7, 2),
54
- operator = _useState8[0],
55
- setOperator = _useState8[1];
66
+ _useState8 = _slicedToArray(_useState7, 2),
67
+ operator = _useState8[0],
68
+ setOperator = _useState8[1];
69
+
56
70
  var _useState9 = useState(),
57
- _useState10 = _slicedToArray(_useState9, 2),
58
- fieldValue = _useState10[0],
59
- setFieldValue = _useState10[1];
71
+ _useState10 = _slicedToArray(_useState9, 2),
72
+ fieldValue = _useState10[0],
73
+ setFieldValue = _useState10[1];
74
+
60
75
  var _useState11 = useState([]),
61
- _useState12 = _slicedToArray(_useState11, 2),
62
- fieldList = _useState12[0],
63
- setFieldList = _useState12[1];
76
+ _useState12 = _slicedToArray(_useState11, 2),
77
+ fieldList = _useState12[0],
78
+ setFieldList = _useState12[1];
79
+
64
80
  var _useState13 = useState(true),
65
- _useState14 = _slicedToArray(_useState13, 2),
66
- isFirst = _useState14[0],
67
- setIsFirst = _useState14[1];
81
+ _useState14 = _slicedToArray(_useState13, 2),
82
+ isFirst = _useState14[0],
83
+ setIsFirst = _useState14[1];
84
+
68
85
  useEffect(function () {
69
86
  if (!props.value) {
70
87
  setIsFirst(false);
71
88
  return;
72
89
  }
90
+
73
91
  var _props$value = props.value,
74
- datasetId = _props$value.datasetId,
75
- datasetTable = _props$value.datasetTable,
76
- datasetName = _props$value.datasetName,
77
- fieldName = _props$value.fieldName,
78
- fieldType = _props$value.fieldType,
79
- webType = _props$value.webType,
80
- operator = _props$value.operator,
81
- params = _props$value.params;
92
+ datasetId = _props$value.datasetId,
93
+ datasetTable = _props$value.datasetTable,
94
+ datasetName = _props$value.datasetName,
95
+ fieldName = _props$value.fieldName,
96
+ fieldType = _props$value.fieldType,
97
+ webType = _props$value.webType,
98
+ operator = _props$value.operator,
99
+ params = _props$value.params;
82
100
  setDataset({
83
101
  id: datasetId,
84
102
  tableName: datasetTable,
@@ -92,9 +110,11 @@ var CdpConditionItem = function CdpConditionItem(props) {
92
110
  setOperator({
93
111
  value: operator
94
112
  });
113
+
95
114
  if (params) {
96
115
  setFieldValue(params);
97
116
  }
117
+
98
118
  onDatasetChange(datasetId);
99
119
  setTimeout(function () {
100
120
  setIsFirst(false);
@@ -119,23 +139,29 @@ var CdpConditionItem = function CdpConditionItem(props) {
119
139
  if (isFirst) return;
120
140
  if (['absolute', 'relative', 'is null', 'is not null'].includes(operator === null || operator === void 0 ? void 0 : operator.value)) setFieldValue([]);
121
141
  }, [operator]);
142
+
122
143
  var getType = function getType(type) {
123
144
  if (!type) return;
145
+
124
146
  if (type === PropType.STRING2) {
125
147
  return PropType.STRING;
126
148
  }
149
+
127
150
  if (type === PropType.NUMBER2) {
128
151
  return PropType.NUMBER;
129
152
  }
153
+
130
154
  if (type === PropType.DATE2) {
131
155
  return PropType.DATE;
132
156
  }
133
157
  };
158
+
134
159
  var onDatasetChange = function onDatasetChange(datasetId) {
135
160
  if (!datasetId) {
136
161
  setFieldList([]);
137
162
  return;
138
163
  }
164
+
139
165
  setLoading(true);
140
166
  request(Apis.queryDatasetDetail, {
141
167
  method: 'post',
@@ -153,6 +179,7 @@ var CdpConditionItem = function CdpConditionItem(props) {
153
179
  setFieldList([]);
154
180
  });
155
181
  };
182
+
156
183
  var onTableChange = function onTableChange(data) {
157
184
  setDataset(data);
158
185
  setField({
@@ -162,32 +189,41 @@ var CdpConditionItem = function CdpConditionItem(props) {
162
189
  setFieldValue([]);
163
190
  onDatasetChange(data.id);
164
191
  };
192
+
165
193
  var onFieldChange = function onFieldChange(data) {
166
194
  setField(data);
167
195
  setOperator(getOptions(data.webType)[0]);
168
196
  setFieldValue([]);
169
197
  };
198
+
170
199
  var onOperateChange = function onOperateChange(operate) {
171
200
  setOperator(operate);
172
201
  setFieldValue([]);
173
202
  };
203
+
174
204
  function getOptions(type) {
175
205
  var list = [];
206
+
176
207
  switch (type) {
177
208
  case PropType.DATE2:
178
209
  list = dateOperate;
179
210
  break;
211
+
180
212
  case PropType.NUMBER2:
181
213
  list = numberOperate;
182
214
  break;
215
+
183
216
  case PropType.STRING2:
184
217
  list = stringOperate;
185
218
  break;
219
+
186
220
  default:
187
221
  list = [];
188
222
  }
223
+
189
224
  return list;
190
225
  }
226
+
191
227
  function renderByType() {
192
228
  if (!field || !field.name) return null;
193
229
  var optionList = getOptions(field.webType);
@@ -229,6 +265,7 @@ var CdpConditionItem = function CdpConditionItem(props) {
229
265
  },
230
266
  suffix: "\u5929"
231
267
  });
268
+
232
269
  case PropType.STRING2:
233
270
  if (['is null', 'is not null'].includes(operator === null || operator === void 0 ? void 0 : operator.value)) return null;
234
271
  return /*#__PURE__*/React.createElement(Input, {
@@ -240,6 +277,7 @@ var CdpConditionItem = function CdpConditionItem(props) {
240
277
  setFieldValue([e.target.value]);
241
278
  }
242
279
  });
280
+
243
281
  case PropType.NUMBER2:
244
282
  return /*#__PURE__*/React.createElement(Input, {
245
283
  type: "number",
@@ -254,6 +292,7 @@ var CdpConditionItem = function CdpConditionItem(props) {
254
292
  }
255
293
  }());
256
294
  }
295
+
257
296
  return /*#__PURE__*/React.createElement("div", {
258
297
  className: "".concat(classPrefix, "-content")
259
298
  }, /*#__PURE__*/React.createElement(BizSelect, {
@@ -277,24 +316,30 @@ var CdpConditionItem = function CdpConditionItem(props) {
277
316
  onChange: onFieldChange
278
317
  }), renderByType()) : null);
279
318
  };
319
+
280
320
  var CdpCondition = function CdpCondition(props) {
281
321
  var dataId = props.dataId,
282
- defaultValue = props.defaultValue,
283
- onChange = props.onChange;
322
+ defaultValue = props.defaultValue,
323
+ onChange = props.onChange;
324
+
284
325
  var _useState15 = useState([undefined]),
285
- _useState16 = _slicedToArray(_useState15, 2),
286
- cdpConditions = _useState16[0],
287
- setCdpConditions = _useState16[1];
326
+ _useState16 = _slicedToArray(_useState15, 2),
327
+ cdpConditions = _useState16[0],
328
+ setCdpConditions = _useState16[1];
329
+
288
330
  useEffect(function () {
289
331
  if (defaultValue && defaultValue.dataset) {
290
332
  setCdpConditions(defaultValue.dataset);
291
333
  }
292
334
  }, []);
335
+
293
336
  var onChangeCondition = function onChangeCondition(condition, index) {
294
337
  var resData = _.cloneDeep(cdpConditions);
338
+
295
339
  resData[index] = _objectSpread({}, condition);
296
340
  onChange(dataId, resData);
297
341
  };
342
+
298
343
  return /*#__PURE__*/React.createElement("div", {
299
344
  className: classPrefix
300
345
  }, /*#__PURE__*/React.createElement("div", {
@@ -309,4 +354,5 @@ var CdpCondition = function CdpCondition(props) {
309
354
  });
310
355
  }));
311
356
  };
357
+
312
358
  export default CdpCondition;
@@ -1,9 +1,9 @@
1
- function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
2
1
  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; }
2
+
3
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); }
4
+
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
+
7
7
  import React, { useContext } from 'react';
8
8
  import BizEventSelector from '../../eventSelector';
9
9
  import RunTimesCondition from './runTimesCondition';
@@ -13,35 +13,43 @@ import './styles/eventCondition.less';
13
13
  import { BizUserConditionContext, classPrefix } from '..';
14
14
  import { Tooltip } from 'antd';
15
15
  import IconFont from '../../icon/iconFont';
16
+
16
17
  var EventCondition = function EventCondition(props) {
17
18
  var _useContext = useContext(BizUserConditionContext),
18
- isRealTime = _useContext.isRealTime;
19
+ isRealTime = _useContext.isRealTime;
20
+
19
21
  var condition = props.condition,
20
- dataId = props.dataId;
22
+ dataId = props.dataId;
23
+
21
24
  function onChange(data) {
22
25
  props.onChange(dataId, data);
23
26
  }
27
+
24
28
  function onEventChange(data) {
25
29
  var event = data.event;
26
30
  onChange(_objectSpread(_objectSpread({}, condition), {}, {
27
31
  eventId: event.id
28
32
  }));
29
33
  }
34
+
30
35
  function onRunTimesChange(newRunTimes) {
31
36
  onChange(_objectSpread(_objectSpread({}, condition), {}, {
32
37
  runTimes: newRunTimes
33
38
  }));
34
39
  }
40
+
35
41
  function onPeriodChange(_dataId, newPeriod) {
36
42
  onChange(_objectSpread(_objectSpread({}, condition), {}, {
37
43
  runPeriod: newPeriod
38
44
  }));
39
45
  }
46
+
40
47
  function onAttrChange(_dataId, newAttrs) {
41
48
  onChange(_objectSpread(_objectSpread({}, condition), {}, {
42
49
  attrs: newAttrs
43
50
  }));
44
51
  }
52
+
45
53
  function onAddAttr() {
46
54
  onChange(_objectSpread(_objectSpread({}, condition), {}, {
47
55
  attrs: [{
@@ -50,6 +58,7 @@ var EventCondition = function EventCondition(props) {
50
58
  }]
51
59
  }));
52
60
  }
61
+
53
62
  return /*#__PURE__*/React.createElement("div", {
54
63
  className: "".concat(classPrefix, "-event-condition")
55
64
  }, /*#__PURE__*/React.createElement("div", {
@@ -106,4 +115,5 @@ var EventCondition = function EventCondition(props) {
106
115
  isRealTime: isRealTime
107
116
  })))));
108
117
  };
118
+
109
119
  export default EventCondition;
@@ -1,9 +1,9 @@
1
- function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
2
1
  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; }
2
+
3
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); }
4
+
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
+
7
7
  import React, { useMemo } from 'react';
8
8
  import BizSelect from '../../select';
9
9
  import { Input, DatePicker, Checkbox } from 'antd';
@@ -12,11 +12,12 @@ import './styles/periodCondition.less';
12
12
  import { classPrefix } from '..';
13
13
  import { operatorMap } from './constants';
14
14
  var RangePicker = DatePicker.RangePicker;
15
+
15
16
  var PeriodCondition = function PeriodCondition(props) {
16
17
  var dataId = props.dataId,
17
- label = props.label,
18
- isEvent = props.isEvent,
19
- runPeriod = props.runPeriod;
18
+ label = props.label,
19
+ isEvent = props.isEvent,
20
+ runPeriod = props.runPeriod;
20
21
  var options = [{
21
22
  text: '最近',
22
23
  value: 'relative'
@@ -24,6 +25,7 @@ var PeriodCondition = function PeriodCondition(props) {
24
25
  text: '固定时段',
25
26
  value: 'absolute'
26
27
  }];
28
+
27
29
  if (isEvent) {
28
30
  options = options.concat([{
29
31
  text: '任意时间',
@@ -33,6 +35,7 @@ var PeriodCondition = function PeriodCondition(props) {
33
35
  value: 'join_time'
34
36
  }]);
35
37
  }
38
+
36
39
  var unit = useMemo(function () {
37
40
  if (runPeriod.operator === 'absolute' || runPeriod.operator === 'unlimited_time') {
38
41
  return '';
@@ -42,26 +45,33 @@ var PeriodCondition = function PeriodCondition(props) {
42
45
  return '天内';
43
46
  }
44
47
  }, [runPeriod.operator]);
48
+
45
49
  function onChange(data) {
46
50
  props.onChange(dataId, data);
47
51
  }
52
+
48
53
  function onOperatorChange(option) {
49
54
  var newData = {
50
55
  operator: option.value
51
56
  };
57
+
52
58
  if (newData.operator === 'absolute') {
53
59
  var endDate = moment().format('YYYY-MM-DD');
54
60
  var startDate = moment().subtract(7, 'days').format('YYYY-MM-DD');
55
61
  newData.values = [startDate, endDate];
56
62
  }
63
+
57
64
  if (newData.operator === 'relative') {
58
65
  newData.values = ['30', '0'];
59
66
  }
67
+
60
68
  if (newData.operator === 'join_time') {
61
69
  newData.values = ['3', '0'];
62
70
  }
71
+
63
72
  onChange(newData);
64
73
  }
74
+
65
75
  function onDateChange(newData) {
66
76
  if (runPeriod.operator === 'absolute') {
67
77
  var dateRange = newData;
@@ -78,18 +88,23 @@ var PeriodCondition = function PeriodCondition(props) {
78
88
  }));
79
89
  }
80
90
  }
91
+
81
92
  function onChangeToday(e) {
82
93
  var newValues = [runPeriod.values[0], '0'];
94
+
83
95
  if (e.target.checked) {
84
96
  newValues[1] = '1';
85
97
  }
98
+
86
99
  onChange(_objectSpread(_objectSpread({}, runPeriod), {}, {
87
100
  values: newValues
88
101
  }));
89
102
  }
103
+
90
104
  function renderValues() {
91
105
  var operator = runPeriod.operator,
92
- values = runPeriod.values;
106
+ values = runPeriod.values;
107
+
93
108
  if (operator === 'relative' || operator === 'join_time') {
94
109
  return /*#__PURE__*/React.createElement(Input, {
95
110
  size: "middle",
@@ -100,6 +115,7 @@ var PeriodCondition = function PeriodCondition(props) {
100
115
  }
101
116
  });
102
117
  }
118
+
103
119
  if (operator === 'absolute') {
104
120
  return /*#__PURE__*/React.createElement(RangePicker, {
105
121
  size: "middle",
@@ -109,6 +125,7 @@ var PeriodCondition = function PeriodCondition(props) {
109
125
  });
110
126
  }
111
127
  }
128
+
112
129
  return /*#__PURE__*/React.createElement("div", {
113
130
  className: "".concat(classPrefix, "-period-condition")
114
131
  }, label ? /*#__PURE__*/React.createElement("div", {
@@ -142,6 +159,7 @@ var PeriodCondition = function PeriodCondition(props) {
142
159
  onChange: onChangeToday
143
160
  }, "\u4E0D\u5305\u542B\u4ECA\u5929")) : null);
144
161
  };
162
+
145
163
  PeriodCondition.defaultProps = {
146
164
  isEvent: false,
147
165
  isRealTime: false