@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,171 @@
|
|
|
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 _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
10
|
+
|
|
11
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
12
|
+
|
|
13
|
+
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; }
|
|
14
|
+
|
|
15
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
16
|
+
|
|
17
|
+
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; }
|
|
18
|
+
|
|
19
|
+
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; }
|
|
20
|
+
|
|
21
|
+
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; }
|
|
22
|
+
|
|
23
|
+
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e2) { throw _e2; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e3) { didErr = true; err = _e3; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
24
|
+
|
|
25
|
+
function _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
|
+
import React, { useEffect, useState } from 'react';
|
|
30
|
+
import { BizTable } from 'business-lib';
|
|
31
|
+
import util from '../../utils/util';
|
|
32
|
+
import chartData from './data/data';
|
|
33
|
+
import { chartColors as color } from './data/color';
|
|
34
|
+
import './index.less';
|
|
35
|
+
|
|
36
|
+
var getColumn = function getColumn(columnData) {
|
|
37
|
+
var data = [{
|
|
38
|
+
title: '显示',
|
|
39
|
+
width: 60,
|
|
40
|
+
dataIndex: 'icon',
|
|
41
|
+
key: 'icon',
|
|
42
|
+
align: 'center',
|
|
43
|
+
fixed: 'left',
|
|
44
|
+
render: function render(text, record, index) {
|
|
45
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
46
|
+
style: {
|
|
47
|
+
width: '12px',
|
|
48
|
+
height: '12px',
|
|
49
|
+
borderRadius: '50%',
|
|
50
|
+
background: color[index]
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
}, {
|
|
55
|
+
title: '事件',
|
|
56
|
+
width: 150,
|
|
57
|
+
dataIndex: 'name',
|
|
58
|
+
key: 'name',
|
|
59
|
+
ellipsis: true,
|
|
60
|
+
fixed: 'left'
|
|
61
|
+
}];
|
|
62
|
+
console.log(data);
|
|
63
|
+
|
|
64
|
+
for (var i = 0; i < columnData.length; i++) {
|
|
65
|
+
var value = columnData[i];
|
|
66
|
+
|
|
67
|
+
if (/^\d{4}-\d{2}-\d{2}$/.test(value)) {
|
|
68
|
+
// 处理日期
|
|
69
|
+
value = value.replace(/\d{4}-/, '');
|
|
70
|
+
} else if (/^\d{4}-\d{2}-\d{2}\|\d{4}-\d{2}-\d{2}$/.test(value)) {
|
|
71
|
+
// 周、月日期
|
|
72
|
+
var dates = value.match(/\d{4}-\d{2}-\d{2}/g);
|
|
73
|
+
value = dates ? dates[0].replace(/\d{4}-/, '') + '~' + dates[1].replace(/\d{4}-/, '') : value;
|
|
74
|
+
} else {
|
|
75
|
+
value = util.strMiddleSplit(value);
|
|
76
|
+
|
|
77
|
+
if (/:/.test(value)) {
|
|
78
|
+
value = value.replace(/\d{4}-\d{2}-\d{2}\s/, '');
|
|
79
|
+
} else if (/,/.test(value)) {
|
|
80
|
+
value = value.replace(/,/g, '-');
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
data.push({
|
|
85
|
+
title: value,
|
|
86
|
+
width: 100,
|
|
87
|
+
align: 'center',
|
|
88
|
+
ellipsis: true,
|
|
89
|
+
dataIndex: "field".concat(i),
|
|
90
|
+
render: function render(text, record, index) {
|
|
91
|
+
return /*#__PURE__*/React.createElement("span", {
|
|
92
|
+
className: "biz-table-link"
|
|
93
|
+
}, text);
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
data.push({
|
|
99
|
+
title: '操作',
|
|
100
|
+
dataIndex: 'operation',
|
|
101
|
+
fixed: 'right',
|
|
102
|
+
width: 150,
|
|
103
|
+
align: 'right',
|
|
104
|
+
render: function render(_, record) {
|
|
105
|
+
return /*#__PURE__*/React.createElement("a", null, "Delete");
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
return data;
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
var formateTableData = function formateTableData(sData) {
|
|
112
|
+
var tableData = [];
|
|
113
|
+
|
|
114
|
+
var _iterator = _createForOfIteratorHelper(sData),
|
|
115
|
+
_step;
|
|
116
|
+
|
|
117
|
+
try {
|
|
118
|
+
var _loop = function _loop() {
|
|
119
|
+
var row = _step.value;
|
|
120
|
+
var item = {
|
|
121
|
+
id: Math.random(),
|
|
122
|
+
name: row.name,
|
|
123
|
+
align: 'right'
|
|
124
|
+
};
|
|
125
|
+
row.data.forEach(function (data, index) {
|
|
126
|
+
item["field".concat(index)] = data;
|
|
127
|
+
});
|
|
128
|
+
tableData.push(_objectSpread({}, item));
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
132
|
+
_loop();
|
|
133
|
+
}
|
|
134
|
+
} catch (err) {
|
|
135
|
+
_iterator.e(err);
|
|
136
|
+
} finally {
|
|
137
|
+
_iterator.f();
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
return tableData;
|
|
141
|
+
};
|
|
142
|
+
|
|
143
|
+
export default (function () {
|
|
144
|
+
var _useState = useState([]),
|
|
145
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
146
|
+
columns = _useState2[0],
|
|
147
|
+
setColumns = _useState2[1];
|
|
148
|
+
|
|
149
|
+
var _useState3 = useState([]),
|
|
150
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
151
|
+
tableData = _useState4[0],
|
|
152
|
+
setTableData = _useState4[1];
|
|
153
|
+
|
|
154
|
+
useEffect(function () {
|
|
155
|
+
var data = getColumn(chartData.xData);
|
|
156
|
+
setColumns(function () {
|
|
157
|
+
return _toConsumableArray(data);
|
|
158
|
+
});
|
|
159
|
+
setTableData(function () {
|
|
160
|
+
return formateTableData(chartData.seriesData);
|
|
161
|
+
});
|
|
162
|
+
}, []);
|
|
163
|
+
return /*#__PURE__*/React.createElement(BizTable, {
|
|
164
|
+
columns: columns,
|
|
165
|
+
dataSource: tableData,
|
|
166
|
+
rowKey: "id",
|
|
167
|
+
scroll: {
|
|
168
|
+
x: 1500
|
|
169
|
+
}
|
|
170
|
+
});
|
|
171
|
+
});
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { BizTable } from 'business-lib';
|
|
3
|
+
import tableData, { columns } from './data/table';
|
|
4
|
+
export default (function () {
|
|
5
|
+
return /*#__PURE__*/React.createElement(BizTable, {
|
|
6
|
+
columns: columns,
|
|
7
|
+
dataSource: tableData
|
|
8
|
+
});
|
|
9
|
+
});
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ColumnGroupType, ColumnType, TableProps } from 'antd/lib/table';
|
|
3
|
+
import './index.less';
|
|
4
|
+
interface BizTableProps {
|
|
5
|
+
/**
|
|
6
|
+
* @description 数据
|
|
7
|
+
* @default -
|
|
8
|
+
*/
|
|
9
|
+
dataSource: object[];
|
|
10
|
+
/**
|
|
11
|
+
* @description 表头
|
|
12
|
+
* @default line
|
|
13
|
+
*/
|
|
14
|
+
columns?: (ColumnGroupType<object> | ColumnType<object>)[];
|
|
15
|
+
/**
|
|
16
|
+
* @description 数据总数
|
|
17
|
+
* @default dataSource.length
|
|
18
|
+
*/
|
|
19
|
+
total?: number;
|
|
20
|
+
/**
|
|
21
|
+
* @description 每页行数
|
|
22
|
+
* @default 10
|
|
23
|
+
*/
|
|
24
|
+
pageSize?: number;
|
|
25
|
+
/**
|
|
26
|
+
* @description 是否分页
|
|
27
|
+
* @default true
|
|
28
|
+
*/
|
|
29
|
+
pagination?: boolean;
|
|
30
|
+
}
|
|
31
|
+
declare const BizTable: React.FC<BizTableProps & TableProps<any>>;
|
|
32
|
+
export default BizTable;
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
var _excluded = ["dataSource", "columns", "total", "scroll", "pageSize", "pagination"];
|
|
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 _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
10
|
+
|
|
11
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
12
|
+
|
|
13
|
+
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); }
|
|
14
|
+
|
|
15
|
+
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; }
|
|
16
|
+
|
|
17
|
+
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; }
|
|
18
|
+
|
|
19
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
20
|
+
|
|
21
|
+
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; }
|
|
22
|
+
|
|
23
|
+
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; }
|
|
24
|
+
|
|
25
|
+
import { Table } from 'antd';
|
|
26
|
+
import React, { useState } from 'react';
|
|
27
|
+
import './index.less';
|
|
28
|
+
|
|
29
|
+
var BizTable = function BizTable(props) {
|
|
30
|
+
var dataSource = props.dataSource,
|
|
31
|
+
columns = props.columns,
|
|
32
|
+
_props$total = props.total,
|
|
33
|
+
total = _props$total === void 0 ? dataSource.length : _props$total,
|
|
34
|
+
scroll = props.scroll,
|
|
35
|
+
_props$pageSize = props.pageSize,
|
|
36
|
+
pageSize = _props$pageSize === void 0 ? 10 : _props$pageSize,
|
|
37
|
+
_props$pagination = props.pagination,
|
|
38
|
+
pagination = _props$pagination === void 0 ? true : _props$pagination,
|
|
39
|
+
res = _objectWithoutProperties(props, _excluded);
|
|
40
|
+
|
|
41
|
+
var _useState = useState(scroll),
|
|
42
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
43
|
+
scrollData = _useState2[0],
|
|
44
|
+
setScrollData = _useState2[1];
|
|
45
|
+
|
|
46
|
+
return /*#__PURE__*/React.createElement(Table, _objectSpread(_objectSpread({}, res), {}, {
|
|
47
|
+
columns: columns,
|
|
48
|
+
dataSource: dataSource,
|
|
49
|
+
pagination: pagination && {
|
|
50
|
+
showSizeChanger: true,
|
|
51
|
+
total: total,
|
|
52
|
+
showQuickJumper: true,
|
|
53
|
+
showTotal: function showTotal(totalNum) {
|
|
54
|
+
return total ? /*#__PURE__*/React.createElement("span", null, "\u5171 ", /*#__PURE__*/React.createElement("a", {
|
|
55
|
+
className: "biz-table-total"
|
|
56
|
+
}, totalNum), " \u6761") : '';
|
|
57
|
+
},
|
|
58
|
+
onChange: function onChange(page, pageSize) {
|
|
59
|
+
console.log(page, pageSize);
|
|
60
|
+
var count = page * pageSize;
|
|
61
|
+
|
|
62
|
+
if (pageSize > 10 && (count <= total || total - (page - 1) * pageSize > 10)) {
|
|
63
|
+
setScrollData(function (data) {
|
|
64
|
+
return _objectSpread(_objectSpread({}, data), {}, {
|
|
65
|
+
y: (scroll === null || scroll === void 0 ? void 0 : scroll.y) || 490
|
|
66
|
+
});
|
|
67
|
+
});
|
|
68
|
+
} else {
|
|
69
|
+
setScrollData(function (data) {
|
|
70
|
+
data === null || data === void 0 ? true : delete data.y;
|
|
71
|
+
return _objectSpread({}, data);
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
scroll: scrollData
|
|
77
|
+
}));
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
export default BizTable;
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
@import '../commonStyle/index.less';
|
|
2
|
+
|
|
3
|
+
.ant-table {
|
|
4
|
+
color: @fontColor3;
|
|
5
|
+
border: 1px solid @borderColor;
|
|
6
|
+
border-radius: 10px;
|
|
7
|
+
|
|
8
|
+
.ant-table-container {
|
|
9
|
+
.ant-table-thead > tr > th {
|
|
10
|
+
color: #021429;
|
|
11
|
+
line-height: 16px;
|
|
12
|
+
background: @grayColor;
|
|
13
|
+
border: none;
|
|
14
|
+
&::before {
|
|
15
|
+
width: 0 !important;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
&.ant-table-cell-fix-left-last {
|
|
19
|
+
border-right: 1px solid @borderColor;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.ant-table-tbody > tr:not(:last-child) > td {
|
|
24
|
+
border-bottom: 1px solid @borderColor;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.ant-table-tbody > tr > td {
|
|
28
|
+
line-height: 15px;
|
|
29
|
+
|
|
30
|
+
&.ant-table-cell-fix-left {
|
|
31
|
+
border-bottom: none;
|
|
32
|
+
&.ant-table-cell-fix-left-last {
|
|
33
|
+
border-right: 1px solid @borderColor;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
.ant-table-tbody > tr.ant-table-row:hover > td,
|
|
40
|
+
.ant-table-tbody > tr > td.ant-table-cell-row-hover {
|
|
41
|
+
background: @hoverBgColor;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.biz-table-total {
|
|
45
|
+
color: @themeColor;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.ant-select-item {
|
|
49
|
+
border-radius: 10px;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.ant-select-item-option-active:not(.ant-select-item-option-disabled, .ant-select-item-option-selected) {
|
|
53
|
+
color: @themeColor;
|
|
54
|
+
background: @hoverBgColor;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.ant-select-focused:not(.ant-select-disabled).ant-select:not(.ant-select-customize-input)
|
|
58
|
+
.ant-select-selector,
|
|
59
|
+
.ant-select:not(.ant-select-disabled):hover .ant-select-selector {
|
|
60
|
+
color: @themeColor;
|
|
61
|
+
background: @hoverBgColor;
|
|
62
|
+
border-color: @themeColor;
|
|
63
|
+
box-shadow: none;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.ant-pagination-item {
|
|
67
|
+
color: @fontColor3;
|
|
68
|
+
font-weight: 400;
|
|
69
|
+
background: #fafafb;
|
|
70
|
+
border: none;
|
|
71
|
+
border-radius: 4px;
|
|
72
|
+
|
|
73
|
+
&.ant-pagination-item-active {
|
|
74
|
+
background: @themeColor;
|
|
75
|
+
|
|
76
|
+
a {
|
|
77
|
+
color: #fff;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
&:hover {
|
|
81
|
+
color: @themeColor;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.ant-pagination-prev,
|
|
86
|
+
.ant-pagination-next {
|
|
87
|
+
.ant-pagination-item-link {
|
|
88
|
+
font-weight: 400;
|
|
89
|
+
background: #fafafb;
|
|
90
|
+
border: none;
|
|
91
|
+
border-radius: 4px;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
.ant-select:not(.ant-select-customize-input) {
|
|
96
|
+
.ant-select-selector {
|
|
97
|
+
&:hover {
|
|
98
|
+
color: @themeColor;
|
|
99
|
+
background: @hoverBgColor;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ValueType } from '../type';
|
|
3
|
+
import './style/group.less';
|
|
4
|
+
interface ConditionGroupProps {
|
|
5
|
+
/**
|
|
6
|
+
* @description 默认值
|
|
7
|
+
* @description.zh-CN
|
|
8
|
+
* @default
|
|
9
|
+
*/
|
|
10
|
+
defaultValue?: ValueType;
|
|
11
|
+
/**
|
|
12
|
+
* @description 属性配置项
|
|
13
|
+
* @description.zh-CN
|
|
14
|
+
* @default
|
|
15
|
+
*/
|
|
16
|
+
options?: object;
|
|
17
|
+
/**
|
|
18
|
+
* @description 如果是事件属性,则传事件id,多个用逗号隔开
|
|
19
|
+
* @default -
|
|
20
|
+
*/
|
|
21
|
+
eventIds?: string | number;
|
|
22
|
+
/**
|
|
23
|
+
* @description 参数改变回调
|
|
24
|
+
* @description.zh-CN
|
|
25
|
+
* @default
|
|
26
|
+
*/
|
|
27
|
+
onChange?: (data: ValueType) => void;
|
|
28
|
+
}
|
|
29
|
+
declare const BizConditionGroup: React.FC<ConditionGroupProps>;
|
|
30
|
+
export default BizConditionGroup;
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
2
|
+
|
|
3
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
4
|
+
|
|
5
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
6
|
+
|
|
7
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
8
|
+
|
|
9
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
10
|
+
|
|
11
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
12
|
+
|
|
13
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
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
|
+
import React, { useEffect, useState } from 'react';
|
|
28
|
+
import BizConditionItem from './conditionItem';
|
|
29
|
+
import './style/group.less';
|
|
30
|
+
import util from '../../utils/util';
|
|
31
|
+
|
|
32
|
+
var BizConditionGroup = function BizConditionGroup(props) {
|
|
33
|
+
var _props$defaultValue = props.defaultValue,
|
|
34
|
+
defaultValue = _props$defaultValue === void 0 ? {
|
|
35
|
+
operator: 'and',
|
|
36
|
+
attrs: []
|
|
37
|
+
} : _props$defaultValue,
|
|
38
|
+
options = props.options,
|
|
39
|
+
eventIds = props.eventIds,
|
|
40
|
+
_onChange = props.onChange;
|
|
41
|
+
|
|
42
|
+
var _useState = useState(defaultValue.attrs || []),
|
|
43
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
44
|
+
attrs = _useState2[0],
|
|
45
|
+
setAttrs = _useState2[1];
|
|
46
|
+
|
|
47
|
+
var _useState3 = useState(defaultValue.operator || 'and'),
|
|
48
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
49
|
+
operate = _useState4[0],
|
|
50
|
+
setOperate = _useState4[1];
|
|
51
|
+
|
|
52
|
+
useEffect(function () {
|
|
53
|
+
if (util.equal(attrs, defaultValue.attrs)) return;
|
|
54
|
+
setAttrs(function () {
|
|
55
|
+
return defaultValue.attrs ? _toConsumableArray(defaultValue.attrs) : [];
|
|
56
|
+
});
|
|
57
|
+
}, [defaultValue]);
|
|
58
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
59
|
+
className: "biz-attr-group-container"
|
|
60
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
61
|
+
className: "biz-attr-group-operate"
|
|
62
|
+
}, attrs.length > 1 && /*#__PURE__*/React.createElement("div", {
|
|
63
|
+
className: "biz-attr-operate",
|
|
64
|
+
onClick: function onClick(e) {
|
|
65
|
+
e.stopPropagation();
|
|
66
|
+
var value = e.target.innerText === '且' ? 'and' : 'or';
|
|
67
|
+
setOperate(function () {
|
|
68
|
+
return value;
|
|
69
|
+
});
|
|
70
|
+
_onChange && _onChange({
|
|
71
|
+
operator: value,
|
|
72
|
+
attrs: attrs
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
76
|
+
className: operate === 'and' ? 'active' : ''
|
|
77
|
+
}, "\u4E14"), /*#__PURE__*/React.createElement("div", {
|
|
78
|
+
className: operate === 'or' ? 'active' : ''
|
|
79
|
+
}, "\u6216"))), /*#__PURE__*/React.createElement("div", {
|
|
80
|
+
className: "biz-attr-group-content"
|
|
81
|
+
}, attrs.map(function (item, index) {
|
|
82
|
+
return /*#__PURE__*/React.createElement(BizConditionItem, {
|
|
83
|
+
key: item.attrId || index,
|
|
84
|
+
options: options,
|
|
85
|
+
eventIds: eventIds,
|
|
86
|
+
defaultValue: item.data,
|
|
87
|
+
onDelete: function onDelete() {
|
|
88
|
+
setAttrs(function (data) {
|
|
89
|
+
data.splice(index, 1);
|
|
90
|
+
_onChange && _onChange({
|
|
91
|
+
operator: operate,
|
|
92
|
+
attrs: _toConsumableArray(data)
|
|
93
|
+
});
|
|
94
|
+
return _toConsumableArray(data);
|
|
95
|
+
});
|
|
96
|
+
},
|
|
97
|
+
onChange: function onChange(data) {
|
|
98
|
+
setAttrs(function (attr) {
|
|
99
|
+
attr[index].data = _objectSpread({}, data);
|
|
100
|
+
_onChange && _onChange({
|
|
101
|
+
operator: operate,
|
|
102
|
+
attrs: _toConsumableArray(attr)
|
|
103
|
+
});
|
|
104
|
+
return _toConsumableArray(attr);
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
})));
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
export default BizConditionGroup;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import './style/index.less';
|
|
3
|
+
import { AttrItemType } from '../type';
|
|
4
|
+
import { EventMetaProps } from '../../utils/type';
|
|
5
|
+
interface ConditionItemProps {
|
|
6
|
+
/**
|
|
7
|
+
* @description 默认选项
|
|
8
|
+
* @description.zh-CN
|
|
9
|
+
* @default -
|
|
10
|
+
*/
|
|
11
|
+
defaultValue?: AttrItemType;
|
|
12
|
+
/**
|
|
13
|
+
* @description 属性的配置项
|
|
14
|
+
* @description.zh-CN
|
|
15
|
+
* @default -
|
|
16
|
+
*/
|
|
17
|
+
options?: EventMetaProps;
|
|
18
|
+
/**
|
|
19
|
+
* @description 如果是事件属性,则传事件id,多个用逗号隔开
|
|
20
|
+
* @default -
|
|
21
|
+
*/
|
|
22
|
+
eventIds?: string | number;
|
|
23
|
+
/**
|
|
24
|
+
* @description 软件id
|
|
25
|
+
* @default -
|
|
26
|
+
*/
|
|
27
|
+
appId?: Number;
|
|
28
|
+
/**
|
|
29
|
+
* @description 平台id
|
|
30
|
+
* @default -
|
|
31
|
+
*/
|
|
32
|
+
platform?: Number;
|
|
33
|
+
/**
|
|
34
|
+
* @description 选中 option 时,调用此函数
|
|
35
|
+
* @description.zh-CN
|
|
36
|
+
* @default
|
|
37
|
+
*/
|
|
38
|
+
onChange?: (data: object) => void;
|
|
39
|
+
/**
|
|
40
|
+
* @description 删除属性
|
|
41
|
+
* @description.zh-CN
|
|
42
|
+
* @default -
|
|
43
|
+
*/
|
|
44
|
+
onDelete?: () => void;
|
|
45
|
+
}
|
|
46
|
+
declare const BizConditionItem: React.FC<ConditionItemProps>;
|
|
47
|
+
export default BizConditionItem;
|