@zgfe/business-lib 1.1.31-alpha.2 → 1.1.31
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.
- package/es/assets/colorIcon/demo.css +539 -0
- package/es/assets/colorIcon/demo_index.html +741 -0
- package/es/assets/colorIcon/iconfont.css +112 -0
- package/es/assets/colorIcon/iconfont.js +43 -0
- package/es/assets/colorIcon/iconfont.json +177 -0
- package/es/assets/colorIcon/iconfont.svg +67 -0
- package/es/assets/colorIcon/iconfont.ttf +0 -0
- package/es/assets/colorIcon/iconfont.woff +0 -0
- package/es/assets/colorIcon/iconfont.woff2 +0 -0
- package/es/assets/iconfont/demo_index.html +95 -3
- package/es/assets/iconfont/iconfont.css +19 -3
- package/es/assets/iconfont/iconfont.js +1 -1
- package/es/assets/iconfont/iconfont.json +28 -0
- package/es/assets/iconfont/iconfont.ttf +0 -0
- package/es/assets/iconfont/iconfont.woff +0 -0
- package/es/assets/iconfont/iconfont.woff2 +0 -0
- package/es/assets/styles/resetAntd.less +12 -36
- package/es/attrConditions/utils/operates.d.ts +0 -50
- package/es/attrConditions/utils/operates.js +0 -126
- package/es/colorIcon/demo/index.d.ts +3 -0
- package/es/colorIcon/demo/index.js +10 -0
- package/es/colorIcon/index.d.ts +9 -0
- package/es/colorIcon/index.js +19 -0
- package/es/constants/apis.d.ts +1 -0
- package/es/constants/apis.js +2 -1
- package/es/datePicker/index.d.ts +1 -1
- package/es/datePicker/index.js +1 -1
- package/es/datePicker/styles/index.less +1 -1
- package/es/demoWrapper/content.d.ts +2 -1
- package/es/demoWrapper/content.js +23 -12
- package/es/demoWrapper/demo/index.js +5 -3
- package/es/demoWrapper/head.d.ts +3 -1
- package/es/demoWrapper/head.js +17 -5
- package/es/demoWrapper/index.js +18 -10
- package/es/eventSelector/listPanel.js +11 -4
- package/es/index.d.ts +3 -1
- package/es/index.js +3 -1
- package/es/socket/demo/demo.d.ts +2 -0
- package/es/socket/demo/demo.js +145 -0
- package/es/socket/demo/index.less +27 -0
- package/es/socket/index.d.ts +31 -0
- package/es/socket/index.js +291 -0
- package/es/socket/types.d.ts +38 -0
- package/es/socket/types.js +28 -0
- package/es/userCondition/conditionTypeList.js +1 -17
- package/es/userCondition/conditions/constants.d.ts +0 -1
- package/es/userCondition/conditions/constants.js +1 -2
- package/es/userCondition/conditions/eventCondition.js +2 -77
- package/es/userCondition/orConditions.js +0 -15
- package/es/userCondition/types.d.ts +3 -34
- package/es/userCondition/util.d.ts +1 -1
- package/es/userCondition/util.js +0 -29
- package/package.json +61 -61
- package/es/userCondition/conditions/businessCondition.d.ts +0 -11
- package/es/userCondition/conditions/businessCondition.js +0 -413
- package/es/userCondition/conditions/dataAttribute.d.ts +0 -10
- package/es/userCondition/conditions/dataAttribute.js +0 -329
- package/es/userCondition/conditions/timeDimension.d.ts +0 -9
- package/es/userCondition/conditions/timeDimension.js +0 -200
|
@@ -1,329 +0,0 @@
|
|
|
1
|
-
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
2
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
3
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
4
|
-
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
5
|
-
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
6
|
-
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
7
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
8
|
-
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
9
|
-
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
10
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
11
|
-
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
12
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
13
|
-
import React, { useContext, useEffect, useState } from 'react';
|
|
14
|
-
import BizSelect from '../../select';
|
|
15
|
-
import './styles/runTimesCondition.less';
|
|
16
|
-
import { classPrefix } from '..';
|
|
17
|
-
import { stringOperate, orderTypeList, typeList, computeTypeList } from '../../attrConditions/utils/operates';
|
|
18
|
-
import moment from 'moment';
|
|
19
|
-
import request from '../../utils/ajax';
|
|
20
|
-
import BizGlobalDataContext from '../../context';
|
|
21
|
-
import { DatePicker, Input } from 'antd';
|
|
22
|
-
var RangePicker = DatePicker.RangePicker;
|
|
23
|
-
var DataAttribute = function DataAttribute(props) {
|
|
24
|
-
var condition = props.condition,
|
|
25
|
-
index = props.index,
|
|
26
|
-
serviceAttrType = props.serviceAttrType,
|
|
27
|
-
onChange = props.onChange;
|
|
28
|
-
var list = [];
|
|
29
|
-
var operateList = [];
|
|
30
|
-
switch (condition.attrs[index].attrType) {
|
|
31
|
-
case 'cont-string':
|
|
32
|
-
list = typeList['cont-string'];
|
|
33
|
-
operateList = stringOperate;
|
|
34
|
-
break;
|
|
35
|
-
case 'cont-num':
|
|
36
|
-
list = computeTypeList;
|
|
37
|
-
operateList = typeList['cont-num'];
|
|
38
|
-
break;
|
|
39
|
-
default:
|
|
40
|
-
list = typeList['cont-date'];
|
|
41
|
-
break;
|
|
42
|
-
}
|
|
43
|
-
var _useState = useState((serviceAttrType === null || serviceAttrType === void 0 ? void 0 : serviceAttrType.value) ? list : []),
|
|
44
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
45
|
-
masterList = _useState2[0],
|
|
46
|
-
setMasterList = _useState2[1];
|
|
47
|
-
var _useState3 = useState(operateList),
|
|
48
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
|
49
|
-
stringOperateList = _useState4[0],
|
|
50
|
-
setStringOperateList = _useState4[1];
|
|
51
|
-
var _useState5 = useState([]),
|
|
52
|
-
_useState6 = _slicedToArray(_useState5, 2),
|
|
53
|
-
paramsList = _useState6[0],
|
|
54
|
-
setParamsList = _useState6[1];
|
|
55
|
-
var _useState7 = useState([]),
|
|
56
|
-
_useState8 = _slicedToArray(_useState7, 2),
|
|
57
|
-
bizDataAttrList = _useState8[0],
|
|
58
|
-
setBizDataAttrList = _useState8[1];
|
|
59
|
-
var _useState9 = useState(''),
|
|
60
|
-
_useState10 = _slicedToArray(_useState9, 2),
|
|
61
|
-
searchValue = _useState10[0],
|
|
62
|
-
setSearchValue = _useState10[1];
|
|
63
|
-
var _useContext = useContext(BizGlobalDataContext),
|
|
64
|
-
currentApp = _useContext.currentApp;
|
|
65
|
-
useEffect(function () {
|
|
66
|
-
if (serviceAttrType === null || serviceAttrType === void 0 ? void 0 : serviceAttrType.value) {
|
|
67
|
-
queryBizDataAttrList(serviceAttrType === null || serviceAttrType === void 0 ? void 0 : serviceAttrType.value);
|
|
68
|
-
} else {
|
|
69
|
-
setBizDataAttrList(orderTypeList);
|
|
70
|
-
}
|
|
71
|
-
}, [searchValue]);
|
|
72
|
-
function queryAppList(type) {
|
|
73
|
-
request(type === 'master' ? '/cep-console/api/v1/cdp/orderAttribute/master' : '/cep-console/api/v1/cdp/orderAttribute/son', {
|
|
74
|
-
headers: {
|
|
75
|
-
'Content-Type': 'application/json'
|
|
76
|
-
},
|
|
77
|
-
method: 'post',
|
|
78
|
-
data: {
|
|
79
|
-
appId: currentApp === null || currentApp === void 0 ? void 0 : currentApp.appId,
|
|
80
|
-
pageNum: 1,
|
|
81
|
-
pageSize: 9999
|
|
82
|
-
}
|
|
83
|
-
}).then(function (res) {
|
|
84
|
-
if (res.data) {
|
|
85
|
-
var _list = res.data.map(function (item) {
|
|
86
|
-
return {
|
|
87
|
-
name: item.name,
|
|
88
|
-
value: item.id,
|
|
89
|
-
columnName: item.columnName
|
|
90
|
-
};
|
|
91
|
-
});
|
|
92
|
-
setMasterList(_list);
|
|
93
|
-
} else {
|
|
94
|
-
setMasterList([]);
|
|
95
|
-
}
|
|
96
|
-
}).catch(function () {
|
|
97
|
-
setMasterList([]);
|
|
98
|
-
});
|
|
99
|
-
}
|
|
100
|
-
function queryValueList(keyword, operate) {
|
|
101
|
-
request('/cep-console/api/v1/es/data/attr/value', {
|
|
102
|
-
headers: {
|
|
103
|
-
'Content-Type': 'application/json'
|
|
104
|
-
},
|
|
105
|
-
method: 'post',
|
|
106
|
-
data: {
|
|
107
|
-
appId: currentApp === null || currentApp === void 0 ? void 0 : currentApp.appId,
|
|
108
|
-
attrId: condition.attrs[index].attrId,
|
|
109
|
-
dataTypeId: operate.bizDataTypeId ? operate.bizDataTypeId : condition.attrs[index].orderType === 'master' ? 1 : 2,
|
|
110
|
-
keyword: keyword,
|
|
111
|
-
pageNum: 1,
|
|
112
|
-
pageSize: 20,
|
|
113
|
-
attrName: operate.name,
|
|
114
|
-
eventId: 0
|
|
115
|
-
}
|
|
116
|
-
}).then(function (res) {
|
|
117
|
-
if (res.data) {
|
|
118
|
-
var _list2 = res.data.map(function (item) {
|
|
119
|
-
return {
|
|
120
|
-
name: operate.bizDataTypeId ? item : item.name,
|
|
121
|
-
value: operate.bizDataTypeId ? item : item.id
|
|
122
|
-
};
|
|
123
|
-
});
|
|
124
|
-
setParamsList(_list2);
|
|
125
|
-
} else {
|
|
126
|
-
setParamsList([]);
|
|
127
|
-
}
|
|
128
|
-
}).catch(function () {
|
|
129
|
-
setParamsList([]);
|
|
130
|
-
});
|
|
131
|
-
}
|
|
132
|
-
function queryBizDataAttrList(bizDataTypeId) {
|
|
133
|
-
request('/cep-console/api/v1/bizdata/attr/list', {
|
|
134
|
-
headers: {
|
|
135
|
-
'Content-Type': 'application/json'
|
|
136
|
-
},
|
|
137
|
-
method: 'post',
|
|
138
|
-
data: {
|
|
139
|
-
bizDataTypeId: bizDataTypeId
|
|
140
|
-
}
|
|
141
|
-
}).then(function (res) {
|
|
142
|
-
if (res.data) {
|
|
143
|
-
var _list3 = res.data.map(function (item) {
|
|
144
|
-
return _objectSpread(_objectSpread({}, item), {}, {
|
|
145
|
-
value: item.id
|
|
146
|
-
});
|
|
147
|
-
});
|
|
148
|
-
setBizDataAttrList(_list3);
|
|
149
|
-
} else {
|
|
150
|
-
setBizDataAttrList([]);
|
|
151
|
-
}
|
|
152
|
-
}).catch(function () {
|
|
153
|
-
setBizDataAttrList([]);
|
|
154
|
-
});
|
|
155
|
-
}
|
|
156
|
-
var onOrderTypeListChange = function onOrderTypeListChange(operate) {
|
|
157
|
-
if (serviceAttrType === null || serviceAttrType === void 0 ? void 0 : serviceAttrType.value) {
|
|
158
|
-
condition.attrs[index].category = 'custom';
|
|
159
|
-
condition.attrs[index].attrId = operate.id;
|
|
160
|
-
condition.attrs[index].attrName = operate.name;
|
|
161
|
-
switch (operate.propType) {
|
|
162
|
-
case 1:
|
|
163
|
-
setMasterList(typeList['cont-string']);
|
|
164
|
-
condition.attrs[index].attrType = 'cont-string';
|
|
165
|
-
queryValueList('', operate);
|
|
166
|
-
break;
|
|
167
|
-
case 2:
|
|
168
|
-
setMasterList(computeTypeList);
|
|
169
|
-
setStringOperateList(typeList['cont-num']);
|
|
170
|
-
condition.attrs[index].attrType = 'cont-num';
|
|
171
|
-
break;
|
|
172
|
-
default:
|
|
173
|
-
setMasterList(typeList['cont-date']);
|
|
174
|
-
condition.attrs[index].attrType = 'cont-date';
|
|
175
|
-
break;
|
|
176
|
-
}
|
|
177
|
-
} else {
|
|
178
|
-
setStringOperateList([]);
|
|
179
|
-
condition.attrs[index].orderType = operate.value;
|
|
180
|
-
queryAppList(operate.value);
|
|
181
|
-
}
|
|
182
|
-
onChange(_objectSpread({}, condition));
|
|
183
|
-
};
|
|
184
|
-
var onMasterListChange = function onMasterListChange(operate) {
|
|
185
|
-
if (!(serviceAttrType === null || serviceAttrType === void 0 ? void 0 : serviceAttrType.value)) {
|
|
186
|
-
condition.attrs[index].attrMaping = operate.columnName;
|
|
187
|
-
condition.attrs[index].attrType = 'cont-string';
|
|
188
|
-
setStringOperateList(stringOperate);
|
|
189
|
-
} else {
|
|
190
|
-
switch (condition.attrs[index].attrType) {
|
|
191
|
-
case 'cont-string':
|
|
192
|
-
case 'cont-date':
|
|
193
|
-
condition.attrs[index].operator = operate.value;
|
|
194
|
-
condition.attrs[index].params = [];
|
|
195
|
-
if (condition.attrs[index].operator === 'absolute' && condition.attrs[index].attrType === 'cont-date') {
|
|
196
|
-
var endDate = moment().format('YYYY-MM-DD');
|
|
197
|
-
var startDate = moment().subtract(7, 'days').format('YYYY-MM-DD');
|
|
198
|
-
condition.attrs[index].params = [startDate, endDate];
|
|
199
|
-
}
|
|
200
|
-
break;
|
|
201
|
-
default:
|
|
202
|
-
condition.attrs[index].computeType = operate.value;
|
|
203
|
-
break;
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
onChange(_objectSpread({}, condition));
|
|
207
|
-
};
|
|
208
|
-
var onStringOperateChange = function onStringOperateChange(operate) {
|
|
209
|
-
condition.attrs[index].operator = operate.value;
|
|
210
|
-
onChange(_objectSpread({}, condition));
|
|
211
|
-
};
|
|
212
|
-
var onValue0Change = function onValue0Change(e) {
|
|
213
|
-
var value = e.target.value;
|
|
214
|
-
condition.attrs[index].params[0] = value;
|
|
215
|
-
onChange(_objectSpread({}, condition));
|
|
216
|
-
};
|
|
217
|
-
var onValue1Change = function onValue1Change(e) {
|
|
218
|
-
var value = e.target.value;
|
|
219
|
-
condition.attrs[index].params[1] = value;
|
|
220
|
-
onChange(_objectSpread({}, condition));
|
|
221
|
-
};
|
|
222
|
-
var onParamsChange = function onParamsChange(operate) {
|
|
223
|
-
var obj = operate.map(function (item) {
|
|
224
|
-
return item.value;
|
|
225
|
-
});
|
|
226
|
-
if (!(serviceAttrType === null || serviceAttrType === void 0 ? void 0 : serviceAttrType.value)) {
|
|
227
|
-
queryValueList(searchValue, {});
|
|
228
|
-
}
|
|
229
|
-
condition.attrs[index].params = obj;
|
|
230
|
-
onChange(_objectSpread({}, condition));
|
|
231
|
-
};
|
|
232
|
-
function onDateChange(newData) {
|
|
233
|
-
if (condition.attrs[index].operator === 'absolute') {
|
|
234
|
-
var dateRange = newData;
|
|
235
|
-
var newValues = dateRange.map(function (date) {
|
|
236
|
-
return date.format('YYYY-MM-DD');
|
|
237
|
-
});
|
|
238
|
-
condition.attrs[index].params = newValues;
|
|
239
|
-
onChange(_objectSpread({}, condition));
|
|
240
|
-
}
|
|
241
|
-
}
|
|
242
|
-
return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
|
|
243
|
-
className: "".concat(classPrefix, "-runtimes-condition")
|
|
244
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
245
|
-
className: "".concat(classPrefix, "-period-condition-operator")
|
|
246
|
-
}, /*#__PURE__*/React.createElement(BizSelect, {
|
|
247
|
-
className: "".concat(classPrefix, "-select-condition"),
|
|
248
|
-
options: bizDataAttrList,
|
|
249
|
-
labelField: "name",
|
|
250
|
-
keyField: "value",
|
|
251
|
-
overlayWidth: 120,
|
|
252
|
-
onChange: onOrderTypeListChange
|
|
253
|
-
})), /*#__PURE__*/React.createElement("div", {
|
|
254
|
-
className: "".concat(classPrefix, "-period-condition-operator")
|
|
255
|
-
}, /*#__PURE__*/React.createElement(BizSelect, {
|
|
256
|
-
className: "".concat(classPrefix, "-select-condition"),
|
|
257
|
-
options: masterList,
|
|
258
|
-
labelField: "name",
|
|
259
|
-
keyField: "value",
|
|
260
|
-
onChange: onMasterListChange
|
|
261
|
-
})), condition.attrs[index].attrType !== 'cont-string' && condition.attrs[index].attrType !== 'cont-date' ? /*#__PURE__*/React.createElement("div", {
|
|
262
|
-
className: "".concat(classPrefix, "-period-condition-operator")
|
|
263
|
-
}, /*#__PURE__*/React.createElement(BizSelect, {
|
|
264
|
-
className: "".concat(classPrefix, "-select-condition"),
|
|
265
|
-
options: stringOperateList,
|
|
266
|
-
labelField: "name",
|
|
267
|
-
keyField: "value",
|
|
268
|
-
value: {
|
|
269
|
-
name: condition.attrs[index].operator,
|
|
270
|
-
value: condition.attrs[index].operator
|
|
271
|
-
},
|
|
272
|
-
overlayWidth: 120,
|
|
273
|
-
onChange: onStringOperateChange
|
|
274
|
-
})) : null, !(serviceAttrType === null || serviceAttrType === void 0 ? void 0 : serviceAttrType.value) || condition.attrs[index].attrType === 'cont-string' && condition.attrs[index].operator !== 'is null' && condition.attrs[index].operator !== 'is not null' ? /*#__PURE__*/React.createElement("div", {
|
|
275
|
-
className: "".concat(classPrefix, "-period-condition-operator"),
|
|
276
|
-
style: {
|
|
277
|
-
width: '250px'
|
|
278
|
-
}
|
|
279
|
-
}, /*#__PURE__*/React.createElement(BizSelect, {
|
|
280
|
-
className: "".concat(classPrefix, "-multi-select"),
|
|
281
|
-
multiple: true,
|
|
282
|
-
enableCreate: false,
|
|
283
|
-
size: "middle",
|
|
284
|
-
labelField: "name",
|
|
285
|
-
keyField: "value",
|
|
286
|
-
options: paramsList,
|
|
287
|
-
onChange: onParamsChange,
|
|
288
|
-
onSearch: setSearchValue
|
|
289
|
-
})) : null, condition.attrs[index].attrType === 'cont-num' || condition.attrs[index].attrType === 'cont-date' && condition.attrs[index].operator !== 'absolute' ? /*#__PURE__*/React.createElement("div", {
|
|
290
|
-
className: "".concat(classPrefix, "-period-condition")
|
|
291
|
-
}, /*#__PURE__*/React.createElement(Input, {
|
|
292
|
-
key: "relative-date",
|
|
293
|
-
className: "".concat(classPrefix, "-select-condition"),
|
|
294
|
-
size: "middle",
|
|
295
|
-
type: condition.attrs[index].attrType === 'cont-date' ? 'number' : '',
|
|
296
|
-
placeholder: condition.attrs[index].operator === 'between' ? '输入最小值' : '请输入',
|
|
297
|
-
value: condition.attrs[index].params[0],
|
|
298
|
-
style: {
|
|
299
|
-
width: condition.attrs[index].operator === 'between' || condition.attrs[index].attrType === 'cont-date' && condition.attrs[index].operator ? 100 : 200
|
|
300
|
-
},
|
|
301
|
-
suffix: condition.attrs[index].attrType === 'cont-date' ? '天' : null,
|
|
302
|
-
onChange: onValue0Change
|
|
303
|
-
})) : null, condition.attrs[index].attrType === 'cont-num' && condition.attrs[index].operator === 'between' || condition.attrs[index].attrType === 'cont-date' && (condition.attrs[index].operator === 'relativeInterval' || condition.attrs[index].operator === 'futureInterval') ? /*#__PURE__*/React.createElement("div", {
|
|
304
|
-
className: "".concat(classPrefix, "-period-condition"),
|
|
305
|
-
style: {
|
|
306
|
-
marginLeft: 10
|
|
307
|
-
}
|
|
308
|
-
}, /*#__PURE__*/React.createElement(Input, {
|
|
309
|
-
key: "relative-date",
|
|
310
|
-
className: "".concat(classPrefix, "-select-condition"),
|
|
311
|
-
size: "middle",
|
|
312
|
-
type: condition.attrs[index].attrType === 'cont-date' ? 'number' : '',
|
|
313
|
-
placeholder: '输入最大值',
|
|
314
|
-
value: condition.attrs[index].params[1],
|
|
315
|
-
style: {
|
|
316
|
-
width: 100
|
|
317
|
-
},
|
|
318
|
-
suffix: condition.attrs[index].attrType === 'cont-date' ? '天' : null,
|
|
319
|
-
onChange: onValue1Change
|
|
320
|
-
})) : null, condition.attrs[index].attrType === 'cont-date' && condition.attrs[index].operator === 'absolute' ? /*#__PURE__*/React.createElement("div", {
|
|
321
|
-
className: "".concat(classPrefix, "-runtimes-condition")
|
|
322
|
-
}, /*#__PURE__*/React.createElement(RangePicker, {
|
|
323
|
-
size: "middle",
|
|
324
|
-
defaultValue: [moment(condition.attrs[index].params[0]), moment(condition.attrs[index].params[1])],
|
|
325
|
-
onChange: onDateChange,
|
|
326
|
-
allowClear: false
|
|
327
|
-
})) : null));
|
|
328
|
-
};
|
|
329
|
-
export default DataAttribute;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import './styles/runTimesCondition.less';
|
|
3
|
-
export interface TimeDimensionPropsI {
|
|
4
|
-
condition: any;
|
|
5
|
-
index: number;
|
|
6
|
-
onChange: (condition: any) => void;
|
|
7
|
-
}
|
|
8
|
-
declare const TimeDimension: React.FC<TimeDimensionPropsI>;
|
|
9
|
-
export default TimeDimension;
|
|
@@ -1,200 +0,0 @@
|
|
|
1
|
-
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
2
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
3
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
4
|
-
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
5
|
-
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
6
|
-
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
7
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
8
|
-
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
9
|
-
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
10
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
11
|
-
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
12
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
13
|
-
import React, { useState } from 'react';
|
|
14
|
-
import { Input } from 'antd';
|
|
15
|
-
import BizSelect from '../../select';
|
|
16
|
-
import './styles/runTimesCondition.less';
|
|
17
|
-
import { classPrefix } from '..';
|
|
18
|
-
import { timeDimensionType, skyTimeOperatorType, weekTimeOperatorType, monthTimeOperatorType, timeValuesType, weekValuesType, monthValuesType, typeList } from '../../attrConditions/utils/operates';
|
|
19
|
-
var TimeDimension = function TimeDimension(props) {
|
|
20
|
-
var condition = props.condition,
|
|
21
|
-
index = props.index,
|
|
22
|
-
onChange = props.onChange;
|
|
23
|
-
var _useState = useState({
|
|
24
|
-
name: '每天',
|
|
25
|
-
value: 1
|
|
26
|
-
}),
|
|
27
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
28
|
-
setTimeDimensionTypeList = _useState2[1];
|
|
29
|
-
var list = [];
|
|
30
|
-
var valuesList = [];
|
|
31
|
-
switch (condition.timeDimensions[index].timeDimension) {
|
|
32
|
-
case 1:
|
|
33
|
-
list = skyTimeOperatorType;
|
|
34
|
-
valuesList = timeValuesType;
|
|
35
|
-
break;
|
|
36
|
-
case 2:
|
|
37
|
-
list = weekTimeOperatorType;
|
|
38
|
-
valuesList = weekValuesType;
|
|
39
|
-
break;
|
|
40
|
-
default:
|
|
41
|
-
list = monthTimeOperatorType;
|
|
42
|
-
valuesList = monthValuesType;
|
|
43
|
-
break;
|
|
44
|
-
}
|
|
45
|
-
var _useState3 = useState(list),
|
|
46
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
|
47
|
-
timeOperatorTypeList = _useState4[0],
|
|
48
|
-
setTimeOperatorTypeList = _useState4[1];
|
|
49
|
-
var _useState5 = useState(valuesList),
|
|
50
|
-
_useState6 = _slicedToArray(_useState5, 2),
|
|
51
|
-
timeValuesTypeList = _useState6[0],
|
|
52
|
-
setTimeValuesTypeList = _useState6[1];
|
|
53
|
-
function onOperatorChange(data) {
|
|
54
|
-
condition.timeDimensions[index].frequencyOperator = data.value;
|
|
55
|
-
condition.timeDimensions[index].frequencyValues = [condition.timeDimensions[index].frequencyValues[0]];
|
|
56
|
-
onChange(_objectSpread({}, condition));
|
|
57
|
-
}
|
|
58
|
-
function onValue0Change(e) {
|
|
59
|
-
var value = e.target.value;
|
|
60
|
-
condition.timeDimensions[index].frequencyValues[0] = value;
|
|
61
|
-
onChange(_objectSpread({}, condition));
|
|
62
|
-
}
|
|
63
|
-
function onValue1Change(e) {
|
|
64
|
-
var value = e.target.value;
|
|
65
|
-
condition.timeDimensions[index].frequencyValues[1] = value;
|
|
66
|
-
onChange(_objectSpread({}, condition));
|
|
67
|
-
}
|
|
68
|
-
var onTimeDimensionTypeChange = function onTimeDimensionTypeChange(operate) {
|
|
69
|
-
setTimeDimensionTypeList(operate);
|
|
70
|
-
switch (operate.value) {
|
|
71
|
-
case 1:
|
|
72
|
-
setTimeValuesTypeList(timeValuesType);
|
|
73
|
-
setTimeOperatorTypeList(skyTimeOperatorType);
|
|
74
|
-
break;
|
|
75
|
-
case 2:
|
|
76
|
-
setTimeValuesTypeList(weekValuesType);
|
|
77
|
-
setTimeOperatorTypeList(weekTimeOperatorType);
|
|
78
|
-
break;
|
|
79
|
-
default:
|
|
80
|
-
setTimeValuesTypeList(monthValuesType);
|
|
81
|
-
setTimeOperatorTypeList(monthTimeOperatorType);
|
|
82
|
-
break;
|
|
83
|
-
}
|
|
84
|
-
condition.timeDimensions[index].timeDimension = operate.value;
|
|
85
|
-
onChange(_objectSpread({}, condition));
|
|
86
|
-
};
|
|
87
|
-
var onTimeOperatorTypeChange = function onTimeOperatorTypeChange(operate) {
|
|
88
|
-
condition.timeDimensions[index].timeValues = [condition.timeDimensions[index].timeValues[0]];
|
|
89
|
-
condition.timeDimensions[index].timeOperator = operate.value;
|
|
90
|
-
onChange(_objectSpread({}, condition));
|
|
91
|
-
};
|
|
92
|
-
var onTimeValuesType0Change = function onTimeValuesType0Change(operate) {
|
|
93
|
-
condition.timeDimensions[index].timeValues[0] = operate.value;
|
|
94
|
-
onChange(_objectSpread({}, condition));
|
|
95
|
-
};
|
|
96
|
-
var onTimeValuesType1Change = function onTimeValuesType1Change(operate) {
|
|
97
|
-
condition.timeDimensions[index].timeValues[1] = operate.value;
|
|
98
|
-
onChange(_objectSpread({}, condition));
|
|
99
|
-
};
|
|
100
|
-
return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
|
|
101
|
-
className: "".concat(classPrefix, "-runtimes-condition")
|
|
102
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
103
|
-
className: "".concat(classPrefix, "-period-condition-operator")
|
|
104
|
-
}, /*#__PURE__*/React.createElement(BizSelect, {
|
|
105
|
-
className: "".concat(classPrefix, "-select-condition"),
|
|
106
|
-
options: timeDimensionType,
|
|
107
|
-
labelField: "name",
|
|
108
|
-
keyField: "value",
|
|
109
|
-
overlayWidth: 80,
|
|
110
|
-
value: {
|
|
111
|
-
name: condition.timeDimensions[index].timeDimension,
|
|
112
|
-
value: condition.timeDimensions[index].timeDimension
|
|
113
|
-
},
|
|
114
|
-
onChange: onTimeDimensionTypeChange
|
|
115
|
-
})), /*#__PURE__*/React.createElement("div", {
|
|
116
|
-
className: "".concat(classPrefix, "-period-condition-operator")
|
|
117
|
-
}, /*#__PURE__*/React.createElement(BizSelect, {
|
|
118
|
-
className: "".concat(classPrefix, "-select-condition"),
|
|
119
|
-
options: timeOperatorTypeList,
|
|
120
|
-
labelField: "name",
|
|
121
|
-
keyField: "value",
|
|
122
|
-
overlayWidth: 120,
|
|
123
|
-
value: {
|
|
124
|
-
name: condition.timeDimensions[index].timeOperator,
|
|
125
|
-
value: condition.timeDimensions[index].timeOperator
|
|
126
|
-
},
|
|
127
|
-
onChange: onTimeOperatorTypeChange
|
|
128
|
-
})), condition.timeDimensions[index].timeOperator === 'in' || condition.timeDimensions[index].timeOperator === 'between' ? /*#__PURE__*/React.createElement("div", {
|
|
129
|
-
className: "".concat(classPrefix, "-period-condition-operator")
|
|
130
|
-
}, /*#__PURE__*/React.createElement(BizSelect, {
|
|
131
|
-
className: "".concat(classPrefix, "-select-condition"),
|
|
132
|
-
options: timeValuesTypeList,
|
|
133
|
-
labelField: "name",
|
|
134
|
-
keyField: "value",
|
|
135
|
-
overlayWidth: 120,
|
|
136
|
-
value: {
|
|
137
|
-
name: condition.timeDimensions[index].timeValues[0],
|
|
138
|
-
value: condition.timeDimensions[index].timeValues[0]
|
|
139
|
-
},
|
|
140
|
-
onChange: onTimeValuesType0Change
|
|
141
|
-
})) : null, condition.timeDimensions[index].timeOperator === 'between' ? /*#__PURE__*/React.createElement("div", {
|
|
142
|
-
className: "".concat(classPrefix, "-period-condition-operator")
|
|
143
|
-
}, /*#__PURE__*/React.createElement(BizSelect, {
|
|
144
|
-
className: "".concat(classPrefix, "-select-condition"),
|
|
145
|
-
options: timeValuesTypeList,
|
|
146
|
-
labelField: "name",
|
|
147
|
-
keyField: "value",
|
|
148
|
-
overlayWidth: 120,
|
|
149
|
-
value: {
|
|
150
|
-
name: condition.timeDimensions[index].timeValues[1],
|
|
151
|
-
value: condition.timeDimensions[index].timeValues[1]
|
|
152
|
-
},
|
|
153
|
-
onChange: onTimeValuesType1Change
|
|
154
|
-
})) : null, /*#__PURE__*/React.createElement("div", {
|
|
155
|
-
className: "".concat(classPrefix, "-period-condition-operator")
|
|
156
|
-
}, /*#__PURE__*/React.createElement(BizSelect, {
|
|
157
|
-
options: typeList['cont-num'],
|
|
158
|
-
labelField: "name",
|
|
159
|
-
overlayWidth: 100,
|
|
160
|
-
keyField: "value",
|
|
161
|
-
value: {
|
|
162
|
-
value: condition.timeDimensions[index].frequencyOperator,
|
|
163
|
-
name: condition.timeDimensions[index].frequencyOperator
|
|
164
|
-
},
|
|
165
|
-
size: "middle",
|
|
166
|
-
onChange: onOperatorChange
|
|
167
|
-
})), /*#__PURE__*/React.createElement("div", {
|
|
168
|
-
className: "".concat(classPrefix, "-period-condition")
|
|
169
|
-
}, /*#__PURE__*/React.createElement(Input, {
|
|
170
|
-
key: "relative-date",
|
|
171
|
-
className: "".concat(classPrefix, "-select-condition"),
|
|
172
|
-
type: condition.timeDimensions[index].frequencyOperator !== 'between' ? 'number' : '',
|
|
173
|
-
size: "middle",
|
|
174
|
-
value: condition.timeDimensions[index].frequencyValues[0],
|
|
175
|
-
placeholder: condition.timeDimensions[index].frequencyOperator !== 'between' ? '请输入' : '输入最小值',
|
|
176
|
-
style: {
|
|
177
|
-
width: 100
|
|
178
|
-
},
|
|
179
|
-
onChange: onValue0Change,
|
|
180
|
-
suffix: condition.timeDimensions[index].frequencyOperator !== 'between' ? '次' : null
|
|
181
|
-
})), condition.timeDimensions[index].frequencyOperator === 'between' ? /*#__PURE__*/React.createElement("div", {
|
|
182
|
-
className: "".concat(classPrefix, "-period-condition"),
|
|
183
|
-
style: {
|
|
184
|
-
marginLeft: 10
|
|
185
|
-
}
|
|
186
|
-
}, /*#__PURE__*/React.createElement(Input, {
|
|
187
|
-
key: "relative-date",
|
|
188
|
-
className: "".concat(classPrefix, "-select-condition"),
|
|
189
|
-
type: condition.timeDimensions[index].frequencyOperator !== 'between' ? 'number' : '',
|
|
190
|
-
size: "middle",
|
|
191
|
-
placeholder: condition.timeDimensions[index].frequencyOperator !== 'between' ? '请输入' : '输入最大值',
|
|
192
|
-
value: condition.timeDimensions[index].frequencyValues[1],
|
|
193
|
-
style: {
|
|
194
|
-
width: 100
|
|
195
|
-
},
|
|
196
|
-
onChange: onValue1Change,
|
|
197
|
-
suffix: condition.timeDimensions[index].frequencyOperator !== 'between' ? '次' : null
|
|
198
|
-
})) : null));
|
|
199
|
-
};
|
|
200
|
-
export default TimeDimension;
|