@zgfe/business-lib 1.0.0-beta.6 → 1.0.3
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/analysisLayout/demo/index.js +4 -1
- package/es/analysisLayout/index.d.ts +1 -28
- package/es/analysisLayout/index.js +38 -48
- package/es/analysisLayout/index.less +1 -1
- package/es/assets/styles/chunks.less +143 -0
- package/es/assets/styles/inner.less +3 -0
- package/es/assets/styles/resetAntd.less +398 -0
- package/es/assets/styles/variable.less +21 -0
- package/es/assets/theme.d.ts +5 -0
- package/es/assets/theme.js +4 -0
- package/es/attrConditions/components/operateList.d.ts +8 -0
- package/es/attrConditions/components/operateList.js +83 -0
- package/es/attrConditions/components/stringList.d.ts +9 -0
- package/es/attrConditions/components/stringList.js +168 -0
- package/es/attrConditions/components/valuesList.d.ts +10 -0
- package/es/attrConditions/components/valuesList.js +188 -0
- package/es/{attributeSelector/demo/multi.d.ts → attrConditions/demo/group.d.ts} +0 -0
- package/es/attrConditions/demo/group.js +82 -0
- package/es/{globalAttributes → attrConditions}/demo/index.d.ts +0 -0
- package/es/{datePicker/demo/form.js → attrConditions/demo/index.js} +43 -23
- package/es/attrConditions/group.d.ts +5 -0
- package/es/attrConditions/group.js +183 -0
- package/es/attrConditions/index.d.ts +6 -0
- package/es/attrConditions/index.js +160 -0
- package/es/attrConditions/styles/group.less +49 -0
- package/es/attrConditions/styles/index.less +94 -0
- package/es/attrConditions/types.d.ts +63 -0
- package/es/attrConditions/types.js +19 -0
- package/es/attrConditions/utils/operates.d.ts +16 -0
- package/es/attrConditions/utils/operates.js +67 -0
- package/es/attributeSelector/demo/index.d.ts +3 -0
- package/es/attributeSelector/demo/{singleForm.js → index.js} +42 -44
- package/es/attributeSelector/index.d.ts +4 -111
- package/es/attributeSelector/index.js +88 -543
- package/es/attributeSelector/listPanel.d.ts +4 -0
- package/es/attributeSelector/listPanel.js +208 -0
- package/es/attributeSelector/option.d.ts +15 -0
- package/es/attributeSelector/option.js +53 -0
- package/es/attributeSelector/styles/index.less +100 -0
- package/es/attributeSelector/types.d.ts +79 -0
- package/es/attributeSelector/types.js +15 -0
- package/es/attributeSelector/util.d.ts +7 -0
- package/es/attributeSelector/util.js +69 -0
- package/es/chart/demo/pie.js +1 -0
- package/es/chart/index.d.ts +2 -96
- package/es/chart/index.js +28 -35
- package/es/chart/styles/index.less +50 -0
- package/es/chart/types.d.ts +46 -0
- package/es/chart/{type.js → types.js} +0 -0
- package/es/chart/util/{chartConfig.d.ts → chartOptionConfig.d.ts} +4 -35
- package/es/chart/util/{chartConfig.js → chartOptionConfig.js} +45 -111
- package/es/chart/util/formatData.d.ts +3 -7
- package/es/chart/util/formatData.js +47 -26
- package/es/chart/util/formatOption.d.ts +2 -1
- package/es/chart/util/formatOption.js +22 -9
- package/es/chart/util/mapUtil.d.ts +3 -3
- package/es/chart/util/mapUtil.js +9 -19
- package/es/commonStyle/icon.less +116 -112
- package/es/commonStyle/select.less +1 -1
- package/es/commonStyle/theme.less +520 -473
- package/es/components/iconFont.js +4 -2
- package/es/context/index.d.ts +16 -0
- package/es/context/index.js +3 -0
- package/es/datePicker/datePicker.d.ts +10 -0
- package/es/datePicker/datePicker.js +115 -0
- package/es/datePicker/demo/index.d.ts +1 -0
- package/es/datePicker/demo/index.js +9 -2
- package/es/datePicker/index.d.ts +4 -27
- package/es/datePicker/index.js +72 -148
- package/es/datePicker/styles/index.less +48 -0
- package/es/datePicker/types.d.ts +24 -0
- package/es/{eventSelector/type.js → datePicker/types.js} +0 -0
- package/es/datePicker/utils.d.ts +6 -0
- package/es/datePicker/utils.js +70 -0
- package/es/dialog/components/itemNode.d.ts +10 -0
- package/es/dialog/components/itemNode.js +109 -0
- package/es/dialog/components/list.d.ts +3 -13
- package/es/dialog/components/list.js +15 -12
- package/es/dialog/components/selectToInput.d.ts +4 -48
- package/es/dialog/components/selectToInput.js +74 -80
- package/es/dialog/components/styles/handle.less +39 -0
- package/es/dialog/components/styles/list.less +60 -0
- package/es/dialog/components/styles/tab.less +55 -0
- package/es/dialog/components/tab.d.ts +3 -7
- package/es/dialog/components/tab.js +57 -19
- package/es/dialog/data/{chart.d.ts → data.d.ts} +9 -0
- package/es/dialog/data/{chart.js → data.js} +11 -0
- package/es/dialog/demo/index.d.ts +23 -0
- package/es/dialog/demo/index.js +34 -3
- package/es/dialog/demo/index2.js +14 -2
- package/es/dialog/index.d.ts +4 -97
- package/es/dialog/index.js +54 -109
- package/es/dialog/styles/index.less +11 -0
- package/es/dialog/types.d.ts +77 -0
- package/es/{targetConditionGroup/type.js → dialog/types.js} +0 -0
- package/es/eventSelector/demo/index.js +26 -44
- package/es/eventSelector/index.d.ts +4 -30
- package/es/eventSelector/index.js +90 -416
- package/es/eventSelector/listPanel.d.ts +4 -0
- package/es/eventSelector/listPanel.js +197 -0
- package/es/eventSelector/option.d.ts +17 -0
- package/es/eventSelector/option.js +54 -0
- package/es/eventSelector/styles/index.less +77 -0
- package/es/eventSelector/types.d.ts +31 -0
- package/es/eventSelector/types.js +1 -0
- package/es/index.d.ts +14 -11
- package/es/index.js +9 -11
- package/es/{attributeSelector/data → mock}/env.d.ts +0 -0
- package/es/{attributeSelector/data → mock}/env.js +0 -0
- package/es/{attributeSelector/data → mock}/event.d.ts +0 -0
- package/es/{attributeSelector/data → mock}/event.js +0 -0
- package/es/{attributeSelector/data → mock}/user.d.ts +0 -0
- package/es/{attributeSelector/data → mock}/user.js +0 -0
- package/es/{multipleSelector → searchInput}/demo/index.d.ts +0 -0
- package/es/searchInput/demo/index.js +5 -0
- package/es/searchInput/index.d.ts +8 -0
- package/es/searchInput/index.js +31 -0
- package/es/{attributeSelector/demo/multiForm.d.ts → select/demo/group.d.ts} +0 -0
- package/es/{globalAttributes/demo/index.js → select/demo/group.js} +49 -31
- package/es/select/demo/index.js +49 -21
- package/es/{attributeSelector/demo/single.d.ts → select/demo/multiple.d.ts} +0 -0
- package/es/{multipleSelector/demo/index.js → select/demo/multiple.js} +55 -12
- package/es/select/handle.d.ts +5 -0
- package/es/select/handle.js +119 -0
- package/es/select/index.d.ts +4 -49
- package/es/select/index.js +168 -122
- package/es/select/option.d.ts +4 -0
- package/es/select/option.js +59 -0
- package/es/select/overlay.d.ts +4 -0
- package/es/select/overlay.js +154 -0
- package/es/select/styles/handle.less +111 -0
- package/es/select/styles/index.less +99 -0
- package/es/select/types.d.ts +65 -0
- package/es/select/types.js +1 -0
- package/es/table/demo/data/table.js +1 -1
- package/es/table/demo/index.d.ts +1 -1
- package/es/table/demo/index.js +9 -8
- package/es/table/demo/index3.js +9 -18
- package/es/table/index.d.ts +4 -30
- package/es/table/index.js +30 -26
- package/es/table/styles/index.less +5 -0
- package/es/table/type.d.ts +10 -0
- package/es/table/type.js +1 -0
- package/es/targetConditionGroup/components/targetDimension.d.ts +8 -0
- package/es/targetConditionGroup/components/targetDimension.js +153 -0
- package/es/targetConditionGroup/data/operates.d.ts +8 -24
- package/es/targetConditionGroup/data/operates.js +26 -69
- package/es/targetConditionGroup/demo/group.d.ts +1 -0
- package/es/targetConditionGroup/demo/group.js +108 -23
- package/es/targetConditionGroup/demo/index.js +34 -34
- package/es/targetConditionGroup/demo/styles/index.less +29 -0
- package/es/targetConditionGroup/index.d.ts +4 -57
- package/es/targetConditionGroup/index.js +177 -274
- package/es/targetConditionGroup/styles/index.less +25 -0
- package/es/targetConditionGroup/types.d.ts +32 -0
- package/es/targetConditionGroup/types.js +1 -0
- package/es/targetSelector/demo/index.d.ts +1 -0
- package/es/targetSelector/demo/index.js +29 -71
- package/es/targetSelector/editBox.d.ts +8 -0
- package/es/targetSelector/{components/BizEventNameEditBox.js → editBox.js} +49 -24
- package/es/targetSelector/index.d.ts +5 -55
- package/es/targetSelector/index.js +103 -214
- package/es/targetSelector/optionIcon.d.ts +9 -0
- package/es/targetSelector/optionIcon.js +24 -0
- package/es/targetSelector/optionMenu.d.ts +7 -0
- package/es/targetSelector/optionMenu.js +38 -0
- package/es/targetSelector/styles/index.less +88 -0
- package/es/targetSelector/types.d.ts +18 -0
- package/es/targetSelector/types.js +1 -0
- package/es/userCondition/conditionTypeList.d.ts +10 -0
- package/es/userCondition/conditionTypeList.js +43 -0
- package/es/userCondition/conditionWrap.d.ts +7 -0
- package/es/userCondition/conditionWrap.js +18 -0
- package/es/userCondition/conditions/eventCondition.d.ts +8 -0
- package/es/userCondition/conditions/eventCondition.js +104 -0
- package/es/userCondition/conditions/periodCondition.d.ts +11 -0
- package/es/userCondition/conditions/periodCondition.js +156 -0
- package/es/userCondition/conditions/propCondition.d.ts +11 -0
- package/es/userCondition/conditions/propCondition.js +147 -0
- package/es/userCondition/conditions/runTimesCondition.d.ts +9 -0
- package/es/userCondition/conditions/runTimesCondition.js +78 -0
- package/es/userCondition/conditions/styles/eventCondition.less +49 -0
- package/es/userCondition/conditions/styles/periodCondition.less +14 -0
- package/es/userCondition/conditions/styles/propCondition.less +36 -0
- package/es/userCondition/conditions/styles/runTimesCondition.less +16 -0
- package/es/{attributeSelector/demo/singleForm.d.ts → userCondition/demo/index.d.ts} +0 -0
- package/es/userCondition/demo/index.js +97 -0
- package/es/userCondition/index.d.ts +7 -0
- package/es/userCondition/index.js +146 -0
- package/es/userCondition/orConditions.d.ts +5 -0
- package/es/userCondition/orConditions.js +202 -0
- package/es/userCondition/relationLabel.d.ts +6 -0
- package/es/userCondition/relationLabel.js +12 -0
- package/es/userCondition/styles/conditionTypeList.less +31 -0
- package/es/userCondition/styles/conditionWrap.less +14 -0
- package/es/userCondition/styles/index.less +13 -0
- package/es/userCondition/styles/orConditions.less +16 -0
- package/es/userCondition/styles/relationLabel.less +18 -0
- package/es/userCondition/types.d.ts +79 -0
- package/es/userCondition/types.js +1 -0
- package/es/userCondition/util.d.ts +2 -0
- package/es/userCondition/util.js +54 -0
- package/es/{datePicker/demo/form.d.ts → userGroup/demo/group.d.ts} +0 -0
- package/es/{targetConditionGroup/demo/form.js → userGroup/demo/group.js} +68 -72
- package/es/userGroup/demo/index.d.ts +0 -1
- package/es/userGroup/demo/index.js +5 -62
- package/es/userGroup/index.d.ts +3 -77
- package/es/userGroup/index.js +60 -108
- package/es/userGroup/styles/index.less +20 -0
- package/es/userGroup/types.d.ts +15 -0
- package/es/userGroup/types.js +1 -0
- package/es/utils/ajax.js +5 -20
- package/es/utils/type.d.ts +42 -44
- package/es/utils/util.d.ts +1 -35
- package/es/utils/util.js +27 -57
- package/package.json +11 -4
- package/es/attributeSelector/demo/multi.js +0 -39
- package/es/attributeSelector/demo/multiForm.js +0 -64
- package/es/attributeSelector/demo/single.js +0 -43
- package/es/attributeSelector/group.d.ts +0 -31
- package/es/attributeSelector/group.js +0 -225
- package/es/attributeSelector/index.less +0 -172
- package/es/chart/index.less +0 -38
- package/es/chart/style/circle.svg +0 -4
- package/es/chart/type.d.ts +0 -22
- package/es/datePicker/data.d.ts +0 -9
- package/es/datePicker/data.js +0 -65
- package/es/datePicker/index.less +0 -364
- package/es/dialog/components/style/list.less +0 -59
- package/es/dialog/components/style/tab.less +0 -61
- package/es/dialog/style/index.less +0 -86
- package/es/eventSelector/demo/form.d.ts +0 -2
- package/es/eventSelector/demo/form.js +0 -89
- package/es/eventSelector/demo/nodata.d.ts +0 -2
- package/es/eventSelector/demo/nodata.js +0 -13
- package/es/eventSelector/index.less +0 -121
- package/es/eventSelector/type.d.ts +0 -41
- package/es/globalAttributes/demo/data/env.d.ts +0 -11
- package/es/globalAttributes/demo/data/env.js +0 -181
- package/es/globalAttributes/demo/data/event.d.ts +0 -237
- package/es/globalAttributes/demo/data/event.js +0 -3483
- package/es/globalAttributes/demo/data/user.d.ts +0 -22
- package/es/globalAttributes/demo/data/user.js +0 -218
- package/es/globalAttributes/index.d.ts +0 -47
- package/es/globalAttributes/index.js +0 -112
- package/es/multipleSelector/index.d.ts +0 -36
- package/es/multipleSelector/index.js +0 -131
- package/es/multipleSelector/index.less +0 -136
- package/es/table/demo/index.less +0 -8
- package/es/table/index.less +0 -139
- package/es/targetConditionGroup/components/conditionGroup.d.ts +0 -30
- package/es/targetConditionGroup/components/conditionGroup.js +0 -112
- package/es/targetConditionGroup/components/conditionItem.d.ts +0 -47
- package/es/targetConditionGroup/components/conditionItem.js +0 -232
- package/es/targetConditionGroup/components/style/group.less +0 -47
- package/es/targetConditionGroup/components/style/index.less +0 -16
- package/es/targetConditionGroup/demo/data/env.d.ts +0 -11
- package/es/targetConditionGroup/demo/data/env.js +0 -181
- package/es/targetConditionGroup/demo/data/event.d.ts +0 -237
- package/es/targetConditionGroup/demo/data/event.js +0 -3483
- package/es/targetConditionGroup/demo/data/user.d.ts +0 -22
- package/es/targetConditionGroup/demo/data/user.js +0 -218
- package/es/targetConditionGroup/demo/form.d.ts +0 -2
- package/es/targetConditionGroup/demo/item.d.ts +0 -2
- package/es/targetConditionGroup/demo/item.js +0 -5
- package/es/targetConditionGroup/group.d.ts +0 -56
- package/es/targetConditionGroup/group.js +0 -204
- package/es/targetConditionGroup/index.less +0 -76
- package/es/targetConditionGroup/type.d.ts +0 -95
- package/es/targetSelector/components/BizCascadeBox.d.ts +0 -34
- package/es/targetSelector/components/BizCascadeBox.js +0 -213
- package/es/targetSelector/components/BizEventNameEditBox.d.ts +0 -20
- package/es/targetSelector/demo/form.d.ts +0 -2
- package/es/targetSelector/demo/form.js +0 -133
- package/es/targetSelector/demo/nodata.d.ts +0 -2
- package/es/targetSelector/demo/nodata.js +0 -13
- package/es/targetSelector/index.less +0 -28
- package/es/userGroup/demo/cluster.d.ts +0 -3
- package/es/userGroup/demo/cluster.js +0 -102
- package/es/userGroup/demo/index.less +0 -3
- package/es/userGroup/index.less +0 -2
- package/es/userGroup/userCluster.d.ts +0 -63
- package/es/userGroup/userCluster.js +0 -255
package/es/utils/util.js
CHANGED
|
@@ -29,13 +29,6 @@ var util = {
|
|
|
29
29
|
equal: function equal(a, b) {
|
|
30
30
|
return JSON.stringify(a) === JSON.stringify(b);
|
|
31
31
|
},
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* 获取指定范围的随机数
|
|
35
|
-
* @param min
|
|
36
|
-
* @param max
|
|
37
|
-
* @returns {*}
|
|
38
|
-
*/
|
|
39
32
|
random: function random(min, max) {
|
|
40
33
|
return Math.round(Math.random() * (max - min)) + min;
|
|
41
34
|
},
|
|
@@ -73,49 +66,20 @@ var util = {
|
|
|
73
66
|
|
|
74
67
|
return option;
|
|
75
68
|
},
|
|
76
|
-
|
|
77
|
-
/**
|
|
78
|
-
* 将数字转为千分位分割格式
|
|
79
|
-
* @param num
|
|
80
|
-
* @returns {string}
|
|
81
|
-
*/
|
|
82
69
|
toThousands: function toThousands(num) {
|
|
83
|
-
var source = String(num).split('.');
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
return source.join('.'); // 再将小数部分合并进来
|
|
70
|
+
var source = String(num).split('.');
|
|
71
|
+
source[0] = source[0].replace(new RegExp('(\\d)(?=(\\d{3})+$)', 'ig'), '$1,');
|
|
72
|
+
return source.join('.');
|
|
88
73
|
},
|
|
89
|
-
|
|
90
|
-
/**
|
|
91
|
-
* 为单数前补0
|
|
92
|
-
* @param num
|
|
93
|
-
* @returns {string}
|
|
94
|
-
*/
|
|
95
74
|
toDoubleNumber: function toDoubleNumber(num) {
|
|
96
|
-
// num += ''
|
|
97
75
|
var num2 = num.toString();
|
|
98
76
|
return num > 9 ? num2 : '0' + num2;
|
|
99
77
|
},
|
|
100
|
-
|
|
101
|
-
/**
|
|
102
|
-
* 日期格式化
|
|
103
|
-
* @param date
|
|
104
|
-
* @param formatter
|
|
105
|
-
* @returns {string}
|
|
106
|
-
*/
|
|
107
78
|
dateFormat: function dateFormat() {
|
|
108
79
|
var date = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : new Date();
|
|
109
80
|
var formatter = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'yyyy-mm-dd';
|
|
110
81
|
return formatter.replace('yyyy', date.getFullYear()).replace('mm', this.toDoubleNumber(date.getMonth() + 1)).replace('dd', this.toDoubleNumber(date.getDate()));
|
|
111
82
|
},
|
|
112
|
-
|
|
113
|
-
/**
|
|
114
|
-
* 日期格式化
|
|
115
|
-
* @param date
|
|
116
|
-
* @param formatter
|
|
117
|
-
* @returns {string}
|
|
118
|
-
*/
|
|
119
83
|
timeFormat: function timeFormat() {
|
|
120
84
|
var date = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : new Date();
|
|
121
85
|
var formatter = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'hh:mm:ss';
|
|
@@ -124,7 +88,6 @@ var util = {
|
|
|
124
88
|
if (this.isDate(date)) {
|
|
125
89
|
return formatter.replace('hh', this.toDoubleNumber(date.getHours())).replace('mm', this.toDoubleNumber(date.getMinutes())).replace('ss', this.toDoubleNumber(date.getSeconds()));
|
|
126
90
|
} else if (this.isNumber(date)) {
|
|
127
|
-
// formatter 格式化规则 如:{s:'秒', h:'小时', m: '分钟'}
|
|
128
91
|
var s = parseInt(date / 1000 + '');
|
|
129
92
|
var m = parseInt(s / 60 + '');
|
|
130
93
|
var h = parseInt(m / 60 + '');
|
|
@@ -143,13 +106,6 @@ var util = {
|
|
|
143
106
|
return formatter.replace('hh', this.toDoubleNumber(h)).replace('mm', this.toDoubleNumber(m)).replace('ss', this.toDoubleNumber(s));
|
|
144
107
|
}
|
|
145
108
|
},
|
|
146
|
-
|
|
147
|
-
/**
|
|
148
|
-
* 从中间拆分字符串,长度超出的话,解析为xxx...xxx
|
|
149
|
-
* @param str
|
|
150
|
-
* @param config
|
|
151
|
-
* @returns {string}
|
|
152
|
-
*/
|
|
153
109
|
strMiddleSplit: function strMiddleSplit(str) {
|
|
154
110
|
var config = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {
|
|
155
111
|
maxLength: 20,
|
|
@@ -159,9 +115,7 @@ var util = {
|
|
|
159
115
|
};
|
|
160
116
|
str += '';
|
|
161
117
|
var reg = {
|
|
162
|
-
// eslint-disable-next-line
|
|
163
118
|
fullCharReg: /[^\x00-\xff]/,
|
|
164
|
-
// eslint-disable-next-line
|
|
165
119
|
fullCharsReg: /[^\x00-\xff]/g,
|
|
166
120
|
anyChars: /[\S\s]{1}/g
|
|
167
121
|
};
|
|
@@ -191,14 +145,30 @@ var util = {
|
|
|
191
145
|
|
|
192
146
|
return str;
|
|
193
147
|
},
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
148
|
+
setHighLight: function setHighLight(content, search, wrapper) {
|
|
149
|
+
var res = [];
|
|
150
|
+
var match = content.match(new RegExp(search, 'i'));
|
|
151
|
+
|
|
152
|
+
if (!match) {
|
|
153
|
+
res.push(content);
|
|
154
|
+
return res;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
var text = match[0];
|
|
158
|
+
var matchIndex = match.index;
|
|
159
|
+
|
|
160
|
+
if (matchIndex - 1 >= 0) {
|
|
161
|
+
res.push(content.substring(0, matchIndex));
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
res.push(wrapper(text, "".concat(content, "-").concat(search)));
|
|
165
|
+
|
|
166
|
+
if (matchIndex + text.length < content.length) {
|
|
167
|
+
var beginIndex = matchIndex + text.length;
|
|
168
|
+
res.push(this.setHighLight(content.substring(beginIndex, content.length), search, wrapper));
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
return res;
|
|
202
172
|
}
|
|
203
173
|
};
|
|
204
174
|
export default util;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zgfe/business-lib",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"start": "dumi dev",
|
|
6
6
|
"docs:build": "dumi build",
|
|
@@ -10,14 +10,17 @@
|
|
|
10
10
|
"prettier": "prettier --write \"**/*.{js,jsx,tsx,ts,less,md,json}\"",
|
|
11
11
|
"test": "umi-test",
|
|
12
12
|
"test:coverage": "umi-test --coverage",
|
|
13
|
-
"prepublishOnly": "npm run build"
|
|
13
|
+
"prepublishOnly": "npm run build",
|
|
14
|
+
"pub": "lerna publish"
|
|
14
15
|
},
|
|
15
16
|
"module": "es/index.js",
|
|
16
17
|
"typings": "es/index.d.ts",
|
|
17
18
|
"gitHooks": {
|
|
18
19
|
"pre-commit": "lint-staged"
|
|
19
20
|
},
|
|
20
|
-
"files": [
|
|
21
|
+
"files": [
|
|
22
|
+
"es"
|
|
23
|
+
],
|
|
21
24
|
"lint-staged": {
|
|
22
25
|
"*.{js,jsx,less,md,json}": [
|
|
23
26
|
"prettier --write"
|
|
@@ -32,9 +35,12 @@
|
|
|
32
35
|
"babel-plugin-import": "^1.13.3",
|
|
33
36
|
"echarts": "^5.3.2",
|
|
34
37
|
"echarts-for-react": "^3.0.2",
|
|
38
|
+
"lerna": "^4.0.0",
|
|
35
39
|
"react-infinite-scroll-component": "^6.1.0"
|
|
36
40
|
},
|
|
37
41
|
"peerDependencies": {
|
|
42
|
+
"@types/lodash": "^4.14.182",
|
|
43
|
+
"lodash": "^4.17.21",
|
|
38
44
|
"react": "^16.12.0 || ^17.0.0"
|
|
39
45
|
},
|
|
40
46
|
"devDependencies": {
|
|
@@ -51,5 +57,6 @@
|
|
|
51
57
|
"lint-staged": "^10.0.7",
|
|
52
58
|
"prettier": "^2.2.1",
|
|
53
59
|
"yorkie": "^2.0.0"
|
|
54
|
-
}
|
|
60
|
+
},
|
|
61
|
+
"gitHead": "81e9003818182ca6aa3755ba71f55cf8964d7d09"
|
|
55
62
|
}
|
|
@@ -1,39 +0,0 @@
|
|
|
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 { BizGroupSelect } from '@zgfe/business-lib';
|
|
15
|
-
import eventData from '../data/event';
|
|
16
|
-
import envData from '../data/env';
|
|
17
|
-
import userData from '../data/user';
|
|
18
|
-
var options = {
|
|
19
|
-
event: eventData,
|
|
20
|
-
user: userData,
|
|
21
|
-
env: envData
|
|
22
|
-
};
|
|
23
|
-
export default (function () {
|
|
24
|
-
var _useState = useState(['browser_version']),
|
|
25
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
26
|
-
attribute = _useState2[0],
|
|
27
|
-
setAttribute = _useState2[1];
|
|
28
|
-
|
|
29
|
-
var handleChange = function handleChange(value) {
|
|
30
|
-
setAttribute(value);
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(BizGroupSelect, {
|
|
34
|
-
defaultValue: attribute,
|
|
35
|
-
options: options,
|
|
36
|
-
eventIds: '24095076,24256188,24143017,24143013',
|
|
37
|
-
onChange: handleChange
|
|
38
|
-
}), /*#__PURE__*/React.createElement("p", null, "\u9009\u62E9\u7684\u5C5E\u6027\u662F\uFF1A", JSON.stringify(attribute)));
|
|
39
|
-
});
|
|
@@ -1,64 +0,0 @@
|
|
|
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 { Button, Form } from 'antd';
|
|
15
|
-
import { BizGroupSelect } from '@zgfe/business-lib';
|
|
16
|
-
import eventData from '../data/event';
|
|
17
|
-
import envData from '../data/env';
|
|
18
|
-
import userData from '../data/user';
|
|
19
|
-
var options = {
|
|
20
|
-
event: eventData,
|
|
21
|
-
user: userData,
|
|
22
|
-
env: envData
|
|
23
|
-
};
|
|
24
|
-
export default (function () {
|
|
25
|
-
var _Form$useForm = Form.useForm(),
|
|
26
|
-
_Form$useForm2 = _slicedToArray(_Form$useForm, 1),
|
|
27
|
-
form = _Form$useForm2[0];
|
|
28
|
-
|
|
29
|
-
var _useState = useState({
|
|
30
|
-
attr: ['visit_times']
|
|
31
|
-
}),
|
|
32
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
33
|
-
formData = _useState2[0],
|
|
34
|
-
setFormData = _useState2[1];
|
|
35
|
-
|
|
36
|
-
var onFinish = function onFinish(values) {
|
|
37
|
-
setFormData(values);
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
var onFinishFailed = function onFinishFailed(errorInfo) {
|
|
41
|
-
console.log('Failed:', errorInfo);
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Form, {
|
|
45
|
-
form: form,
|
|
46
|
-
onFinish: onFinish,
|
|
47
|
-
onFinishFailed: onFinishFailed,
|
|
48
|
-
initialValues: formData
|
|
49
|
-
}, /*#__PURE__*/React.createElement(Form.Item, {
|
|
50
|
-
label: "\u5C5E\u6027",
|
|
51
|
-
name: "attr"
|
|
52
|
-
}, /*#__PURE__*/React.createElement(BizGroupSelect, {
|
|
53
|
-
options: options,
|
|
54
|
-
eventIds: '24095076,24256188,24143017,24143013'
|
|
55
|
-
})), /*#__PURE__*/React.createElement(Form.Item, {
|
|
56
|
-
wrapperCol: {
|
|
57
|
-
offset: 8,
|
|
58
|
-
span: 16
|
|
59
|
-
}
|
|
60
|
-
}, /*#__PURE__*/React.createElement(Button, {
|
|
61
|
-
type: "primary",
|
|
62
|
-
htmlType: "submit"
|
|
63
|
-
}, "Submit"))), /*#__PURE__*/React.createElement("p", null, JSON.stringify(formData)));
|
|
64
|
-
});
|
|
@@ -1,43 +0,0 @@
|
|
|
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 { BizAttributeSelector } from '@zgfe/business-lib';
|
|
15
|
-
import eventData from '../data/event';
|
|
16
|
-
import envData from '../data/env';
|
|
17
|
-
import userData from '../data/user';
|
|
18
|
-
var options = {
|
|
19
|
-
event: eventData,
|
|
20
|
-
user: userData,
|
|
21
|
-
env: envData
|
|
22
|
-
};
|
|
23
|
-
export default (function () {
|
|
24
|
-
var _useState = useState('browser_version'),
|
|
25
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
26
|
-
attribute = _useState2[0],
|
|
27
|
-
setAttribute = _useState2[1];
|
|
28
|
-
|
|
29
|
-
var handleChange = function handleChange(value) {
|
|
30
|
-
setAttribute(value);
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(BizAttributeSelector, {
|
|
34
|
-
defaultValue: attribute,
|
|
35
|
-
options: options,
|
|
36
|
-
disabled: ['项目id'],
|
|
37
|
-
eventIds: '24095076,24256188,24143017,24143013',
|
|
38
|
-
onChange: handleChange,
|
|
39
|
-
showUserProp: false,
|
|
40
|
-
showEventEnv: false,
|
|
41
|
-
showEventProp: false
|
|
42
|
-
}), /*#__PURE__*/React.createElement("p", null, "\u9009\u62E9\u7684\u5C5E\u6027\u662F\uFF1A", attribute));
|
|
43
|
-
});
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import './index.less';
|
|
3
|
-
import { AttributeProps, AttrsListProps } from './index';
|
|
4
|
-
interface AttributeGroupProps extends AttributeProps {
|
|
5
|
-
/**
|
|
6
|
-
* @description 若组件是表单选项,value就是form的initialValues,也是组件的默认选项
|
|
7
|
-
* @description.zh-CN
|
|
8
|
-
* @default -
|
|
9
|
-
*/
|
|
10
|
-
value?: Array<string | number | AttrsListProps>;
|
|
11
|
-
/**
|
|
12
|
-
* @description 默认选项
|
|
13
|
-
* @description.zh-CN
|
|
14
|
-
* @default -
|
|
15
|
-
*/
|
|
16
|
-
defaultValue?: Array<string | number | AttrsListProps>;
|
|
17
|
-
/**
|
|
18
|
-
* @description 最多个数
|
|
19
|
-
* @description.zh-CN
|
|
20
|
-
* @default 3
|
|
21
|
-
*/
|
|
22
|
-
maxAttrGroup?: number;
|
|
23
|
-
/**
|
|
24
|
-
* @description 选中 option 时,调用此函数
|
|
25
|
-
* @description.zh-CN
|
|
26
|
-
* @default -
|
|
27
|
-
*/
|
|
28
|
-
onChange: (valueObject: object[] | (string | number)[], value: object[] | (string | number)[]) => void;
|
|
29
|
-
}
|
|
30
|
-
declare const BizGroupSelect: React.FC<AttributeGroupProps>;
|
|
31
|
-
export default BizGroupSelect;
|
|
@@ -1,225 +0,0 @@
|
|
|
1
|
-
var _excluded = ["defaultValue", "value", "responseType", "maxAttrGroup", "onChange", "disabled"];
|
|
2
|
-
|
|
3
|
-
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; }
|
|
4
|
-
|
|
5
|
-
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; }
|
|
6
|
-
|
|
7
|
-
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; }
|
|
8
|
-
|
|
9
|
-
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
10
|
-
|
|
11
|
-
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."); }
|
|
12
|
-
|
|
13
|
-
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
14
|
-
|
|
15
|
-
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
16
|
-
|
|
17
|
-
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); }
|
|
18
|
-
|
|
19
|
-
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; } } }; }
|
|
20
|
-
|
|
21
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
22
|
-
|
|
23
|
-
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
|
-
|
|
25
|
-
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); }
|
|
26
|
-
|
|
27
|
-
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; }
|
|
28
|
-
|
|
29
|
-
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; }
|
|
30
|
-
|
|
31
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
32
|
-
|
|
33
|
-
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; }
|
|
34
|
-
|
|
35
|
-
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; }
|
|
36
|
-
|
|
37
|
-
import React, { useEffect, useState } from 'react';
|
|
38
|
-
import IconFont from '../components/iconFont';
|
|
39
|
-
import './index.less';
|
|
40
|
-
import BizAttributeSelector from './index';
|
|
41
|
-
|
|
42
|
-
var BizGroupSelect = function BizGroupSelect(props) {
|
|
43
|
-
var _props$defaultValue = props.defaultValue,
|
|
44
|
-
defaultValue = _props$defaultValue === void 0 ? [] : _props$defaultValue,
|
|
45
|
-
_props$value = props.value,
|
|
46
|
-
value = _props$value === void 0 ? [] : _props$value,
|
|
47
|
-
_props$responseType = props.responseType,
|
|
48
|
-
responseType = _props$responseType === void 0 ? 'id' : _props$responseType,
|
|
49
|
-
_props$maxAttrGroup = props.maxAttrGroup,
|
|
50
|
-
maxAttrGroup = _props$maxAttrGroup === void 0 ? 3 : _props$maxAttrGroup,
|
|
51
|
-
onChange = props.onChange,
|
|
52
|
-
_props$disabled = props.disabled,
|
|
53
|
-
disabled = _props$disabled === void 0 ? [] : _props$disabled,
|
|
54
|
-
restProp = _objectWithoutProperties(props, _excluded);
|
|
55
|
-
|
|
56
|
-
var _useState = useState([]),
|
|
57
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
58
|
-
attrGroups = _useState2[0],
|
|
59
|
-
setAttrGroups = _useState2[1];
|
|
60
|
-
|
|
61
|
-
var _useState3 = useState(false),
|
|
62
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
|
63
|
-
isChange = _useState4[0],
|
|
64
|
-
setIsChange = _useState4[1];
|
|
65
|
-
|
|
66
|
-
var _useState5 = useState(disabled),
|
|
67
|
-
_useState6 = _slicedToArray(_useState5, 2),
|
|
68
|
-
disableData = _useState6[0],
|
|
69
|
-
setDisableData = _useState6[1]; // 初始化添加key
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
useEffect(function () {
|
|
73
|
-
var inValue = defaultValue.length ? defaultValue : value;
|
|
74
|
-
var groups = [];
|
|
75
|
-
|
|
76
|
-
var _iterator = _createForOfIteratorHelper(inValue),
|
|
77
|
-
_step;
|
|
78
|
-
|
|
79
|
-
try {
|
|
80
|
-
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
81
|
-
var data = _step.value;
|
|
82
|
-
var id = _typeof(data) === 'object' ? data.value : data;
|
|
83
|
-
var obj = {
|
|
84
|
-
value: id
|
|
85
|
-
};
|
|
86
|
-
groups.push({
|
|
87
|
-
key: Math.random().toString(),
|
|
88
|
-
data: obj
|
|
89
|
-
});
|
|
90
|
-
}
|
|
91
|
-
} catch (err) {
|
|
92
|
-
_iterator.e(err);
|
|
93
|
-
} finally {
|
|
94
|
-
_iterator.f();
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
if (!groups.length) {
|
|
98
|
-
groups = [{
|
|
99
|
-
key: Math.random().toString()
|
|
100
|
-
}];
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
setAttrGroups(groups);
|
|
104
|
-
}, []); // 选项发生变化
|
|
105
|
-
|
|
106
|
-
useEffect(function () {
|
|
107
|
-
if (!isChange) {
|
|
108
|
-
return;
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
var newDis = [];
|
|
112
|
-
|
|
113
|
-
var _iterator2 = _createForOfIteratorHelper(attrGroups),
|
|
114
|
-
_step2;
|
|
115
|
-
|
|
116
|
-
try {
|
|
117
|
-
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
118
|
-
var _group$data;
|
|
119
|
-
|
|
120
|
-
var group = _step2.value;
|
|
121
|
-
var key = (_group$data = group.data) === null || _group$data === void 0 ? void 0 : _group$data.value;
|
|
122
|
-
|
|
123
|
-
if (key) {
|
|
124
|
-
newDis.push(key);
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
} catch (err) {
|
|
128
|
-
_iterator2.e(err);
|
|
129
|
-
} finally {
|
|
130
|
-
_iterator2.f();
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
setIsChange(false);
|
|
134
|
-
setDisableData(function () {
|
|
135
|
-
return [].concat(newDis, _toConsumableArray(disabled));
|
|
136
|
-
});
|
|
137
|
-
handleChange();
|
|
138
|
-
}, [attrGroups]); // 选择回调
|
|
139
|
-
|
|
140
|
-
var handleChange = function handleChange() {
|
|
141
|
-
var ids = [],
|
|
142
|
-
datas = [];
|
|
143
|
-
|
|
144
|
-
var _iterator3 = _createForOfIteratorHelper(attrGroups),
|
|
145
|
-
_step3;
|
|
146
|
-
|
|
147
|
-
try {
|
|
148
|
-
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
|
|
149
|
-
var group = _step3.value;
|
|
150
|
-
|
|
151
|
-
if (group.data) {
|
|
152
|
-
datas.push(group.data);
|
|
153
|
-
group.data.value && ids.push(group.data.value);
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
} catch (err) {
|
|
157
|
-
_iterator3.e(err);
|
|
158
|
-
} finally {
|
|
159
|
-
_iterator3.f();
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
if (responseType === 'id') {
|
|
163
|
-
onChange(ids, datas);
|
|
164
|
-
} else {
|
|
165
|
-
onChange(datas, ids);
|
|
166
|
-
}
|
|
167
|
-
};
|
|
168
|
-
|
|
169
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
170
|
-
className: "biz-attr-group"
|
|
171
|
-
}, attrGroups.map(function (item, index) {
|
|
172
|
-
return /*#__PURE__*/React.createElement(BizAttributeSelector, _objectSpread(_objectSpread({}, restProp), {}, {
|
|
173
|
-
key: item.key,
|
|
174
|
-
defaultValue: item.data,
|
|
175
|
-
onChange: function onChange(data, data2) {
|
|
176
|
-
setAttrGroups(function (group) {
|
|
177
|
-
var key = group[index].key;
|
|
178
|
-
var dd = {};
|
|
179
|
-
|
|
180
|
-
if (_typeof(data) === 'object') {
|
|
181
|
-
dd = data;
|
|
182
|
-
} else if (_typeof(data2) === 'object') {
|
|
183
|
-
dd = data2;
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
group[index] = {
|
|
187
|
-
key: key,
|
|
188
|
-
data: _objectSpread({}, dd)
|
|
189
|
-
};
|
|
190
|
-
return _toConsumableArray(group);
|
|
191
|
-
});
|
|
192
|
-
setIsChange(true);
|
|
193
|
-
},
|
|
194
|
-
onDelete: function onDelete() {
|
|
195
|
-
setAttrGroups(function (group) {
|
|
196
|
-
group.splice(index, 1);
|
|
197
|
-
return _toConsumableArray(group);
|
|
198
|
-
});
|
|
199
|
-
setIsChange(true);
|
|
200
|
-
},
|
|
201
|
-
responseType: 'object',
|
|
202
|
-
disabled: disableData,
|
|
203
|
-
index: index,
|
|
204
|
-
showDeleteIcon: attrGroups.length > 1
|
|
205
|
-
}));
|
|
206
|
-
}), attrGroups.length < maxAttrGroup && /*#__PURE__*/React.createElement("div", {
|
|
207
|
-
className: "biz-icon-add",
|
|
208
|
-
onClick: function onClick() {
|
|
209
|
-
setIsChange(false);
|
|
210
|
-
setAttrGroups(function (group) {
|
|
211
|
-
var empityGroup = {
|
|
212
|
-
key: Math.random().toString()
|
|
213
|
-
};
|
|
214
|
-
return [].concat(_toConsumableArray(group), [empityGroup]);
|
|
215
|
-
});
|
|
216
|
-
}
|
|
217
|
-
}, /*#__PURE__*/React.createElement(IconFont, {
|
|
218
|
-
className: "biz-icon",
|
|
219
|
-
type: 'icon-tianjia1'
|
|
220
|
-
}), /*#__PURE__*/React.createElement("span", {
|
|
221
|
-
className: "biz-icon-text"
|
|
222
|
-
}, "\u6DFB\u52A0\u5C5E\u6027")));
|
|
223
|
-
};
|
|
224
|
-
|
|
225
|
-
export default BizGroupSelect;
|