@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.
- package/es/addToPanel/index.js +1 -0
- package/es/addToScene/index.js +1 -0
- package/es/assets/styles/chunks.less +3 -4
- package/es/assets/styles/resetAntd.less +47 -11
- package/es/attrConditions/components/operateList.d.ts +1 -0
- package/es/attrConditions/components/operateList.js +2 -2
- package/es/attrConditions/components/stringList.d.ts +1 -0
- package/es/attrConditions/components/stringList.js +2 -2
- package/es/attrConditions/components/valuesList.d.ts +1 -1
- package/es/attrConditions/components/valuesList.js +11 -12
- package/es/attrConditions/demo/group.js +13 -1
- package/es/attrConditions/group.js +14 -0
- package/es/attrConditions/index.js +16 -5
- package/es/attrConditions/styles/index.less +39 -5
- package/es/attrConditions/types.d.ts +4 -0
- package/es/attrConditions/utils/operates.js +2 -2
- package/es/attributeSelector/index.js +8 -4
- package/es/attributeSelector/listPanel.js +32 -19
- package/es/attributeSelector/styles/index.less +3 -3
- package/es/attributeSelector/types.d.ts +7 -0
- package/es/attributeSelector/types.js +8 -1
- package/es/attributeSelector/util.js +3 -2
- package/es/eventSelector/index.js +10 -4
- package/es/eventSelector/listPanel.js +18 -23
- package/es/eventSelector/styles/index.less +5 -5
- package/es/eventSelector/types.d.ts +4 -0
- package/es/index.d.ts +2 -1
- package/es/index.js +2 -1
- package/es/mock/event.js +214 -0
- package/es/select/demo/children.d.ts +2 -0
- package/es/select/demo/children.js +81 -0
- package/es/select/demo/customLabel.d.ts +2 -0
- package/es/select/demo/customLabel.js +23 -0
- package/es/select/demo/index.js +10 -4
- package/es/select/demo/multiple.js +10 -3
- package/es/select/handle.js +4 -2
- package/es/select/index.d.ts +2 -2
- package/es/select/index.js +7 -5
- package/es/select/option.js +8 -2
- package/es/select/overlay.js +5 -3
- package/es/select/styles/handle.less +23 -13
- package/es/select/types.d.ts +5 -1
- package/es/userCondition/conditionTypeList.js +29 -6
- package/es/userCondition/conditionWrap.js +4 -2
- package/es/userCondition/conditions/constants.d.ts +24 -0
- package/es/userCondition/conditions/constants.js +41 -0
- package/es/userCondition/conditions/eventCondition.js +13 -4
- package/es/userCondition/conditions/periodCondition.js +21 -10
- package/es/userCondition/conditions/propCondition.js +25 -6
- package/es/userCondition/conditions/runTimesCondition.js +2 -2
- package/es/userCondition/conditions/styles/eventCondition.less +9 -7
- package/es/userCondition/conditions/styles/periodCondition.less +12 -0
- package/es/userCondition/conditions/styles/propCondition.less +11 -3
- package/es/userCondition/conditions/styles/runTimesCondition.less +3 -0
- package/es/userCondition/conditions/styles/tagsCondition.less +20 -0
- package/es/userCondition/conditions/styles/textDesc.less +17 -0
- package/es/userCondition/conditions/tagsCondition.d.ts +9 -0
- package/es/userCondition/conditions/tagsCondition.js +107 -0
- package/es/userCondition/conditions/textDesc.d.ts +9 -0
- package/es/userCondition/conditions/textDesc.js +241 -0
- package/es/userCondition/demo/index.js +259 -31
- package/es/userCondition/index.d.ts +1 -1
- package/es/userCondition/index.js +52 -10
- package/es/userCondition/orConditions.js +69 -28
- package/es/userCondition/relationLabel.js +6 -1
- package/es/userCondition/styles/conditionTypeList.less +1 -1
- package/es/userCondition/styles/conditionWrap.less +3 -0
- package/es/userCondition/styles/index.less +21 -1
- package/es/userCondition/styles/orConditions.less +20 -2
- package/es/userCondition/styles/relationLabel.less +5 -4
- package/es/userCondition/types.d.ts +28 -2
- package/es/userCondition/util.d.ts +5 -1
- package/es/userCondition/util.js +42 -0
- package/es/userTagsSelector/cascaderOverlay.d.ts +5 -0
- package/es/userTagsSelector/cascaderOverlay.js +114 -0
- package/es/userTagsSelector/components/search/index.d.ts +8 -0
- package/es/userTagsSelector/components/search/index.js +16 -0
- package/es/userTagsSelector/components/search/index.less +6 -0
- package/es/userTagsSelector/context.d.ts +3 -0
- package/es/userTagsSelector/context.js +2 -0
- package/es/userTagsSelector/demo/index.d.ts +2 -0
- package/es/userTagsSelector/demo/index.js +48 -0
- package/es/userTagsSelector/groups/groupOption.d.ts +5 -0
- package/es/userTagsSelector/groups/groupOption.js +42 -0
- package/es/userTagsSelector/groups/index.d.ts +4 -0
- package/es/userTagsSelector/groups/index.js +86 -0
- package/es/userTagsSelector/groups/styles/index.less +0 -0
- package/es/userTagsSelector/groups/styles/option.less +50 -0
- package/es/userTagsSelector/index.d.ts +6 -0
- package/es/userTagsSelector/index.js +110 -0
- package/es/userTagsSelector/multipleCheckPanel/checkOption.d.ts +5 -0
- package/es/userTagsSelector/multipleCheckPanel/checkOption.js +45 -0
- package/es/userTagsSelector/multipleCheckPanel/index.d.ts +4 -0
- package/es/userTagsSelector/multipleCheckPanel/index.js +80 -0
- package/es/userTagsSelector/multipleCheckPanel/styles/index.less +0 -0
- package/es/userTagsSelector/multipleCheckPanel/styles/option.less +40 -0
- package/es/userTagsSelector/styles/cascaderOverlay.less +27 -0
- package/es/userTagsSelector/styles/index.less +10 -0
- package/es/userTagsSelector/types.d.ts +67 -0
- package/es/userTagsSelector/types.js +1 -0
- package/es/userTagsSelector/util.d.ts +4 -0
- package/es/userTagsSelector/util.js +38 -0
- package/es/utils/type.d.ts +2 -2
- package/package.json +6 -7
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
@import '../../../assets/styles/variable.less';
|
|
2
|
+
.biz-user-condition {
|
|
3
|
+
&-text-desc {
|
|
4
|
+
color: @text-color-secondary;
|
|
5
|
+
font-size: 14px;
|
|
6
|
+
&-or {
|
|
7
|
+
margin: 0 @margin-xs;
|
|
8
|
+
}
|
|
9
|
+
&-label {
|
|
10
|
+
}
|
|
11
|
+
&-operator {
|
|
12
|
+
}
|
|
13
|
+
&-value {
|
|
14
|
+
color: @text-color;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { AllConditionBasePropsI, BizUserConditionT } from '../types';
|
|
3
|
+
import './styles/tagsCondition.less';
|
|
4
|
+
declare type Labels = BizUserConditionT.Labels;
|
|
5
|
+
export interface TagsConditionPropI extends AllConditionBasePropsI<Labels> {
|
|
6
|
+
labels: Labels;
|
|
7
|
+
}
|
|
8
|
+
declare const TagsCondition: React.FC<TagsConditionPropI>;
|
|
9
|
+
export default TagsCondition;
|
|
@@ -0,0 +1,107 @@
|
|
|
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
|
+
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
|
+
|
|
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
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
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
|
+
|
|
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); }
|
|
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
|
+
|
|
17
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
18
|
+
|
|
19
|
+
import React, { useContext, useState } from 'react';
|
|
20
|
+
import { BizUserConditionContext, classPrefix } from '..';
|
|
21
|
+
import BizSelect from '../../select';
|
|
22
|
+
import { operatorMap } from './constants';
|
|
23
|
+
import BizUserTagsSelect from '../../userTagsSelector';
|
|
24
|
+
import './styles/tagsCondition.less';
|
|
25
|
+
import { findTagFactory } from '../util';
|
|
26
|
+
var options = [{
|
|
27
|
+
value: 'equal',
|
|
28
|
+
text: '是'
|
|
29
|
+
}, {
|
|
30
|
+
value: 'not equal',
|
|
31
|
+
text: '不是'
|
|
32
|
+
}];
|
|
33
|
+
|
|
34
|
+
var TagsCondition = function TagsCondition(props) {
|
|
35
|
+
var _useContext = useContext(BizUserConditionContext),
|
|
36
|
+
userTagsData = _useContext.userTagsData;
|
|
37
|
+
|
|
38
|
+
var labels = props.labels,
|
|
39
|
+
dataId = props.dataId,
|
|
40
|
+
onChange = props.onChange;
|
|
41
|
+
|
|
42
|
+
var _useState = useState(function () {
|
|
43
|
+
return buildDefaultValues();
|
|
44
|
+
}),
|
|
45
|
+
_useState2 = _slicedToArray(_useState, 1),
|
|
46
|
+
defaultValues = _useState2[0];
|
|
47
|
+
|
|
48
|
+
function onOperatorChange(operator) {
|
|
49
|
+
onChange(dataId, _objectSpread(_objectSpread({}, labels), {}, {
|
|
50
|
+
operator: operator.value
|
|
51
|
+
}));
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
function onTagsChange(data) {
|
|
55
|
+
var values = data.map(function (item) {
|
|
56
|
+
return item[1].labelId;
|
|
57
|
+
});
|
|
58
|
+
onChange(dataId, _objectSpread(_objectSpread({}, labels), {}, {
|
|
59
|
+
values: values
|
|
60
|
+
}));
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
function buildDefaultValues() {
|
|
64
|
+
var values = [];
|
|
65
|
+
var findTag = findTagFactory(userTagsData);
|
|
66
|
+
labels.values.forEach(function (id) {
|
|
67
|
+
var tag = findTag(id);
|
|
68
|
+
|
|
69
|
+
if (tag) {
|
|
70
|
+
values.push([tag.labelGroup, tag]);
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
return values;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
77
|
+
className: "".concat(classPrefix, "-tags-condition")
|
|
78
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
79
|
+
className: "".concat(classPrefix, "-tags-condition-label")
|
|
80
|
+
}, "\u7528\u6237\u6807\u7B7E"), /*#__PURE__*/React.createElement("div", {
|
|
81
|
+
className: "".concat(classPrefix, "-tags-condition-operator")
|
|
82
|
+
}, /*#__PURE__*/React.createElement(BizSelect, {
|
|
83
|
+
options: options,
|
|
84
|
+
labelField: "text",
|
|
85
|
+
keyField: "value",
|
|
86
|
+
value: {
|
|
87
|
+
value: labels.operator,
|
|
88
|
+
text: operatorMap[labels.operator]
|
|
89
|
+
},
|
|
90
|
+
onChange: onOperatorChange
|
|
91
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
92
|
+
className: "".concat(classPrefix, "-tags-condition-value")
|
|
93
|
+
}, /*#__PURE__*/React.createElement(BizUserTagsSelect, {
|
|
94
|
+
defaultValue: defaultValues,
|
|
95
|
+
data: userTagsData,
|
|
96
|
+
childFields: ['children'],
|
|
97
|
+
keyFields: ['labelGroup', 'labelId'],
|
|
98
|
+
labelFields: ['labelGroup', 'labelName'],
|
|
99
|
+
valueFields: ['labelGroup', 'labelId'],
|
|
100
|
+
onChange: onTagsChange,
|
|
101
|
+
destroyPopupOnHide: true
|
|
102
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
103
|
+
className: "".concat(classPrefix, "-tags-condition-unit")
|
|
104
|
+
}));
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
export default TagsCondition;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { BizUserConditionT } from '../types';
|
|
3
|
+
import './styles/textDesc.less';
|
|
4
|
+
export interface TextProps {
|
|
5
|
+
condition: BizUserConditionT.ActiveCondition | BizUserConditionT.AddCondition | BizUserConditionT.PropCondition | BizUserConditionT.EventCondition | BizUserConditionT.TagsCondition;
|
|
6
|
+
showOrDesc: boolean;
|
|
7
|
+
}
|
|
8
|
+
declare const Text: React.FC<TextProps>;
|
|
9
|
+
export default Text;
|
|
@@ -0,0 +1,241 @@
|
|
|
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
|
+
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
|
+
|
|
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
|
+
import React, { useContext, useMemo } from 'react';
|
|
8
|
+
import { BizUserConditionContext, classPrefix } from '..';
|
|
9
|
+
import BizGlobalDataContext from '../../context';
|
|
10
|
+
import { findEvent, findPropAndEnv, findTagFactory } from '../util';
|
|
11
|
+
import { durationHandler, operatorMap } from './constants';
|
|
12
|
+
import './styles/textDesc.less';
|
|
13
|
+
|
|
14
|
+
var Text = function Text(props) {
|
|
15
|
+
var _useContext = useContext(BizUserConditionContext),
|
|
16
|
+
userPropsMap = _useContext.userPropsMap;
|
|
17
|
+
|
|
18
|
+
var condition = props.condition,
|
|
19
|
+
showOrDesc = props.showOrDesc;
|
|
20
|
+
|
|
21
|
+
var _useContext2 = useContext(BizGlobalDataContext),
|
|
22
|
+
eventGroupList = _useContext2.eventGroupList,
|
|
23
|
+
userPropList = _useContext2.userPropList,
|
|
24
|
+
eventEnvList = _useContext2.eventEnvList;
|
|
25
|
+
|
|
26
|
+
var _useContext3 = useContext(BizUserConditionContext),
|
|
27
|
+
userTagsData = _useContext3.userTagsData;
|
|
28
|
+
|
|
29
|
+
function render() {
|
|
30
|
+
if (condition.labels) {
|
|
31
|
+
return renderTags(condition);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
if (condition.eventId === '-4') {
|
|
35
|
+
return renderPeriod({
|
|
36
|
+
before: '活跃于'
|
|
37
|
+
}, condition.runPeriod);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
if (condition.eventId === '-3') {
|
|
41
|
+
return renderPeriod({
|
|
42
|
+
before: '新增于'
|
|
43
|
+
}, condition.runPeriod);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
if (condition.eventId === undefined) {
|
|
47
|
+
return renderProps(condition.attrs[0], 'user');
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
if (condition.eventId) {
|
|
51
|
+
return renderEvent(condition);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
function renderPeriod(label, period, isEvent) {
|
|
56
|
+
var _label$after;
|
|
57
|
+
|
|
58
|
+
var valuesDom = /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("span", null, period.values[0]), /*#__PURE__*/React.createElement("span", null, (_label$after = label.after) !== null && _label$after !== void 0 ? _label$after : '天'));
|
|
59
|
+
|
|
60
|
+
if (period.operator === 'unlimited_time') {
|
|
61
|
+
return /*#__PURE__*/React.createElement("span", null, "\u5728\u4EFB\u610F\u65F6\u95F4\u5185");
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
if (period.operator === 'absolute') {
|
|
65
|
+
valuesDom = /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("span", {
|
|
66
|
+
className: "".concat(classPrefix, "-text-desc-value")
|
|
67
|
+
}, period.values[0]), /*#__PURE__*/React.createElement("span", null, "\u5230"), /*#__PURE__*/React.createElement("span", {
|
|
68
|
+
className: "".concat(classPrefix, "-text-desc-value")
|
|
69
|
+
}, period.values[1]));
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
return /*#__PURE__*/React.createElement("span", {
|
|
73
|
+
style: !isEvent ? {
|
|
74
|
+
backgroundColor: '#effcff',
|
|
75
|
+
padding: '6px 7px'
|
|
76
|
+
} : {}
|
|
77
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
78
|
+
className: "label"
|
|
79
|
+
}, label.before), period.operator === 'relative' ? /*#__PURE__*/React.createElement("span", null, "\u6700\u8FD1") : null, valuesDom);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
function renderProps(attr, type) {
|
|
83
|
+
var data = null;
|
|
84
|
+
|
|
85
|
+
if (type === 'user') {
|
|
86
|
+
var _data;
|
|
87
|
+
|
|
88
|
+
data = findPropAndEnv(attr.attrName, userPropList !== null && userPropList !== void 0 ? userPropList : []);
|
|
89
|
+
return /*#__PURE__*/React.createElement("span", {
|
|
90
|
+
style: {
|
|
91
|
+
backgroundColor: '#effcff',
|
|
92
|
+
padding: '6px 7px'
|
|
93
|
+
}
|
|
94
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
95
|
+
className: "".concat(classPrefix, "-text-desc-label")
|
|
96
|
+
}, (_data = data) === null || _data === void 0 ? void 0 : _data.label), renderPropValues(attr));
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
function renderEvent(condition) {
|
|
101
|
+
var event = findEvent(condition.eventId, eventGroupList !== null && eventGroupList !== void 0 ? eventGroupList : []);
|
|
102
|
+
if (!event) return null;
|
|
103
|
+
var periodLabel = {};
|
|
104
|
+
|
|
105
|
+
if (condition.runPeriod.operator === 'join_time') {
|
|
106
|
+
periodLabel.before = '在新增后';
|
|
107
|
+
periodLabel.after = '天内';
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
if (condition.runPeriod.operator === 'relative' || condition.runPeriod.operator === 'absolute') {
|
|
111
|
+
periodLabel.before = '在';
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
var period = renderPeriod(periodLabel, condition.runPeriod, true);
|
|
115
|
+
var runtimes = renderRuntimes(condition.runTimes);
|
|
116
|
+
var attrs = renderAttrs(event, condition.attrs);
|
|
117
|
+
return /*#__PURE__*/React.createElement("span", {
|
|
118
|
+
style: {
|
|
119
|
+
backgroundColor: '#fffeeb',
|
|
120
|
+
padding: '6px 7px'
|
|
121
|
+
}
|
|
122
|
+
}, period, /*#__PURE__*/React.createElement("span", {
|
|
123
|
+
className: "".concat(classPrefix, "-text-desc-value")
|
|
124
|
+
}, event.name), attrs, runtimes);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
function renderAttrs(event, attrs) {
|
|
128
|
+
var attrsDom = [];
|
|
129
|
+
attrs.forEach(function (attr, i) {
|
|
130
|
+
var index = event.attrList.findIndex(function (item) {
|
|
131
|
+
return item.id === attr.attrId;
|
|
132
|
+
});
|
|
133
|
+
var label = '';
|
|
134
|
+
|
|
135
|
+
if (index >= 0) {
|
|
136
|
+
label = event === null || event === void 0 ? void 0 : event.attrList[index].label;
|
|
137
|
+
} else if (eventEnvList) {
|
|
138
|
+
var env = findPropAndEnv(attr.attrName, eventEnvList);
|
|
139
|
+
label = env ? env.label : '';
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
if (label) {
|
|
143
|
+
var dom = /*#__PURE__*/React.createElement("span", {
|
|
144
|
+
key: i
|
|
145
|
+
}, /*#__PURE__*/React.createElement("span", null, label), /*#__PURE__*/React.createElement("span", null, renderPropValues(attr)), i !== attrs.length - 1 ? ',' : '');
|
|
146
|
+
attrsDom.push(dom);
|
|
147
|
+
}
|
|
148
|
+
});
|
|
149
|
+
if (!attrsDom.length) return null;
|
|
150
|
+
return /*#__PURE__*/React.createElement("span", null, /*#__PURE__*/React.createElement("span", null, "\uFF08"), attrsDom, /*#__PURE__*/React.createElement("span", null, "\uFF09"));
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
function renderRuntimes(runTimes) {
|
|
154
|
+
return /*#__PURE__*/React.createElement("span", null, /*#__PURE__*/React.createElement("span", {
|
|
155
|
+
className: "".concat(classPrefix, "-text-desc-value")
|
|
156
|
+
}, "\u6B21\u6570"), /*#__PURE__*/React.createElement("span", {
|
|
157
|
+
className: "".concat(classPrefix, "-text-desc-value")
|
|
158
|
+
}, runTimes.operator), /*#__PURE__*/React.createElement("span", {
|
|
159
|
+
className: "".concat(classPrefix, "-text-desc-value")
|
|
160
|
+
}, runTimes.values[0]));
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
function renderTags(condition) {
|
|
164
|
+
var labels = condition.labels;
|
|
165
|
+
return /*#__PURE__*/React.createElement("span", {
|
|
166
|
+
style: {
|
|
167
|
+
backgroundColor: '#effcff',
|
|
168
|
+
padding: '6px 7px'
|
|
169
|
+
}
|
|
170
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
171
|
+
className: "label"
|
|
172
|
+
}, /*#__PURE__*/React.createElement("b", null, "\u7528\u6237\u6807\u7B7E")), /*#__PURE__*/React.createElement("span", null, /*#__PURE__*/React.createElement("b", null, operatorMap[labels.operator])), /*#__PURE__*/React.createElement("span", {
|
|
173
|
+
className: "".concat(classPrefix, "-text-desc-value")
|
|
174
|
+
}, /*#__PURE__*/React.createElement("span", null, "("), labels.values.map(function (id, index) {
|
|
175
|
+
var tag = findTag(id);
|
|
176
|
+
return /*#__PURE__*/React.createElement("span", {
|
|
177
|
+
key: id
|
|
178
|
+
}, index >= 1 ? /*#__PURE__*/React.createElement("span", {
|
|
179
|
+
style: {
|
|
180
|
+
margin: '0 4px'
|
|
181
|
+
}
|
|
182
|
+
}, "\u6216") : null, /*#__PURE__*/React.createElement("span", null, tag && tag.labelName));
|
|
183
|
+
}), /*#__PURE__*/React.createElement("span", null, ")")));
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
function renderPropValues(attr) {
|
|
187
|
+
if (attr.attrType === 'cont-date') {
|
|
188
|
+
return renderDateValues(attr.operator, attr.params);
|
|
189
|
+
} else if (attr.attrType === 'cont-num') {
|
|
190
|
+
return renderNumValues(attr);
|
|
191
|
+
} else if (attr.attrType === 'cont-string') {
|
|
192
|
+
return renderStringValues(attr);
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
function renderStringValues(attr) {
|
|
197
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("span", {
|
|
198
|
+
className: "".concat(classPrefix, "-text-desc-operator")
|
|
199
|
+
}, operatorMap[attr.operator]), /*#__PURE__*/React.createElement("span", {
|
|
200
|
+
className: "".concat(classPrefix, "-text-desc-value")
|
|
201
|
+
}, attr.params.map(function (param, i) {
|
|
202
|
+
return /*#__PURE__*/React.createElement(React.Fragment, {
|
|
203
|
+
key: param
|
|
204
|
+
}, i > 0 ? /*#__PURE__*/React.createElement("span", null, "\u6216") : null, /*#__PURE__*/React.createElement("span", null, param));
|
|
205
|
+
})));
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
function renderNumValues(attr) {
|
|
209
|
+
var numOperatorMap = _objectSpread(_objectSpread({}, operatorMap), {}, {
|
|
210
|
+
'not equal': '≠'
|
|
211
|
+
});
|
|
212
|
+
|
|
213
|
+
if (userPropsMap[attr.attrName] && userPropsMap[attr.attrName].subtype === 2) {
|
|
214
|
+
var handler = durationHandler[attr.params[1]];
|
|
215
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("span", null, numOperatorMap[attr.operator]), /*#__PURE__*/React.createElement("span", null, handler.format(attr.params[0])), /*#__PURE__*/React.createElement("span", null, handler.unit));
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("span", null, operatorMap[attr.operator]), /*#__PURE__*/React.createElement("span", null, attr.params[0]));
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
function renderDateValues(operator, params) {
|
|
222
|
+
if (operator === 'relative') {
|
|
223
|
+
return /*#__PURE__*/React.createElement("span", null, "\u4E3A\u6700\u8FD1".concat(params[0], "\u5929"));
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
if (operator === 'absolute') {
|
|
227
|
+
return /*#__PURE__*/React.createElement("span", null, "\u4E3A".concat(params[0], "\u5230").concat(params[1]));
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
var findTag = useMemo(function () {
|
|
232
|
+
return findTagFactory(userTagsData);
|
|
233
|
+
}, [userTagsData]);
|
|
234
|
+
return /*#__PURE__*/React.createElement("span", {
|
|
235
|
+
className: "".concat(classPrefix, "-text-desc")
|
|
236
|
+
}, showOrDesc ? /*#__PURE__*/React.createElement("span", {
|
|
237
|
+
className: "".concat(classPrefix, "-text-desc-or")
|
|
238
|
+
}, "\u6216\u8005") : null, render());
|
|
239
|
+
};
|
|
240
|
+
|
|
241
|
+
export default Text;
|