@hipay/hipay-material-ui 1.0.0-beta.23 → 1.0.0-beta.25
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/HI-CHANGELOG.md +26 -43
- package/HiChip/HiChip.js +61 -8
- package/HiDatePicker/HiDateRangePicker.js +27 -13
- package/HiDatePicker/HiDateRangeSelector.js +13 -2
- package/HiForm/HiInput.js +1 -0
- package/HiForm/HiPasswordField.js +2 -2
- package/HiPins/HiPins.js +6 -4
- package/HiSelect/HiSelect.js +7 -5
- package/HiSelect/SelectInput.js +3 -8
- package/HiSelectableList/HiSelectableList.js +51 -49
- package/HiSelectableList/HiSelectableListItem.js +4 -2
- package/HiTable/BodyCellBuilder.js +22 -12
- package/HiTable/BodyCells/CellAccount.js +12 -3
- package/HiTable/BodyCells/CellAccountNumber.js +12 -3
- package/HiTable/BodyCells/CellAddress.js +12 -3
- package/HiTable/BodyCells/CellCountry.js +12 -3
- package/HiTable/BodyCells/CellDate.js +43 -42
- package/HiTable/BodyCells/CellIcon.js +12 -3
- package/HiTable/BodyCells/CellImage.js +12 -3
- package/HiTable/BodyCells/CellNumeric.js +12 -3
- package/HiTable/BodyCells/CellRate.js +12 -3
- package/HiTable/BodyCells/CellSentinel.js +17 -7
- package/HiTable/BodyCells/CellStatus.js +12 -3
- package/HiTable/BodyCells/CellText.js +17 -7
- package/HiTable/BodyCells/CellThirdPartySecurity.js +12 -3
- package/HiTable/BodyRow.js +12 -3
- package/HiTable/ColumnFilter.js +1 -4
- package/HiTable/HeaderCell.js +21 -11
- package/HiTable/HiStickyRow.js +24 -13
- package/HiTable/HiTable.js +30 -69
- package/HiTable/HiTableBody.js +99 -29
- package/HiTable/HiTableContextMenu.js +31 -16
- package/HiTable/HiTableFooter.js +9 -0
- package/HiTable/HiTableHead.js +15 -7
- package/HiTopBar/HiTopBar.js +6 -0
- package/README.md +71 -6
- package/es/HiChip/HiChip.js +74 -8
- package/es/HiDatePicker/HiDateRangePicker.js +25 -12
- package/es/HiDatePicker/HiDateRangeSelector.js +12 -2
- package/es/HiForm/HiInput.js +1 -0
- package/es/HiForm/HiPasswordField.js +2 -2
- package/es/HiPins/HiPins.js +4 -4
- package/es/HiSelect/HiSelect.js +6 -5
- package/es/HiSelect/SelectInput.js +3 -8
- package/es/HiSelectableList/HiSelectableList.js +51 -49
- package/es/HiSelectableList/HiSelectableListItem.js +4 -2
- package/es/HiTable/BodyCellBuilder.js +8 -2
- package/es/HiTable/BodyCells/CellAccount.js +6 -1
- package/es/HiTable/BodyCells/CellAccountNumber.js +6 -1
- package/es/HiTable/BodyCells/CellAddress.js +6 -1
- package/es/HiTable/BodyCells/CellCountry.js +6 -1
- package/es/HiTable/BodyCells/CellDate.js +28 -37
- package/es/HiTable/BodyCells/CellIcon.js +6 -1
- package/es/HiTable/BodyCells/CellImage.js +6 -1
- package/es/HiTable/BodyCells/CellNumeric.js +6 -1
- package/es/HiTable/BodyCells/CellRate.js +6 -1
- package/es/HiTable/BodyCells/CellSentinel.js +6 -1
- package/es/HiTable/BodyCells/CellStatus.js +6 -1
- package/es/HiTable/BodyCells/CellText.js +6 -1
- package/es/HiTable/BodyCells/CellThirdPartySecurity.js +6 -1
- package/es/HiTable/BodyRow.js +7 -2
- package/es/HiTable/ColumnFilter.js +1 -4
- package/es/HiTable/HeaderCell.js +16 -9
- package/es/HiTable/HiStickyRow.js +20 -13
- package/es/HiTable/HiTable.js +4 -40
- package/es/HiTable/HiTableBody.js +78 -26
- package/es/HiTable/HiTableContextMenu.js +28 -16
- package/es/HiTable/HiTableFooter.js +5 -0
- package/es/HiTable/HiTableHead.js +11 -6
- package/es/HiTopBar/HiTopBar.js +5 -0
- package/es/utils/HiIconBuilder.js +6 -2
- package/index.es.js +1 -1
- package/index.js +1 -1
- package/package.json +6 -1
- package/umd/hipay-material-ui.development.js +80901 -47149
- package/umd/hipay-material-ui.production.min.js +5 -5
- package/utils/HiIconBuilder.js +6 -2
@@ -1,6 +1,8 @@
|
|
1
|
-
import
|
1
|
+
import _JSON$stringify from 'babel-runtime/core-js/json/stringify';
|
2
2
|
import React from 'react';
|
3
3
|
import PropTypes from 'prop-types';
|
4
|
+
import moment from 'moment';
|
5
|
+
import 'moment/locale/fr';
|
4
6
|
|
5
7
|
import withStyles from '../../styles/withStyles';
|
6
8
|
import Tooltip from '../../Tooltip';
|
@@ -20,45 +22,28 @@ export const styles = theme => ({
|
|
20
22
|
* Cette cellule permet d'afficher une date en fonction de la locale de l'utilisateur
|
21
23
|
*/
|
22
24
|
class CellDate extends React.Component {
|
25
|
+
constructor(...args) {
|
26
|
+
var _temp;
|
27
|
+
|
28
|
+
return _temp = super(...args), this.formatLong = 'dddd DD MMMM YYYY HH:mm:ss', _temp;
|
29
|
+
}
|
30
|
+
|
31
|
+
shouldComponentUpdate(nextProps, nextState) {
|
32
|
+
return _JSON$stringify(this.props) !== _JSON$stringify(nextProps) || _JSON$stringify(this.state) !== _JSON$stringify(nextState);
|
33
|
+
}
|
23
34
|
|
24
35
|
render() {
|
25
|
-
const { classes, displayTime, value, locale, view } = this.props;
|
36
|
+
const { classes, displayTime, value, locale, view, formatShort } = this.props;
|
26
37
|
|
27
|
-
const date =
|
38
|
+
const date = moment(value);
|
39
|
+
moment.locale(locale);
|
28
40
|
|
29
|
-
|
30
|
-
weekday: 'long',
|
31
|
-
year: 'numeric',
|
32
|
-
month: 'long',
|
33
|
-
day: '2-digit'
|
34
|
-
}, displayTime && {
|
35
|
-
hour: '2-digit',
|
36
|
-
minute: '2-digit',
|
37
|
-
second: '2-digit'
|
38
|
-
});
|
39
|
-
const titleValue = date.toLocaleString(locale, options);
|
41
|
+
const titleValue = displayTime ? date.format(this.formatLong) : date.format(this.formatLong.replace('HH:mm:ss', ''));
|
40
42
|
let displayedValue = titleValue;
|
41
43
|
if (view === cst.VIEWS.SMALL) {
|
42
|
-
|
43
|
-
year: '2-digit',
|
44
|
-
month: '2-digit',
|
45
|
-
day: '2-digit'
|
46
|
-
}, displayTime && {
|
47
|
-
hour: '2-digit',
|
48
|
-
minute: '2-digit'
|
49
|
-
});
|
50
|
-
displayedValue = date.toLocaleString(locale, options);
|
44
|
+
displayedValue = displayTime ? date.format(formatShort.replace('YYYY', 'YY') + ' HH:mm:ss') : date.format(formatShort.replace('YYYY', 'YY'));
|
51
45
|
} else if (view === cst.VIEWS.MEDIUM) {
|
52
|
-
|
53
|
-
year: 'numeric',
|
54
|
-
month: '2-digit',
|
55
|
-
day: '2-digit'
|
56
|
-
}, displayTime && {
|
57
|
-
hour: '2-digit',
|
58
|
-
minute: '2-digit',
|
59
|
-
second: '2-digit'
|
60
|
-
});
|
61
|
-
displayedValue = date.toLocaleString(locale, options);
|
46
|
+
displayedValue = displayTime ? date.format(formatShort + ' HH:mm:ss') : date.format(formatShort);
|
62
47
|
}
|
63
48
|
|
64
49
|
if (view === cst.VIEWS.LARGE) {
|
@@ -83,8 +68,9 @@ class CellDate extends React.Component {
|
|
83
68
|
|
84
69
|
CellDate.defaultProps = {
|
85
70
|
displayTime: false,
|
86
|
-
locale: 'en
|
87
|
-
view: 'l'
|
71
|
+
locale: 'en',
|
72
|
+
view: 'l',
|
73
|
+
formatShort: 'DD/MM/YYYY'
|
88
74
|
};
|
89
75
|
CellDate.propTypes = process.env.NODE_ENV !== "production" ? {
|
90
76
|
/**
|
@@ -96,11 +82,16 @@ CellDate.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
96
82
|
*/
|
97
83
|
displayTime: PropTypes.bool,
|
98
84
|
/**
|
99
|
-
*
|
85
|
+
* Format de la date en vue small (ex: DD/MM/YYYY)
|
86
|
+
* @see https://momentjs.com/docs/#/parsing/string-format/
|
87
|
+
*/
|
88
|
+
formatShort: PropTypes.string.isRequired,
|
89
|
+
/**
|
90
|
+
* Locale moment
|
100
91
|
*/
|
101
92
|
locale: PropTypes.string,
|
102
93
|
/**
|
103
|
-
*
|
94
|
+
* Date as string
|
104
95
|
*/
|
105
96
|
value: PropTypes.string.isRequired,
|
106
97
|
/**
|
@@ -1,3 +1,4 @@
|
|
1
|
+
import _JSON$stringify from 'babel-runtime/core-js/json/stringify';
|
1
2
|
import React from 'react';
|
2
3
|
import PropTypes from 'prop-types';
|
3
4
|
import Tooltip from '../../Tooltip';
|
@@ -26,7 +27,11 @@ export const styles = {
|
|
26
27
|
* Cette cellule permet d'afficher une icône et un label (optionnel).
|
27
28
|
* En vue small (s) elle affiche uniquement l'icône avec une largeur fixe.
|
28
29
|
*/
|
29
|
-
class CellIcon extends React.
|
30
|
+
class CellIcon extends React.Component {
|
31
|
+
|
32
|
+
shouldComponentUpdate(nextProps, nextState) {
|
33
|
+
return _JSON$stringify(this.props) !== _JSON$stringify(nextProps) || _JSON$stringify(this.state) !== _JSON$stringify(nextState);
|
34
|
+
}
|
30
35
|
|
31
36
|
render() {
|
32
37
|
const { classes, icon, value, view, color } = this.props;
|
@@ -1,3 +1,4 @@
|
|
1
|
+
import _JSON$stringify from 'babel-runtime/core-js/json/stringify';
|
1
2
|
import React from 'react';
|
2
3
|
import PropTypes from 'prop-types';
|
3
4
|
import Tooltip from '../../Tooltip';
|
@@ -45,7 +46,11 @@ export const styles = theme => ({
|
|
45
46
|
* En vue large, aucun tooltip n'est affiché
|
46
47
|
* En vue small (s) elle affiche uniquement l'image avec une largeur fixe.
|
47
48
|
*/
|
48
|
-
class CellImage extends React.
|
49
|
+
class CellImage extends React.Component {
|
50
|
+
|
51
|
+
shouldComponentUpdate(nextProps, nextState) {
|
52
|
+
return _JSON$stringify(this.props) !== _JSON$stringify(nextProps) || _JSON$stringify(this.state) !== _JSON$stringify(nextState);
|
53
|
+
}
|
49
54
|
|
50
55
|
render() {
|
51
56
|
const { classes, path, value, view, size } = this.props;
|
@@ -1,3 +1,4 @@
|
|
1
|
+
import _JSON$stringify from 'babel-runtime/core-js/json/stringify';
|
1
2
|
import React from 'react';
|
2
3
|
import PropTypes from 'prop-types';
|
3
4
|
|
@@ -15,7 +16,11 @@ export const styles = theme => ({
|
|
15
16
|
/**
|
16
17
|
* Cette cellule permet d'afficher un volume ou un montant avec devise
|
17
18
|
*/
|
18
|
-
class CellNumeric extends React.
|
19
|
+
class CellNumeric extends React.Component {
|
20
|
+
|
21
|
+
shouldComponentUpdate(nextProps, nextState) {
|
22
|
+
return _JSON$stringify(this.props) !== _JSON$stringify(nextProps) || _JSON$stringify(this.state) !== _JSON$stringify(nextState);
|
23
|
+
}
|
19
24
|
|
20
25
|
render() {
|
21
26
|
const { classes, value, locale, currency, view, precision } = this.props;
|
@@ -1,3 +1,4 @@
|
|
1
|
+
import _JSON$stringify from 'babel-runtime/core-js/json/stringify';
|
1
2
|
import React from 'react';
|
2
3
|
import PropTypes from 'prop-types';
|
3
4
|
import classNames from 'classnames';
|
@@ -45,7 +46,11 @@ export const styles = theme => ({
|
|
45
46
|
* Cette cellule permet d'afficher un pourcentage
|
46
47
|
* avec une icône d'évolution (optionnelle) et un indicateur du type de données représentées (optionnel)
|
47
48
|
*/
|
48
|
-
class CellRate extends React.
|
49
|
+
class CellRate extends React.Component {
|
50
|
+
|
51
|
+
shouldComponentUpdate(nextProps, nextState) {
|
52
|
+
return _JSON$stringify(this.props) !== _JSON$stringify(nextProps) || _JSON$stringify(this.state) !== _JSON$stringify(nextState);
|
53
|
+
}
|
49
54
|
|
50
55
|
render() {
|
51
56
|
|
@@ -1,3 +1,4 @@
|
|
1
|
+
import _JSON$stringify from 'babel-runtime/core-js/json/stringify';
|
1
2
|
import React from 'react';
|
2
3
|
import PropTypes from 'prop-types';
|
3
4
|
import Tooltip from '../../Tooltip';
|
@@ -21,7 +22,11 @@ export const styles = {
|
|
21
22
|
/**
|
22
23
|
* Cette cellule permet d'afficher le résultat de Sentinel (score & fraudResult & smartDecision)
|
23
24
|
*/
|
24
|
-
class CellSentinel extends React.
|
25
|
+
class CellSentinel extends React.Component {
|
26
|
+
|
27
|
+
shouldComponentUpdate(nextProps, nextState) {
|
28
|
+
return _JSON$stringify(this.props) !== _JSON$stringify(nextProps) || _JSON$stringify(this.state) !== _JSON$stringify(nextState);
|
29
|
+
}
|
25
30
|
|
26
31
|
constructor(props) {
|
27
32
|
super(props);
|
@@ -1,3 +1,4 @@
|
|
1
|
+
import _JSON$stringify from 'babel-runtime/core-js/json/stringify';
|
1
2
|
import React from 'react';
|
2
3
|
import PropTypes from 'prop-types';
|
3
4
|
|
@@ -18,7 +19,11 @@ export const styles = theme => ({
|
|
18
19
|
}
|
19
20
|
});
|
20
21
|
|
21
|
-
class CellStatus extends React.
|
22
|
+
class CellStatus extends React.Component {
|
23
|
+
|
24
|
+
shouldComponentUpdate(nextProps, nextState) {
|
25
|
+
return _JSON$stringify(this.props) !== _JSON$stringify(nextProps) || _JSON$stringify(this.state) !== _JSON$stringify(nextState);
|
26
|
+
}
|
22
27
|
|
23
28
|
render() {
|
24
29
|
const { classes, theme, nbOperations, value, code, onOpenDetails } = this.props;
|
@@ -1,3 +1,4 @@
|
|
1
|
+
import _JSON$stringify from 'babel-runtime/core-js/json/stringify';
|
1
2
|
import React from 'react';
|
2
3
|
import PropTypes from 'prop-types';
|
3
4
|
|
@@ -27,7 +28,11 @@ export const styles = theme => ({
|
|
27
28
|
}
|
28
29
|
});
|
29
30
|
|
30
|
-
class CellText extends React.
|
31
|
+
class CellText extends React.Component {
|
32
|
+
|
33
|
+
shouldComponentUpdate(nextProps, nextState) {
|
34
|
+
return _JSON$stringify(this.props) !== _JSON$stringify(nextProps) || _JSON$stringify(this.state) !== _JSON$stringify(nextState);
|
35
|
+
}
|
31
36
|
|
32
37
|
constructor(props) {
|
33
38
|
super(props);
|
@@ -1,3 +1,4 @@
|
|
1
|
+
import _JSON$stringify from 'babel-runtime/core-js/json/stringify';
|
1
2
|
// @inheritedComponent CellLayout
|
2
3
|
|
3
4
|
import React from 'react';
|
@@ -19,7 +20,11 @@ export const styles = {
|
|
19
20
|
/**
|
20
21
|
* Cette cellule permet d'afficher une icône représentant le statut du 3DS.
|
21
22
|
*/
|
22
|
-
class CellThirdPartySecurity extends React.
|
23
|
+
class CellThirdPartySecurity extends React.Component {
|
24
|
+
|
25
|
+
shouldComponentUpdate(nextProps, nextState) {
|
26
|
+
return _JSON$stringify(this.props) !== _JSON$stringify(nextProps) || _JSON$stringify(this.state) !== _JSON$stringify(nextState);
|
27
|
+
}
|
23
28
|
|
24
29
|
render() {
|
25
30
|
const { classes, theme, label, value } = this.props;
|
package/es/HiTable/BodyRow.js
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
import _extends from 'babel-runtime/helpers/extends';
|
2
2
|
import _objectWithoutProperties from 'babel-runtime/helpers/objectWithoutProperties';
|
3
|
+
import _JSON$stringify from 'babel-runtime/core-js/json/stringify';
|
3
4
|
|
4
5
|
// @inheritedComponent BodyCellBuilder
|
5
6
|
import React from 'react';
|
@@ -8,7 +9,7 @@ import classNames from 'classnames';
|
|
8
9
|
import { TableRow, TableCell } from 'material-ui/Table';
|
9
10
|
import { fade } from 'material-ui/styles/colorManipulator';
|
10
11
|
import BodyCellBuilder from './BodyCellBuilder';
|
11
|
-
import { withStyles
|
12
|
+
import { withStyles } from '../styles';
|
12
13
|
import * as cst from './constants';
|
13
14
|
|
14
15
|
export const styles = theme => ({
|
@@ -45,7 +46,7 @@ export const styles = theme => ({
|
|
45
46
|
}
|
46
47
|
});
|
47
48
|
|
48
|
-
class BodyRow extends React.
|
49
|
+
class BodyRow extends React.Component {
|
49
50
|
|
50
51
|
constructor(props) {
|
51
52
|
super();
|
@@ -67,6 +68,10 @@ class BodyRow extends React.PureComponent {
|
|
67
68
|
this.handleSelect = this.handleSelect.bind(this);
|
68
69
|
}
|
69
70
|
|
71
|
+
shouldComponentUpdate(nextProps, nextState) {
|
72
|
+
return _JSON$stringify(this.props) !== _JSON$stringify(nextProps) || _JSON$stringify(this.state) !== _JSON$stringify(nextState);
|
73
|
+
}
|
74
|
+
|
70
75
|
componentDidMount() {
|
71
76
|
// Live data animation
|
72
77
|
if (this.state.live) {
|
@@ -30,9 +30,6 @@ export const styles = theme => ({
|
|
30
30
|
padding: 10,
|
31
31
|
color: theme.palette.neutral.normal
|
32
32
|
},
|
33
|
-
menuItemSortable: {
|
34
|
-
paddingLeft: 8
|
35
|
-
},
|
36
33
|
menuItemFilter: _extends({}, theme.typography.body1, {
|
37
34
|
color: theme.palette.neutral.dark,
|
38
35
|
fontWeight: theme.typography.fontWeightMedium,
|
@@ -200,7 +197,7 @@ class ColumnFilter extends React.Component {
|
|
200
197
|
),
|
201
198
|
!!sortable && React.createElement(
|
202
199
|
'div',
|
203
|
-
|
200
|
+
null,
|
204
201
|
React.createElement(
|
205
202
|
MenuItem,
|
206
203
|
{
|
package/es/HiTable/HeaderCell.js
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
import _JSON$stringify from 'babel-runtime/core-js/json/stringify';
|
1
2
|
import _extends from 'babel-runtime/helpers/extends';
|
2
3
|
import React from 'react';
|
3
4
|
import PropTypes from 'prop-types';
|
@@ -78,18 +79,19 @@ export const styles = theme => ({
|
|
78
79
|
/**
|
79
80
|
* Construit une cellule d'entête avec le titre, clickable, triable et filtrable
|
80
81
|
*/
|
81
|
-
class HeaderCell extends React.
|
82
|
+
class HeaderCell extends React.Component {
|
82
83
|
|
83
84
|
constructor(props) {
|
84
85
|
super(props);
|
85
86
|
|
87
|
+
this.anchorEl = null;
|
88
|
+
|
86
89
|
this.onFilterClick = (event, columnDataset) => {
|
87
90
|
this.openFilterMenu(event, columnDataset);
|
88
91
|
};
|
89
92
|
|
90
93
|
this.state = {
|
91
94
|
filterOpen: false,
|
92
|
-
anchorEl: null,
|
93
95
|
menuFilters: []
|
94
96
|
};
|
95
97
|
|
@@ -100,16 +102,21 @@ class HeaderCell extends React.PureComponent {
|
|
100
102
|
this.handleFilterChange = this.handleFilterChange.bind(this);
|
101
103
|
}
|
102
104
|
|
105
|
+
shouldComponentUpdate(nextProps, nextState) {
|
106
|
+
return _JSON$stringify(nextProps) !== _JSON$stringify(this.props) || _JSON$stringify(nextState) !== _JSON$stringify(this.state);
|
107
|
+
}
|
108
|
+
|
103
109
|
openFilterMenu(event, columnDataset) {
|
104
110
|
this.setState({
|
105
111
|
filterOpen: true,
|
106
|
-
anchorEl: event.currentTarget,
|
107
112
|
menuFilters: columnDataset
|
108
113
|
});
|
114
|
+
this.anchorEl = event.currentTarget;
|
109
115
|
}
|
110
116
|
|
111
117
|
handleClose() {
|
112
|
-
this.setState({ filterOpen: false,
|
118
|
+
this.setState({ filterOpen: false, menuFilters: [] });
|
119
|
+
this.anchorEl = null;
|
113
120
|
}
|
114
121
|
|
115
122
|
/**
|
@@ -149,7 +156,7 @@ class HeaderCell extends React.PureComponent {
|
|
149
156
|
translations
|
150
157
|
} = this.props;
|
151
158
|
|
152
|
-
const { filterOpen,
|
159
|
+
const { filterOpen, menuFilters } = this.state;
|
153
160
|
|
154
161
|
const offset = selectable ? dense ? 32 : 40 : padding;
|
155
162
|
|
@@ -233,7 +240,6 @@ class HeaderCell extends React.PureComponent {
|
|
233
240
|
_filterable ? this.onFilterClick(event, filterSource) : this.handleSort(sortDirection === 'asc' ? 'desc' : 'asc');
|
234
241
|
}
|
235
242
|
},
|
236
|
-
align === 'right' && _icons,
|
237
243
|
React.createElement(
|
238
244
|
'span',
|
239
245
|
{
|
@@ -241,7 +247,7 @@ class HeaderCell extends React.PureComponent {
|
|
241
247
|
},
|
242
248
|
view !== 's' ? title : smallTitle || title
|
243
249
|
),
|
244
|
-
|
250
|
+
_icons
|
245
251
|
) : React.createElement(
|
246
252
|
'div',
|
247
253
|
{
|
@@ -268,7 +274,7 @@ class HeaderCell extends React.PureComponent {
|
|
268
274
|
filterValueList: menuFilters,
|
269
275
|
isOpen: filterOpen,
|
270
276
|
onClose: this.handleClose,
|
271
|
-
anchorEl: anchorEl,
|
277
|
+
anchorEl: this.anchorEl,
|
272
278
|
sortable: sortable,
|
273
279
|
onSort: this.handleSort,
|
274
280
|
onFilterChange: this.handleFilterChange,
|
@@ -288,7 +294,8 @@ HeaderCell.defaultProps = {
|
|
288
294
|
dense: false,
|
289
295
|
fixedColumnWidth: true,
|
290
296
|
sticky: true,
|
291
|
-
padding: 8
|
297
|
+
padding: 8,
|
298
|
+
translations: {}
|
292
299
|
};
|
293
300
|
HeaderCell.propTypes = process.env.NODE_ENV !== "production" ? {
|
294
301
|
/**
|
@@ -1,3 +1,4 @@
|
|
1
|
+
import _JSON$stringify from 'babel-runtime/core-js/json/stringify';
|
1
2
|
import React from 'react';
|
2
3
|
import PropTypes from 'prop-types';
|
3
4
|
import { TableRow, TableCell } from 'material-ui/Table';
|
@@ -73,6 +74,10 @@ export const ONCHANGE_ERROR_MESSAGE = 'Vous devez saisir la propriété "onChang
|
|
73
74
|
|
74
75
|
class HiStickyRow extends React.PureComponent {
|
75
76
|
|
77
|
+
shouldComponentUpdate(nextProps, nextState) {
|
78
|
+
return _JSON$stringify(this.props) !== _JSON$stringify(nextProps) || _JSON$stringify(this.state) !== _JSON$stringify(nextState);
|
79
|
+
}
|
80
|
+
|
76
81
|
render() {
|
77
82
|
const { classes, dense, colSpan, label, length, index, translations, view } = this.props;
|
78
83
|
const buttonClasses = classNames(classes.button, { [classes.denseButton]: dense });
|
@@ -112,18 +117,24 @@ class HiStickyRow extends React.PureComponent {
|
|
112
117
|
className: 'stickyRowContent',
|
113
118
|
style: {
|
114
119
|
position: 'relative',
|
115
|
-
top: dense ? 3 : 2
|
120
|
+
top: dense ? 3 : 2,
|
121
|
+
display: 'flex',
|
122
|
+
alignItems: 'center'
|
116
123
|
}
|
117
124
|
},
|
118
125
|
React.createElement(
|
119
|
-
'
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
React.createElement(
|
126
|
+
'div',
|
127
|
+
null,
|
128
|
+
React.createElement(
|
129
|
+
'span',
|
130
|
+
{ id: 'sticky-label', className: classes.label },
|
131
|
+
label
|
132
|
+
),
|
133
|
+
React.createElement(
|
134
|
+
'span',
|
135
|
+
{ id: 'sticky-badge', style: { position: 'relative' } },
|
136
|
+
React.createElement(HiChip, { label: length, classes: { root: classes.badgeRoot } })
|
137
|
+
)
|
127
138
|
),
|
128
139
|
React.createElement(
|
129
140
|
Button,
|
@@ -204,10 +215,6 @@ HiStickyRow.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
204
215
|
* Objet contenant les éléments textuels du composant
|
205
216
|
*/
|
206
217
|
translations: PropTypes.object.isRequired,
|
207
|
-
/**
|
208
|
-
* Valeur de la ligne
|
209
|
-
*/
|
210
|
-
value: PropTypes.string,
|
211
218
|
/**
|
212
219
|
* Taille du tableau (L/M/S),
|
213
220
|
* définit l'espace entre les cellules et leurs tailles par default
|
package/es/HiTable/HiTable.js
CHANGED
@@ -146,27 +146,9 @@ class HiTable extends React.Component {
|
|
146
146
|
|
147
147
|
this.state = {
|
148
148
|
dateUpdate: Date.now(),
|
149
|
-
isScrollToBottom: false
|
150
|
-
groupByIds: {}
|
149
|
+
isScrollToBottom: false
|
151
150
|
};
|
152
151
|
|
153
|
-
// create associative array (object) with sticky row key & its values
|
154
|
-
// => used for sticky row badges
|
155
|
-
if (props.groupBy) {
|
156
|
-
props.dataSource.map(row => {
|
157
|
-
let value = row.datas[props.groupBy].value;
|
158
|
-
let date = new Date(value);
|
159
|
-
|
160
|
-
if (date instanceof Date && isFinite(date)) {
|
161
|
-
value = value.substr(0, 10);
|
162
|
-
}
|
163
|
-
if (!this.state.groupByIds.hasOwnProperty(value)) {
|
164
|
-
this.state.groupByIds[value] = [];
|
165
|
-
}
|
166
|
-
this.state.groupByIds[value].push(row.datas);
|
167
|
-
});
|
168
|
-
}
|
169
|
-
|
170
152
|
// Orderable
|
171
153
|
this.openOrderColumnsMenu = this.openOrderColumnsMenu.bind(this);
|
172
154
|
this.closeOrderColumnsMenu = this.closeOrderColumnsMenu.bind(this);
|
@@ -259,28 +241,10 @@ class HiTable extends React.Component {
|
|
259
241
|
// Only if needed
|
260
242
|
if (this.props.dataSource.length > prevProps.dataSource.length || this.props.dense !== prevProps.dense || this.props.sortedColumnId !== prevProps.sortedColumnId || this.props.sortDirection !== prevProps.sortDirection) {
|
261
243
|
this.updateStickyRowsPosition();
|
262
|
-
if (this.props.dataSource.length
|
244
|
+
if (this.props.dataSource.length !== prevProps.dataSource.length) {
|
263
245
|
this.handleStickyRowPositions();
|
264
246
|
}
|
265
247
|
}
|
266
|
-
if (this.props.dataSource.length > prevProps.dataSource.length && this.props.groupBy) {
|
267
|
-
// create associative array (object) with sticky row key & its values
|
268
|
-
// => used for sticky row badges
|
269
|
-
let groupByIds = {};
|
270
|
-
this.props.dataSource.map(row => {
|
271
|
-
let value = row.datas[this.props.groupBy].value;
|
272
|
-
let date = new Date(value);
|
273
|
-
|
274
|
-
if (date instanceof Date && isFinite(date)) {
|
275
|
-
value = value.substr(0, 10);
|
276
|
-
}
|
277
|
-
if (!groupByIds.hasOwnProperty(value)) {
|
278
|
-
groupByIds[value] = [];
|
279
|
-
}
|
280
|
-
groupByIds[value].push(row.datas);
|
281
|
-
});
|
282
|
-
this.setState({ groupByIds: groupByIds });
|
283
|
-
}
|
284
248
|
|
285
249
|
this.isScrollToBottom(this.scrollTop === this.tBody.scrollHeight - this.tBody.offsetHeight);
|
286
250
|
|
@@ -590,7 +554,7 @@ class HiTable extends React.Component {
|
|
590
554
|
detailRowsOptions
|
591
555
|
} = this.props;
|
592
556
|
|
593
|
-
const { dateUpdate, isScrollToBottom
|
557
|
+
const { dateUpdate, isScrollToBottom } = this.state;
|
594
558
|
|
595
559
|
const headerHeight = dense ? cst.CELL_HEADER_HEIGHT_DENSE : cst.CELL_HEADER_HEIGHT;
|
596
560
|
|
@@ -665,7 +629,6 @@ class HiTable extends React.Component {
|
|
665
629
|
translations: translations.tableBody,
|
666
630
|
groupBy: groupBy,
|
667
631
|
onClickNext: this.handleNextStickyRow,
|
668
|
-
groupByIds: groupByIds,
|
669
632
|
lookupColumns: lookupColumns,
|
670
633
|
loading: loading,
|
671
634
|
fixedColumnWidth: fixedColumnWidth,
|
@@ -691,6 +654,7 @@ class HiTable extends React.Component {
|
|
691
654
|
),
|
692
655
|
React.createElement(HiTableContextMenu, {
|
693
656
|
tabId: tabId,
|
657
|
+
columns: columns,
|
694
658
|
onSearch: this.props.onSearch,
|
695
659
|
onRedirect: this.props.onRedirect
|
696
660
|
}),
|