@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,102 @@
|
|
|
1
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
2
|
+
|
|
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."); }
|
|
4
|
+
|
|
5
|
+
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); }
|
|
6
|
+
|
|
7
|
+
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; }
|
|
8
|
+
|
|
9
|
+
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; }
|
|
10
|
+
|
|
11
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
12
|
+
|
|
13
|
+
import React, { useState } from 'react';
|
|
14
|
+
import { BizUserCluster } from 'business-lib';
|
|
15
|
+
import './index.less';
|
|
16
|
+
import { Button, Form } from 'antd';
|
|
17
|
+
var groupOptions = [{
|
|
18
|
+
id: 1,
|
|
19
|
+
name: '用户群1'
|
|
20
|
+
}, {
|
|
21
|
+
id: 2,
|
|
22
|
+
name: '用户群2'
|
|
23
|
+
}, {
|
|
24
|
+
id: 3,
|
|
25
|
+
name: '用户群3'
|
|
26
|
+
}];
|
|
27
|
+
var groupOptions2 = [{
|
|
28
|
+
id: 1,
|
|
29
|
+
name: '用户群1'
|
|
30
|
+
}, {
|
|
31
|
+
id: 2,
|
|
32
|
+
name: '用户群2'
|
|
33
|
+
}, {
|
|
34
|
+
id: 3,
|
|
35
|
+
name: '用户群3'
|
|
36
|
+
}];
|
|
37
|
+
|
|
38
|
+
var UserClusterDemo = function UserClusterDemo() {
|
|
39
|
+
var _Form$useForm = Form.useForm(),
|
|
40
|
+
_Form$useForm2 = _slicedToArray(_Form$useForm, 1),
|
|
41
|
+
form = _Form$useForm2[0];
|
|
42
|
+
|
|
43
|
+
var _useState = useState(),
|
|
44
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
45
|
+
userCluster = _useState2[0],
|
|
46
|
+
setUserCluster = _useState2[1];
|
|
47
|
+
|
|
48
|
+
var onFinish = function onFinish(values) {
|
|
49
|
+
setUserCluster(JSON.stringify(values));
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
var onFinishFailed = function onFinishFailed(errorInfo) {
|
|
53
|
+
console.log('Failed:', errorInfo);
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
var handleChange = function handleChange(selectedGroups, actualGroups) {
|
|
57
|
+
console.log(selectedGroups, actualGroups);
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
61
|
+
className: "biz-user-group-demo"
|
|
62
|
+
}, /*#__PURE__*/React.createElement(Form, {
|
|
63
|
+
form: form,
|
|
64
|
+
onFinish: onFinish,
|
|
65
|
+
onFinishFailed: onFinishFailed,
|
|
66
|
+
initialValues: {
|
|
67
|
+
cluster: [1, 2],
|
|
68
|
+
cluster2: [{
|
|
69
|
+
id: 3
|
|
70
|
+
}, {
|
|
71
|
+
id: 4
|
|
72
|
+
}]
|
|
73
|
+
}
|
|
74
|
+
}, /*#__PURE__*/React.createElement(Form.Item, {
|
|
75
|
+
label: "\u7528\u6237\u7FA4",
|
|
76
|
+
name: "cluster"
|
|
77
|
+
}, /*#__PURE__*/React.createElement(BizUserCluster, {
|
|
78
|
+
options: groupOptions,
|
|
79
|
+
maxUserGroup: 6,
|
|
80
|
+
onChange: handleChange
|
|
81
|
+
})), /*#__PURE__*/React.createElement(Form.Item, {
|
|
82
|
+
label: "\u7528\u6237\u7FA42",
|
|
83
|
+
name: "cluster2"
|
|
84
|
+
}, /*#__PURE__*/React.createElement(BizUserCluster, {
|
|
85
|
+
options: groupOptions2,
|
|
86
|
+
responseType: 'object',
|
|
87
|
+
maxUserGroup: 2,
|
|
88
|
+
onChange: handleChange
|
|
89
|
+
})), /*#__PURE__*/React.createElement(Form.Item, {
|
|
90
|
+
wrapperCol: {
|
|
91
|
+
offset: 8,
|
|
92
|
+
span: 16
|
|
93
|
+
}
|
|
94
|
+
}, /*#__PURE__*/React.createElement(Button, {
|
|
95
|
+
type: "primary",
|
|
96
|
+
htmlType: "submit"
|
|
97
|
+
}, "Submit"))), /*#__PURE__*/React.createElement("p", null, "\u5DF2\u9009\u7528\u6237\u7FA4\u4FE1\u606F\uFF1A", userCluster));
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
export default (function () {
|
|
101
|
+
return /*#__PURE__*/React.createElement(UserClusterDemo, null);
|
|
102
|
+
});
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
2
|
+
|
|
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."); }
|
|
4
|
+
|
|
5
|
+
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); }
|
|
6
|
+
|
|
7
|
+
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; }
|
|
8
|
+
|
|
9
|
+
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; }
|
|
10
|
+
|
|
11
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
12
|
+
|
|
13
|
+
import React, { useState } from 'react';
|
|
14
|
+
import { BizUserGroup } from 'business-lib';
|
|
15
|
+
import './index.less';
|
|
16
|
+
import { Button, Form } from 'antd';
|
|
17
|
+
var groupOptions = [{
|
|
18
|
+
id: 1,
|
|
19
|
+
name: '用户群1'
|
|
20
|
+
}, {
|
|
21
|
+
id: 2,
|
|
22
|
+
name: '用户群2'
|
|
23
|
+
}, {
|
|
24
|
+
id: 3,
|
|
25
|
+
name: '用户群3'
|
|
26
|
+
}, {
|
|
27
|
+
id: 4,
|
|
28
|
+
name: '用户群4'
|
|
29
|
+
}, {
|
|
30
|
+
id: 5,
|
|
31
|
+
name: '用户群5'
|
|
32
|
+
}, {
|
|
33
|
+
id: 6,
|
|
34
|
+
name: '用户群6'
|
|
35
|
+
}];
|
|
36
|
+
|
|
37
|
+
var UserGroupDemo = function UserGroupDemo() {
|
|
38
|
+
var _Form$useForm = Form.useForm(),
|
|
39
|
+
_Form$useForm2 = _slicedToArray(_Form$useForm, 1),
|
|
40
|
+
form = _Form$useForm2[0];
|
|
41
|
+
|
|
42
|
+
var _useState = useState(),
|
|
43
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
44
|
+
group = _useState2[0],
|
|
45
|
+
setGroup = _useState2[1];
|
|
46
|
+
|
|
47
|
+
var _useState3 = useState(null),
|
|
48
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
49
|
+
group2 = _useState4[0],
|
|
50
|
+
setGroup2 = _useState4[1];
|
|
51
|
+
|
|
52
|
+
var onFinish = function onFinish(values) {
|
|
53
|
+
setGroup(JSON.stringify(values));
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
var onFinishFailed = function onFinishFailed(errorInfo) {
|
|
57
|
+
console.log('Failed:', errorInfo);
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
var handleChange = function handleChange(value) {
|
|
61
|
+
console.log('change', value);
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
var handleChange2 = function handleChange2(value) {
|
|
65
|
+
setGroup2(value.name);
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
69
|
+
className: "biz-user-group-demo"
|
|
70
|
+
}, /*#__PURE__*/React.createElement(Form, {
|
|
71
|
+
form: form,
|
|
72
|
+
onFinish: onFinish,
|
|
73
|
+
onFinishFailed: onFinishFailed,
|
|
74
|
+
initialValues: {
|
|
75
|
+
group: 1,
|
|
76
|
+
group2: {
|
|
77
|
+
id: 2,
|
|
78
|
+
name: '用户群2'
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}, /*#__PURE__*/React.createElement(Form.Item, {
|
|
82
|
+
label: "\u7528\u6237\u7FA4",
|
|
83
|
+
name: "group"
|
|
84
|
+
}, /*#__PURE__*/React.createElement(BizUserGroup, {
|
|
85
|
+
options: groupOptions,
|
|
86
|
+
onChange: handleChange
|
|
87
|
+
})), /*#__PURE__*/React.createElement(Form.Item, {
|
|
88
|
+
label: "\u7528\u6237\u7FA42",
|
|
89
|
+
name: "group2"
|
|
90
|
+
}, /*#__PURE__*/React.createElement(BizUserGroup, {
|
|
91
|
+
options: groupOptions,
|
|
92
|
+
responseType: 'object',
|
|
93
|
+
onChange: handleChange
|
|
94
|
+
})), /*#__PURE__*/React.createElement(Form.Item, {
|
|
95
|
+
wrapperCol: {
|
|
96
|
+
offset: 8,
|
|
97
|
+
span: 16
|
|
98
|
+
}
|
|
99
|
+
}, /*#__PURE__*/React.createElement(Button, {
|
|
100
|
+
type: "primary",
|
|
101
|
+
htmlType: "submit"
|
|
102
|
+
}, "Submit"))), /*#__PURE__*/React.createElement("p", null, "\u5DF2\u9009\u7528\u6237\u7FA4\uFF1A", group), /*#__PURE__*/React.createElement("br", null), /*#__PURE__*/React.createElement(BizUserGroup, {
|
|
103
|
+
options: groupOptions,
|
|
104
|
+
responseType: 'object',
|
|
105
|
+
defaultValue: {
|
|
106
|
+
id: 2,
|
|
107
|
+
name: '用户群2'
|
|
108
|
+
},
|
|
109
|
+
onChange: handleChange2
|
|
110
|
+
}), /*#__PURE__*/React.createElement("p", null, "\u5DF2\u9009\u7528\u6237\u7FA4\uFF1A", group2));
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
export default (function () {
|
|
114
|
+
return /*#__PURE__*/React.createElement(UserGroupDemo, null);
|
|
115
|
+
});
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import './index.less';
|
|
3
|
+
import { Option } from 'antd/lib/mentions';
|
|
4
|
+
interface Option {
|
|
5
|
+
[prop: string]: any;
|
|
6
|
+
}
|
|
7
|
+
interface UserGroupProps {
|
|
8
|
+
/**
|
|
9
|
+
* @description 若组件是表单选项,value就是form的initialValues,也是组件的默认选项
|
|
10
|
+
* @description.zh-CN
|
|
11
|
+
* @default -
|
|
12
|
+
*/
|
|
13
|
+
value?: string | number | Option | null;
|
|
14
|
+
/**
|
|
15
|
+
* @description 默认选项
|
|
16
|
+
* @description.zh-CN
|
|
17
|
+
* @default -
|
|
18
|
+
*/
|
|
19
|
+
defaultValue?: string | number | Option | null;
|
|
20
|
+
/**
|
|
21
|
+
* @description 返回数据类型
|
|
22
|
+
* @description.zh-CN id | object
|
|
23
|
+
* @default id
|
|
24
|
+
*/
|
|
25
|
+
responseType?: string;
|
|
26
|
+
/**
|
|
27
|
+
* @description 禁选数组
|
|
28
|
+
* @description.zh-CN id | object []
|
|
29
|
+
* @default -
|
|
30
|
+
*/
|
|
31
|
+
disabled?: Array<string | number>;
|
|
32
|
+
/**
|
|
33
|
+
* @description 自定义节点 label、value 的字段
|
|
34
|
+
* @description.zh-CN
|
|
35
|
+
* @default -
|
|
36
|
+
*/
|
|
37
|
+
fieldNames?: {
|
|
38
|
+
label: string;
|
|
39
|
+
value: string;
|
|
40
|
+
};
|
|
41
|
+
/**
|
|
42
|
+
* @description 数据化配置选项内容
|
|
43
|
+
* @description.zh-CN
|
|
44
|
+
* @default { label: 'name', value: 'id' }
|
|
45
|
+
*/
|
|
46
|
+
options: Option[];
|
|
47
|
+
/**
|
|
48
|
+
* @description 选中 option 时,调用此函数
|
|
49
|
+
* @description.zh-CN
|
|
50
|
+
* @default
|
|
51
|
+
*/
|
|
52
|
+
onChange?: (option: string | number | object, value: string | number | object, index: number) => void;
|
|
53
|
+
/**
|
|
54
|
+
* @description 删除选择框
|
|
55
|
+
* @description.zh-CN
|
|
56
|
+
* @default -
|
|
57
|
+
*/
|
|
58
|
+
onDelete?: () => void;
|
|
59
|
+
/**
|
|
60
|
+
* @description 是否展示删除按钮
|
|
61
|
+
* @description.zh-CN
|
|
62
|
+
* @default false
|
|
63
|
+
*/
|
|
64
|
+
showDeleteIcon?: boolean;
|
|
65
|
+
/**
|
|
66
|
+
* @description 选择框是第几个
|
|
67
|
+
* @description.zh-CN
|
|
68
|
+
* @default 0
|
|
69
|
+
*/
|
|
70
|
+
index?: number;
|
|
71
|
+
/**
|
|
72
|
+
* @description 选择框默认文本
|
|
73
|
+
* @description.zh-CN
|
|
74
|
+
* @default 请选择
|
|
75
|
+
*/
|
|
76
|
+
placeholder?: string;
|
|
77
|
+
}
|
|
78
|
+
declare const BizUserGroup: React.FC<UserGroupProps>;
|
|
79
|
+
export default BizUserGroup;
|
|
@@ -0,0 +1,134 @@
|
|
|
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 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; }
|
|
10
|
+
|
|
11
|
+
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; }
|
|
12
|
+
|
|
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
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
16
|
+
|
|
17
|
+
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."); }
|
|
18
|
+
|
|
19
|
+
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); }
|
|
20
|
+
|
|
21
|
+
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; }
|
|
22
|
+
|
|
23
|
+
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; }
|
|
24
|
+
|
|
25
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
26
|
+
|
|
27
|
+
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); }
|
|
28
|
+
|
|
29
|
+
import { Select, Tooltip } from 'antd';
|
|
30
|
+
import React, { useEffect, useState } from 'react';
|
|
31
|
+
import { IconFont } from '..';
|
|
32
|
+
import './index.less'; // 单个用户群
|
|
33
|
+
|
|
34
|
+
var BizUserGroup = function BizUserGroup(props) {
|
|
35
|
+
var defaultValue = props.defaultValue,
|
|
36
|
+
value = props.value,
|
|
37
|
+
disabled = props.disabled,
|
|
38
|
+
_props$responseType = props.responseType,
|
|
39
|
+
responseType = _props$responseType === void 0 ? 'id' : _props$responseType,
|
|
40
|
+
_props$showDeleteIcon = props.showDeleteIcon,
|
|
41
|
+
showDeleteIcon = _props$showDeleteIcon === void 0 ? false : _props$showDeleteIcon,
|
|
42
|
+
_props$fieldNames = props.fieldNames,
|
|
43
|
+
fieldNames = _props$fieldNames === void 0 ? {
|
|
44
|
+
label: 'name',
|
|
45
|
+
value: 'id'
|
|
46
|
+
} : _props$fieldNames,
|
|
47
|
+
options = props.options,
|
|
48
|
+
onDelete = props.onDelete,
|
|
49
|
+
onChange = props.onChange,
|
|
50
|
+
_props$index = props.index,
|
|
51
|
+
index = _props$index === void 0 ? 0 : _props$index,
|
|
52
|
+
_props$placeholder = props.placeholder,
|
|
53
|
+
placeholder = _props$placeholder === void 0 ? '请选择' : _props$placeholder;
|
|
54
|
+
var intoValue = defaultValue || value;
|
|
55
|
+
var selectValue = intoValue && _typeof(intoValue) === 'object' ? intoValue[fieldNames.value] : intoValue;
|
|
56
|
+
|
|
57
|
+
var _useState = useState(selectValue),
|
|
58
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
59
|
+
userId = _useState2[0],
|
|
60
|
+
setUserId = _useState2[1];
|
|
61
|
+
|
|
62
|
+
var _useState3 = useState(options),
|
|
63
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
64
|
+
userOptions = _useState4[0],
|
|
65
|
+
setUserOptions = _useState4[1];
|
|
66
|
+
|
|
67
|
+
var _onChange = function _onChange(value, option) {
|
|
68
|
+
setUserId(function () {
|
|
69
|
+
return value;
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
if (onChange) {
|
|
73
|
+
if (responseType == 'id') {
|
|
74
|
+
onChange(value, option, index);
|
|
75
|
+
} else {
|
|
76
|
+
onChange(option, value, index);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
useEffect(function () {
|
|
82
|
+
if (!disabled || !disabled.length) return;
|
|
83
|
+
var selectOptions = options.map(function (item) {
|
|
84
|
+
// debugger
|
|
85
|
+
if (disabled.indexOf(item[fieldNames.value]) > -1) {
|
|
86
|
+
if (userId && item[fieldNames.value] == userId) {
|
|
87
|
+
delete item.disabled;
|
|
88
|
+
} else {
|
|
89
|
+
item.disabled = true;
|
|
90
|
+
}
|
|
91
|
+
} else {
|
|
92
|
+
delete item.disabled;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
return _objectSpread({}, item);
|
|
96
|
+
});
|
|
97
|
+
setUserOptions(function () {
|
|
98
|
+
return _toConsumableArray(selectOptions);
|
|
99
|
+
});
|
|
100
|
+
}, [disabled]);
|
|
101
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
102
|
+
className: "biz-select-cotainer"
|
|
103
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
104
|
+
className: "biz-select-content"
|
|
105
|
+
}, /*#__PURE__*/React.createElement(Select, {
|
|
106
|
+
className: "biz-select",
|
|
107
|
+
bordered: false,
|
|
108
|
+
showArrow: false,
|
|
109
|
+
defaultValue: userId,
|
|
110
|
+
listHeight: 500,
|
|
111
|
+
listItemHeight: 48,
|
|
112
|
+
fieldNames: fieldNames,
|
|
113
|
+
options: userOptions,
|
|
114
|
+
onChange: _onChange,
|
|
115
|
+
placeholder: placeholder
|
|
116
|
+
}), /*#__PURE__*/React.createElement(IconFont, {
|
|
117
|
+
className: "biz-select-zhankai",
|
|
118
|
+
type: 'icon-xiangxia'
|
|
119
|
+
})), showDeleteIcon && /*#__PURE__*/React.createElement("div", {
|
|
120
|
+
className: "biz-option-icon biz-option-icon-delete",
|
|
121
|
+
onClick: onDelete
|
|
122
|
+
}, /*#__PURE__*/React.createElement(Tooltip, {
|
|
123
|
+
title: function title() {
|
|
124
|
+
return '删除';
|
|
125
|
+
},
|
|
126
|
+
color: "#242541",
|
|
127
|
+
key: 'delete'
|
|
128
|
+
}, /*#__PURE__*/React.createElement(IconFont, {
|
|
129
|
+
className: "biz-icon-delete",
|
|
130
|
+
type: 'icon-qingchu'
|
|
131
|
+
}))));
|
|
132
|
+
};
|
|
133
|
+
|
|
134
|
+
export default BizUserGroup;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface UserClusterProps {
|
|
3
|
+
/**
|
|
4
|
+
* @description 若组件是表单选项,value就是form的initialValues,也是组件的默认选项
|
|
5
|
+
* @description.zh-CN
|
|
6
|
+
* @default []
|
|
7
|
+
*/
|
|
8
|
+
value?: Array<ValueType>;
|
|
9
|
+
/**
|
|
10
|
+
* @description 默认值
|
|
11
|
+
* @default []
|
|
12
|
+
*/
|
|
13
|
+
defaultValue?: Array<ValueType>;
|
|
14
|
+
/**
|
|
15
|
+
* @description 返回数据类型
|
|
16
|
+
* @description.zh-CN id | object
|
|
17
|
+
* @default id
|
|
18
|
+
*/
|
|
19
|
+
responseType?: string;
|
|
20
|
+
/**
|
|
21
|
+
* @description 自定义节点 label、value 的字段
|
|
22
|
+
* @description.zh-CN
|
|
23
|
+
* @default -
|
|
24
|
+
*/
|
|
25
|
+
fieldNames?: {
|
|
26
|
+
label: string;
|
|
27
|
+
value: string;
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* @description 数据化配置选项内容
|
|
31
|
+
* @description.zh-CN
|
|
32
|
+
* @default { label: 'name', value: 'id' }
|
|
33
|
+
*/
|
|
34
|
+
options: Option[];
|
|
35
|
+
/**
|
|
36
|
+
* @description 选中 option 时,调用此函数
|
|
37
|
+
* @description.zh-CN
|
|
38
|
+
* @default -
|
|
39
|
+
*/
|
|
40
|
+
onChange: (valueObject: Option[] | (string | number)[], value: Option[] | (string | number)[]) => void;
|
|
41
|
+
/**
|
|
42
|
+
* @description 最多个数
|
|
43
|
+
* @description.zh-CN
|
|
44
|
+
* @default 3
|
|
45
|
+
*/
|
|
46
|
+
maxUserGroup?: number;
|
|
47
|
+
/**
|
|
48
|
+
* @description 选择框默认文本
|
|
49
|
+
* @description.zh-CN
|
|
50
|
+
* @default 请选择
|
|
51
|
+
*/
|
|
52
|
+
placeholder?: string;
|
|
53
|
+
}
|
|
54
|
+
interface Option {
|
|
55
|
+
key?: string | number;
|
|
56
|
+
disabled?: boolean | null;
|
|
57
|
+
[prop: string]: any;
|
|
58
|
+
}
|
|
59
|
+
interface ValueType {
|
|
60
|
+
[prop: string]: any;
|
|
61
|
+
}
|
|
62
|
+
declare const BizUserCluster: React.FC<UserClusterProps>;
|
|
63
|
+
export default BizUserCluster;
|