@zgfe/business-lib 1.0.15-user.2 → 1.0.15
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/styles/chunks.less +4 -3
- package/es/assets/styles/resetAntd.less +1 -40
- package/es/assets/theme.js +2 -0
- package/es/attrConditions/components/operateList.d.ts +0 -1
- package/es/attrConditions/components/operateList.js +2 -2
- package/es/attrConditions/components/stringList.d.ts +0 -1
- package/es/attrConditions/components/stringList.js +2 -2
- package/es/attrConditions/components/valuesList.d.ts +0 -1
- package/es/attrConditions/components/valuesList.js +4 -5
- package/es/attrConditions/demo/index.js +8 -7
- package/es/attrConditions/index.js +4 -14
- package/es/attrConditions/styles/index.less +2 -3
- package/es/attrConditions/types.d.ts +0 -3
- package/es/attrConditions/utils/operates.js +2 -2
- package/es/attributeSelector/index.js +4 -8
- package/es/attributeSelector/listPanel.js +19 -32
- package/es/attributeSelector/styles/index.less +3 -3
- package/es/attributeSelector/types.d.ts +0 -7
- package/es/attributeSelector/types.js +1 -8
- package/es/attributeSelector/util.js +2 -3
- package/es/eventSelector/index.js +4 -10
- package/es/eventSelector/listPanel.js +0 -2
- package/es/eventSelector/styles/index.less +5 -5
- package/es/eventSelector/types.d.ts +0 -4
- package/es/index.d.ts +2 -3
- package/es/index.js +2 -3
- package/es/mock/event.js +0 -214
- package/es/select/demo/index.js +4 -10
- package/es/select/demo/multiple.js +3 -10
- package/es/select/handle.js +2 -4
- package/es/select/index.d.ts +2 -2
- package/es/select/index.js +5 -7
- package/es/select/overlay.js +1 -1
- package/es/select/styles/handle.less +13 -23
- package/es/select/types.d.ts +1 -3
- package/es/userCondition/conditionTypeList.js +3 -14
- package/es/userCondition/conditionWrap.js +2 -4
- package/es/userCondition/conditions/eventCondition.js +4 -14
- package/es/userCondition/conditions/periodCondition.js +10 -20
- package/es/userCondition/conditions/propCondition.js +8 -28
- package/es/userCondition/conditions/runTimesCondition.js +2 -2
- package/es/userCondition/conditions/styles/eventCondition.less +6 -8
- package/es/userCondition/conditions/styles/periodCondition.less +0 -3
- package/es/userCondition/conditions/styles/propCondition.less +3 -3
- package/es/userCondition/conditions/styles/runTimesCondition.less +0 -3
- package/es/userCondition/demo/index.js +31 -234
- package/es/userCondition/index.d.ts +1 -1
- package/es/userCondition/index.js +11 -32
- package/es/userCondition/orConditions.js +28 -70
- package/es/userCondition/relationLabel.js +1 -6
- package/es/userCondition/styles/conditionTypeList.less +1 -1
- package/es/userCondition/styles/conditionWrap.less +0 -3
- package/es/userCondition/styles/index.less +1 -20
- package/es/userCondition/styles/orConditions.less +2 -20
- package/es/userCondition/styles/relationLabel.less +3 -4
- package/es/userCondition/types.d.ts +2 -21
- package/es/userCondition/util.d.ts +1 -5
- package/es/userCondition/util.js +0 -42
- package/es/utils/type.d.ts +2 -2
- package/package.json +2 -5
- package/es/assets/theme.d.ts +0 -15
- package/es/select/demo/children.d.ts +0 -2
- package/es/select/demo/children.js +0 -81
- package/es/userCondition/conditions/constants.d.ts +0 -21
- package/es/userCondition/conditions/constants.js +0 -21
- package/es/userCondition/conditions/styles/tagsCondition.less +0 -18
- package/es/userCondition/conditions/styles/textDesc.less +0 -17
- package/es/userCondition/conditions/tagsCondition.d.ts +0 -9
- package/es/userCondition/conditions/tagsCondition.js +0 -107
- package/es/userCondition/conditions/textDesc.d.ts +0 -9
- package/es/userCondition/conditions/textDesc.js +0 -197
- package/es/userTagsSelector/cascaderOverlay.d.ts +0 -5
- package/es/userTagsSelector/cascaderOverlay.js +0 -114
- package/es/userTagsSelector/components/search/index.d.ts +0 -8
- package/es/userTagsSelector/components/search/index.js +0 -16
- package/es/userTagsSelector/components/search/index.less +0 -6
- package/es/userTagsSelector/context.d.ts +0 -3
- package/es/userTagsSelector/context.js +0 -2
- package/es/userTagsSelector/demo/index.d.ts +0 -2
- package/es/userTagsSelector/demo/index.js +0 -48
- package/es/userTagsSelector/groups/groupOption.d.ts +0 -5
- package/es/userTagsSelector/groups/groupOption.js +0 -42
- package/es/userTagsSelector/groups/index.d.ts +0 -4
- package/es/userTagsSelector/groups/index.js +0 -86
- package/es/userTagsSelector/groups/styles/index.less +0 -0
- package/es/userTagsSelector/groups/styles/option.less +0 -50
- package/es/userTagsSelector/index.d.ts +0 -6
- package/es/userTagsSelector/index.js +0 -110
- package/es/userTagsSelector/multipleCheckPanel/checkOption.d.ts +0 -5
- package/es/userTagsSelector/multipleCheckPanel/checkOption.js +0 -45
- package/es/userTagsSelector/multipleCheckPanel/index.d.ts +0 -4
- package/es/userTagsSelector/multipleCheckPanel/index.js +0 -80
- package/es/userTagsSelector/multipleCheckPanel/styles/index.less +0 -0
- package/es/userTagsSelector/multipleCheckPanel/styles/option.less +0 -39
- package/es/userTagsSelector/styles/cascaderOverlay.less +0 -27
- package/es/userTagsSelector/styles/index.less +0 -10
- package/es/userTagsSelector/types.d.ts +0 -67
- package/es/userTagsSelector/types.js +0 -1
- package/es/userTagsSelector/util.d.ts +0 -4
- package/es/userTagsSelector/util.js +0 -38
|
@@ -1,107 +0,0 @@
|
|
|
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-value")
|
|
82
|
-
}, /*#__PURE__*/React.createElement(BizUserTagsSelect, {
|
|
83
|
-
defaultValue: defaultValues,
|
|
84
|
-
data: userTagsData,
|
|
85
|
-
childFields: ['children'],
|
|
86
|
-
keyFields: ['labelGroup', 'labelId'],
|
|
87
|
-
labelFields: ['labelGroup', 'labelName'],
|
|
88
|
-
valueFields: ['labelGroup', 'labelId'],
|
|
89
|
-
onChange: onTagsChange,
|
|
90
|
-
destroyPopupOnHide: true
|
|
91
|
-
})), /*#__PURE__*/React.createElement("div", {
|
|
92
|
-
className: "".concat(classPrefix, "-tags-condition-operator")
|
|
93
|
-
}, /*#__PURE__*/React.createElement(BizSelect, {
|
|
94
|
-
options: options,
|
|
95
|
-
labelField: "text",
|
|
96
|
-
keyField: "value",
|
|
97
|
-
value: {
|
|
98
|
-
value: labels.operator,
|
|
99
|
-
text: operatorMap[labels.operator]
|
|
100
|
-
},
|
|
101
|
-
onChange: onOperatorChange
|
|
102
|
-
})), /*#__PURE__*/React.createElement("div", {
|
|
103
|
-
className: "".concat(classPrefix, "-tags-condition-unit")
|
|
104
|
-
}));
|
|
105
|
-
};
|
|
106
|
-
|
|
107
|
-
export default TagsCondition;
|
|
@@ -1,9 +0,0 @@
|
|
|
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;
|
|
@@ -1,197 +0,0 @@
|
|
|
1
|
-
import React, { useContext, useMemo } from 'react';
|
|
2
|
-
import { BizUserConditionContext, classPrefix } from '..';
|
|
3
|
-
import BizGlobalDataContext from '../../context';
|
|
4
|
-
import { findEvent, findPropAndEnv, findTagFactory } from '../util';
|
|
5
|
-
import { operatorMap } from './constants';
|
|
6
|
-
import './styles/textDesc.less';
|
|
7
|
-
|
|
8
|
-
var Text = function Text(props) {
|
|
9
|
-
var condition = props.condition,
|
|
10
|
-
showOrDesc = props.showOrDesc;
|
|
11
|
-
|
|
12
|
-
var _useContext = useContext(BizGlobalDataContext),
|
|
13
|
-
eventGroupList = _useContext.eventGroupList,
|
|
14
|
-
userPropList = _useContext.userPropList,
|
|
15
|
-
eventEnvList = _useContext.eventEnvList;
|
|
16
|
-
|
|
17
|
-
var _useContext2 = useContext(BizUserConditionContext),
|
|
18
|
-
userTagsData = _useContext2.userTagsData;
|
|
19
|
-
|
|
20
|
-
function render() {
|
|
21
|
-
if (condition.labels) {
|
|
22
|
-
return renderTags(condition);
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
if (condition.eventId === '-4') {
|
|
26
|
-
return renderPeriod({
|
|
27
|
-
before: '活跃于'
|
|
28
|
-
}, condition.runPeriod);
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
if (condition.eventId === '-3') {
|
|
32
|
-
return renderPeriod({
|
|
33
|
-
before: '新增于'
|
|
34
|
-
}, condition.runPeriod);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
if (condition.eventId === undefined) {
|
|
38
|
-
return renderProps(condition.attrs[0], 'user');
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
if (condition.eventId) {
|
|
42
|
-
return renderEvent(condition);
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
function renderPeriod(label, period, isEvent) {
|
|
47
|
-
var _label$after;
|
|
48
|
-
|
|
49
|
-
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 : '天'));
|
|
50
|
-
|
|
51
|
-
if (period.operator === 'unlimited_time') {
|
|
52
|
-
return /*#__PURE__*/React.createElement("span", null, "\u5728\u4EFB\u610F\u65F6\u95F4\u5185");
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
if (period.operator === 'absolute') {
|
|
56
|
-
valuesDom = /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("span", {
|
|
57
|
-
className: "".concat(classPrefix, "-text-desc-value")
|
|
58
|
-
}, period.values[0]), /*#__PURE__*/React.createElement("span", null, "\u5230"), /*#__PURE__*/React.createElement("span", {
|
|
59
|
-
className: "".concat(classPrefix, "-text-desc-value")
|
|
60
|
-
}, period.values[1]));
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
return /*#__PURE__*/React.createElement("span", {
|
|
64
|
-
style: !isEvent ? {
|
|
65
|
-
backgroundColor: '#effcff',
|
|
66
|
-
padding: '6px 7px'
|
|
67
|
-
} : {}
|
|
68
|
-
}, /*#__PURE__*/React.createElement("span", {
|
|
69
|
-
className: "label"
|
|
70
|
-
}, label.before), /*#__PURE__*/React.createElement("span", null, operatorMap[period.operator]), valuesDom);
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
function renderProps(attr, type) {
|
|
74
|
-
var data = null;
|
|
75
|
-
|
|
76
|
-
if (type === 'user') {
|
|
77
|
-
var _data;
|
|
78
|
-
|
|
79
|
-
data = findPropAndEnv(attr.attrName, userPropList !== null && userPropList !== void 0 ? userPropList : []);
|
|
80
|
-
return /*#__PURE__*/React.createElement("span", {
|
|
81
|
-
style: {
|
|
82
|
-
backgroundColor: '#effcff',
|
|
83
|
-
padding: '6px 7px'
|
|
84
|
-
}
|
|
85
|
-
}, /*#__PURE__*/React.createElement("span", {
|
|
86
|
-
className: "".concat(classPrefix, "-text-desc-label")
|
|
87
|
-
}, (_data = data) === null || _data === void 0 ? void 0 : _data.label), /*#__PURE__*/React.createElement("span", {
|
|
88
|
-
className: "".concat(classPrefix, "-text-desc-operator")
|
|
89
|
-
}, operatorMap[attr.operator]), /*#__PURE__*/React.createElement("span", {
|
|
90
|
-
className: "".concat(classPrefix, "-text-desc-value")
|
|
91
|
-
}, attr.params.map(function (param, i) {
|
|
92
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, i > 0 ? /*#__PURE__*/React.createElement("span", null, "\u6216") : null, /*#__PURE__*/React.createElement("span", null, param));
|
|
93
|
-
})));
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
function renderEvent(condition) {
|
|
98
|
-
var event = findEvent(condition.eventId, eventGroupList !== null && eventGroupList !== void 0 ? eventGroupList : []);
|
|
99
|
-
if (!event) return null;
|
|
100
|
-
var periodLabel = {};
|
|
101
|
-
|
|
102
|
-
if (condition.runPeriod.operator === 'join_time') {
|
|
103
|
-
periodLabel.before = '在新增后';
|
|
104
|
-
periodLabel.after = '天内';
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
if (condition.runPeriod.operator === 'relative' || condition.runPeriod.operator === 'absolute') {
|
|
108
|
-
periodLabel.before = '在';
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
var period = renderPeriod(periodLabel, condition.runPeriod, true);
|
|
112
|
-
var runtimes = renderRuntimes(condition.runTimes);
|
|
113
|
-
var attrs = renderAttrs(event, condition.attrs);
|
|
114
|
-
return /*#__PURE__*/React.createElement("span", {
|
|
115
|
-
style: {
|
|
116
|
-
backgroundColor: '#fffeeb',
|
|
117
|
-
padding: '6px 7px'
|
|
118
|
-
}
|
|
119
|
-
}, period, /*#__PURE__*/React.createElement("span", {
|
|
120
|
-
className: "".concat(classPrefix, "-text-desc-value")
|
|
121
|
-
}, event.name), attrs, runtimes);
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
function renderAttrs(event, attrs) {
|
|
125
|
-
var attrsDom = [];
|
|
126
|
-
attrs.forEach(function (attr, i) {
|
|
127
|
-
var index = event.attrList.findIndex(function (item) {
|
|
128
|
-
return item.id === attr.attrId;
|
|
129
|
-
});
|
|
130
|
-
var label = '';
|
|
131
|
-
|
|
132
|
-
if (index >= 0) {
|
|
133
|
-
label = event === null || event === void 0 ? void 0 : event.attrList[index].label;
|
|
134
|
-
} else if (eventEnvList) {
|
|
135
|
-
var env = findPropAndEnv(attr.attrName, eventEnvList);
|
|
136
|
-
label = env ? env.label : '';
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
if (label) {
|
|
140
|
-
var dom = /*#__PURE__*/React.createElement("span", {
|
|
141
|
-
key: i
|
|
142
|
-
}, /*#__PURE__*/React.createElement("span", null, label), /*#__PURE__*/React.createElement("span", null, operatorMap[attr.operator]), /*#__PURE__*/React.createElement("span", null, attr.params.map(function (param, i) {
|
|
143
|
-
return /*#__PURE__*/React.createElement("span", {
|
|
144
|
-
key: i
|
|
145
|
-
}, i > 0 ? '或' : '', param);
|
|
146
|
-
})), /*#__PURE__*/React.createElement("span", null, i !== attrs.length - 1 ? ',' : ''));
|
|
147
|
-
attrsDom.push(dom);
|
|
148
|
-
}
|
|
149
|
-
});
|
|
150
|
-
if (!attrsDom.length) return null;
|
|
151
|
-
return /*#__PURE__*/React.createElement("span", null, /*#__PURE__*/React.createElement("span", null, "\uFF08"), attrsDom, /*#__PURE__*/React.createElement("span", null, "\uFF09"));
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
function renderRuntimes(runTimes) {
|
|
155
|
-
return /*#__PURE__*/React.createElement("span", null, /*#__PURE__*/React.createElement("span", {
|
|
156
|
-
className: "".concat(classPrefix, "-text-desc-value")
|
|
157
|
-
}, "\u6B21\u6570"), /*#__PURE__*/React.createElement("span", {
|
|
158
|
-
className: "".concat(classPrefix, "-text-desc-value")
|
|
159
|
-
}, runTimes.operator), /*#__PURE__*/React.createElement("span", {
|
|
160
|
-
className: "".concat(classPrefix, "-text-desc-value")
|
|
161
|
-
}, runTimes.values[0]));
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
function renderTags(condition) {
|
|
165
|
-
var labels = condition.labels;
|
|
166
|
-
return /*#__PURE__*/React.createElement("span", {
|
|
167
|
-
style: {
|
|
168
|
-
backgroundColor: '#effcff',
|
|
169
|
-
padding: '6px 7px'
|
|
170
|
-
}
|
|
171
|
-
}, /*#__PURE__*/React.createElement("span", {
|
|
172
|
-
className: "label"
|
|
173
|
-
}, /*#__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", {
|
|
174
|
-
className: "".concat(classPrefix, "-text-desc-value")
|
|
175
|
-
}, /*#__PURE__*/React.createElement("span", null, "("), labels.values.map(function (id, index) {
|
|
176
|
-
var tag = findTag(id);
|
|
177
|
-
return /*#__PURE__*/React.createElement("span", {
|
|
178
|
-
key: id
|
|
179
|
-
}, index >= 1 ? /*#__PURE__*/React.createElement("span", {
|
|
180
|
-
style: {
|
|
181
|
-
margin: '0 4px'
|
|
182
|
-
}
|
|
183
|
-
}, "\u6216") : null, /*#__PURE__*/React.createElement("span", null, tag && tag.labelName));
|
|
184
|
-
}), /*#__PURE__*/React.createElement("span", null, ")")));
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
var findTag = useMemo(function () {
|
|
188
|
-
return findTagFactory(userTagsData);
|
|
189
|
-
}, [userTagsData]);
|
|
190
|
-
return /*#__PURE__*/React.createElement("span", {
|
|
191
|
-
className: "".concat(classPrefix, "-text-desc")
|
|
192
|
-
}, showOrDesc ? /*#__PURE__*/React.createElement("span", {
|
|
193
|
-
className: "".concat(classPrefix, "-text-desc-or")
|
|
194
|
-
}, "\u6216\u8005") : null, render());
|
|
195
|
-
};
|
|
196
|
-
|
|
197
|
-
export default Text;
|
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
2
|
-
|
|
3
|
-
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
4
|
-
|
|
5
|
-
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
6
|
-
|
|
7
|
-
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
8
|
-
|
|
9
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
10
|
-
|
|
11
|
-
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."); }
|
|
12
|
-
|
|
13
|
-
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); }
|
|
14
|
-
|
|
15
|
-
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; }
|
|
16
|
-
|
|
17
|
-
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; }
|
|
18
|
-
|
|
19
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
20
|
-
|
|
21
|
-
import React from 'react';
|
|
22
|
-
import { useState } from 'react';
|
|
23
|
-
import { classPrefix } from '.';
|
|
24
|
-
import './styles/cascaderOverlay.less';
|
|
25
|
-
import Groups from './groups/index';
|
|
26
|
-
import MultipleCheckPanel from './multipleCheckPanel';
|
|
27
|
-
import { getFieldFactory } from './util';
|
|
28
|
-
import _ from 'lodash';
|
|
29
|
-
|
|
30
|
-
var CascaderOverlay = function CascaderOverlay(props) {
|
|
31
|
-
var data = props.data,
|
|
32
|
-
currentValue = props.currentValue,
|
|
33
|
-
labelFields = props.labelFields,
|
|
34
|
-
keyFields = props.keyFields,
|
|
35
|
-
valueFields = props.valueFields,
|
|
36
|
-
childFields = props.childFields;
|
|
37
|
-
|
|
38
|
-
var _useState = useState(function () {
|
|
39
|
-
var initPath = [];
|
|
40
|
-
var curr = data[0];
|
|
41
|
-
var getChildField = getFieldFactory(childFields);
|
|
42
|
-
|
|
43
|
-
while (curr) {
|
|
44
|
-
initPath.push(curr);
|
|
45
|
-
curr = curr[getChildField()];
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
initPath.pop();
|
|
49
|
-
return initPath;
|
|
50
|
-
}),
|
|
51
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
52
|
-
currentPath = _useState2[0],
|
|
53
|
-
setCurrentPath = _useState2[1];
|
|
54
|
-
|
|
55
|
-
function onActive(data, level) {
|
|
56
|
-
var currIndex = level;
|
|
57
|
-
var getChildField = getFieldFactory(childFields.slice(currIndex).length ? childFields.slice(currIndex) : childFields.slice(-1));
|
|
58
|
-
var curr = data;
|
|
59
|
-
var newPath = currentPath.slice();
|
|
60
|
-
|
|
61
|
-
while (curr) {
|
|
62
|
-
newPath[currIndex] = curr;
|
|
63
|
-
curr = curr[getChildField()];
|
|
64
|
-
currIndex++;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
newPath.pop();
|
|
68
|
-
setCurrentPath(newPath);
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
function onCheck(data) {
|
|
72
|
-
var getVabelField = getFieldFactory(valueFields);
|
|
73
|
-
var newValue = currentPath.map(function (item) {
|
|
74
|
-
return item[getVabelField()];
|
|
75
|
-
}).concat(data);
|
|
76
|
-
props.onChange([].concat(_toConsumableArray(currentValue), [newValue]));
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
function onUncheck(data) {
|
|
80
|
-
var index = currentValue.findIndex(function (item) {
|
|
81
|
-
return _.isEqual(item.slice().pop(), data);
|
|
82
|
-
});
|
|
83
|
-
var newValues = currentValue.slice();
|
|
84
|
-
newValues.splice(index, 1);
|
|
85
|
-
props.onChange(newValues);
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
89
|
-
className: "".concat(classPrefix, "-overlay")
|
|
90
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
91
|
-
className: "".concat(classPrefix, "-overlay-groups")
|
|
92
|
-
}, /*#__PURE__*/React.createElement(Groups, {
|
|
93
|
-
currentValue: currentValue,
|
|
94
|
-
valueField: valueFields[0],
|
|
95
|
-
keyField: keyFields[0],
|
|
96
|
-
childField: childFields[0],
|
|
97
|
-
labelField: labelFields[0],
|
|
98
|
-
data: data,
|
|
99
|
-
onActive: onActive,
|
|
100
|
-
level: 0
|
|
101
|
-
})), /*#__PURE__*/React.createElement("div", {
|
|
102
|
-
className: "".concat(classPrefix, "-overlay-selections")
|
|
103
|
-
}, /*#__PURE__*/React.createElement(MultipleCheckPanel, {
|
|
104
|
-
valueField: valueFields[1],
|
|
105
|
-
onCheck: onCheck,
|
|
106
|
-
onUncheck: onUncheck,
|
|
107
|
-
currentValue: currentValue,
|
|
108
|
-
level: 1,
|
|
109
|
-
labelField: labelFields[1],
|
|
110
|
-
data: currentPath[0][childFields[0]]
|
|
111
|
-
})));
|
|
112
|
-
};
|
|
113
|
-
|
|
114
|
-
export default CascaderOverlay;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import BizSearchInput from '../../../searchInput';
|
|
3
|
-
import './index.less';
|
|
4
|
-
import { classPrefix } from '../..';
|
|
5
|
-
|
|
6
|
-
var Search = function Search(props) {
|
|
7
|
-
if (!props.show) return null;
|
|
8
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
9
|
-
className: "".concat(classPrefix, "-drop-panel-search")
|
|
10
|
-
}, /*#__PURE__*/React.createElement(BizSearchInput, {
|
|
11
|
-
placeholder: props.placeholder,
|
|
12
|
-
onChange: props.onChange
|
|
13
|
-
}));
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
export default Search;
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { BizUserTagsSelect } from '@zgfe/business-lib';
|
|
3
|
-
var data = [{
|
|
4
|
-
labelGroup: '基本标签',
|
|
5
|
-
children: []
|
|
6
|
-
}, {
|
|
7
|
-
labelGroup: '行为标签',
|
|
8
|
-
children: []
|
|
9
|
-
}, {
|
|
10
|
-
labelGroup: '活跃标签',
|
|
11
|
-
children: []
|
|
12
|
-
}, {
|
|
13
|
-
labelGroup: '预测标签',
|
|
14
|
-
children: []
|
|
15
|
-
}, {
|
|
16
|
-
labelGroup: '其它标签',
|
|
17
|
-
children: []
|
|
18
|
-
}];
|
|
19
|
-
var defaultValue = [];
|
|
20
|
-
data.forEach(function (item) {
|
|
21
|
-
item.children = Array(100 * Math.random() >> 0).fill(1).map(function (_child, _index) {
|
|
22
|
-
var id = Math.random();
|
|
23
|
-
var tag = {
|
|
24
|
-
id: id,
|
|
25
|
-
labelName: '标签' + id
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
if (id < 0.6 && defaultValue.length < 20) {
|
|
29
|
-
defaultValue.push([item.labelGroup, tag]);
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
return tag;
|
|
33
|
-
});
|
|
34
|
-
});
|
|
35
|
-
export default (function () {
|
|
36
|
-
function onChange(data) {
|
|
37
|
-
console.log(data);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
return /*#__PURE__*/React.createElement(BizUserTagsSelect, {
|
|
41
|
-
childFields: ['children'],
|
|
42
|
-
data: data,
|
|
43
|
-
keyFields: ['labelGroup', 'id'],
|
|
44
|
-
labelFields: ['labelGroup', 'labelName'],
|
|
45
|
-
valueFields: ['labelGroup', 'labelId'],
|
|
46
|
-
onChange: onChange
|
|
47
|
-
});
|
|
48
|
-
});
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { UserTagsSelectorTypes } from '../types';
|
|
3
|
-
import './styles/option.less';
|
|
4
|
-
declare const GroupOption: React.ForwardRefExoticComponent<UserTagsSelectorTypes.GroupOption & React.RefAttributes<HTMLDivElement>>;
|
|
5
|
-
export default GroupOption;
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import React, { forwardRef } from 'react';
|
|
2
|
-
import { Badge } from 'antd';
|
|
3
|
-
import { classPrefix } from '..';
|
|
4
|
-
import theme from '../../assets/theme';
|
|
5
|
-
import './styles/option.less';
|
|
6
|
-
import { util } from '../../utils';
|
|
7
|
-
var GroupOption = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
8
|
-
var label = props.label,
|
|
9
|
-
count = props.count,
|
|
10
|
-
actived = props.actived,
|
|
11
|
-
checked = props.checked,
|
|
12
|
-
_onClick = props.onClick,
|
|
13
|
-
value = props.value,
|
|
14
|
-
highlightText = props.highlightText;
|
|
15
|
-
|
|
16
|
-
function renderLabel() {
|
|
17
|
-
if (!highlightText || !highlightText.trim()) return label;
|
|
18
|
-
var dom = util.setHighLight(label, highlightText, function (text) {
|
|
19
|
-
return /*#__PURE__*/React.createElement("span", {
|
|
20
|
-
style: {
|
|
21
|
-
color: theme['primary-color']
|
|
22
|
-
}
|
|
23
|
-
}, text);
|
|
24
|
-
});
|
|
25
|
-
return dom;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
29
|
-
onClick: function onClick() {
|
|
30
|
-
return _onClick(value);
|
|
31
|
-
},
|
|
32
|
-
className: ["".concat(classPrefix, "-group-option"), actived ? 'active' : '', checked ? 'checked' : ''].join(' '),
|
|
33
|
-
ref: ref
|
|
34
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
35
|
-
className: "".concat(classPrefix, "-group-option-label")
|
|
36
|
-
}, renderLabel()), /*#__PURE__*/React.createElement("div", {
|
|
37
|
-
className: "".concat(classPrefix, "-group-option-count")
|
|
38
|
-
}, /*#__PURE__*/React.createElement(Badge, {
|
|
39
|
-
count: count
|
|
40
|
-
})));
|
|
41
|
-
});
|
|
42
|
-
export default GroupOption;
|