@sis-cc/dotstatsuite-visions 12.28.0 → 12.30.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/CollapsibleTree/CollapsibleTree.js +8 -1
- package/es/VirtualizedTree/withSpotlight.js +10 -10
- package/es/utils.js +8 -0
- package/lib/CollapsibleTree/CollapsibleTree.js +14 -1
- package/lib/VirtualizedTree/withSpotlight.js +11 -10
- package/lib/utils.js +12 -1
- package/package.json +2 -1
- package/umd/@sis-cc/dotstatsuite-visions.js +1786 -1446
- package/umd/@sis-cc/dotstatsuite-visions.min.js +17 -17
- package/umd/@sis-cc/dotstatsuite-visions.min.js.map +1 -1
|
@@ -14,9 +14,11 @@ import IconButton from '@mui/material/IconButton';
|
|
|
14
14
|
import KeyboardArrowDownIcon from '@mui/icons-material/KeyboardArrowDown';
|
|
15
15
|
import KeyboardArrowUpIcon from '@mui/icons-material/KeyboardArrowUp';
|
|
16
16
|
import CircularProgress from '@mui/material/CircularProgress';
|
|
17
|
+
import InfoIcon from '@mui/icons-material/Info';
|
|
17
18
|
import Grid from '@mui/material/Grid';
|
|
18
19
|
import Collapse, { VARIANT_BOLD } from './Collapse';
|
|
19
20
|
import cx from 'classnames';
|
|
21
|
+
import NoData from '../NoData/NoData';
|
|
20
22
|
|
|
21
23
|
var useStyles = makeStyles(function (theme) {
|
|
22
24
|
return {
|
|
@@ -126,6 +128,10 @@ var CollapsibleTree = function CollapsibleTree(_ref) {
|
|
|
126
128
|
)
|
|
127
129
|
)
|
|
128
130
|
),
|
|
131
|
+
R.isEmpty(data) && React.createElement(NoData, {
|
|
132
|
+
message: R.prop('noData', labels) || 'no data',
|
|
133
|
+
icon: React.createElement(InfoIcon, { color: 'primary', fontSize: 'large' })
|
|
134
|
+
}),
|
|
129
135
|
R.map(function (_ref3) {
|
|
130
136
|
var id = _ref3.id,
|
|
131
137
|
label = _ref3.label,
|
|
@@ -210,7 +216,8 @@ CollapsibleTree.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
|
210
216
|
labels: PropTypes.shape({
|
|
211
217
|
collapseAll: PropTypes.string,
|
|
212
218
|
expandAll: PropTypes.string,
|
|
213
|
-
noValue: PropTypes.string
|
|
219
|
+
noValue: PropTypes.string,
|
|
220
|
+
noData: PropTypes.string
|
|
214
221
|
}),
|
|
215
222
|
testId: PropTypes.string,
|
|
216
223
|
valueHandler: PropTypes.func,
|
|
@@ -6,6 +6,7 @@ function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in ob
|
|
|
6
6
|
import * as R from 'ramda';
|
|
7
7
|
import React, { useEffect, useMemo, useState } from 'react';
|
|
8
8
|
import { getDescendants, getHierarchicalId } from './utils';
|
|
9
|
+
import { prepareTerm, searchTerm } from '../utils';
|
|
9
10
|
|
|
10
11
|
export var spotlightFilter = function spotlightFilter(term) {
|
|
11
12
|
var labelRenderer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : R.prop('label');
|
|
@@ -29,23 +30,22 @@ export var spotlightFilter = function spotlightFilter(term) {
|
|
|
29
30
|
}
|
|
30
31
|
return acc;
|
|
31
32
|
};
|
|
32
|
-
var matchRegExp = function matchRegExp(str) {
|
|
33
|
-
return str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
34
|
-
};
|
|
35
33
|
|
|
36
34
|
// Highlight matching terms in the label
|
|
37
35
|
var highlightLabel = function highlightLabel(label) {
|
|
38
|
-
var
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
36
|
+
var i = prepareTerm(label).indexOf(prepareTerm(term));
|
|
37
|
+
var l = R.length(term);
|
|
38
|
+
|
|
39
|
+
var pre = label.slice(0, i);
|
|
40
|
+
var match = label.slice(i, i + l);
|
|
41
|
+
var post = label.slice(i + l);
|
|
42
|
+
|
|
43
|
+
return pre + '<span style=background-color:yellow;border-bottom:2px solid #8CC841>' + match + '</span>' + post;
|
|
42
44
|
};
|
|
43
45
|
|
|
44
46
|
var recurse = function recurse(item) {
|
|
45
47
|
var label = labelRenderer(item);
|
|
46
|
-
var isValidItem =
|
|
47
|
-
return R.includes(R.toLower(term), R.toLower(item));
|
|
48
|
-
};
|
|
48
|
+
var isValidItem = searchTerm(term);
|
|
49
49
|
|
|
50
50
|
var result = [];
|
|
51
51
|
|
package/es/utils.js
CHANGED
|
@@ -3,6 +3,7 @@ var _extends = Object.assign || function (target) { for (var i = 1; i < argument
|
|
|
3
3
|
import React from 'react';
|
|
4
4
|
import * as R from 'ramda';
|
|
5
5
|
import dateFns from 'date-fns';
|
|
6
|
+
import * as diacritics from 'diacritics';
|
|
6
7
|
|
|
7
8
|
var spotlightHandler = function spotlightHandler(_ref) {
|
|
8
9
|
var term = _ref.term,
|
|
@@ -67,4 +68,11 @@ export var getIsRtl = function getIsRtl(theme) {
|
|
|
67
68
|
export var newDate = function newDate(stringDate) {
|
|
68
69
|
var date = new Date(stringDate);
|
|
69
70
|
return dateFns.addMinutes(date, date.getTimezoneOffset());
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
export var prepareTerm = R.pipe(diacritics.remove, R.toLower);
|
|
74
|
+
export var searchTerm = function searchTerm(term) {
|
|
75
|
+
return function (label) {
|
|
76
|
+
return R.includes(prepareTerm(term), prepareTerm(label));
|
|
77
|
+
};
|
|
70
78
|
};
|
|
@@ -52,6 +52,10 @@ var _CircularProgress = require('@mui/material/CircularProgress');
|
|
|
52
52
|
|
|
53
53
|
var _CircularProgress2 = _interopRequireDefault(_CircularProgress);
|
|
54
54
|
|
|
55
|
+
var _Info = require('@mui/icons-material/Info');
|
|
56
|
+
|
|
57
|
+
var _Info2 = _interopRequireDefault(_Info);
|
|
58
|
+
|
|
55
59
|
var _Grid = require('@mui/material/Grid');
|
|
56
60
|
|
|
57
61
|
var _Grid2 = _interopRequireDefault(_Grid);
|
|
@@ -64,6 +68,10 @@ var _classnames = require('classnames');
|
|
|
64
68
|
|
|
65
69
|
var _classnames2 = _interopRequireDefault(_classnames);
|
|
66
70
|
|
|
71
|
+
var _NoData = require('../NoData/NoData');
|
|
72
|
+
|
|
73
|
+
var _NoData2 = _interopRequireDefault(_NoData);
|
|
74
|
+
|
|
67
75
|
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
|
|
68
76
|
|
|
69
77
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -178,6 +186,10 @@ var CollapsibleTree = function CollapsibleTree(_ref) {
|
|
|
178
186
|
)
|
|
179
187
|
)
|
|
180
188
|
),
|
|
189
|
+
R.isEmpty(data) && _react2.default.createElement(_NoData2.default, {
|
|
190
|
+
message: R.prop('noData', labels) || 'no data',
|
|
191
|
+
icon: _react2.default.createElement(_Info2.default, { color: 'primary', fontSize: 'large' })
|
|
192
|
+
}),
|
|
181
193
|
R.map(function (_ref3) {
|
|
182
194
|
var id = _ref3.id,
|
|
183
195
|
label = _ref3.label,
|
|
@@ -262,7 +274,8 @@ CollapsibleTree.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
|
262
274
|
labels: _propTypes2.default.shape({
|
|
263
275
|
collapseAll: _propTypes2.default.string,
|
|
264
276
|
expandAll: _propTypes2.default.string,
|
|
265
|
-
noValue: _propTypes2.default.string
|
|
277
|
+
noValue: _propTypes2.default.string,
|
|
278
|
+
noData: _propTypes2.default.string
|
|
266
279
|
}),
|
|
267
280
|
testId: _propTypes2.default.string,
|
|
268
281
|
valueHandler: _propTypes2.default.func,
|
|
@@ -16,6 +16,8 @@ var _react2 = _interopRequireDefault(_react);
|
|
|
16
16
|
|
|
17
17
|
var _utils = require('./utils');
|
|
18
18
|
|
|
19
|
+
var _utils2 = require('../utils');
|
|
20
|
+
|
|
19
21
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
20
22
|
|
|
21
23
|
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
|
|
@@ -44,23 +46,22 @@ var spotlightFilter = exports.spotlightFilter = function spotlightFilter(term) {
|
|
|
44
46
|
}
|
|
45
47
|
return acc;
|
|
46
48
|
};
|
|
47
|
-
var matchRegExp = function matchRegExp(str) {
|
|
48
|
-
return str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
49
|
-
};
|
|
50
49
|
|
|
51
50
|
// Highlight matching terms in the label
|
|
52
51
|
var highlightLabel = function highlightLabel(label) {
|
|
53
|
-
var
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
52
|
+
var i = (0, _utils2.prepareTerm)(label).indexOf((0, _utils2.prepareTerm)(term));
|
|
53
|
+
var l = R.length(term);
|
|
54
|
+
|
|
55
|
+
var pre = label.slice(0, i);
|
|
56
|
+
var match = label.slice(i, i + l);
|
|
57
|
+
var post = label.slice(i + l);
|
|
58
|
+
|
|
59
|
+
return pre + '<span style=background-color:yellow;border-bottom:2px solid #8CC841>' + match + '</span>' + post;
|
|
57
60
|
};
|
|
58
61
|
|
|
59
62
|
var recurse = function recurse(item) {
|
|
60
63
|
var label = labelRenderer(item);
|
|
61
|
-
var isValidItem =
|
|
62
|
-
return R.includes(R.toLower(term), R.toLower(item));
|
|
63
|
-
};
|
|
64
|
+
var isValidItem = (0, _utils2.searchTerm)(term);
|
|
64
65
|
|
|
65
66
|
var result = [];
|
|
66
67
|
|
package/lib/utils.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
exports.__esModule = true;
|
|
4
|
-
exports.newDate = exports.getIsRtl = exports.getDark = exports.getLight = exports.withBlank = exports.spotlightScopeListEngine = exports.reduceChildren = undefined;
|
|
4
|
+
exports.searchTerm = exports.prepareTerm = exports.newDate = exports.getIsRtl = exports.getDark = exports.getLight = exports.withBlank = exports.spotlightScopeListEngine = exports.reduceChildren = undefined;
|
|
5
5
|
|
|
6
6
|
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
|
|
7
7
|
|
|
@@ -17,6 +17,10 @@ var _dateFns = require('date-fns');
|
|
|
17
17
|
|
|
18
18
|
var _dateFns2 = _interopRequireDefault(_dateFns);
|
|
19
19
|
|
|
20
|
+
var _diacritics = require('diacritics');
|
|
21
|
+
|
|
22
|
+
var diacritics = _interopRequireWildcard(_diacritics);
|
|
23
|
+
|
|
20
24
|
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
|
|
21
25
|
|
|
22
26
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -84,4 +88,11 @@ var getIsRtl = exports.getIsRtl = function getIsRtl(theme) {
|
|
|
84
88
|
var newDate = exports.newDate = function newDate(stringDate) {
|
|
85
89
|
var date = new Date(stringDate);
|
|
86
90
|
return _dateFns2.default.addMinutes(date, date.getTimezoneOffset());
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
var prepareTerm = exports.prepareTerm = R.pipe(diacritics.remove, R.toLower);
|
|
94
|
+
var searchTerm = exports.searchTerm = function searchTerm(term) {
|
|
95
|
+
return function (label) {
|
|
96
|
+
return R.includes(prepareTerm(term), prepareTerm(label));
|
|
97
|
+
};
|
|
87
98
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sis-cc/dotstatsuite-visions",
|
|
3
|
-
"version": "12.
|
|
3
|
+
"version": "12.30.0",
|
|
4
4
|
"description": "Library of visual components",
|
|
5
5
|
"author": "OECD",
|
|
6
6
|
"homepage": "https://visions-qa.siscc.org/#o",
|
|
@@ -33,6 +33,7 @@
|
|
|
33
33
|
"@hello-pangea/dnd": "^16.6.0",
|
|
34
34
|
"@react-hook/size": "^2.1.1",
|
|
35
35
|
"classnames": "^2.2.6",
|
|
36
|
+
"diacritics": "^1.3.0",
|
|
36
37
|
"isemail": "^3.2.0",
|
|
37
38
|
"prop-types": "^15.7.2",
|
|
38
39
|
"ramda": "^0.27.0",
|