@sis-cc/dotstatsuite-visions 7.8.4 → 7.9.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/TableHtml5/cell.js +20 -19
- package/lib/TableHtml5/cell.js +20 -21
- package/package.json +1 -1
package/es/TableHtml5/cell.js
CHANGED
|
@@ -2,11 +2,11 @@ import React from 'react';
|
|
|
2
2
|
import * as R from 'ramda';
|
|
3
3
|
import PropTypes from 'prop-types';
|
|
4
4
|
import cx from 'classnames';
|
|
5
|
-
import { makeStyles } from '@material-ui/core/styles';
|
|
5
|
+
import { makeStyles, useTheme } from '@material-ui/core/styles';
|
|
6
6
|
import TableCell from '@material-ui/core/TableCell';
|
|
7
|
-
import Typography from '@material-ui/core/Typography';
|
|
8
7
|
import Link from '@material-ui/core/Link';
|
|
9
8
|
import Flags from './flags';
|
|
9
|
+
import { getIsRtl } from '../utils';
|
|
10
10
|
|
|
11
11
|
var useStyles = makeStyles(function (theme) {
|
|
12
12
|
return {
|
|
@@ -18,7 +18,8 @@ var useStyles = makeStyles(function (theme) {
|
|
|
18
18
|
color: theme.palette.grey['A700'],
|
|
19
19
|
'&:hover': {
|
|
20
20
|
boxShadow: 'inset 0 0 0 2px ' + theme.palette.primary.main
|
|
21
|
-
}
|
|
21
|
+
},
|
|
22
|
+
whiteSpace: 'nowrap'
|
|
22
23
|
},
|
|
23
24
|
active: {
|
|
24
25
|
boxShadow: 'inset 0 0 0 2px ' + theme.palette.primary.main
|
|
@@ -35,18 +36,22 @@ var useStyles = makeStyles(function (theme) {
|
|
|
35
36
|
value: {
|
|
36
37
|
overflow: 'inherit'
|
|
37
38
|
},
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
39
|
+
rightAlign: {
|
|
40
|
+
// only for rtl layout !
|
|
41
|
+
// changed by right in rtl mode
|
|
42
|
+
textAlign: 'left'
|
|
41
43
|
}
|
|
42
44
|
};
|
|
43
45
|
});
|
|
44
46
|
|
|
47
|
+
var isValidNumber = R.both(R.is(Number), R.complement(R.equals(NaN)));
|
|
48
|
+
|
|
45
49
|
var Cell = function Cell(_ref) {
|
|
46
50
|
var _cx;
|
|
47
51
|
|
|
48
52
|
var flags = _ref.flags,
|
|
49
53
|
value = _ref.value,
|
|
54
|
+
intValue = _ref.intValue,
|
|
50
55
|
headers = _ref.headers,
|
|
51
56
|
isOne = _ref.isOne,
|
|
52
57
|
_ref$indexedDimValIds = _ref.indexedDimValIds,
|
|
@@ -60,6 +65,7 @@ var Cell = function Cell(_ref) {
|
|
|
60
65
|
HTMLRenderer = _ref.HTMLRenderer;
|
|
61
66
|
|
|
62
67
|
var classes = useStyles();
|
|
68
|
+
var isRtl = getIsRtl(useTheme());
|
|
63
69
|
var hasFlag = R.not(R.isEmpty(flags));
|
|
64
70
|
var uiValue = R.is(Function, cellHandler) && !R.isEmpty(indexedDimValIds) ? React.createElement(
|
|
65
71
|
Link,
|
|
@@ -79,26 +85,21 @@ var Cell = function Cell(_ref) {
|
|
|
79
85
|
return React.createElement(
|
|
80
86
|
TableCell,
|
|
81
87
|
{
|
|
88
|
+
align: isValidNumber(intValue) ? 'right' : 'left',
|
|
82
89
|
component: isOne ? 'div' : undefined,
|
|
83
|
-
className: cx(classes.cell, (_cx = {}, _cx[classes.oneCell] = isOne, _cx[classes.active] = isActive, _cx[classes.highlight] = isHighlight, _cx)),
|
|
90
|
+
className: cx(classes.cell, (_cx = {}, _cx[classes.oneCell] = isOne, _cx[classes.active] = isActive, _cx[classes.highlight] = isHighlight, _cx[classes.rightAlign] = isRtl, _cx)),
|
|
84
91
|
headers: headers,
|
|
85
|
-
onClick: activeCellHandler
|
|
92
|
+
onClick: activeCellHandler,
|
|
93
|
+
tabIndex: 0
|
|
86
94
|
},
|
|
87
|
-
React.createElement(
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
React.createElement(
|
|
91
|
-
Typography,
|
|
92
|
-
{ variant: 'body1', tabIndex: 0, noWrap: hasFlag },
|
|
93
|
-
!R.isNil(SideIcon) && React.createElement(SideIcon, { sideProps: sideProps, className: classes.value }),
|
|
94
|
-
hasFlag && React.createElement(Flags, { HTMLRenderer: HTMLRenderer, flags: flags }),
|
|
95
|
-
uiValue
|
|
96
|
-
)
|
|
97
|
-
)
|
|
95
|
+
!R.isNil(SideIcon) && React.createElement(SideIcon, { sideProps: sideProps, className: classes.value }),
|
|
96
|
+
hasFlag && React.createElement(Flags, { HTMLRenderer: HTMLRenderer, flags: flags }),
|
|
97
|
+
uiValue
|
|
98
98
|
);
|
|
99
99
|
};
|
|
100
100
|
|
|
101
101
|
Cell.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
102
|
+
intValue: PropTypes.number,
|
|
102
103
|
flags: PropTypes.array,
|
|
103
104
|
isOne: PropTypes.bool,
|
|
104
105
|
value: PropTypes.string,
|
package/lib/TableHtml5/cell.js
CHANGED
|
@@ -24,10 +24,6 @@ var _TableCell = require('@material-ui/core/TableCell');
|
|
|
24
24
|
|
|
25
25
|
var _TableCell2 = _interopRequireDefault(_TableCell);
|
|
26
26
|
|
|
27
|
-
var _Typography = require('@material-ui/core/Typography');
|
|
28
|
-
|
|
29
|
-
var _Typography2 = _interopRequireDefault(_Typography);
|
|
30
|
-
|
|
31
27
|
var _Link = require('@material-ui/core/Link');
|
|
32
28
|
|
|
33
29
|
var _Link2 = _interopRequireDefault(_Link);
|
|
@@ -36,6 +32,8 @@ var _flags = require('./flags');
|
|
|
36
32
|
|
|
37
33
|
var _flags2 = _interopRequireDefault(_flags);
|
|
38
34
|
|
|
35
|
+
var _utils = require('../utils');
|
|
36
|
+
|
|
39
37
|
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; } }
|
|
40
38
|
|
|
41
39
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -50,7 +48,8 @@ var useStyles = (0, _styles.makeStyles)(function (theme) {
|
|
|
50
48
|
color: theme.palette.grey['A700'],
|
|
51
49
|
'&:hover': {
|
|
52
50
|
boxShadow: 'inset 0 0 0 2px ' + theme.palette.primary.main
|
|
53
|
-
}
|
|
51
|
+
},
|
|
52
|
+
whiteSpace: 'nowrap'
|
|
54
53
|
},
|
|
55
54
|
active: {
|
|
56
55
|
boxShadow: 'inset 0 0 0 2px ' + theme.palette.primary.main
|
|
@@ -67,18 +66,22 @@ var useStyles = (0, _styles.makeStyles)(function (theme) {
|
|
|
67
66
|
value: {
|
|
68
67
|
overflow: 'inherit'
|
|
69
68
|
},
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
69
|
+
rightAlign: {
|
|
70
|
+
// only for rtl layout !
|
|
71
|
+
// changed by right in rtl mode
|
|
72
|
+
textAlign: 'left'
|
|
73
73
|
}
|
|
74
74
|
};
|
|
75
75
|
});
|
|
76
76
|
|
|
77
|
+
var isValidNumber = R.both(R.is(Number), R.complement(R.equals(NaN)));
|
|
78
|
+
|
|
77
79
|
var Cell = function Cell(_ref) {
|
|
78
80
|
var _cx;
|
|
79
81
|
|
|
80
82
|
var flags = _ref.flags,
|
|
81
83
|
value = _ref.value,
|
|
84
|
+
intValue = _ref.intValue,
|
|
82
85
|
headers = _ref.headers,
|
|
83
86
|
isOne = _ref.isOne,
|
|
84
87
|
_ref$indexedDimValIds = _ref.indexedDimValIds,
|
|
@@ -92,6 +95,7 @@ var Cell = function Cell(_ref) {
|
|
|
92
95
|
HTMLRenderer = _ref.HTMLRenderer;
|
|
93
96
|
|
|
94
97
|
var classes = useStyles();
|
|
98
|
+
var isRtl = (0, _utils.getIsRtl)((0, _styles.useTheme)());
|
|
95
99
|
var hasFlag = R.not(R.isEmpty(flags));
|
|
96
100
|
var uiValue = R.is(Function, cellHandler) && !R.isEmpty(indexedDimValIds) ? _react2.default.createElement(
|
|
97
101
|
_Link2.default,
|
|
@@ -111,26 +115,21 @@ var Cell = function Cell(_ref) {
|
|
|
111
115
|
return _react2.default.createElement(
|
|
112
116
|
_TableCell2.default,
|
|
113
117
|
{
|
|
118
|
+
align: isValidNumber(intValue) ? 'right' : 'left',
|
|
114
119
|
component: isOne ? 'div' : undefined,
|
|
115
|
-
className: (0, _classnames2.default)(classes.cell, (_cx = {}, _cx[classes.oneCell] = isOne, _cx[classes.active] = isActive, _cx[classes.highlight] = isHighlight, _cx)),
|
|
120
|
+
className: (0, _classnames2.default)(classes.cell, (_cx = {}, _cx[classes.oneCell] = isOne, _cx[classes.active] = isActive, _cx[classes.highlight] = isHighlight, _cx[classes.rightAlign] = isRtl, _cx)),
|
|
116
121
|
headers: headers,
|
|
117
|
-
onClick: activeCellHandler
|
|
122
|
+
onClick: activeCellHandler,
|
|
123
|
+
tabIndex: 0
|
|
118
124
|
},
|
|
119
|
-
_react2.default.createElement(
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
_react2.default.createElement(
|
|
123
|
-
_Typography2.default,
|
|
124
|
-
{ variant: 'body1', tabIndex: 0, noWrap: hasFlag },
|
|
125
|
-
!R.isNil(SideIcon) && _react2.default.createElement(SideIcon, { sideProps: sideProps, className: classes.value }),
|
|
126
|
-
hasFlag && _react2.default.createElement(_flags2.default, { HTMLRenderer: HTMLRenderer, flags: flags }),
|
|
127
|
-
uiValue
|
|
128
|
-
)
|
|
129
|
-
)
|
|
125
|
+
!R.isNil(SideIcon) && _react2.default.createElement(SideIcon, { sideProps: sideProps, className: classes.value }),
|
|
126
|
+
hasFlag && _react2.default.createElement(_flags2.default, { HTMLRenderer: HTMLRenderer, flags: flags }),
|
|
127
|
+
uiValue
|
|
130
128
|
);
|
|
131
129
|
};
|
|
132
130
|
|
|
133
131
|
Cell.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
132
|
+
intValue: _propTypes2.default.number,
|
|
134
133
|
flags: _propTypes2.default.array,
|
|
135
134
|
isOne: _propTypes2.default.bool,
|
|
136
135
|
value: _propTypes2.default.string,
|