@zgfe/business-lib 1.1.27 → 1.1.29-visual.0
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/addToPanel/components/addPanel.js +8 -21
- package/es/addToPanel/components/radioGroup.js +1 -3
- package/es/addToPanel/components/styleList.js +5 -22
- package/es/addToPanel/demo/edit.js +5 -12
- package/es/addToPanel/demo/index.js +5 -12
- package/es/addToPanel/index.js +21 -58
- package/es/addToScene/addGroup.js +0 -4
- package/es/addToScene/demo/index.js +5 -12
- package/es/addToScene/index.js +13 -40
- package/es/assets/demo/index.js +0 -2
- package/es/assets/demo/input.js +5 -12
- package/es/assets/iconfont/iconfont.js +10 -17
- package/es/assets/theme.js +0 -1
- package/es/attrConditions/components/operateList.js +10 -27
- package/es/attrConditions/components/stringList.js +69 -98
- package/es/attrConditions/components/valuesList.js +14 -40
- package/es/attrConditions/demo/group.js +11 -23
- package/es/attrConditions/demo/index.js +17 -26
- package/es/attrConditions/group.js +17 -48
- package/es/attrConditions/index.js +22 -49
- package/es/attrConditions/types.js +0 -1
- package/es/attributeSelector/demo/disable.js +8 -16
- package/es/attributeSelector/demo/index.js +8 -17
- package/es/attributeSelector/index.js +22 -45
- package/es/attributeSelector/listPanel.js +18 -46
- package/es/attributeSelector/option.js +3 -13
- package/es/attributeSelector/types.js +0 -5
- package/es/attributeSelector/util.js +0 -3
- package/es/chart/demo/index.js +5 -14
- package/es/chart/index.js +30 -44
- package/es/chart/util/chartOptionConfig.d.ts +3 -3
- package/es/chart/util/chartOptionConfig.js +13 -37
- package/es/chart/util/data/china.js +1 -4
- package/es/chart/util/formatData.d.ts +2 -2
- package/es/chart/util/formatData.js +0 -5
- package/es/chart/util/formatOption.js +0 -13
- package/es/chart/util/mapUtil.js +5 -26
- package/es/config.js +0 -2
- package/es/cycleTime/demo/disable.js +0 -1
- package/es/cycleTime/index.js +19 -46
- package/es/cycleTime/month.js +8 -27
- package/es/datePicker/datePicker.js +5 -23
- package/es/datePicker/demo/customType.js +13 -22
- package/es/datePicker/demo/day.js +13 -22
- package/es/datePicker/demo/index.js +12 -21
- package/es/datePicker/index.js +18 -41
- package/es/datePicker/utils.js +0 -7
- package/es/demoWrapper/content.js +31 -56
- package/es/demoWrapper/head.js +9 -23
- package/es/demoWrapper/index.js +14 -30
- package/es/dialog/demo/index.js +5 -12
- package/es/dialog/index.js +4 -6
- package/es/dnd/demo/data.js +19 -28
- package/es/dnd/demo/handle.js +19 -28
- package/es/dnd/index.js +21 -45
- package/es/dnd/item.js +10 -30
- package/es/eventSelector/demo/index.js +12 -23
- package/es/eventSelector/index.js +14 -42
- package/es/eventSelector/listPanel.js +27 -61
- package/es/eventSelector/option.js +6 -11
- package/es/icon/iconFont.js +7 -13
- package/es/index.d.ts +2 -1
- package/es/index.js +2 -1
- package/es/layout/analysisLayout/demo/index.js +0 -6
- package/es/layout/analysisLayout/index.d.ts +1 -1
- package/es/layout/analysisLayout/index.js +16 -34
- package/es/layout/detail/index.js +1 -3
- package/es/loginForm/index.js +7 -18
- package/es/searchInput/index.js +2 -7
- package/es/select/demo/children.js +8 -16
- package/es/select/demo/customLabel.js +0 -2
- package/es/select/demo/group.js +8 -17
- package/es/select/demo/index.js +11 -19
- package/es/select/demo/loading.js +8 -18
- package/es/select/demo/multiple.js +8 -16
- package/es/select/handle.js +14 -34
- package/es/select/index.js +22 -59
- package/es/select/option.js +10 -30
- package/es/select/overlay.js +25 -62
- package/es/socket/demo/demo.d.ts +2 -0
- package/es/socket/demo/demo.js +51 -0
- package/es/socket/demo/index.less +4 -0
- package/es/socket/index.d.ts +27 -0
- package/es/socket/index.js +217 -0
- package/es/socket/types.d.ts +27 -0
- package/es/socket/types.js +18 -0
- package/es/table/demo/data/table.js +0 -2
- package/es/table/demo/index.js +13 -39
- package/es/table/demo/index2.js +5 -15
- package/es/table/demo/index3.js +7 -28
- package/es/table/index.js +14 -33
- package/es/targetConditionGroup/components/targetDimension.js +12 -38
- package/es/targetConditionGroup/demo/group.js +21 -36
- package/es/targetConditionGroup/demo/index.js +5 -13
- package/es/targetConditionGroup/index.js +31 -84
- package/es/targetSelector/demo/index.js +15 -28
- package/es/targetSelector/editBox.js +5 -20
- package/es/targetSelector/index.js +15 -36
- package/es/targetSelector/optionIcon.js +1 -5
- package/es/targetSelector/optionMenu.js +0 -3
- package/es/userCondition/conditionTypeList.js +7 -12
- package/es/userCondition/conditionWrap.js +0 -2
- package/es/userCondition/conditions/cdpCondition.js +51 -97
- package/es/userCondition/conditions/eventCondition.js +6 -16
- package/es/userCondition/conditions/periodCondition.js +8 -26
- package/es/userCondition/conditions/propCondition.js +29 -61
- package/es/userCondition/conditions/runTimesCondition.js +5 -10
- package/es/userCondition/conditions/tagsCondition.d.ts +1 -1
- package/es/userCondition/conditions/tagsCondition.js +15 -33
- package/es/userCondition/conditions/textDesc.js +16 -67
- package/es/userCondition/demo/index.js +11 -21
- package/es/userCondition/index.js +51 -91
- package/es/userCondition/orConditions.js +11 -48
- package/es/userCondition/relationLabel.js +1 -4
- package/es/userCondition/types.d.ts +1 -1
- package/es/userCondition/types.js +0 -1
- package/es/userCondition/util.js +4 -13
- package/es/userGroup/demo/group.js +14 -23
- package/es/userGroup/demo/index.js +5 -15
- package/es/userGroup/index.js +12 -30
- package/es/userTagsSelector/cascaderOverlay.js +19 -51
- package/es/userTagsSelector/components/search/index.js +0 -2
- package/es/userTagsSelector/demo/index.js +0 -3
- package/es/userTagsSelector/groups/groupOption.js +6 -8
- package/es/userTagsSelector/groups/index.js +15 -30
- package/es/userTagsSelector/index.js +17 -35
- package/es/userTagsSelector/multipleCheckPanel/checkOption.js +3 -6
- package/es/userTagsSelector/multipleCheckPanel/index.js +8 -21
- package/es/userTagsSelector/util.js +0 -2
- package/es/utils/ajax.js +45 -71
- package/es/utils/base64.js +3 -22
- package/es/utils/type.d.ts +1 -1
- package/es/utils/type.js +4 -7
- package/es/utils/util.js +0 -16
- package/package.json +2 -2
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
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); }
|
|
2
|
+
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; }
|
|
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
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
5
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
6
|
+
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."); }
|
|
7
|
+
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); }
|
|
8
|
+
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; }
|
|
9
|
+
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
10
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
11
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
12
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
13
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
14
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
15
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
16
|
+
import { notification } from 'antd';
|
|
17
|
+
import SocketClientTypes from './types';
|
|
18
|
+
var SocketClient = /*#__PURE__*/function () {
|
|
19
|
+
function SocketClient(url, params) {
|
|
20
|
+
_classCallCheck(this, SocketClient);
|
|
21
|
+
this.client = void 0;
|
|
22
|
+
this.url = void 0;
|
|
23
|
+
this.params = void 0;
|
|
24
|
+
this.listeners = {};
|
|
25
|
+
this.catch = [];
|
|
26
|
+
this.url = url;
|
|
27
|
+
this.params = params;
|
|
28
|
+
this.open();
|
|
29
|
+
}
|
|
30
|
+
_createClass(SocketClient, [{
|
|
31
|
+
key: "emit",
|
|
32
|
+
value: function emit(event, payload) {
|
|
33
|
+
var _this$client, _this$client2;
|
|
34
|
+
switch ((_this$client = this.client) === null || _this$client === void 0 ? void 0 : _this$client.readyState) {
|
|
35
|
+
case WebSocket.CLOSED:
|
|
36
|
+
notification.warn({
|
|
37
|
+
message: '连接已关闭'
|
|
38
|
+
});
|
|
39
|
+
break;
|
|
40
|
+
case WebSocket.CLOSING:
|
|
41
|
+
notification.warn({
|
|
42
|
+
message: '正在关闭连接'
|
|
43
|
+
});
|
|
44
|
+
break;
|
|
45
|
+
case WebSocket.CONNECTING:
|
|
46
|
+
notification.warn({
|
|
47
|
+
message: '连接中'
|
|
48
|
+
});
|
|
49
|
+
this.catch.push([event, payload]);
|
|
50
|
+
break;
|
|
51
|
+
case WebSocket.OPEN:
|
|
52
|
+
(_this$client2 = this.client) === null || _this$client2 === void 0 ? void 0 : _this$client2.send(JSON.stringify({
|
|
53
|
+
type: SocketClientTypes.RequestType.normal,
|
|
54
|
+
data: {
|
|
55
|
+
event: event,
|
|
56
|
+
payload: payload
|
|
57
|
+
}
|
|
58
|
+
}));
|
|
59
|
+
break;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}, {
|
|
63
|
+
key: "on",
|
|
64
|
+
value: function on(type, handle) {
|
|
65
|
+
if (!this.listeners[type]) {
|
|
66
|
+
this.listeners[type] = [];
|
|
67
|
+
}
|
|
68
|
+
this.listeners[type].push(handle);
|
|
69
|
+
}
|
|
70
|
+
}, {
|
|
71
|
+
key: "onConnected",
|
|
72
|
+
value: function onConnected(handle) {
|
|
73
|
+
this.on(SocketClientTypes.EventType.connected, handle);
|
|
74
|
+
}
|
|
75
|
+
}, {
|
|
76
|
+
key: "onDisconnected",
|
|
77
|
+
value: function onDisconnected(handle) {
|
|
78
|
+
this.on(SocketClientTypes.EventType.disconnected, handle);
|
|
79
|
+
}
|
|
80
|
+
}, {
|
|
81
|
+
key: "onError",
|
|
82
|
+
value: function onError(handle) {
|
|
83
|
+
this.on(SocketClientTypes.EventType.error, handle);
|
|
84
|
+
}
|
|
85
|
+
}, {
|
|
86
|
+
key: "_onError",
|
|
87
|
+
value: function _onError(_event) {
|
|
88
|
+
var _this$listeners$error;
|
|
89
|
+
this.log('error', 'socket连接异常');
|
|
90
|
+
(_this$listeners$error = this.listeners['error']) === null || _this$listeners$error === void 0 ? void 0 : _this$listeners$error.forEach(function (handle) {
|
|
91
|
+
handle.call(undefined);
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
}, {
|
|
95
|
+
key: "_onClose",
|
|
96
|
+
value: function _onClose(_event) {
|
|
97
|
+
var _this$listeners$disco;
|
|
98
|
+
this.log('error', 'socket连接已关闭');
|
|
99
|
+
(_this$listeners$disco = this.listeners['disconnected']) === null || _this$listeners$disco === void 0 ? void 0 : _this$listeners$disco.forEach(function (handle) {
|
|
100
|
+
handle.call(undefined);
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
}, {
|
|
104
|
+
key: "_onOpen",
|
|
105
|
+
value: function _onOpen(event) {
|
|
106
|
+
var _this$listeners$conne,
|
|
107
|
+
_this = this;
|
|
108
|
+
this.log('info', 'socket连接成功', event);
|
|
109
|
+
this.login();
|
|
110
|
+
(_this$listeners$conne = this.listeners['connected']) === null || _this$listeners$conne === void 0 ? void 0 : _this$listeners$conne.forEach(function (handle) {
|
|
111
|
+
handle.call(undefined);
|
|
112
|
+
});
|
|
113
|
+
this.catch.forEach(function (_ref) {
|
|
114
|
+
var _ref2 = _slicedToArray(_ref, 2),
|
|
115
|
+
event = _ref2[0],
|
|
116
|
+
payload = _ref2[1];
|
|
117
|
+
_this.emit(event, payload);
|
|
118
|
+
});
|
|
119
|
+
this.catch = [];
|
|
120
|
+
this.ping();
|
|
121
|
+
}
|
|
122
|
+
}, {
|
|
123
|
+
key: "onMessage",
|
|
124
|
+
value: function onMessage(event) {
|
|
125
|
+
var res = JSON.parse(event.data);
|
|
126
|
+
var res_ = res.data;
|
|
127
|
+
try {
|
|
128
|
+
res_ = JSON.parse(res.data);
|
|
129
|
+
} catch (e) {
|
|
130
|
+
this.log('info', '非json响应', res_);
|
|
131
|
+
}
|
|
132
|
+
var data = res_.data;
|
|
133
|
+
if (!data || !data.event) return;
|
|
134
|
+
if (this.listeners[data.event]) {
|
|
135
|
+
this.listeners[data.event].forEach(function (handle) {
|
|
136
|
+
handle.call(undefined, data.payload);
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
}, {
|
|
141
|
+
key: "ping",
|
|
142
|
+
value: function ping() {
|
|
143
|
+
var _this2 = this;
|
|
144
|
+
setInterval(function () {
|
|
145
|
+
var _this2$client;
|
|
146
|
+
(_this2$client = _this2.client) === null || _this2$client === void 0 ? void 0 : _this2$client.send(JSON.stringify({
|
|
147
|
+
type: SocketClientTypes.RequestType.ping
|
|
148
|
+
}));
|
|
149
|
+
}, 3000);
|
|
150
|
+
}
|
|
151
|
+
}, {
|
|
152
|
+
key: "removeAllListeners",
|
|
153
|
+
value: function removeAllListeners() {
|
|
154
|
+
this.listeners = {};
|
|
155
|
+
}
|
|
156
|
+
}, {
|
|
157
|
+
key: "removeListener",
|
|
158
|
+
value: function removeListener(event, handle) {
|
|
159
|
+
var _this3 = this;
|
|
160
|
+
if (handle) {
|
|
161
|
+
this.listeners[event].forEach(function (item, i) {
|
|
162
|
+
if (item === handle) {
|
|
163
|
+
_this3.listeners[event].splice(i, 1);
|
|
164
|
+
}
|
|
165
|
+
});
|
|
166
|
+
} else {
|
|
167
|
+
this.listeners[event] = [];
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
}, {
|
|
171
|
+
key: "login",
|
|
172
|
+
value: function login() {
|
|
173
|
+
var _this$client3;
|
|
174
|
+
this.log('info', '开始登录', this.params);
|
|
175
|
+
(_this$client3 = this.client) === null || _this$client3 === void 0 ? void 0 : _this$client3.send(JSON.stringify(_objectSpread({
|
|
176
|
+
type: SocketClientTypes.RequestType.normal
|
|
177
|
+
}, this.params)));
|
|
178
|
+
}
|
|
179
|
+
}, {
|
|
180
|
+
key: "open",
|
|
181
|
+
value: function open(url, params) {
|
|
182
|
+
this.params = params || this.params;
|
|
183
|
+
if (this.client) this.close();
|
|
184
|
+
var client = new WebSocket(url || this.url);
|
|
185
|
+
this.client = client;
|
|
186
|
+
client.onmessage = this.onMessage.bind(this);
|
|
187
|
+
client.onerror = this._onError.bind(this);
|
|
188
|
+
client.onclose = this._onClose.bind(this);
|
|
189
|
+
client.onopen = this._onOpen.bind(this);
|
|
190
|
+
}
|
|
191
|
+
}, {
|
|
192
|
+
key: "close",
|
|
193
|
+
value: function close() {
|
|
194
|
+
var _this$client4;
|
|
195
|
+
(_this$client4 = this.client) === null || _this$client4 === void 0 ? void 0 : _this$client4.close();
|
|
196
|
+
this.log('info', '关闭socket连接');
|
|
197
|
+
}
|
|
198
|
+
}, {
|
|
199
|
+
key: "destroy",
|
|
200
|
+
value: function destroy() {
|
|
201
|
+
this.removeAllListeners();
|
|
202
|
+
this.close();
|
|
203
|
+
this.client = undefined;
|
|
204
|
+
}
|
|
205
|
+
}, {
|
|
206
|
+
key: "log",
|
|
207
|
+
value: function log(type) {
|
|
208
|
+
var _console;
|
|
209
|
+
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
210
|
+
args[_key - 1] = arguments[_key];
|
|
211
|
+
}
|
|
212
|
+
(_console = console)[type].apply(_console, args);
|
|
213
|
+
}
|
|
214
|
+
}]);
|
|
215
|
+
return SocketClient;
|
|
216
|
+
}();
|
|
217
|
+
export default SocketClient;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
declare namespace SocketClientTypes {
|
|
2
|
+
enum EventType {
|
|
3
|
+
connected = "connected",
|
|
4
|
+
disconnected = "disconnected",
|
|
5
|
+
error = "error"
|
|
6
|
+
}
|
|
7
|
+
enum RequestType {
|
|
8
|
+
common = 0,
|
|
9
|
+
ping = 1,
|
|
10
|
+
login = 3,
|
|
11
|
+
normal = 5,
|
|
12
|
+
img = 6
|
|
13
|
+
}
|
|
14
|
+
type Message = {
|
|
15
|
+
type: RequestType;
|
|
16
|
+
data: {
|
|
17
|
+
event: string;
|
|
18
|
+
payload: Record<string, any> | string | number | boolean;
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
interface ResponseData {
|
|
22
|
+
code: string;
|
|
23
|
+
data: Message;
|
|
24
|
+
}
|
|
25
|
+
type Handler = (msg?: Message['data']['payload']) => void;
|
|
26
|
+
}
|
|
27
|
+
export default SocketClientTypes;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
var SocketClientTypes;
|
|
2
|
+
(function (SocketClientTypes) {
|
|
3
|
+
var EventType;
|
|
4
|
+
(function (EventType) {
|
|
5
|
+
EventType["connected"] = "connected";
|
|
6
|
+
EventType["disconnected"] = "disconnected";
|
|
7
|
+
EventType["error"] = "error";
|
|
8
|
+
})(EventType = SocketClientTypes.EventType || (SocketClientTypes.EventType = {}));
|
|
9
|
+
var RequestType;
|
|
10
|
+
(function (RequestType) {
|
|
11
|
+
RequestType[RequestType["common"] = 0] = "common";
|
|
12
|
+
RequestType[RequestType["ping"] = 1] = "ping";
|
|
13
|
+
RequestType[RequestType["login"] = 3] = "login";
|
|
14
|
+
RequestType[RequestType["normal"] = 5] = "normal";
|
|
15
|
+
RequestType[RequestType["img"] = 6] = "img";
|
|
16
|
+
})(RequestType = SocketClientTypes.RequestType || (SocketClientTypes.RequestType = {}));
|
|
17
|
+
})(SocketClientTypes || (SocketClientTypes = {}));
|
|
18
|
+
export default SocketClientTypes;
|
|
@@ -24,7 +24,6 @@ export var columns = [{
|
|
|
24
24
|
}
|
|
25
25
|
}];
|
|
26
26
|
var tableData = [];
|
|
27
|
-
|
|
28
27
|
for (var i = 0; i < 100; i++) {
|
|
29
28
|
tableData.push({
|
|
30
29
|
key: i,
|
|
@@ -33,5 +32,4 @@ for (var i = 0; i < 100; i++) {
|
|
|
33
32
|
address: "London Park no. ".concat(i)
|
|
34
33
|
});
|
|
35
34
|
}
|
|
36
|
-
|
|
37
35
|
export default tableData;
|
package/es/table/demo/index.js
CHANGED
|
@@ -1,38 +1,26 @@
|
|
|
1
|
+
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); }
|
|
1
2
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
2
|
-
|
|
3
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
4
|
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
6
|
-
|
|
7
5
|
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
8
|
-
|
|
9
6
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
10
|
-
|
|
11
7
|
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
|
-
|
|
8
|
+
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
15
9
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
16
|
-
|
|
17
10
|
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
11
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
20
|
-
|
|
21
|
-
function
|
|
22
|
-
|
|
12
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
13
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
14
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
23
15
|
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
16
|
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
|
-
|
|
17
|
+
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; }
|
|
29
18
|
import React, { useEffect, useState } from 'react';
|
|
30
19
|
import { BizTable } from '@zgfe/business-lib';
|
|
31
20
|
import util from '../../utils/util';
|
|
32
21
|
import chartData from './data/data';
|
|
33
22
|
import { chartColors as color } from './data/color';
|
|
34
23
|
import '@zgfe/business-lib/es/assets/styles/resetAntd.less';
|
|
35
|
-
|
|
36
24
|
var getColumn = function getColumn(columnData) {
|
|
37
25
|
var data = [{
|
|
38
26
|
title: '显示',
|
|
@@ -45,7 +33,6 @@ var getColumn = function getColumn(columnData) {
|
|
|
45
33
|
for (var _len = arguments.length, res = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
46
34
|
res[_key] = arguments[_key];
|
|
47
35
|
}
|
|
48
|
-
|
|
49
36
|
return /*#__PURE__*/React.createElement("div", {
|
|
50
37
|
style: {
|
|
51
38
|
width: '12px',
|
|
@@ -63,10 +50,8 @@ var getColumn = function getColumn(columnData) {
|
|
|
63
50
|
ellipsis: true,
|
|
64
51
|
fixed: 'left'
|
|
65
52
|
}];
|
|
66
|
-
|
|
67
53
|
for (var i = 0; i < columnData.length; i++) {
|
|
68
54
|
var value = columnData[i];
|
|
69
|
-
|
|
70
55
|
if (/^\d{4}-\d{2}-\d{2}$/.test(value)) {
|
|
71
56
|
value = value.replace(/\d{4}-/, '');
|
|
72
57
|
} else if (/^\d{4}-\d{2}-\d{2}\|\d{4}-\d{2}-\d{2}$/.test(value)) {
|
|
@@ -74,14 +59,12 @@ var getColumn = function getColumn(columnData) {
|
|
|
74
59
|
value = dates ? dates[0].replace(/\d{4}-/, '') + '~' + dates[1].replace(/\d{4}-/, '') : value;
|
|
75
60
|
} else {
|
|
76
61
|
value = util.strMiddleSplit(value);
|
|
77
|
-
|
|
78
62
|
if (/:/.test(value)) {
|
|
79
63
|
value = value.replace(/\d{4}-\d{2}-\d{2}\s/, '');
|
|
80
64
|
} else if (/,/.test(value)) {
|
|
81
65
|
value = value.replace(/,/g, '-');
|
|
82
66
|
}
|
|
83
67
|
}
|
|
84
|
-
|
|
85
68
|
data.push({
|
|
86
69
|
title: value,
|
|
87
70
|
width: 100,
|
|
@@ -95,7 +78,6 @@ var getColumn = function getColumn(columnData) {
|
|
|
95
78
|
}
|
|
96
79
|
});
|
|
97
80
|
}
|
|
98
|
-
|
|
99
81
|
data.push({
|
|
100
82
|
title: '操作',
|
|
101
83
|
dataIndex: 'operation',
|
|
@@ -108,13 +90,10 @@ var getColumn = function getColumn(columnData) {
|
|
|
108
90
|
});
|
|
109
91
|
return data;
|
|
110
92
|
};
|
|
111
|
-
|
|
112
93
|
var formateTableData = function formateTableData(sData) {
|
|
113
94
|
var tableData = [];
|
|
114
|
-
|
|
115
95
|
var _iterator = _createForOfIteratorHelper(sData),
|
|
116
|
-
|
|
117
|
-
|
|
96
|
+
_step;
|
|
118
97
|
try {
|
|
119
98
|
var _loop = function _loop() {
|
|
120
99
|
var row = _step.value;
|
|
@@ -128,7 +107,6 @@ var formateTableData = function formateTableData(sData) {
|
|
|
128
107
|
});
|
|
129
108
|
tableData.push(_objectSpread({}, item));
|
|
130
109
|
};
|
|
131
|
-
|
|
132
110
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
133
111
|
_loop();
|
|
134
112
|
}
|
|
@@ -137,21 +115,17 @@ var formateTableData = function formateTableData(sData) {
|
|
|
137
115
|
} finally {
|
|
138
116
|
_iterator.f();
|
|
139
117
|
}
|
|
140
|
-
|
|
141
118
|
return tableData;
|
|
142
119
|
};
|
|
143
|
-
|
|
144
120
|
export default (function () {
|
|
145
121
|
var _useState = useState([]),
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
122
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
123
|
+
columns = _useState2[0],
|
|
124
|
+
setColumns = _useState2[1];
|
|
150
125
|
var _useState3 = useState([]),
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
126
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
127
|
+
tableData = _useState4[0],
|
|
128
|
+
setTableData = _useState4[1];
|
|
155
129
|
useEffect(function () {
|
|
156
130
|
var data = getColumn(chartData.xData);
|
|
157
131
|
setColumns(function () {
|
package/es/table/demo/index2.js
CHANGED
|
@@ -1,28 +1,20 @@
|
|
|
1
1
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
2
|
-
|
|
3
2
|
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
3
|
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
|
|
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
|
-
|
|
4
|
+
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; }
|
|
5
|
+
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
11
6
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
12
|
-
|
|
13
7
|
import React, { useEffect, useState } from 'react';
|
|
14
8
|
import { BizTable } from '@zgfe/business-lib';
|
|
15
9
|
import { columns } from './data/table';
|
|
16
10
|
export default (function () {
|
|
17
11
|
var _useState = useState([]),
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
12
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
13
|
+
tableData = _useState2[0],
|
|
14
|
+
setTableData = _useState2[1];
|
|
22
15
|
var getData = function getData(pagination) {
|
|
23
16
|
var current = pagination && pagination.current || 0;
|
|
24
17
|
var data = [];
|
|
25
|
-
|
|
26
18
|
for (var i = 0; i < 10; i++) {
|
|
27
19
|
data.push({
|
|
28
20
|
key: current * 10 + i,
|
|
@@ -31,12 +23,10 @@ export default (function () {
|
|
|
31
23
|
address: "London Park no. ".concat(current * 10 + i)
|
|
32
24
|
});
|
|
33
25
|
}
|
|
34
|
-
|
|
35
26
|
setTableData(function () {
|
|
36
27
|
return data;
|
|
37
28
|
});
|
|
38
29
|
};
|
|
39
|
-
|
|
40
30
|
useEffect(function () {
|
|
41
31
|
getData();
|
|
42
32
|
}, []);
|
package/es/table/demo/index3.js
CHANGED
|
@@ -1,23 +1,13 @@
|
|
|
1
1
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
2
|
-
|
|
3
2
|
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
3
|
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
6
|
-
|
|
7
4
|
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
8
|
-
|
|
9
5
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
10
|
-
|
|
11
6
|
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
7
|
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
|
|
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
|
-
|
|
8
|
+
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; }
|
|
9
|
+
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
19
10
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
20
|
-
|
|
21
11
|
import React, { useEffect, useState } from 'react';
|
|
22
12
|
import { BizTable } from '@zgfe/business-lib';
|
|
23
13
|
var dataSource2 = [{
|
|
@@ -137,10 +127,9 @@ var column2 = [{
|
|
|
137
127
|
}];
|
|
138
128
|
export default (function () {
|
|
139
129
|
var _useState = useState([]),
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
130
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
131
|
+
tableData = _useState2[0],
|
|
132
|
+
setTableData = _useState2[1];
|
|
144
133
|
var sortData = function sortData(data) {
|
|
145
134
|
var compare = function compare(a, b) {
|
|
146
135
|
if (a.attr1 !== b.attr1) {
|
|
@@ -151,35 +140,28 @@ export default (function () {
|
|
|
151
140
|
return a.attr3 - b.attr3;
|
|
152
141
|
}
|
|
153
142
|
};
|
|
154
|
-
|
|
155
143
|
data.sort(compare);
|
|
156
144
|
return data;
|
|
157
145
|
};
|
|
158
|
-
|
|
159
146
|
var mergeRow = function mergeRow(source, field, field2, field3) {
|
|
160
147
|
var count = 0,
|
|
161
|
-
|
|
162
|
-
|
|
148
|
+
scount = 0,
|
|
149
|
+
tcount = 0;
|
|
163
150
|
var indexCount = 1;
|
|
164
151
|
var data = JSON.parse(JSON.stringify(source));
|
|
165
|
-
|
|
166
152
|
while (indexCount < data.length) {
|
|
167
153
|
var item = data.slice(count, count + 1)[0];
|
|
168
|
-
|
|
169
154
|
if (!item["".concat(field, "RowSpan")]) {
|
|
170
155
|
item["".concat(field, "RowSpan")] = 1;
|
|
171
156
|
item["".concat(field2, "RowSpan")] = 1;
|
|
172
157
|
item["".concat(field3, "RowSpan")] = 1;
|
|
173
158
|
}
|
|
174
|
-
|
|
175
159
|
if (item[field] === data[indexCount][field]) {
|
|
176
160
|
item["".concat(field, "RowSpan")]++;
|
|
177
161
|
data[indexCount]["".concat(field, "RowSpan")] = 0;
|
|
178
|
-
|
|
179
162
|
if (data[scount][field2] === data[indexCount][field2]) {
|
|
180
163
|
data[scount]["".concat(field2, "RowSpan")]++;
|
|
181
164
|
data[indexCount]["".concat(field2, "RowSpan")] = 0;
|
|
182
|
-
|
|
183
165
|
if (data[tcount][field3] === data[indexCount][field3]) {
|
|
184
166
|
data[tcount]["".concat(field3, "RowSpan")]++;
|
|
185
167
|
data[indexCount]["".concat(field3, "RowSpan")] = 0;
|
|
@@ -198,13 +180,10 @@ export default (function () {
|
|
|
198
180
|
scount = indexCount;
|
|
199
181
|
tcount = indexCount;
|
|
200
182
|
}
|
|
201
|
-
|
|
202
183
|
indexCount++;
|
|
203
184
|
}
|
|
204
|
-
|
|
205
185
|
return data;
|
|
206
186
|
};
|
|
207
|
-
|
|
208
187
|
useEffect(function () {
|
|
209
188
|
var data = mergeRow(sortData(dataSource2), 'attr1', 'attr2', 'attr3');
|
|
210
189
|
setTableData(function () {
|
package/es/table/index.js
CHANGED
|
@@ -1,59 +1,42 @@
|
|
|
1
1
|
var _excluded = ["dataSource", "columns", "total", "scroll", "pageSize", "pagination"];
|
|
2
|
-
|
|
3
2
|
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
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; }
|
|
6
|
-
|
|
7
|
-
function
|
|
8
|
-
|
|
4
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
5
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
6
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
9
7
|
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); }
|
|
10
|
-
|
|
11
8
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
12
|
-
|
|
13
9
|
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."); }
|
|
14
|
-
|
|
15
10
|
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); }
|
|
16
|
-
|
|
17
|
-
function
|
|
18
|
-
|
|
19
|
-
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; }
|
|
20
|
-
|
|
11
|
+
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; }
|
|
12
|
+
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
21
13
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
22
|
-
|
|
23
14
|
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; }
|
|
24
|
-
|
|
25
15
|
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; }
|
|
26
|
-
|
|
27
16
|
import { Table } from 'antd';
|
|
28
17
|
import React, { useMemo, useState } from 'react';
|
|
29
18
|
import './styles/index.less';
|
|
30
|
-
|
|
31
19
|
var BizTable = function BizTable(props) {
|
|
32
20
|
var dataSource = props.dataSource,
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
21
|
+
columns = props.columns,
|
|
22
|
+
total = props.total,
|
|
23
|
+
scroll = props.scroll,
|
|
24
|
+
pageSize = props.pageSize,
|
|
25
|
+
pagination = props.pagination,
|
|
26
|
+
res = _objectWithoutProperties(props, _excluded);
|
|
40
27
|
var _useState = useState(scroll),
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
28
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
29
|
+
scrollData = _useState2[0],
|
|
30
|
+
setScrollData = _useState2[1];
|
|
45
31
|
var paginationObj = useMemo(function () {
|
|
46
32
|
if (_typeof(pagination) === 'object') {
|
|
47
33
|
return _objectSpread({}, pagination);
|
|
48
34
|
}
|
|
49
|
-
|
|
50
35
|
return {};
|
|
51
36
|
}, [pagination]);
|
|
52
|
-
|
|
53
37
|
var onChangePage = function onChangePage(page, pageSize) {
|
|
54
38
|
var count = page * pageSize;
|
|
55
39
|
var totalCount = total || dataSource.length;
|
|
56
|
-
|
|
57
40
|
if (pageSize > 10 && (count <= totalCount || totalCount - (page - 1) * pageSize > 10)) {
|
|
58
41
|
setScrollData(function (data) {
|
|
59
42
|
return _objectSpread(_objectSpread({}, data), {}, {
|
|
@@ -67,7 +50,6 @@ var BizTable = function BizTable(props) {
|
|
|
67
50
|
});
|
|
68
51
|
}
|
|
69
52
|
};
|
|
70
|
-
|
|
71
53
|
return /*#__PURE__*/React.createElement(Table, _objectSpread(_objectSpread({}, res), {}, {
|
|
72
54
|
columns: columns,
|
|
73
55
|
dataSource: dataSource,
|
|
@@ -86,7 +68,6 @@ var BizTable = function BizTable(props) {
|
|
|
86
68
|
scroll: scrollData
|
|
87
69
|
}));
|
|
88
70
|
};
|
|
89
|
-
|
|
90
71
|
BizTable.defaultProps = {
|
|
91
72
|
pageSize: 10,
|
|
92
73
|
pagination: true
|