@zgfe/business-lib 1.0.0-beta.1
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/README.md +12 -0
- package/es/analysisLayout/demo/index.d.ts +3 -0
- package/es/analysisLayout/demo/index.js +30 -0
- package/es/analysisLayout/demo/index.less +12 -0
- package/es/analysisLayout/index.d.ts +13 -0
- package/es/analysisLayout/index.js +153 -0
- package/es/analysisLayout/index.less +115 -0
- package/es/attributeSelector/data/env.d.ts +11 -0
- package/es/attributeSelector/data/env.js +181 -0
- package/es/attributeSelector/data/event.d.ts +237 -0
- package/es/attributeSelector/data/event.js +3483 -0
- package/es/attributeSelector/data/user.d.ts +22 -0
- package/es/attributeSelector/data/user.js +218 -0
- package/es/attributeSelector/demo/multi.d.ts +2 -0
- package/es/attributeSelector/demo/multi.js +39 -0
- package/es/attributeSelector/demo/multiForm.d.ts +2 -0
- package/es/attributeSelector/demo/multiForm.js +64 -0
- package/es/attributeSelector/demo/single.d.ts +2 -0
- package/es/attributeSelector/demo/single.js +43 -0
- package/es/attributeSelector/demo/singleForm.d.ts +2 -0
- package/es/attributeSelector/demo/singleForm.js +66 -0
- package/es/attributeSelector/group.d.ts +31 -0
- package/es/attributeSelector/group.js +225 -0
- package/es/attributeSelector/index.d.ts +110 -0
- package/es/attributeSelector/index.js +578 -0
- package/es/attributeSelector/index.less +172 -0
- package/es/chart/chartConfig.d.ts +28 -0
- package/es/chart/chartConfig.js +256 -0
- package/es/chart/color.d.ts +1 -0
- package/es/chart/color.js +1 -0
- package/es/chart/demo/bar.d.ts +2 -0
- package/es/chart/demo/bar.js +19 -0
- package/es/chart/demo/data.d.ts +11 -0
- package/es/chart/demo/data.js +37 -0
- package/es/chart/demo/index.d.ts +2 -0
- package/es/chart/demo/index.js +9 -0
- package/es/chart/demo/pie.d.ts +2 -0
- package/es/chart/demo/pie.js +30 -0
- package/es/chart/index.d.ts +63 -0
- package/es/chart/index.js +76 -0
- package/es/chart/index.less +38 -0
- package/es/chart/style/circle.svg +4 -0
- package/es/commonStyle/icon.less +147 -0
- package/es/commonStyle/index.less +171 -0
- package/es/commonStyle/select.less +101 -0
- package/es/commonStyle/theme.less +432 -0
- package/es/commonStyle/variable.less +124 -0
- package/es/datePicker/data.d.ts +9 -0
- package/es/datePicker/data.js +65 -0
- package/es/datePicker/demo/form.d.ts +2 -0
- package/es/datePicker/demo/form.js +53 -0
- package/es/datePicker/demo/index.d.ts +2 -0
- package/es/datePicker/demo/index.js +30 -0
- package/es/datePicker/index.d.ts +29 -0
- package/es/datePicker/index.js +207 -0
- package/es/datePicker/index.less +388 -0
- package/es/dialog/components/list.d.ts +15 -0
- package/es/dialog/components/list.js +57 -0
- package/es/dialog/components/selectToInput.d.ts +43 -0
- package/es/dialog/components/selectToInput.js +107 -0
- package/es/dialog/components/style/list.less +59 -0
- package/es/dialog/components/style/tab.less +61 -0
- package/es/dialog/components/tab.d.ts +9 -0
- package/es/dialog/components/tab.js +50 -0
- package/es/dialog/data/chart.d.ts +11 -0
- package/es/dialog/data/chart.js +62 -0
- package/es/dialog/demo/index.d.ts +2 -0
- package/es/dialog/demo/index.js +122 -0
- package/es/dialog/demo/index2.d.ts +2 -0
- package/es/dialog/demo/index2.js +79 -0
- package/es/dialog/demo/index3.d.ts +2 -0
- package/es/dialog/demo/index3.js +61 -0
- package/es/dialog/index.d.ts +68 -0
- package/es/dialog/index.js +188 -0
- package/es/dialog/style/index.less +70 -0
- package/es/eventSelector/cascade.less +120 -0
- package/es/eventSelector/demo/form.d.ts +2 -0
- package/es/eventSelector/demo/form.js +89 -0
- package/es/eventSelector/demo/index.d.ts +2 -0
- package/es/eventSelector/demo/index.js +69 -0
- package/es/eventSelector/demo/nodata.d.ts +2 -0
- package/es/eventSelector/demo/nodata.js +13 -0
- package/es/eventSelector/index.d.ts +27 -0
- package/es/eventSelector/index.js +390 -0
- package/es/eventSelector/type.d.ts +41 -0
- package/es/eventSelector/type.js +1 -0
- package/es/globalAttributes/demo/data/env.d.ts +11 -0
- package/es/globalAttributes/demo/data/env.js +181 -0
- package/es/globalAttributes/demo/data/event.d.ts +237 -0
- package/es/globalAttributes/demo/data/event.js +3483 -0
- package/es/globalAttributes/demo/data/user.d.ts +22 -0
- package/es/globalAttributes/demo/data/user.js +218 -0
- package/es/globalAttributes/demo/index.d.ts +2 -0
- package/es/globalAttributes/demo/index.js +50 -0
- package/es/globalAttributes/index.d.ts +46 -0
- package/es/globalAttributes/index.js +116 -0
- package/es/index.d.ts +23 -0
- package/es/index.js +25 -0
- package/es/multipleSelector/demo/index.d.ts +2 -0
- package/es/multipleSelector/demo/index.js +35 -0
- package/es/multipleSelector/index.d.ts +36 -0
- package/es/multipleSelector/index.js +109 -0
- package/es/multipleSelector/index.less +138 -0
- package/es/select/demo/index.d.ts +2 -0
- package/es/select/demo/index.js +22 -0
- package/es/select/index.d.ts +42 -0
- package/es/select/index.js +142 -0
- package/es/table/demo/data/color.d.ts +1 -0
- package/es/table/demo/data/color.js +1 -0
- package/es/table/demo/data/data.d.ts +11 -0
- package/es/table/demo/data/data.js +37 -0
- package/es/table/demo/data/table.d.ts +4 -0
- package/es/table/demo/data/table.js +37 -0
- package/es/table/demo/index.d.ts +3 -0
- package/es/table/demo/index.js +171 -0
- package/es/table/demo/index.less +8 -0
- package/es/table/demo/index2.d.ts +2 -0
- package/es/table/demo/index2.js +9 -0
- package/es/table/index.d.ts +32 -0
- package/es/table/index.js +80 -0
- package/es/table/index.less +102 -0
- package/es/targetConditionGroup/components/conditionGroup.d.ts +30 -0
- package/es/targetConditionGroup/components/conditionGroup.js +111 -0
- package/es/targetConditionGroup/components/conditionItem.d.ts +47 -0
- package/es/targetConditionGroup/components/conditionItem.js +259 -0
- package/es/targetConditionGroup/components/style/group.less +47 -0
- package/es/targetConditionGroup/components/style/index.less +16 -0
- package/es/targetConditionGroup/data/operates.d.ts +36 -0
- package/es/targetConditionGroup/data/operates.js +98 -0
- package/es/targetConditionGroup/demo/data/env.d.ts +11 -0
- package/es/targetConditionGroup/demo/data/env.js +181 -0
- package/es/targetConditionGroup/demo/data/event.d.ts +237 -0
- package/es/targetConditionGroup/demo/data/event.js +3483 -0
- package/es/targetConditionGroup/demo/data/user.d.ts +22 -0
- package/es/targetConditionGroup/demo/data/user.js +218 -0
- package/es/targetConditionGroup/demo/form.d.ts +2 -0
- package/es/targetConditionGroup/demo/form.js +96 -0
- package/es/targetConditionGroup/demo/index.d.ts +2 -0
- package/es/targetConditionGroup/demo/index.js +73 -0
- package/es/targetConditionGroup/demo/item.d.ts +2 -0
- package/es/targetConditionGroup/demo/item.js +5 -0
- package/es/targetConditionGroup/index.d.ts +53 -0
- package/es/targetConditionGroup/index.js +265 -0
- package/es/targetConditionGroup/index.less +65 -0
- package/es/targetConditionGroup/type.d.ts +50 -0
- package/es/targetConditionGroup/type.js +1 -0
- package/es/targetSelector/components/BizCascadeBox.d.ts +34 -0
- package/es/targetSelector/components/BizCascadeBox.js +213 -0
- package/es/targetSelector/components/BizEventNameEditBox.d.ts +20 -0
- package/es/targetSelector/components/BizEventNameEditBox.js +57 -0
- package/es/targetSelector/demo/form.d.ts +2 -0
- package/es/targetSelector/demo/form.js +133 -0
- package/es/targetSelector/demo/index.d.ts +2 -0
- package/es/targetSelector/demo/index.js +107 -0
- package/es/targetSelector/demo/nodata.d.ts +2 -0
- package/es/targetSelector/demo/nodata.js +13 -0
- package/es/targetSelector/index.d.ts +40 -0
- package/es/targetSelector/index.js +204 -0
- package/es/targetSelector/index.less +53 -0
- package/es/userGroup/demo/cluster.d.ts +3 -0
- package/es/userGroup/demo/cluster.js +102 -0
- package/es/userGroup/demo/index.d.ts +3 -0
- package/es/userGroup/demo/index.js +115 -0
- package/es/userGroup/demo/index.less +3 -0
- package/es/userGroup/index.d.ts +79 -0
- package/es/userGroup/index.js +134 -0
- package/es/userGroup/index.less +2 -0
- package/es/userGroup/userCluster.d.ts +63 -0
- package/es/userGroup/userCluster.js +254 -0
- package/es/utils/ajax.d.ts +7 -0
- package/es/utils/ajax.js +139 -0
- package/es/utils/index.d.ts +3 -0
- package/es/utils/index.js +3 -0
- package/es/utils/type.d.ts +54 -0
- package/es/utils/type.js +1 -0
- package/es/utils/util.d.ts +67 -0
- package/es/utils/util.js +204 -0
- package/package.json +55 -0
|
@@ -0,0 +1,254 @@
|
|
|
1
|
+
var _excluded = ["key", "disabled"];
|
|
2
|
+
|
|
3
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
4
|
+
|
|
5
|
+
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."); }
|
|
6
|
+
|
|
7
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
8
|
+
|
|
9
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
10
|
+
|
|
11
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
12
|
+
|
|
13
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
14
|
+
|
|
15
|
+
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; }
|
|
16
|
+
|
|
17
|
+
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; }
|
|
18
|
+
|
|
19
|
+
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; }
|
|
20
|
+
|
|
21
|
+
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); }
|
|
22
|
+
|
|
23
|
+
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e2) { throw _e2; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e3) { didErr = true; err = _e3; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
24
|
+
|
|
25
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
26
|
+
|
|
27
|
+
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."); }
|
|
28
|
+
|
|
29
|
+
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); }
|
|
30
|
+
|
|
31
|
+
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; }
|
|
32
|
+
|
|
33
|
+
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; }
|
|
34
|
+
|
|
35
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
36
|
+
|
|
37
|
+
import { BizUserGroup, IconFont } from '..';
|
|
38
|
+
import React, { useEffect, useState } from 'react';
|
|
39
|
+
|
|
40
|
+
var BizUserCluster = function BizUserCluster(props) {
|
|
41
|
+
var _props$defaultValue = props.defaultValue,
|
|
42
|
+
defaultValue = _props$defaultValue === void 0 ? [] : _props$defaultValue,
|
|
43
|
+
_props$value = props.value,
|
|
44
|
+
value = _props$value === void 0 ? [] : _props$value,
|
|
45
|
+
_props$responseType = props.responseType,
|
|
46
|
+
responseType = _props$responseType === void 0 ? 'id' : _props$responseType,
|
|
47
|
+
_props$fieldNames = props.fieldNames,
|
|
48
|
+
fieldNames = _props$fieldNames === void 0 ? {
|
|
49
|
+
label: 'name',
|
|
50
|
+
value: 'id'
|
|
51
|
+
} : _props$fieldNames,
|
|
52
|
+
options = props.options,
|
|
53
|
+
handleChange = props.onChange,
|
|
54
|
+
_props$maxUserGroup = props.maxUserGroup,
|
|
55
|
+
maxUserGroup = _props$maxUserGroup === void 0 ? 3 : _props$maxUserGroup,
|
|
56
|
+
_props$placeholder = props.placeholder,
|
|
57
|
+
placeholder = _props$placeholder === void 0 ? '请选择' : _props$placeholder;
|
|
58
|
+
|
|
59
|
+
var _useState = useState([]),
|
|
60
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
61
|
+
userGroups = _useState2[0],
|
|
62
|
+
setUserGroups = _useState2[1];
|
|
63
|
+
|
|
64
|
+
var _useState3 = useState(options),
|
|
65
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
66
|
+
userOptions = _useState4[0],
|
|
67
|
+
setUserOptions = _useState4[1];
|
|
68
|
+
|
|
69
|
+
var _useState5 = useState([]),
|
|
70
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
71
|
+
selectIds = _useState6[0],
|
|
72
|
+
setSelectIds = _useState6[1];
|
|
73
|
+
|
|
74
|
+
var _useState7 = useState(false),
|
|
75
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
76
|
+
isChange = _useState8[0],
|
|
77
|
+
setIsChange = _useState8[1]; // 获取唯一key值
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
var getUniqueKey = function getUniqueKey() {
|
|
81
|
+
return Math.random().toString();
|
|
82
|
+
}; // 初始化添加key
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
useEffect(function () {
|
|
86
|
+
var inValue = defaultValue.length ? defaultValue : value;
|
|
87
|
+
var groups = [];
|
|
88
|
+
var ids = [];
|
|
89
|
+
|
|
90
|
+
var _iterator = _createForOfIteratorHelper(inValue),
|
|
91
|
+
_step;
|
|
92
|
+
|
|
93
|
+
try {
|
|
94
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
95
|
+
var _value = _step.value;
|
|
96
|
+
var vid = _typeof(_value) === 'object' ? _value[fieldNames.value] : _value;
|
|
97
|
+
ids.push(vid);
|
|
98
|
+
|
|
99
|
+
var _iterator2 = _createForOfIteratorHelper(options),
|
|
100
|
+
_step2;
|
|
101
|
+
|
|
102
|
+
try {
|
|
103
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
104
|
+
var option = _step2.value;
|
|
105
|
+
|
|
106
|
+
if (vid == option[fieldNames.value]) {
|
|
107
|
+
var _key = getUniqueKey();
|
|
108
|
+
|
|
109
|
+
groups.push(_objectSpread({
|
|
110
|
+
key: _key
|
|
111
|
+
}, option));
|
|
112
|
+
break;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
} catch (err) {
|
|
116
|
+
_iterator2.e(err);
|
|
117
|
+
} finally {
|
|
118
|
+
_iterator2.f();
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
} catch (err) {
|
|
122
|
+
_iterator.e(err);
|
|
123
|
+
} finally {
|
|
124
|
+
_iterator.f();
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
if (!defaultValue.length && !value.length) {
|
|
128
|
+
var key = getUniqueKey();
|
|
129
|
+
groups = [{
|
|
130
|
+
key: key
|
|
131
|
+
}];
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
setSelectIds(ids);
|
|
135
|
+
setUserGroups(groups);
|
|
136
|
+
}, []); // 数据响应
|
|
137
|
+
|
|
138
|
+
useEffect(function () {
|
|
139
|
+
if (!isChange) {
|
|
140
|
+
return;
|
|
141
|
+
} // 去掉bizGroupsKey
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
var actualGroups = []; // 已选择的id数组
|
|
145
|
+
|
|
146
|
+
var selectedGroups = [];
|
|
147
|
+
|
|
148
|
+
var _iterator3 = _createForOfIteratorHelper(userGroups),
|
|
149
|
+
_step3;
|
|
150
|
+
|
|
151
|
+
try {
|
|
152
|
+
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
|
|
153
|
+
var group = _step3.value;
|
|
154
|
+
|
|
155
|
+
var key = group.key,
|
|
156
|
+
disabled = group.disabled,
|
|
157
|
+
res = _objectWithoutProperties(group, _excluded);
|
|
158
|
+
|
|
159
|
+
var keys = Object.keys(res);
|
|
160
|
+
|
|
161
|
+
if (keys.length > 0) {
|
|
162
|
+
actualGroups.push(res);
|
|
163
|
+
selectedGroups.push(group[fieldNames.value]);
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
} catch (err) {
|
|
167
|
+
_iterator3.e(err);
|
|
168
|
+
} finally {
|
|
169
|
+
_iterator3.f();
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
setSelectIds(function () {
|
|
173
|
+
return [].concat(selectedGroups);
|
|
174
|
+
});
|
|
175
|
+
|
|
176
|
+
if (responseType === 'id') {
|
|
177
|
+
handleChange(selectedGroups, actualGroups);
|
|
178
|
+
} else {
|
|
179
|
+
handleChange(actualGroups, selectedGroups);
|
|
180
|
+
}
|
|
181
|
+
}, [userGroups]); // 用户群更改操作
|
|
182
|
+
|
|
183
|
+
var _onChange = function _onChange(option, value, index) {
|
|
184
|
+
var changeGroups = _toConsumableArray(userGroups);
|
|
185
|
+
|
|
186
|
+
var data = {};
|
|
187
|
+
|
|
188
|
+
if (_typeof(option) === 'object') {
|
|
189
|
+
data = _objectSpread({}, option);
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
if (_typeof(value) === 'object') {
|
|
193
|
+
data = _objectSpread({}, value);
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
changeGroups[index] = _objectSpread(_objectSpread({}, changeGroups[index]), data);
|
|
197
|
+
setUserGroups(function () {
|
|
198
|
+
return _toConsumableArray(changeGroups);
|
|
199
|
+
});
|
|
200
|
+
setIsChange(true);
|
|
201
|
+
}; // 添加用户群
|
|
202
|
+
|
|
203
|
+
|
|
204
|
+
var addUserGroup = function addUserGroup() {
|
|
205
|
+
var key = getUniqueKey();
|
|
206
|
+
setUserGroups(function (groups) {
|
|
207
|
+
return [].concat(_toConsumableArray(groups), [{
|
|
208
|
+
key: key
|
|
209
|
+
}]);
|
|
210
|
+
});
|
|
211
|
+
setIsChange(false);
|
|
212
|
+
}; // 删除用户群
|
|
213
|
+
|
|
214
|
+
|
|
215
|
+
var _onDelete = function _onDelete(index) {
|
|
216
|
+
setUserGroups(function (groups) {
|
|
217
|
+
groups.splice(index, 1);
|
|
218
|
+
return _toConsumableArray(groups);
|
|
219
|
+
});
|
|
220
|
+
setIsChange(true);
|
|
221
|
+
};
|
|
222
|
+
|
|
223
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
224
|
+
className: "biz-user-cluster-container"
|
|
225
|
+
}, userGroups.map(function (item, index) {
|
|
226
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
227
|
+
className: "biz-user-cluster-item",
|
|
228
|
+
key: item.key
|
|
229
|
+
}, /*#__PURE__*/React.createElement(BizUserGroup, {
|
|
230
|
+
defaultValue: item ? item[fieldNames.value] : null,
|
|
231
|
+
options: options,
|
|
232
|
+
fieldNames: fieldNames,
|
|
233
|
+
onDelete: function onDelete() {
|
|
234
|
+
return _onDelete(index);
|
|
235
|
+
},
|
|
236
|
+
onChange: _onChange,
|
|
237
|
+
showDeleteIcon: userGroups.length > 1,
|
|
238
|
+
placeholder: placeholder,
|
|
239
|
+
disabled: selectIds,
|
|
240
|
+
index: index,
|
|
241
|
+
responseType: 'object'
|
|
242
|
+
}));
|
|
243
|
+
}), userGroups.length < maxUserGroup && /*#__PURE__*/React.createElement("div", {
|
|
244
|
+
className: "biz-icon-add",
|
|
245
|
+
onClick: addUserGroup
|
|
246
|
+
}, /*#__PURE__*/React.createElement(IconFont, {
|
|
247
|
+
className: "biz-icon",
|
|
248
|
+
type: 'icon-tianjia1'
|
|
249
|
+
}), /*#__PURE__*/React.createElement("span", {
|
|
250
|
+
className: "biz-icon-text"
|
|
251
|
+
}, "\u6DFB\u52A0\u7528\u6237\u7FA4")));
|
|
252
|
+
};
|
|
253
|
+
|
|
254
|
+
export default BizUserCluster;
|
package/es/utils/ajax.js
ADDED
|
@@ -0,0 +1,139 @@
|
|
|
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 axios from 'axios';
|
|
8
|
+
var history = {
|
|
9
|
+
// ajax历史记录
|
|
10
|
+
option: [// 等待队列
|
|
11
|
+
{
|
|
12
|
+
resolve: null,
|
|
13
|
+
reject: null
|
|
14
|
+
}]
|
|
15
|
+
};
|
|
16
|
+
var timer = {
|
|
17
|
+
url: {
|
|
18
|
+
id: 0,
|
|
19
|
+
cancel: null,
|
|
20
|
+
reject: function reject() {}
|
|
21
|
+
}
|
|
22
|
+
}; // 计时器管理
|
|
23
|
+
|
|
24
|
+
var CancelToken = axios.CancelToken;
|
|
25
|
+
|
|
26
|
+
var _request = function _request(ajax) {
|
|
27
|
+
return function () {
|
|
28
|
+
var option = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {
|
|
29
|
+
url: '',
|
|
30
|
+
responseOnce: false,
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* 指定unique后,代表同一时间内,该url的请求只能存在一个(取消前置请求)
|
|
34
|
+
* 当值为字符串时,url+unique值共同组成timer的key,以此来作为相同请求的判定
|
|
35
|
+
*/
|
|
36
|
+
unique: false,
|
|
37
|
+
delay: 0 // 延时请求(unique的配合参数)
|
|
38
|
+
|
|
39
|
+
};
|
|
40
|
+
return new Promise(function (resolve, reject) {
|
|
41
|
+
// 如果请求返回之前,同样的请求传递过来,则在返回中将后续请求一并resolve,而不再重复发送请求到服务器
|
|
42
|
+
var key = JSON.stringify(option);
|
|
43
|
+
var timerKey = option.url + '_' + (Object.prototype.toString.call(option.unique) === '[object String]' ? option.unique : '');
|
|
44
|
+
|
|
45
|
+
if (option.unique && timer[timerKey]) {
|
|
46
|
+
// 如果查询已存在,则取消前一个请求
|
|
47
|
+
clearTimeout(timer[timerKey].id);
|
|
48
|
+
|
|
49
|
+
if (timer[timerKey].cancel) {
|
|
50
|
+
timer[timerKey].cancel();
|
|
51
|
+
} else {
|
|
52
|
+
var cancel = new Error('cancel: before request');
|
|
53
|
+
cancel.__CANCEL__ = true; // 兼容axios的判断
|
|
54
|
+
|
|
55
|
+
timer[timerKey].reject(cancel);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
delete timer[timerKey];
|
|
59
|
+
if (history[key]) delete history[key];
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
if (!history[key]) {
|
|
63
|
+
history[key] = [{
|
|
64
|
+
resolve: resolve,
|
|
65
|
+
reject: reject
|
|
66
|
+
}];
|
|
67
|
+
|
|
68
|
+
var request = function request() {
|
|
69
|
+
ajax(option).then(function (res) {
|
|
70
|
+
history[key].forEach(function (item) {
|
|
71
|
+
item.resolve(res);
|
|
72
|
+
});
|
|
73
|
+
}).catch(function (err) {
|
|
74
|
+
history[key].forEach(function (item) {
|
|
75
|
+
item.reject(err);
|
|
76
|
+
});
|
|
77
|
+
}).finally(function () {
|
|
78
|
+
delete timer[timerKey];
|
|
79
|
+
delete history[key];
|
|
80
|
+
});
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
if (option.unique) {
|
|
84
|
+
timer[timerKey] = {
|
|
85
|
+
id: 0,
|
|
86
|
+
option: option,
|
|
87
|
+
cancel: null,
|
|
88
|
+
reject: reject
|
|
89
|
+
};
|
|
90
|
+
timer[timerKey].id = setTimeout(function () {
|
|
91
|
+
option.cancelToken = new CancelToken(function (c) {
|
|
92
|
+
if (timer[timerKey]) {
|
|
93
|
+
timer[timerKey].cancel = c;
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
request();
|
|
97
|
+
}, option.delay || 0);
|
|
98
|
+
} else {
|
|
99
|
+
request();
|
|
100
|
+
}
|
|
101
|
+
} else if (option.responseOnce) {
|
|
102
|
+
// 如果已经有相同请求在进行,且responseOnce,则以cancel形式取消该请求
|
|
103
|
+
var _cancel = new Error('cancel: before request');
|
|
104
|
+
|
|
105
|
+
_cancel.__CANCEL__ = true; // 兼容axios的判断
|
|
106
|
+
|
|
107
|
+
reject(_cancel);
|
|
108
|
+
} else {
|
|
109
|
+
// 有相同请求,但是请求需要以正常结果返回,则加入请求队列,第一个请求响应后一并响应
|
|
110
|
+
history[key].push({
|
|
111
|
+
resolve: resolve,
|
|
112
|
+
reject: reject
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
});
|
|
116
|
+
};
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
var _ajax = function _ajax(option) {
|
|
120
|
+
var optionData = _objectSpread({
|
|
121
|
+
method: 'post',
|
|
122
|
+
url: '',
|
|
123
|
+
data: null,
|
|
124
|
+
withCredentials: true
|
|
125
|
+
}, option);
|
|
126
|
+
|
|
127
|
+
return new Promise(function (resolve, reject) {
|
|
128
|
+
axios(optionData).then(function (res) {
|
|
129
|
+
resolve(res.data);
|
|
130
|
+
}).catch(function (error) {
|
|
131
|
+
if (axios.isCancel(error)) return;
|
|
132
|
+
reject(error);
|
|
133
|
+
});
|
|
134
|
+
});
|
|
135
|
+
};
|
|
136
|
+
|
|
137
|
+
var ajax = _request(_ajax);
|
|
138
|
+
|
|
139
|
+
export default ajax;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
export interface Event {
|
|
2
|
+
value?: string | number;
|
|
3
|
+
label?: string | number;
|
|
4
|
+
[prop: string]: any;
|
|
5
|
+
}
|
|
6
|
+
export interface EventType {
|
|
7
|
+
aliasName?: string;
|
|
8
|
+
option?: string | number | Event;
|
|
9
|
+
}
|
|
10
|
+
interface EventProps {
|
|
11
|
+
attrId?: string;
|
|
12
|
+
event_id: string | number;
|
|
13
|
+
event_name: string;
|
|
14
|
+
event_attrs: Array<AttrsListProps>;
|
|
15
|
+
dimensionId?: string;
|
|
16
|
+
[prop: string]: any;
|
|
17
|
+
}
|
|
18
|
+
interface AttrsListProps {
|
|
19
|
+
value?: string | number;
|
|
20
|
+
text?: string;
|
|
21
|
+
attr_id?: string | number;
|
|
22
|
+
attr_name?: string;
|
|
23
|
+
alias_name?: string | null;
|
|
24
|
+
prop_type?: string | number;
|
|
25
|
+
icon?: string;
|
|
26
|
+
value_dict?: boolean;
|
|
27
|
+
hidden?: boolean | number;
|
|
28
|
+
dimension_sub?: string | number;
|
|
29
|
+
[prop: string]: any;
|
|
30
|
+
}
|
|
31
|
+
export interface EventGroupProps {
|
|
32
|
+
groupName: string | null;
|
|
33
|
+
groupId: string | number;
|
|
34
|
+
eventList?: Array<EventProps>;
|
|
35
|
+
[prop: string]: any;
|
|
36
|
+
}
|
|
37
|
+
interface AppInfoProps {
|
|
38
|
+
appId?: string | number;
|
|
39
|
+
platform?: string;
|
|
40
|
+
[prop: string]: any;
|
|
41
|
+
}
|
|
42
|
+
export interface EventMetaProps {
|
|
43
|
+
event?: Array<EventGroupProps>;
|
|
44
|
+
user?: Array<object>;
|
|
45
|
+
env?: Array<object>;
|
|
46
|
+
}
|
|
47
|
+
export interface GlobalContextProps {
|
|
48
|
+
userGroups?: Array<any>;
|
|
49
|
+
eventMeta?: Array<EventGroupProps>;
|
|
50
|
+
userProps?: Array<any>;
|
|
51
|
+
eventEnv?: Array<any>;
|
|
52
|
+
appInfo?: AppInfoProps;
|
|
53
|
+
}
|
|
54
|
+
export {};
|
package/es/utils/type.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
declare let util: {
|
|
2
|
+
dayTime: number;
|
|
3
|
+
type(obj: any): string;
|
|
4
|
+
isObject(obj: any): boolean;
|
|
5
|
+
isArray(obj: any): boolean;
|
|
6
|
+
isString(obj: any): boolean;
|
|
7
|
+
isNumber(obj: any): boolean;
|
|
8
|
+
isDate(obj: any): boolean;
|
|
9
|
+
isFunction(obj: any): boolean;
|
|
10
|
+
isEqual(a?: {}, b?: {}): boolean;
|
|
11
|
+
equal(a: any, b: any): boolean;
|
|
12
|
+
/**
|
|
13
|
+
* 获取指定范围的随机数
|
|
14
|
+
* @param min
|
|
15
|
+
* @param max
|
|
16
|
+
* @returns {*}
|
|
17
|
+
*/
|
|
18
|
+
random(min: number, max: number): number;
|
|
19
|
+
guid(): string;
|
|
20
|
+
mergeObject(defaults: {
|
|
21
|
+
[x: string]: any;
|
|
22
|
+
}, option: {
|
|
23
|
+
[x: string]: any;
|
|
24
|
+
}): {
|
|
25
|
+
[x: string]: any;
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* 将数字转为千分位分割格式
|
|
29
|
+
* @param num
|
|
30
|
+
* @returns {string}
|
|
31
|
+
*/
|
|
32
|
+
toThousands(num: number): string;
|
|
33
|
+
/**
|
|
34
|
+
* 为单数前补0
|
|
35
|
+
* @param num
|
|
36
|
+
* @returns {string}
|
|
37
|
+
*/
|
|
38
|
+
toDoubleNumber(num: number): string;
|
|
39
|
+
/**
|
|
40
|
+
* 日期格式化
|
|
41
|
+
* @param date
|
|
42
|
+
* @param formatter
|
|
43
|
+
* @returns {string}
|
|
44
|
+
*/
|
|
45
|
+
dateFormat(date?: any, formatter?: string): string;
|
|
46
|
+
/**
|
|
47
|
+
* 日期格式化
|
|
48
|
+
* @param date
|
|
49
|
+
* @param formatter
|
|
50
|
+
* @returns {string}
|
|
51
|
+
*/
|
|
52
|
+
timeFormat(date: any, formatter: string | undefined, autoShort: any): string | undefined;
|
|
53
|
+
/**
|
|
54
|
+
* 从中间拆分字符串,长度超出的话,解析为xxx...xxx
|
|
55
|
+
* @param str
|
|
56
|
+
* @param config
|
|
57
|
+
* @returns {string}
|
|
58
|
+
*/
|
|
59
|
+
strMiddleSplit(str: string, config?: {
|
|
60
|
+
maxLength: number;
|
|
61
|
+
beginLength: number;
|
|
62
|
+
endLength: number;
|
|
63
|
+
replaceStr: string;
|
|
64
|
+
}): string;
|
|
65
|
+
setHighLight(content: string, search: string): string;
|
|
66
|
+
};
|
|
67
|
+
export default util;
|