@zgfe/business-lib 1.0.25-layers.5 → 1.0.25-userGroupFix.0
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/cycleTime/index.d.ts +0 -1
- package/es/cycleTime/index.js +5 -11
- package/es/cycleTime/month.d.ts +0 -1
- package/es/cycleTime/month.js +3 -6
- package/es/cycleTime/styles/month.less +0 -12
- package/es/select/demo/multiple.js +2 -3
- package/es/select/handle.js +3 -4
- package/es/select/styles/handle.less +27 -36
- package/es/userCondition/conditions/styles/eventCondition.less +1 -1
- package/es/userCondition/conditions/styles/tagsCondition.less +1 -1
- package/es/userCondition/conditions/tagsCondition.js +13 -26
- package/es/userCondition/conditions/textDesc.js +8 -29
- package/es/userCondition/demo/index.js +228 -5
- package/es/userCondition/types.d.ts +3 -21
- package/es/userCondition/util.d.ts +1 -23
- package/es/userCondition/util.js +5 -39
- package/es/userTagsSelector/cascaderOverlay.js +42 -132
- package/es/userTagsSelector/demo/index.js +5 -12
- package/es/userTagsSelector/groups/groupOption.js +2 -3
- package/es/userTagsSelector/groups/index.js +11 -18
- package/es/userTagsSelector/groups/styles/option.less +1 -6
- package/es/userTagsSelector/index.js +3 -17
- package/es/userTagsSelector/multipleCheckPanel/checkOption.js +1 -2
- package/es/userTagsSelector/multipleCheckPanel/index.js +16 -7
- package/es/userTagsSelector/styles/cascaderOverlay.less +4 -9
- package/es/userTagsSelector/types.d.ts +10 -1
- package/es/userTagsSelector/util.d.ts +1 -1
- package/es/userTagsSelector/util.js +2 -6
- package/package.json +2 -2
- package/es/cycleTime/demo/disable.d.ts +0 -2
- package/es/cycleTime/demo/disable.js +0 -17
- package/es/userCondition/demo/mockData.d.ts +0 -85
- package/es/userCondition/demo/mockData.js +0 -546
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { UserProp } from '../attributeSelector/types';
|
|
3
|
+
import { TagI } from './../userTagsSelector/types';
|
|
3
4
|
export declare type Unpacked<T, U extends keyof T> = Required<T> extends {
|
|
4
5
|
[key in U]: infer R;
|
|
5
6
|
} ? R : never;
|
|
@@ -29,27 +30,8 @@ export declare namespace BizUserConditionT {
|
|
|
29
30
|
isRealTime?: boolean;
|
|
30
31
|
}
|
|
31
32
|
interface UserTagsDataI {
|
|
32
|
-
appId: number;
|
|
33
|
-
createTime: string;
|
|
34
|
-
updateTime: string;
|
|
35
|
-
del: number;
|
|
36
33
|
labelGroup: string;
|
|
37
|
-
|
|
38
|
-
labelName: string;
|
|
39
|
-
labelStatus: number;
|
|
40
|
-
labelType: number;
|
|
41
|
-
remark: string;
|
|
42
|
-
creator: string;
|
|
43
|
-
userAmount: number;
|
|
44
|
-
layerNum: number;
|
|
45
|
-
endProcessTime: string;
|
|
46
|
-
layers: {
|
|
47
|
-
layerLabelId: number;
|
|
48
|
-
layerLabelName: string;
|
|
49
|
-
layerRemark: string;
|
|
50
|
-
layerCondition: any[][];
|
|
51
|
-
sequence: number;
|
|
52
|
-
}[];
|
|
34
|
+
children: TagI[];
|
|
53
35
|
}
|
|
54
36
|
interface AttrCondition {
|
|
55
37
|
attrId: number;
|
|
@@ -80,7 +62,7 @@ export declare namespace BizUserConditionT {
|
|
|
80
62
|
}
|
|
81
63
|
interface Labels {
|
|
82
64
|
operator: 'not equal' | 'equal';
|
|
83
|
-
values:
|
|
65
|
+
values: number[];
|
|
84
66
|
}
|
|
85
67
|
interface TagsCondition {
|
|
86
68
|
attrs: [];
|
|
@@ -4,26 +4,4 @@ export declare function buildCondition(type: BizUserConditionT.ConditionType): B
|
|
|
4
4
|
export declare function transformNumberOperate(key: string, output?: boolean): string;
|
|
5
5
|
export declare function findEvent(eventId: number, eventGroupList: Unpacked<GlobalContextProps, 'eventGroupList'>): import("../attributeSelector/types").AnalysisEvent | null;
|
|
6
6
|
export declare function findPropAndEnv(name: string, list: Unpacked<GlobalContextProps, 'userPropList' | 'eventEnvList'>): import("../attributeSelector/types").UserProp | import("../attributeSelector/types").EnvProp | null;
|
|
7
|
-
export declare function
|
|
8
|
-
labelGroup: string;
|
|
9
|
-
id?: undefined;
|
|
10
|
-
labelName?: undefined;
|
|
11
|
-
layerLabelId?: undefined;
|
|
12
|
-
layerLabelName?: undefined;
|
|
13
|
-
} | {
|
|
14
|
-
id: number;
|
|
15
|
-
labelName: string;
|
|
16
|
-
labelGroup?: undefined;
|
|
17
|
-
layerLabelId?: undefined;
|
|
18
|
-
layerLabelName?: undefined;
|
|
19
|
-
} | {
|
|
20
|
-
layerLabelId: number;
|
|
21
|
-
layerLabelName: string;
|
|
22
|
-
labelGroup?: undefined;
|
|
23
|
-
id?: undefined;
|
|
24
|
-
labelName?: undefined;
|
|
25
|
-
})[] | null;
|
|
26
|
-
export declare function buildTagsGroup(list: BizUserConditionT.UserTagsDataI[]): {
|
|
27
|
-
labelGroup: string;
|
|
28
|
-
children: BizUserConditionT.UserTagsDataI[];
|
|
29
|
-
}[];
|
|
7
|
+
export declare function findTagFactory(data: BizUserConditionT.UserTagsDataI[]): (id: number) => import("../userTagsSelector/types").TagI | null;
|
package/es/userCondition/util.js
CHANGED
|
@@ -1,9 +1,3 @@
|
|
|
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
1
|
export function buildCondition(type) {
|
|
8
2
|
switch (type) {
|
|
9
3
|
case 'add':
|
|
@@ -105,45 +99,17 @@ export function findPropAndEnv(name, list) {
|
|
|
105
99
|
|
|
106
100
|
return null;
|
|
107
101
|
}
|
|
108
|
-
export function
|
|
109
|
-
return function (
|
|
102
|
+
export function findTagFactory(data) {
|
|
103
|
+
return function (id) {
|
|
110
104
|
var i = -1;
|
|
111
105
|
var j = data.findIndex(function (item) {
|
|
112
|
-
i = item.
|
|
113
|
-
return
|
|
106
|
+
i = item.children.findIndex(function (tag) {
|
|
107
|
+
return tag.labelId === id;
|
|
114
108
|
});
|
|
115
109
|
if (i < 0) return false;
|
|
116
110
|
return true;
|
|
117
111
|
});
|
|
118
112
|
if (j < 0) return null;
|
|
119
|
-
return [
|
|
120
|
-
labelGroup: data[j].labelGroup
|
|
121
|
-
}, {
|
|
122
|
-
id: data[j].id,
|
|
123
|
-
labelName: data[j].labelName
|
|
124
|
-
}, {
|
|
125
|
-
layerLabelId: data[j].layers[i].layerLabelId,
|
|
126
|
-
layerLabelName: data[j].layers[i].layerLabelName
|
|
127
|
-
}];
|
|
113
|
+
return data[j].children[i];
|
|
128
114
|
};
|
|
129
|
-
}
|
|
130
|
-
export function buildTagsGroup(list) {
|
|
131
|
-
var groupOrder = ['基本标签', '活跃标签', '行为标签', '预测标签', '其它标签'];
|
|
132
|
-
var groupsMap = {};
|
|
133
|
-
var options = [];
|
|
134
|
-
list.forEach(function (label) {
|
|
135
|
-
if (Object.hasOwn(groupsMap, label.labelGroup)) {
|
|
136
|
-
groupsMap[label.labelGroup].children.push(_objectSpread({}, label));
|
|
137
|
-
} else {
|
|
138
|
-
var group = {
|
|
139
|
-
labelGroup: label.labelGroup,
|
|
140
|
-
children: [_objectSpread({}, label)]
|
|
141
|
-
};
|
|
142
|
-
groupsMap[label.labelGroup] = group;
|
|
143
|
-
}
|
|
144
|
-
});
|
|
145
|
-
groupOrder.map(function (group) {
|
|
146
|
-
groupsMap[group] && options.push(groupsMap[group]);
|
|
147
|
-
});
|
|
148
|
-
return options;
|
|
149
115
|
}
|
|
@@ -1,7 +1,3 @@
|
|
|
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
1
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
6
2
|
|
|
7
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."); }
|
|
@@ -10,8 +6,6 @@ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symb
|
|
|
10
6
|
|
|
11
7
|
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
12
8
|
|
|
13
|
-
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; }
|
|
14
|
-
|
|
15
9
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
16
10
|
|
|
17
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."); }
|
|
@@ -24,77 +18,49 @@ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Sy
|
|
|
24
18
|
|
|
25
19
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
26
20
|
|
|
27
|
-
import React
|
|
21
|
+
import React from 'react';
|
|
28
22
|
import { useState } from 'react';
|
|
29
23
|
import { classPrefix } from '.';
|
|
30
24
|
import './styles/cascaderOverlay.less';
|
|
31
25
|
import Groups from './groups/index';
|
|
32
26
|
import MultipleCheckPanel from './multipleCheckPanel';
|
|
33
|
-
import {
|
|
27
|
+
import { getFieldFactory } from './util';
|
|
34
28
|
import _ from 'lodash';
|
|
35
|
-
import Search from './components/search';
|
|
36
29
|
|
|
37
30
|
var CascaderOverlay = function CascaderOverlay(props) {
|
|
38
|
-
var
|
|
31
|
+
var data = props.data,
|
|
32
|
+
currentValue = props.currentValue,
|
|
39
33
|
labelFields = props.labelFields,
|
|
40
34
|
keyFields = props.keyFields,
|
|
41
35
|
valueFields = props.valueFields,
|
|
42
36
|
childFields = props.childFields;
|
|
43
|
-
var timer = useRef(null);
|
|
44
37
|
|
|
45
|
-
var _useState = useState(
|
|
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
|
+
}),
|
|
46
51
|
_useState2 = _slicedToArray(_useState, 2),
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
var _useState3 = useState(initPath(data)),
|
|
51
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
|
52
|
-
currentPath = _useState4[0],
|
|
53
|
-
setCurrentPath = _useState4[1];
|
|
54
|
-
|
|
55
|
-
var _useState5 = useState(''),
|
|
56
|
-
_useState6 = _slicedToArray(_useState5, 2),
|
|
57
|
-
highlightText = _useState6[0],
|
|
58
|
-
setHighlightText = _useState6[1];
|
|
59
|
-
|
|
60
|
-
function initPath(data) {
|
|
61
|
-
return function () {
|
|
62
|
-
var path = [];
|
|
63
|
-
var curr = data[0];
|
|
64
|
-
var getChildField = getFieldFactory(childFields);
|
|
65
|
-
|
|
66
|
-
while (curr) {
|
|
67
|
-
path.push(curr);
|
|
68
|
-
var childField = getChildField();
|
|
69
|
-
|
|
70
|
-
if (_.isArray(curr[childField])) {
|
|
71
|
-
curr = curr[childField].length ? curr[childField][0] : null;
|
|
72
|
-
} else {
|
|
73
|
-
curr = curr[childField];
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
path.pop();
|
|
78
|
-
return path;
|
|
79
|
-
};
|
|
80
|
-
}
|
|
52
|
+
currentPath = _useState2[0],
|
|
53
|
+
setCurrentPath = _useState2[1];
|
|
81
54
|
|
|
82
55
|
function onActive(data, level) {
|
|
83
56
|
var currIndex = level;
|
|
84
57
|
var getChildField = getFieldFactory(childFields.slice(currIndex).length ? childFields.slice(currIndex) : childFields.slice(-1));
|
|
85
58
|
var curr = data;
|
|
86
|
-
var newPath = currentPath.slice(
|
|
59
|
+
var newPath = currentPath.slice();
|
|
87
60
|
|
|
88
61
|
while (curr) {
|
|
89
62
|
newPath[currIndex] = curr;
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
if (_.isArray(curr[childField])) {
|
|
93
|
-
curr = curr[childField].length ? curr[childField][0] : null;
|
|
94
|
-
} else {
|
|
95
|
-
curr = curr[childField];
|
|
96
|
-
}
|
|
97
|
-
|
|
63
|
+
curr = curr[getChildField()];
|
|
98
64
|
currIndex++;
|
|
99
65
|
}
|
|
100
66
|
|
|
@@ -104,13 +70,8 @@ var CascaderOverlay = function CascaderOverlay(props) {
|
|
|
104
70
|
|
|
105
71
|
function onCheck(data) {
|
|
106
72
|
var getVabelField = getFieldFactory(valueFields);
|
|
107
|
-
var getLabelField = getFieldFactory(labelFields);
|
|
108
73
|
var newValue = currentPath.map(function (item) {
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
var labelField = getLabelField();
|
|
112
|
-
var valueField = getVabelField();
|
|
113
|
-
return _ref = {}, _defineProperty(_ref, labelField, item[labelField]), _defineProperty(_ref, valueField, item[valueField]), _ref;
|
|
74
|
+
return item[getVabelField()];
|
|
114
75
|
}).concat(data);
|
|
115
76
|
props.onChange([].concat(_toConsumableArray(currentValue), [newValue]));
|
|
116
77
|
}
|
|
@@ -124,81 +85,30 @@ var CascaderOverlay = function CascaderOverlay(props) {
|
|
|
124
85
|
props.onChange(newValues);
|
|
125
86
|
}
|
|
126
87
|
|
|
127
|
-
function onSearch(val) {
|
|
128
|
-
timer.current && clearTimeout(timer.current);
|
|
129
|
-
timer.current = setTimeout(function () {
|
|
130
|
-
var _labelFields$, _props$data;
|
|
131
|
-
|
|
132
|
-
var res = [];
|
|
133
|
-
var filter = filterFactory((_labelFields$ = labelFields[1]) !== null && _labelFields$ !== void 0 ? _labelFields$ : labelFields[0], val);
|
|
134
|
-
(_props$data = props.data) === null || _props$data === void 0 ? void 0 : _props$data.forEach(function (item) {
|
|
135
|
-
var searchList = item[childFields[0]].filter(filter);
|
|
136
|
-
|
|
137
|
-
if (searchList.length) {
|
|
138
|
-
res.push(_objectSpread(_objectSpread({}, item), {}, _defineProperty({}, childFields[0], item[childFields[0]].filter(filter))));
|
|
139
|
-
}
|
|
140
|
-
});
|
|
141
|
-
setData(res);
|
|
142
|
-
setCurrentPath(initPath(res));
|
|
143
|
-
setHighlightText(val);
|
|
144
|
-
}, 300);
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
function render() {
|
|
148
|
-
if (!data.length) return /*#__PURE__*/React.createElement("div", {
|
|
149
|
-
style: {
|
|
150
|
-
padding: 8,
|
|
151
|
-
width: 596
|
|
152
|
-
}
|
|
153
|
-
}, "\u6682\u65E0\u6570\u636E");
|
|
154
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
155
|
-
className: "".concat(classPrefix, "-overlay-groups")
|
|
156
|
-
}, /*#__PURE__*/React.createElement(Groups, {
|
|
157
|
-
key: 0,
|
|
158
|
-
currentValue: currentValue,
|
|
159
|
-
valueField: valueFields[0],
|
|
160
|
-
keyField: keyFields[0],
|
|
161
|
-
childField: childFields[0],
|
|
162
|
-
labelField: labelFields[0],
|
|
163
|
-
data: data,
|
|
164
|
-
onActive: onActive,
|
|
165
|
-
level: 0
|
|
166
|
-
})), /*#__PURE__*/React.createElement("div", {
|
|
167
|
-
className: "".concat(classPrefix, "-overlay-groups")
|
|
168
|
-
}, /*#__PURE__*/React.createElement(Groups, {
|
|
169
|
-
currentValue: currentValue,
|
|
170
|
-
valueField: valueFields[1],
|
|
171
|
-
keyField: keyFields[1],
|
|
172
|
-
childField: childFields[1],
|
|
173
|
-
labelField: labelFields[1],
|
|
174
|
-
data: currentPath[0] ? currentPath[0][childFields[0]] : [],
|
|
175
|
-
onActive: onActive,
|
|
176
|
-
highlightText: highlightText,
|
|
177
|
-
level: 1
|
|
178
|
-
})), /*#__PURE__*/React.createElement("div", {
|
|
179
|
-
className: "".concat(classPrefix, "-overlay-selections")
|
|
180
|
-
}, /*#__PURE__*/React.createElement(MultipleCheckPanel, {
|
|
181
|
-
valueField: valueFields[2],
|
|
182
|
-
onCheck: onCheck,
|
|
183
|
-
onUncheck: onUncheck,
|
|
184
|
-
currentValue: currentValue,
|
|
185
|
-
level: 2,
|
|
186
|
-
labelField: labelFields[2],
|
|
187
|
-
data: currentPath[1] ? currentPath[1][childFields[1]] : []
|
|
188
|
-
})));
|
|
189
|
-
}
|
|
190
|
-
|
|
191
88
|
return /*#__PURE__*/React.createElement("div", {
|
|
192
89
|
className: "".concat(classPrefix, "-overlay")
|
|
193
90
|
}, /*#__PURE__*/React.createElement("div", {
|
|
194
|
-
className: "".concat(classPrefix, "-overlay-
|
|
195
|
-
}, /*#__PURE__*/React.createElement(
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
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
|
|
199
101
|
})), /*#__PURE__*/React.createElement("div", {
|
|
200
|
-
className: "".concat(classPrefix, "-overlay-
|
|
201
|
-
},
|
|
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
|
+
})));
|
|
202
112
|
};
|
|
203
113
|
|
|
204
114
|
export default CascaderOverlay;
|
|
@@ -22,14 +22,7 @@ data.forEach(function (item) {
|
|
|
22
22
|
var id = Math.random();
|
|
23
23
|
var tag = {
|
|
24
24
|
id: id,
|
|
25
|
-
labelName: '标签' + id + id + id + id
|
|
26
|
-
layers: Array(5 * Math.random() >> 0).fill(1).map(function (_item, i) {
|
|
27
|
-
var layer = {
|
|
28
|
-
layerLabelId: Math.random(),
|
|
29
|
-
layerLabelName: '分层' + i
|
|
30
|
-
};
|
|
31
|
-
return layer;
|
|
32
|
-
})
|
|
25
|
+
labelName: '标签' + id + id + id + id
|
|
33
26
|
};
|
|
34
27
|
|
|
35
28
|
if (id < 0.6 && defaultValue.length < 20) {
|
|
@@ -45,11 +38,11 @@ export default (function () {
|
|
|
45
38
|
}
|
|
46
39
|
|
|
47
40
|
return /*#__PURE__*/React.createElement(BizUserTagsSelect, {
|
|
48
|
-
childFields: ['children'
|
|
41
|
+
childFields: ['children'],
|
|
49
42
|
data: data,
|
|
50
|
-
keyFields: ['labelGroup', 'id'
|
|
51
|
-
labelFields: ['labelGroup', 'labelName'
|
|
52
|
-
valueFields: ['labelGroup', '
|
|
43
|
+
keyFields: ['labelGroup', 'id'],
|
|
44
|
+
labelFields: ['labelGroup', 'labelName'],
|
|
45
|
+
valueFields: ['labelGroup', 'labelId'],
|
|
53
46
|
onChange: onChange
|
|
54
47
|
});
|
|
55
48
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { forwardRef } from 'react';
|
|
2
2
|
import { Badge } from 'antd';
|
|
3
3
|
import { classPrefix } from '..';
|
|
4
|
-
import
|
|
4
|
+
import theme from '../../assets/theme.js';
|
|
5
5
|
import './styles/option.less';
|
|
6
6
|
import { util } from '../../utils';
|
|
7
7
|
var GroupOption = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
@@ -30,8 +30,7 @@ var GroupOption = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
30
30
|
return _onClick(value);
|
|
31
31
|
},
|
|
32
32
|
className: ["".concat(classPrefix, "-group-option"), actived ? 'active' : '', checked ? 'checked' : ''].join(' '),
|
|
33
|
-
ref: ref
|
|
34
|
-
title: label
|
|
33
|
+
ref: ref
|
|
35
34
|
}, /*#__PURE__*/React.createElement("div", {
|
|
36
35
|
className: "".concat(classPrefix, "-group-option-label")
|
|
37
36
|
}, renderLabel()), /*#__PURE__*/React.createElement("div", {
|
|
@@ -10,7 +10,7 @@ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Sy
|
|
|
10
10
|
|
|
11
11
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
12
12
|
|
|
13
|
-
import React, {
|
|
13
|
+
import React, { useMemo } from 'react';
|
|
14
14
|
import VirtualList from 'rc-virtual-list';
|
|
15
15
|
import { classPrefix } from '../';
|
|
16
16
|
import GroupOption from './groupOption';
|
|
@@ -33,21 +33,11 @@ var Groups = function Groups(props) {
|
|
|
33
33
|
searchValue = _useState2[0],
|
|
34
34
|
setSearchValue = _useState2[1];
|
|
35
35
|
|
|
36
|
-
var _useState3 = useState(data
|
|
36
|
+
var _useState3 = useState(data[0][valueField]),
|
|
37
37
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
38
38
|
active = _useState4[0],
|
|
39
39
|
setActive = _useState4[1];
|
|
40
40
|
|
|
41
|
-
var searchFilter = useMemo(function () {
|
|
42
|
-
return filterFactory(labelField, searchValue);
|
|
43
|
-
}, [labelField, searchValue]);
|
|
44
|
-
var isChecked = useMemo(function () {
|
|
45
|
-
return isCheckedFactory(currentValue, level);
|
|
46
|
-
}, [currentValue, level]);
|
|
47
|
-
useEffect(function () {
|
|
48
|
-
if (data.length) setActive(data[0][valueField]);
|
|
49
|
-
}, [data]);
|
|
50
|
-
|
|
51
41
|
function _onClick(i) {
|
|
52
42
|
setActive(data[i][valueField]);
|
|
53
43
|
props.onActive(data[i], level);
|
|
@@ -57,6 +47,12 @@ var Groups = function Groups(props) {
|
|
|
57
47
|
setSearchValue(val);
|
|
58
48
|
}
|
|
59
49
|
|
|
50
|
+
var searchFilter = useMemo(function () {
|
|
51
|
+
return filterFactory(labelField, searchValue);
|
|
52
|
+
}, [labelField, searchValue]);
|
|
53
|
+
var isChecked = useMemo(function () {
|
|
54
|
+
return isCheckedFactory(currentValue, level);
|
|
55
|
+
}, [currentValue, level]);
|
|
60
56
|
if (!data.length) return /*#__PURE__*/React.createElement("span", null, "\u6682\u65E0\u6570\u636E");
|
|
61
57
|
return /*#__PURE__*/React.createElement("div", {
|
|
62
58
|
className: "".concat(classPrefix, "-groups-panel")
|
|
@@ -65,22 +61,19 @@ var Groups = function Groups(props) {
|
|
|
65
61
|
onChange: onSearch
|
|
66
62
|
}), /*#__PURE__*/React.createElement(VirtualList, {
|
|
67
63
|
data: searchable ? data.filter(searchFilter) : data,
|
|
68
|
-
height:
|
|
69
|
-
itemHeight: 48,
|
|
64
|
+
height: 408,
|
|
70
65
|
itemKey: keyField
|
|
71
66
|
}, function (item, index) {
|
|
72
|
-
var _props$highlightText;
|
|
73
|
-
|
|
74
67
|
return /*#__PURE__*/React.createElement(GroupOption, {
|
|
75
68
|
onClick: function onClick() {
|
|
76
69
|
return _onClick(index);
|
|
77
70
|
},
|
|
78
71
|
actived: item[valueField] === active,
|
|
79
|
-
checked: isChecked(item
|
|
72
|
+
checked: isChecked(item[valueField]),
|
|
80
73
|
count: item[childField].length,
|
|
81
74
|
label: item[labelField],
|
|
82
75
|
value: item[valueField],
|
|
83
|
-
highlightText:
|
|
76
|
+
highlightText: searchValue
|
|
84
77
|
});
|
|
85
78
|
}));
|
|
86
79
|
};
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
39
|
&.active {
|
|
40
|
-
color: #fff
|
|
40
|
+
color: #fff;
|
|
41
41
|
background: @primary-color;
|
|
42
42
|
.biz-user-tags-selector-group-option-count {
|
|
43
43
|
.ant-badge-count {
|
|
@@ -45,11 +45,6 @@
|
|
|
45
45
|
background: @primary-color;
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
|
-
.biz-user-tags-selector-group-option-label {
|
|
49
|
-
* {
|
|
50
|
-
color: #fff !important;
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
48
|
}
|
|
54
49
|
}
|
|
55
50
|
}
|
|
@@ -1,9 +1,3 @@
|
|
|
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
1
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
8
2
|
|
|
9
3
|
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."); }
|
|
@@ -46,14 +40,7 @@ var UserTagsSelect = function UserTagsSelect(props) {
|
|
|
46
40
|
|
|
47
41
|
var handleValue = useMemo(function () {
|
|
48
42
|
return currentValue.map(function (item) {
|
|
49
|
-
|
|
50
|
-
var pre = item[item.length - 2];
|
|
51
|
-
|
|
52
|
-
var res = _objectSpread(_objectSpread({}, last), {}, {
|
|
53
|
-
handleText: "".concat(pre[labelFields[labelFields.length - 2]], "\uFF1A").concat(last[labelFields[labelFields.length - 1]])
|
|
54
|
-
});
|
|
55
|
-
|
|
56
|
-
return res;
|
|
43
|
+
return item.slice().pop();
|
|
57
44
|
});
|
|
58
45
|
}, [currentValue]);
|
|
59
46
|
|
|
@@ -64,8 +51,7 @@ var UserTagsSelect = function UserTagsSelect(props) {
|
|
|
64
51
|
function onDelete(data) {
|
|
65
52
|
var current = currentValue.slice();
|
|
66
53
|
var index = current.findIndex(function (item) {
|
|
67
|
-
|
|
68
|
-
return _.isEqual(item.slice().pop()[keyField], data[keyField]);
|
|
54
|
+
return _.isEqual(item.slice().pop(), data);
|
|
69
55
|
});
|
|
70
56
|
current.splice(index, 1);
|
|
71
57
|
props.onChange && props.onChange(current);
|
|
@@ -111,7 +97,7 @@ var UserTagsSelect = function UserTagsSelect(props) {
|
|
|
111
97
|
}, /*#__PURE__*/React.createElement(SelectHandle, {
|
|
112
98
|
border: false,
|
|
113
99
|
value: handleValue,
|
|
114
|
-
labelField:
|
|
100
|
+
labelField: labelFields[labelFields.length - 1],
|
|
115
101
|
multiple: true,
|
|
116
102
|
size: "middle",
|
|
117
103
|
placeholder: "\u9009\u62E9\u6807\u7B7E",
|
|
@@ -33,8 +33,7 @@ var CheckOption = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
33
33
|
|
|
34
34
|
return /*#__PURE__*/React.createElement("div", {
|
|
35
35
|
ref: ref,
|
|
36
|
-
className: ["".concat(classPrefix, "-check-option"), disabled ? "".concat(classPrefix, "-check-option-disabled") : ''].join(' ')
|
|
37
|
-
title: label
|
|
36
|
+
className: ["".concat(classPrefix, "-check-option"), disabled ? "".concat(classPrefix, "-check-option-disabled") : ''].join(' ')
|
|
38
37
|
}, /*#__PURE__*/React.createElement(Checkbox, {
|
|
39
38
|
onChange: onChange,
|
|
40
39
|
disabled: disabled,
|
|
@@ -13,6 +13,7 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
|
13
13
|
import React, { useMemo, useState } from 'react';
|
|
14
14
|
import { classPrefix } from '..';
|
|
15
15
|
import VirtualList from 'rc-virtual-list';
|
|
16
|
+
import Search from '../components/search';
|
|
16
17
|
import CheckOption from './checkOption';
|
|
17
18
|
import { filterFactory, isCheckedFactory } from '../util';
|
|
18
19
|
|
|
@@ -20,12 +21,16 @@ var MultipleCheckPanel = function MultipleCheckPanel(props) {
|
|
|
20
21
|
var data = props.data,
|
|
21
22
|
labelField = props.labelField,
|
|
22
23
|
level = props.level,
|
|
23
|
-
currentValue = props.currentValue
|
|
24
|
-
valueField = props.valueField;
|
|
24
|
+
currentValue = props.currentValue;
|
|
25
25
|
|
|
26
26
|
var _useState = useState(''),
|
|
27
|
-
_useState2 = _slicedToArray(_useState,
|
|
28
|
-
searchValue = _useState2[0]
|
|
27
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
28
|
+
searchValue = _useState2[0],
|
|
29
|
+
setSearchValue = _useState2[1];
|
|
30
|
+
|
|
31
|
+
function onSearch(val) {
|
|
32
|
+
setSearchValue(val);
|
|
33
|
+
}
|
|
29
34
|
|
|
30
35
|
var searchFilter = useMemo(function () {
|
|
31
36
|
return filterFactory(labelField, searchValue);
|
|
@@ -45,13 +50,17 @@ var MultipleCheckPanel = function MultipleCheckPanel(props) {
|
|
|
45
50
|
if (!data.length) return /*#__PURE__*/React.createElement("span", null, "\u6682\u65E0\u6570\u636E");
|
|
46
51
|
return /*#__PURE__*/React.createElement("div", {
|
|
47
52
|
className: "".concat(classPrefix, "-check-panel")
|
|
48
|
-
}, /*#__PURE__*/React.createElement(
|
|
53
|
+
}, /*#__PURE__*/React.createElement(Search, {
|
|
54
|
+
show: true,
|
|
55
|
+
onChange: onSearch,
|
|
56
|
+
placeholder: "\u641C\u7D22\u6807\u7B7E\u540D\u79F0"
|
|
57
|
+
}), /*#__PURE__*/React.createElement(VirtualList, {
|
|
49
58
|
data: data.filter(searchFilter),
|
|
50
59
|
itemHeight: 48,
|
|
51
60
|
itemKey: labelField,
|
|
52
|
-
height:
|
|
61
|
+
height: 361
|
|
53
62
|
}, function (item, index) {
|
|
54
|
-
var checked = isChecked(item
|
|
63
|
+
var checked = isChecked(item);
|
|
55
64
|
return /*#__PURE__*/React.createElement(CheckOption, {
|
|
56
65
|
checked: checked,
|
|
57
66
|
highlightText: searchValue,
|
|
@@ -1,24 +1,19 @@
|
|
|
1
1
|
@import '../../assets/styles/inner.less';
|
|
2
2
|
.biz-user-tags-selector {
|
|
3
3
|
&-overlay {
|
|
4
|
+
display: flex;
|
|
5
|
+
width: 651px;
|
|
4
6
|
max-height: 425px;
|
|
5
7
|
background-color: #fff;
|
|
6
8
|
border-radius: @border-radius-normal;
|
|
7
9
|
box-shadow: @box-shadow-base;
|
|
8
|
-
&-search {
|
|
9
|
-
height: 48px;
|
|
10
|
-
padding: @margin-xs @margin-xs 0;
|
|
11
|
-
}
|
|
12
|
-
&-panel {
|
|
13
|
-
display: flex;
|
|
14
|
-
}
|
|
15
10
|
&-groups {
|
|
16
|
-
width:
|
|
11
|
+
width: 192px;
|
|
17
12
|
padding: @margin-xs;
|
|
18
13
|
border-right: 1px solid @border-color-base;
|
|
19
14
|
}
|
|
20
15
|
&-selections {
|
|
21
|
-
|
|
16
|
+
flex: 1;
|
|
22
17
|
min-width: 0;
|
|
23
18
|
padding: @padding-xs;
|
|
24
19
|
}
|
|
@@ -29,7 +29,6 @@ export declare namespace UserTagsSelectorTypes {
|
|
|
29
29
|
searchable?: boolean;
|
|
30
30
|
level: number;
|
|
31
31
|
currentValue: any[];
|
|
32
|
-
highlightText?: string;
|
|
33
32
|
}
|
|
34
33
|
interface GroupOption {
|
|
35
34
|
actived: boolean;
|
|
@@ -56,3 +55,13 @@ export declare namespace UserTagsSelectorTypes {
|
|
|
56
55
|
disabled: boolean;
|
|
57
56
|
}
|
|
58
57
|
}
|
|
58
|
+
export interface TagI {
|
|
59
|
+
appId: number;
|
|
60
|
+
createTime: string;
|
|
61
|
+
updateTime: string;
|
|
62
|
+
del: number;
|
|
63
|
+
labelGroup: string;
|
|
64
|
+
labelId: number;
|
|
65
|
+
labelName: string;
|
|
66
|
+
labelStatus: number;
|
|
67
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export declare function curry(fn: Function): (...arg1: any[]) => (...arg2: any[]) => any;
|
|
2
2
|
export declare function filterFactory(labelField: string, searchValue: string): (item: any) => boolean;
|
|
3
|
-
export declare function isCheckedFactory(currentValue: any[], level: number): (
|
|
3
|
+
export declare function isCheckedFactory(currentValue: any[], level: number): (val: any) => boolean;
|
|
4
4
|
export declare function getFieldFactory(fields: string[]): () => string;
|