@chaoswise/ui 2.3.5 → 2.3.6
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/lib/CWMessage/index.js
CHANGED
|
@@ -240,11 +240,12 @@ function Message(props) {
|
|
|
240
240
|
});
|
|
241
241
|
socket.on("push", /*#__PURE__*/function () {
|
|
242
242
|
var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(data) {
|
|
243
|
-
var _JSON$parse,
|
|
243
|
+
var _JSON$parse, count, message, _ref6, _ref6$total, total, noticeMessage, userMessageId, type, _ref7, enable, mode, _ref7$time, time;
|
|
244
244
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
245
245
|
while (1) switch (_context3.prev = _context3.next) {
|
|
246
246
|
case 0:
|
|
247
|
-
_JSON$parse = JSON.parse(data),
|
|
247
|
+
_JSON$parse = JSON.parse(data), count = _JSON$parse.count, message = _JSON$parse.message;
|
|
248
|
+
_ref6 = count || {}, _ref6$total = _ref6.total, total = _ref6$total === void 0 ? 0 : _ref6$total;
|
|
248
249
|
setMessageTotal(total);
|
|
249
250
|
onSocketChange(JSON.parse(data));
|
|
250
251
|
if (message) {
|
|
@@ -252,14 +253,14 @@ function Message(props) {
|
|
|
252
253
|
if (noticeMessage) {
|
|
253
254
|
userMessageId = noticeMessage.id, type = noticeMessage.type;
|
|
254
255
|
if (userMessageId) {
|
|
255
|
-
|
|
256
|
+
_ref7 = messageOptionRef.current[type] || {}, enable = _ref7.enable, mode = _ref7.mode, _ref7$time = _ref7.time, time = _ref7$time === void 0 ? 5 : _ref7$time;
|
|
256
257
|
if (enable) {
|
|
257
258
|
openNotification(time, userMessageId);
|
|
258
259
|
}
|
|
259
260
|
}
|
|
260
261
|
}
|
|
261
262
|
}
|
|
262
|
-
case
|
|
263
|
+
case 5:
|
|
263
264
|
case "end":
|
|
264
265
|
return _context3.stop();
|
|
265
266
|
}
|
|
@@ -303,7 +304,7 @@ function Message(props) {
|
|
|
303
304
|
};
|
|
304
305
|
}();
|
|
305
306
|
var getMessageQuerySettings = /*#__PURE__*/function () {
|
|
306
|
-
var
|
|
307
|
+
var _ref9 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
|
|
307
308
|
var resRequestApi, res, data;
|
|
308
309
|
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
309
310
|
while (1) switch (_context6.prev = _context6.next) {
|
|
@@ -324,7 +325,7 @@ function Message(props) {
|
|
|
324
325
|
}, _callee6);
|
|
325
326
|
}));
|
|
326
327
|
return function getMessageQuerySettings() {
|
|
327
|
-
return
|
|
328
|
+
return _ref9.apply(this, arguments);
|
|
328
329
|
};
|
|
329
330
|
}();
|
|
330
331
|
return /*#__PURE__*/React.createElement("div", {
|
|
@@ -264,9 +264,8 @@ var CWRangePicker = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
264
264
|
var _values = [];
|
|
265
265
|
if (values) {
|
|
266
266
|
_values = computedRecentlyValue(values);
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
}
|
|
267
|
+
} else {
|
|
268
|
+
_values = getChangeUnitDate(captureUnit[0], captureUnit[1]);
|
|
270
269
|
}
|
|
271
270
|
var newValue = _objectSpread(_objectSpread({}, recordDateValue), {}, {
|
|
272
271
|
timeDomain: recordUnit,
|
|
@@ -44,6 +44,10 @@ var ErrorBoundary = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
44
44
|
localStorage.setItem('ChunkLoadError', '');
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
|
+
// 热更新导致mobx报错,reload页面
|
|
48
|
+
if (error.message.includes('The set of provided stores has changed')) {
|
|
49
|
+
window.location.reload();
|
|
50
|
+
}
|
|
47
51
|
});
|
|
48
52
|
_this.state = {
|
|
49
53
|
hasError: false
|
|
@@ -35,7 +35,7 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
|
35
35
|
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; }
|
|
36
36
|
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; }
|
|
37
37
|
import React, { useState, useEffect, Fragment, forwardRef, useMemo } from "react";
|
|
38
|
-
import { filterTreeByName, filterTreeByNameTable, filterObj, getNotSelectKeys, getKeysAndTitle, getBottomKey, renderLeafNodetree, renderRelationNode } from "./utils";
|
|
38
|
+
import { filterTreeByName, filterTree, filterTreeByNameTable, filterObj, getNotSelectKeys, getKeysAndTitle, getBottomKey, renderLeafNodetree, renderRelationNode } from "./utils";
|
|
39
39
|
import classnames from "classnames";
|
|
40
40
|
import CheckList from "./CheckList";
|
|
41
41
|
import PropTypes from "prop-types";
|
|
@@ -302,7 +302,7 @@ var QuickTransfer = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
302
302
|
});
|
|
303
303
|
}
|
|
304
304
|
if (type === "tree") {
|
|
305
|
-
newCheckedValue =
|
|
305
|
+
newCheckedValue = filterTree(checkValue, searchValue);
|
|
306
306
|
}
|
|
307
307
|
if (type === "table") {
|
|
308
308
|
newCheckedValue = filterTreeByNameTable(checkValue, searchValue, renderColumns ? renderColumns : newRenderColumns);
|
|
@@ -341,7 +341,7 @@ var QuickTransfer = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
341
341
|
setListCheckedStyle(listCheckedKeys_, newData);
|
|
342
342
|
}
|
|
343
343
|
if (type === "tree") {
|
|
344
|
-
newData =
|
|
344
|
+
newData = filterTree(dataSource, searchValue);
|
|
345
345
|
setData(newData);
|
|
346
346
|
}
|
|
347
347
|
if (type === "table") {
|
|
@@ -27,7 +27,7 @@ export var isShowByloopChidren = function isShowByloopChidren(list, searchInfo)
|
|
|
27
27
|
};
|
|
28
28
|
//搜索树
|
|
29
29
|
export var filterTreeByName = function filterTreeByName(organizationList, searchValue) {
|
|
30
|
-
if (searchValue
|
|
30
|
+
if (!searchValue) {
|
|
31
31
|
return organizationList;
|
|
32
32
|
}
|
|
33
33
|
//先过滤最顶层树
|
|
@@ -48,6 +48,55 @@ export var filterTreeByName = function filterTreeByName(organizationList, search
|
|
|
48
48
|
return item;
|
|
49
49
|
});
|
|
50
50
|
};
|
|
51
|
+
export var KMPMatch = function KMPMatch(str, pattern) {
|
|
52
|
+
var next = generateNextArr(pattern);
|
|
53
|
+
var i = 0; // str 指针
|
|
54
|
+
var j = 0; // pattern指针
|
|
55
|
+
while (i < str.length && j < pattern.length) {
|
|
56
|
+
if (str[i] === pattern[j] || j === -1) {
|
|
57
|
+
i++;
|
|
58
|
+
j++;
|
|
59
|
+
} else {
|
|
60
|
+
j = next[j]; // 右移
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
if (j === pattern.length) {
|
|
65
|
+
return i - j;
|
|
66
|
+
} else {
|
|
67
|
+
return -1;
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
function generateNextArr(pattern) {
|
|
71
|
+
var i = 0;
|
|
72
|
+
var j = -1;
|
|
73
|
+
var next = [];
|
|
74
|
+
next[0] = -1;
|
|
75
|
+
while (i < pattern.length) {
|
|
76
|
+
if (j === -1 || pattern[i] === pattern[j]) {
|
|
77
|
+
i++;
|
|
78
|
+
j++;
|
|
79
|
+
next[i] = j;
|
|
80
|
+
} else {
|
|
81
|
+
j = next[j];
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
return next;
|
|
85
|
+
}
|
|
86
|
+
export var filterTree = function filterTree(list, searchValue) {
|
|
87
|
+
return list.reduce(function (t, c) {
|
|
88
|
+
if (!searchValue) {
|
|
89
|
+
return t.concat(c);
|
|
90
|
+
} else {
|
|
91
|
+
var title = c.title,
|
|
92
|
+
children = c.children;
|
|
93
|
+
var res = children ? filterTree(children, searchValue) : undefined;
|
|
94
|
+
return KMPMatch(title.toLowerCase(), searchValue.toLowerCase()) > -1 || res && res.length > 0 ? t.concat(children ? _objectSpread(_objectSpread({}, c), {}, {
|
|
95
|
+
children: res
|
|
96
|
+
}) : c) : t;
|
|
97
|
+
}
|
|
98
|
+
}, []);
|
|
99
|
+
};
|
|
51
100
|
export var isShowByloopChidrenTable = function isShowByloopChidrenTable(list, searchInfo, searchColumns) {
|
|
52
101
|
var isTrue = false;
|
|
53
102
|
var _loop = function _loop() {
|
|
@@ -131,8 +180,9 @@ export var getKeysAndTitle = function getKeysAndTitle(arr) {
|
|
|
131
180
|
disabled = _ref2.disabled;
|
|
132
181
|
!disabled && keys.push({
|
|
133
182
|
key: item.key,
|
|
134
|
-
title: item.props.title
|
|
183
|
+
title: item.props.originTitle // 不能用item.props.title(节点形式)
|
|
135
184
|
});
|
|
185
|
+
|
|
136
186
|
if (item.props.children && item.props.children.length > 0) {
|
|
137
187
|
keys = keys.concat(getKeysAndTitle(item.props.children));
|
|
138
188
|
}
|
|
@@ -149,7 +199,8 @@ export var getBottomKey = function getBottomKey(arr) {
|
|
|
149
199
|
disabled = _ref3.disabled;
|
|
150
200
|
!disabled && keys.push({
|
|
151
201
|
key: item.key,
|
|
152
|
-
title: item.props.
|
|
202
|
+
title: item.props.originTitle,
|
|
203
|
+
// 不能用item.props.title(节点形式)
|
|
153
204
|
children: item.props.children
|
|
154
205
|
});
|
|
155
206
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@chaoswise/ui",
|
|
3
|
-
"version": "2.3.
|
|
3
|
+
"version": "2.3.6",
|
|
4
4
|
"description": "公共UI库",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ui",
|
|
@@ -140,5 +140,5 @@
|
|
|
140
140
|
"access": "public"
|
|
141
141
|
},
|
|
142
142
|
"license": "MIT",
|
|
143
|
-
"gitHead": "
|
|
143
|
+
"gitHead": "6c8d75666cf9208346704fc975f2aa9bbe148e11"
|
|
144
144
|
}
|