@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
package/es/utils/util.js
ADDED
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
var util = {
|
|
2
|
+
dayTime: 24 * 60 * 60 * 1000,
|
|
3
|
+
type: function type(obj) {
|
|
4
|
+
return Object.prototype.toString.call(obj);
|
|
5
|
+
},
|
|
6
|
+
isObject: function isObject(obj) {
|
|
7
|
+
return this.type(obj) === '[object Object]';
|
|
8
|
+
},
|
|
9
|
+
isArray: function isArray(obj) {
|
|
10
|
+
return this.type(obj) === '[object Array]';
|
|
11
|
+
},
|
|
12
|
+
isString: function isString(obj) {
|
|
13
|
+
return this.type(obj) === '[object String]';
|
|
14
|
+
},
|
|
15
|
+
isNumber: function isNumber(obj) {
|
|
16
|
+
return this.type(obj) === '[object Number]';
|
|
17
|
+
},
|
|
18
|
+
isDate: function isDate(obj) {
|
|
19
|
+
return this.type(obj) === '[object Date]';
|
|
20
|
+
},
|
|
21
|
+
isFunction: function isFunction(obj) {
|
|
22
|
+
return this.type(obj) === '[object Function]';
|
|
23
|
+
},
|
|
24
|
+
isEqual: function isEqual() {
|
|
25
|
+
var a = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
26
|
+
var b = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
27
|
+
return JSON.stringify(a) === JSON.stringify(b);
|
|
28
|
+
},
|
|
29
|
+
equal: function equal(a, b) {
|
|
30
|
+
return JSON.stringify(a) === JSON.stringify(b);
|
|
31
|
+
},
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* 获取指定范围的随机数
|
|
35
|
+
* @param min
|
|
36
|
+
* @param max
|
|
37
|
+
* @returns {*}
|
|
38
|
+
*/
|
|
39
|
+
random: function random(min, max) {
|
|
40
|
+
return Math.round(Math.random() * (max - min)) + min;
|
|
41
|
+
},
|
|
42
|
+
guid: function guid() {
|
|
43
|
+
function s4() {
|
|
44
|
+
return Math.floor((1 + Math.random()) * 0x10000).toString(16).substring(1);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
return s4() + s4() + '-' + s4() + '-' + s4() + '-' + s4() + '-' + s4() + s4() + s4();
|
|
48
|
+
},
|
|
49
|
+
mergeObject: function mergeObject(defaults, option) {
|
|
50
|
+
defaults = defaults || {};
|
|
51
|
+
option = option || {};
|
|
52
|
+
|
|
53
|
+
for (var prop in defaults) {
|
|
54
|
+
if (this.isObject(defaults[prop])) {
|
|
55
|
+
option[prop] = option[prop] ? option[prop] : {};
|
|
56
|
+
this.mergeObject(defaults[prop], option[prop]);
|
|
57
|
+
} else if (this.isArray(defaults[prop])) {
|
|
58
|
+
if (!option[prop] || option[prop] === []) {
|
|
59
|
+
option[prop] = defaults[prop];
|
|
60
|
+
} else {
|
|
61
|
+
var i = 0;
|
|
62
|
+
var optLenght = option[prop].length;
|
|
63
|
+
var defaultLength = defaults[prop].length;
|
|
64
|
+
|
|
65
|
+
for (i; i < optLenght && i < defaultLength; i++) {
|
|
66
|
+
option[prop][i] = this.mergeObject(defaults[prop][i], option[prop][i]);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
} else {
|
|
70
|
+
option[prop] = option[prop] === null || option[prop] === undefined ? defaults[prop] : option[prop];
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
return option;
|
|
75
|
+
},
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* 将数字转为千分位分割格式
|
|
79
|
+
* @param num
|
|
80
|
+
* @returns {string}
|
|
81
|
+
*/
|
|
82
|
+
toThousands: function toThousands(num) {
|
|
83
|
+
var source = String(num).split('.'); // 按小数点分成2部分
|
|
84
|
+
|
|
85
|
+
source[0] = source[0].replace(new RegExp('(\\d)(?=(\\d{3})+$)', 'ig'), '$1,'); // 只将整数部分进行都好分割
|
|
86
|
+
|
|
87
|
+
return source.join('.'); // 再将小数部分合并进来
|
|
88
|
+
},
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* 为单数前补0
|
|
92
|
+
* @param num
|
|
93
|
+
* @returns {string}
|
|
94
|
+
*/
|
|
95
|
+
toDoubleNumber: function toDoubleNumber(num) {
|
|
96
|
+
// num += ''
|
|
97
|
+
var num2 = num.toString();
|
|
98
|
+
return num > 9 ? num2 : '0' + num2;
|
|
99
|
+
},
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* 日期格式化
|
|
103
|
+
* @param date
|
|
104
|
+
* @param formatter
|
|
105
|
+
* @returns {string}
|
|
106
|
+
*/
|
|
107
|
+
dateFormat: function dateFormat() {
|
|
108
|
+
var date = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : new Date();
|
|
109
|
+
var formatter = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'yyyy-mm-dd';
|
|
110
|
+
return formatter.replace('yyyy', date.getFullYear()).replace('mm', this.toDoubleNumber(date.getMonth() + 1)).replace('dd', this.toDoubleNumber(date.getDate()));
|
|
111
|
+
},
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* 日期格式化
|
|
115
|
+
* @param date
|
|
116
|
+
* @param formatter
|
|
117
|
+
* @returns {string}
|
|
118
|
+
*/
|
|
119
|
+
timeFormat: function timeFormat() {
|
|
120
|
+
var date = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : new Date();
|
|
121
|
+
var formatter = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'hh:mm:ss';
|
|
122
|
+
var autoShort = arguments.length > 2 ? arguments[2] : undefined;
|
|
123
|
+
|
|
124
|
+
if (this.isDate(date)) {
|
|
125
|
+
return formatter.replace('hh', this.toDoubleNumber(date.getHours())).replace('mm', this.toDoubleNumber(date.getMinutes())).replace('ss', this.toDoubleNumber(date.getSeconds()));
|
|
126
|
+
} else if (this.isNumber(date)) {
|
|
127
|
+
// formatter 格式化规则 如:{s:'秒', h:'小时', m: '分钟'}
|
|
128
|
+
var s = parseInt(date / 1000 + '');
|
|
129
|
+
var m = parseInt(s / 60 + '');
|
|
130
|
+
var h = parseInt(m / 60 + '');
|
|
131
|
+
s = s - m * 60;
|
|
132
|
+
m = m - h * 60;
|
|
133
|
+
|
|
134
|
+
if (!h && autoShort) {
|
|
135
|
+
formatter = formatter.replace(/hh\S*?mm/, 'mm');
|
|
136
|
+
|
|
137
|
+
if (!m) {
|
|
138
|
+
formatter = formatter.replace(/mm\S*?ss/, 'ss');
|
|
139
|
+
return formatter.replace('ss', s + '');
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
return formatter.replace('hh', this.toDoubleNumber(h)).replace('mm', this.toDoubleNumber(m)).replace('ss', this.toDoubleNumber(s));
|
|
144
|
+
}
|
|
145
|
+
},
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* 从中间拆分字符串,长度超出的话,解析为xxx...xxx
|
|
149
|
+
* @param str
|
|
150
|
+
* @param config
|
|
151
|
+
* @returns {string}
|
|
152
|
+
*/
|
|
153
|
+
strMiddleSplit: function strMiddleSplit(str) {
|
|
154
|
+
var config = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {
|
|
155
|
+
maxLength: 20,
|
|
156
|
+
beginLength: 8,
|
|
157
|
+
endLength: 8,
|
|
158
|
+
replaceStr: '...'
|
|
159
|
+
};
|
|
160
|
+
str += '';
|
|
161
|
+
var reg = {
|
|
162
|
+
// eslint-disable-next-line
|
|
163
|
+
fullCharReg: /[^\x00-\xff]/,
|
|
164
|
+
// eslint-disable-next-line
|
|
165
|
+
fullCharsReg: /[^\x00-\xff]/g,
|
|
166
|
+
anyChars: /[\S\s]{1}/g
|
|
167
|
+
};
|
|
168
|
+
var fullCharLength = (str.match(reg.fullCharsReg) || []).length;
|
|
169
|
+
var fullLength = str.length + fullCharLength;
|
|
170
|
+
var beginArr = [];
|
|
171
|
+
var beginLength = 0;
|
|
172
|
+
var endArr = [];
|
|
173
|
+
var endLength = 0;
|
|
174
|
+
|
|
175
|
+
if (fullLength > config.maxLength) {
|
|
176
|
+
var strArr = str.match(reg.anyChars) || [];
|
|
177
|
+
strArr.forEach(function (char) {
|
|
178
|
+
if (beginLength >= config.beginLength) return;
|
|
179
|
+
var len = reg.fullCharReg.test(char) ? 2 : 1;
|
|
180
|
+
beginLength += len;
|
|
181
|
+
beginArr.push(char);
|
|
182
|
+
});
|
|
183
|
+
strArr.reverse().forEach(function (char) {
|
|
184
|
+
if (endLength >= config.endLength) return;
|
|
185
|
+
var len = reg.fullCharReg.test(char) ? 2 : 1;
|
|
186
|
+
endLength += len;
|
|
187
|
+
endArr.push(char);
|
|
188
|
+
});
|
|
189
|
+
return beginArr.join('') + config.replaceStr + endArr.reverse().join('');
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
return str;
|
|
193
|
+
},
|
|
194
|
+
// 高亮显示搜索词
|
|
195
|
+
setHighLight: function setHighLight(content, search) {
|
|
196
|
+
if (!(content && search)) return content;
|
|
197
|
+
var num = content.indexOf(search);
|
|
198
|
+
var c = num > -1 ? content.substr(num, search.length) : '';
|
|
199
|
+
var val = "<span class=\"biz-light-height\">".concat(search, "</span>");
|
|
200
|
+
var regS = new RegExp(search, 'gi');
|
|
201
|
+
return content.replace(regS, val);
|
|
202
|
+
}
|
|
203
|
+
};
|
|
204
|
+
export default util;
|
package/package.json
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@zgfe/business-lib",
|
|
3
|
+
"version": "1.0.0-beta.1",
|
|
4
|
+
"scripts": {
|
|
5
|
+
"start": "dumi dev",
|
|
6
|
+
"docs:build": "dumi build",
|
|
7
|
+
"docs:deploy": "gh-pages -d docs-dist",
|
|
8
|
+
"build": "father-build",
|
|
9
|
+
"deploy": "npm run docs:build && npm run docs:deploy",
|
|
10
|
+
"prettier": "prettier --write \"**/*.{js,jsx,tsx,ts,less,md,json}\"",
|
|
11
|
+
"test": "umi-test",
|
|
12
|
+
"test:coverage": "umi-test --coverage",
|
|
13
|
+
"prepublishOnly": "npm run build"
|
|
14
|
+
},
|
|
15
|
+
"module": "es/index.js",
|
|
16
|
+
"typings": "es/index.d.ts",
|
|
17
|
+
"gitHooks": {
|
|
18
|
+
"pre-commit": "lint-staged"
|
|
19
|
+
},
|
|
20
|
+
"files": ["es"],
|
|
21
|
+
"lint-staged": {
|
|
22
|
+
"*.{js,jsx,less,md,json}": [
|
|
23
|
+
"prettier --write"
|
|
24
|
+
],
|
|
25
|
+
"*.ts?(x)": [
|
|
26
|
+
"prettier --parser=typescript --write"
|
|
27
|
+
]
|
|
28
|
+
},
|
|
29
|
+
"dependencies": {
|
|
30
|
+
"@types/qs": "^6.9.7",
|
|
31
|
+
"axios": "^0.26.1",
|
|
32
|
+
"babel-plugin-import": "^1.13.3",
|
|
33
|
+
"echarts": "^5.3.2",
|
|
34
|
+
"echarts-for-react": "^3.0.2",
|
|
35
|
+
"react-infinite-scroll-component": "^6.1.0"
|
|
36
|
+
},
|
|
37
|
+
"peerDependencies": {
|
|
38
|
+
"react": "^16.12.0 || ^17.0.0"
|
|
39
|
+
},
|
|
40
|
+
"devDependencies": {
|
|
41
|
+
"@testing-library/jest-dom": "^5.15.1",
|
|
42
|
+
"@testing-library/react": "^12.1.2",
|
|
43
|
+
"@types/jest": "^27.0.3",
|
|
44
|
+
"@types/qs": "^6.9.7",
|
|
45
|
+
"@umijs/fabric": "^2.8.1",
|
|
46
|
+
"@umijs/test": "^3.0.5",
|
|
47
|
+
"antd": "^4.19.2",
|
|
48
|
+
"dumi": "^1.1.0",
|
|
49
|
+
"father-build": "^1.17.2",
|
|
50
|
+
"gh-pages": "^3.0.0",
|
|
51
|
+
"lint-staged": "^10.0.7",
|
|
52
|
+
"prettier": "^2.2.1",
|
|
53
|
+
"yorkie": "^2.0.0"
|
|
54
|
+
}
|
|
55
|
+
}
|