@hipay/hipay-material-ui 1.0.0-beta.17 → 1.0.0-beta.19

Sign up to get free protection for your applications and to get access to all the features.
@@ -60,6 +60,7 @@ var styles = exports.styles = function styles(theme) {
60
60
  */
61
61
  function HiColoredLabel(props) {
62
62
  var classes = props.classes,
63
+ className = props.className,
63
64
  label = props.label,
64
65
  color = props.color,
65
66
  active = props.active,
@@ -74,7 +75,7 @@ function HiColoredLabel(props) {
74
75
  return _react2.default.createElement(
75
76
  'div',
76
77
  {
77
- className: (0, _classnames2.default)(classes.root, (0, _defineProperty3.default)({}, classes.beta, beta)),
78
+ className: (0, _classnames2.default)(classes.root, (0, _defineProperty3.default)({}, classes.beta, beta), className),
78
79
  style: {
79
80
  backgroundColor: active ? color : (0, _colorManipulator.fade)(color, 0.08),
80
81
  color: active ? (0, _colorManipulator.getContrastedTextColor)(color, '#4C4C4C', '#FFF') : color,
@@ -99,6 +100,10 @@ HiColoredLabel.propTypes = process.env.NODE_ENV !== "production" ? {
99
100
  * Surcharge les classes du composant
100
101
  */
101
102
  classes: _propTypes2.default.object,
103
+ /**
104
+ * Surcharge les classes du composant
105
+ */
106
+ className: _propTypes2.default.string,
102
107
  /**
103
108
  * Couleur du text & du background
104
109
  */
package/HiForm/HiInput.js CHANGED
@@ -70,7 +70,7 @@ var styles = exports.styles = function styles(theme) {
70
70
  }, theme.typography.body1, {
71
71
  borderBottom: '1px solid ' + theme.palette.input.bottomLine,
72
72
  paddingLeft: 8,
73
- backgroundColor: '#f5f5f5',
73
+ backgroundColor: theme.palette.background2,
74
74
  '&$focused': {
75
75
  backgroundColor: '#ffffff'
76
76
  },
@@ -4,6 +4,10 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
 
7
+ var _extends2 = require('babel-runtime/helpers/extends');
8
+
9
+ var _extends3 = _interopRequireDefault(_extends2);
10
+
7
11
  var _objectWithoutProperties2 = require('babel-runtime/helpers/objectWithoutProperties');
8
12
 
9
13
  var _objectWithoutProperties3 = _interopRequireDefault(_objectWithoutProperties2);
@@ -128,7 +132,8 @@ var BodyCellBuilder = function (_React$PureComponent) {
128
132
  lookedUp = _props.lookedUp,
129
133
  fixedColumnWidth = _props.fixedColumnWidth,
130
134
  disableContextMenu = _props.disableContextMenu,
131
- props = (0, _objectWithoutProperties3.default)(_props, ['ukey', 'type', 'data', 'view', 'width', 'padding', 'align', 'dense', 'ellipsis', 'onSelect', 'selectable', 'selected', 'sticky', 'dateLocale', 'numberLocale', 'childrenCount', 'onOpenDetails', 'lookedUp', 'fixedColumnWidth', 'disableContextMenu']);
135
+ detailInfos = _props.detailInfos,
136
+ props = (0, _objectWithoutProperties3.default)(_props, ['ukey', 'type', 'data', 'view', 'width', 'padding', 'align', 'dense', 'ellipsis', 'onSelect', 'selectable', 'selected', 'sticky', 'dateLocale', 'numberLocale', 'childrenCount', 'onOpenDetails', 'lookedUp', 'fixedColumnWidth', 'disableContextMenu', 'detailInfos']);
132
137
 
133
138
 
134
139
  var layoutProps = {
@@ -144,7 +149,9 @@ var BodyCellBuilder = function (_React$PureComponent) {
144
149
  sticky: sticky,
145
150
  childrenCount: childrenCount,
146
151
  lookedUp: lookedUp,
147
- fixedColumnWidth: fixedColumnWidth
152
+ fixedColumnWidth: fixedColumnWidth,
153
+ detailInfos: detailInfos,
154
+ onOpenDetails: onOpenDetails
148
155
  };
149
156
 
150
157
  var cellContent = void 0;
@@ -257,13 +264,16 @@ var BodyCellBuilder = function (_React$PureComponent) {
257
264
  break;
258
265
 
259
266
  case cst.TYPE_STATUS:
260
- cellElement = _react2.default.createElement(_BodyCells.CellStatus, {
267
+ cellElement = _react2.default.createElement(_BodyCells.CellStatus, (0, _extends3.default)({
261
268
  code: data.value,
262
- nbOperations: data.count_operations,
263
269
  value: data.label ? data.label : data.value,
264
- onOpenDetails: onOpenDetails,
265
270
  sticky: sticky
266
- });
271
+ }, detailInfos && {
272
+ nbOperations: detailInfos.total,
273
+ onOpenDetails: onOpenDetails
274
+ }));
275
+ delete layoutProps.detailInfos;
276
+ delete layoutProps.onOpenDetails;
267
277
  break;
268
278
 
269
279
  case cst.TYPE_THIRD_PARTY_SECURITY:
@@ -309,7 +319,8 @@ var BodyCellBuilder = function (_React$PureComponent) {
309
319
 
310
320
  BodyCellBuilder.defaultProps = {
311
321
  ellipsis: 'right',
312
- disableContextMenu: true
322
+ disableContextMenu: true,
323
+ detailInfos: null
313
324
  };
314
325
  exports.default = BodyCellBuilder;
315
326
  BodyCellBuilder.propTypes = process.env.NODE_ENV !== "production" ? {
@@ -341,6 +352,10 @@ BodyCellBuilder.propTypes = process.env.NODE_ENV !== "production" ? {
341
352
  * Densité, défini la hauteur de la ligne
342
353
  */
343
354
  dense: _propTypes2.default.bool,
355
+ /**
356
+ * Ajoute un Chip affichant le nombre de ligne de détails de la ligne et permettant de les affichés via onOpenDetails
357
+ */
358
+ detailInfos: _propTypes2.default.object,
344
359
  /**
345
360
  * Active/désactive le menu contextuel au clic droit sur les cellules du tableau
346
361
  */
@@ -142,6 +142,8 @@ var CellLayout = function (_React$Component) {
142
142
  selected = _props.selected,
143
143
  onSelect = _props.onSelect,
144
144
  childrenCount = _props.childrenCount,
145
+ detailInfos = _props.detailInfos,
146
+ onOpenDetails = _props.onOpenDetails,
145
147
  theme = _props.theme,
146
148
  padding = _props.padding,
147
149
  lookedUp = _props.lookedUp;
@@ -204,6 +206,22 @@ var CellLayout = function (_React$Component) {
204
206
  { color: theme.palette.business.primary.normal, className: classes.pins },
205
207
  childrenCount
206
208
  )
209
+ ),
210
+ detailInfos && _react2.default.createElement(
211
+ 'div',
212
+ {
213
+ style: {
214
+ position: 'absolute',
215
+ top: dense ? 2 : 6,
216
+ right: 0
217
+ },
218
+ onClick: onOpenDetails
219
+ },
220
+ _react2.default.createElement(
221
+ _HiPins2.default,
222
+ { color: theme.palette.business.secondary.normal, className: classes.pins },
223
+ detailInfos.total
224
+ )
207
225
  )
208
226
  )
209
227
  );
@@ -219,7 +237,8 @@ CellLayout.defaultProps = {
219
237
  dense: false,
220
238
  fixedColumnWidth: true,
221
239
  sticky: false,
222
- padding: 8
240
+ padding: 8,
241
+ detailInfos: null
223
242
  };
224
243
  CellLayout.propTypes = process.env.NODE_ENV !== "production" ? {
225
244
  /**
@@ -234,6 +253,10 @@ CellLayout.propTypes = process.env.NODE_ENV !== "production" ? {
234
253
  * Densité, défini la hauteur de la ligne
235
254
  */
236
255
  dense: _propTypes2.default.bool,
256
+ /**
257
+ * Ajoute un Chip affichant le nombre de ligne de détails de la ligne et permettant de les affichés via onOpenDetails
258
+ */
259
+ detailInfos: _propTypes2.default.object,
237
260
  /**
238
261
  * Recherche lookup sur cette colonne
239
262
  */
@@ -123,7 +123,7 @@ CellStatus.propTypes = process.env.NODE_ENV !== "production" ? {
123
123
  /**
124
124
  * Nombre d'opérations financières
125
125
  */
126
- nbOperations: _propTypes2.default.number.isRequired,
126
+ nbOperations: _propTypes2.default.number,
127
127
  /**
128
128
  * Statut courant de la transaction
129
129
  */
@@ -112,6 +112,12 @@ var BodyRow = function (_React$PureComponent) {
112
112
 
113
113
  var _this = (0, _possibleConstructorReturn3.default)(this, (BodyRow.__proto__ || (0, _getPrototypeOf2.default)(BodyRow)).call(this));
114
114
 
115
+ _this.handleOpenRowDetails = function (type) {
116
+ return function () {
117
+ _this.props.onOpenRowDetails(_this.props.row.rowId, type);
118
+ };
119
+ };
120
+
115
121
  _this.state = {
116
122
  live: props.live,
117
123
  style: {
@@ -165,11 +171,6 @@ var BodyRow = function (_React$PureComponent) {
165
171
  this.props.onClick(this.props.row);
166
172
  }
167
173
  }
168
- }, {
169
- key: 'handleOpenRowDetails',
170
- value: function handleOpenRowDetails() {
171
- this.props.onOpenRowDetails(this.props.row.rowId);
172
- }
173
174
  }, {
174
175
  key: 'handleSelect',
175
176
  value: function handleSelect() {
@@ -197,7 +198,8 @@ var BodyRow = function (_React$PureComponent) {
197
198
  sticky = _props.sticky,
198
199
  innerRow = _props.innerRow,
199
200
  isDetail = _props.isDetail,
200
- other = (0, _objectWithoutProperties3.default)(_props, ['classes', 'theme', 'row', 'columns', 'lookupColumns', 'orderedColumns', 'selectable', 'selected', 'onClick', 'view', 'dense', 'dateLocale', 'numberLocale', 'sticky', 'innerRow', 'isDetail']);
201
+ detailRowsOptions = _props.detailRowsOptions,
202
+ other = (0, _objectWithoutProperties3.default)(_props, ['classes', 'theme', 'row', 'columns', 'lookupColumns', 'orderedColumns', 'selectable', 'selected', 'onClick', 'view', 'dense', 'dateLocale', 'numberLocale', 'sticky', 'innerRow', 'isDetail', 'detailRowsOptions']);
201
203
  var style = this.state.style;
202
204
 
203
205
 
@@ -213,6 +215,19 @@ var BodyRow = function (_React$PureComponent) {
213
215
  // If there is no datas don't display the row
214
216
  if (!row.hasOwnProperty('datas')) return false;
215
217
 
218
+ var detailsInfos = {};
219
+ if (row.details && row.details.length > 0) {
220
+ detailsInfos = row.details.reduce(function (memo, item) {
221
+ if (item.rows.length > 0 && detailRowsOptions[item.type] && detailRowsOptions[item.type].anchor) {
222
+ memo[detailRowsOptions[item.type].anchor] = (0, _extends3.default)({
223
+ type: item.type,
224
+ total: item.rows.length
225
+ }, detailRowsOptions[item.type]);
226
+ }
227
+ return memo;
228
+ }, {});
229
+ }
230
+
216
231
  return _react2.default.createElement(
217
232
  _Table.TableRow,
218
233
  {
@@ -300,8 +315,11 @@ var BodyRow = function (_React$PureComponent) {
300
315
  numberLocale: numberLocale,
301
316
  dense: dense,
302
317
  selected: selected,
303
- onSelect: _this3.handleSelect,
304
- onOpenDetails: _this3.handleOpenRowDetails,
318
+ onSelect: _this3.handleSelect
319
+ }, detailsInfos[colId] && {
320
+ onOpenDetails: _this3.handleOpenRowDetails(detailsInfos[colId].type),
321
+ detailInfos: detailsInfos[colId]
322
+ }, {
305
323
  childrenCount: isParentAnchor ? row.children.length : null,
306
324
  colId: colId,
307
325
  lookedUp: lookedUp
@@ -331,7 +349,8 @@ BodyRow.defaultProps = {
331
349
  live: false,
332
350
  innerRow: false,
333
351
  lookupColumns: [],
334
- fixedColumnWidth: true
352
+ fixedColumnWidth: true,
353
+ detailRowsOptions: {}
335
354
  };
336
355
  BodyRow.propTypes = process.env.NODE_ENV !== "production" ? {
337
356
  /**
@@ -342,6 +361,10 @@ BodyRow.propTypes = process.env.NODE_ENV !== "production" ? {
342
361
  * Densité d'affichage (joue sur la hauteur des lignes)
343
362
  */
344
363
  dense: _propTypes2.default.bool,
364
+ /**
365
+ * Options utilisées pour décrire le comportement de lignes de détails
366
+ */
367
+ detailRowsOptions: _propTypes2.default.object,
345
368
  /**
346
369
  * Fixe la taille des colonnes selon le type de vue
347
370
  * Sinon les colonnes s'adaptent à l'espace disponible
@@ -196,7 +196,8 @@ var ChildRow = function (_React$PureComponent) {
196
196
  dense = _props.dense,
197
197
  sticky = _props.sticky,
198
198
  view = _props.view,
199
- other = (0, _objectWithoutProperties3.default)(_props, ['classes', 'theme', 'onClose', 'parentRowId', 'parentRowDatas', 'parentIndicatorColumn', 'parentLabel', 'parentLabelIcon', 'children', 'columns', 'orderedColumns', 'selectable', 'selected', 'dateLocale', 'dense', 'sticky', 'view']);
199
+ row = _props.row,
200
+ other = (0, _objectWithoutProperties3.default)(_props, ['classes', 'theme', 'onClose', 'parentRowId', 'parentRowDatas', 'parentIndicatorColumn', 'parentLabel', 'parentLabelIcon', 'children', 'columns', 'orderedColumns', 'selectable', 'selected', 'dateLocale', 'dense', 'sticky', 'view', 'row']);
200
201
 
201
202
 
202
203
  var indicator = '';
@@ -225,10 +226,7 @@ var ChildRow = function (_React$PureComponent) {
225
226
  _Table.TableBody,
226
227
  null,
227
228
  _react2.default.createElement(_BodyRow2.default, (0, _extends3.default)({
228
- row: {
229
- rowId: parentRowId,
230
- datas: parentRowDatas
231
- },
229
+ row: row,
232
230
  selectable: selectable,
233
231
  selected: selected,
234
232
  columns: columns,
@@ -364,10 +362,6 @@ ChildRow.propTypes = process.env.NODE_ENV !== "production" ? {
364
362
  * Données de la ligne parente
365
363
  */
366
364
  parentRowDatas: _propTypes2.default.object.isRequired,
367
- /**
368
- * Ligne des détails de la ligne parente
369
- */
370
- parentDetailRows: _propTypes2.default.array,
371
365
  /**
372
366
  * Indicateur du sous-ensemble (en général la date)
373
367
  */
@@ -713,7 +713,8 @@ var HiTable = function (_React$Component) {
713
713
  loading = _props.loading,
714
714
  fixedColumnWidth = _props.fixedColumnWidth,
715
715
  disableContextMenu = _props.disableContextMenu,
716
- footerContent = _props.footerContent;
716
+ footerContent = _props.footerContent,
717
+ detailRowsOptions = _props.detailRowsOptions;
717
718
  var _state = this.state,
718
719
  dateUpdate = _state.dateUpdate,
719
720
  isScrollToBottom = _state.isScrollToBottom,
@@ -799,7 +800,8 @@ var HiTable = function (_React$Component) {
799
800
  lookupColumns: lookupColumns,
800
801
  loading: loading,
801
802
  fixedColumnWidth: fixedColumnWidth,
802
- disableContextMenu: disableContextMenu
803
+ disableContextMenu: disableContextMenu,
804
+ detailRowsOptions: detailRowsOptions
803
805
  }),
804
806
  infiniteScroll && _react2.default.createElement(_HiTableFooterScroll2.default, {
805
807
  tabId: tabId,
@@ -860,6 +862,7 @@ HiTable.defaultProps = {
860
862
  dateLocale: 'en-EN',
861
863
  numberLocale: 'en-EN',
862
864
  dense: false,
865
+ detailRowsOptions: {},
863
866
  height: 450,
864
867
  sticky: true,
865
868
  translations: {
@@ -902,6 +905,17 @@ HiTable.propTypes = process.env.NODE_ENV !== "production" ? {
902
905
  * Locale utilisé pour le format des dates
903
906
  */
904
907
  dateLocale: _propTypes2.default.string,
908
+ /**
909
+ * Options utilisées pour décrire le comportement de lignes de détails
910
+ * ex: {
911
+ * payment_operation: {
912
+ * anchor: 'transaction_id'
913
+ * }
914
+ * }
915
+ * dans cet exemple, on veut que les lignes de détails de type payment_operation
916
+ * soient affichable à partir d'un chip button dans les cellules transaction_id
917
+ */
918
+ detailRowsOptions: _propTypes2.default.object,
905
919
  /**
906
920
  * Densité d'affichage (joue sur la hauteur des lignes)
907
921
  */
@@ -235,18 +235,22 @@ var HiTableBody = function (_React$Component) {
235
235
  /**
236
236
  * Définit les id des lignes dont les détails sont affichés ou null
237
237
  * (ajoute une ligne pour chaque détails)
238
+ * vérifie aussi le type du détail
238
239
  *
239
240
  * @param rowId
241
+ * @param type
240
242
  */
241
243
 
242
244
  }, {
243
245
  key: 'toggleOpenedDetailsRowId',
244
- value: function toggleOpenedDetailsRowId(rowId) {
246
+ value: function toggleOpenedDetailsRowId(rowId, type) {
245
247
  this.setState(function (prevState) {
246
248
  return {
247
- openedDetailsRowIdList: prevState.openedDetailsRowIdList.includes(rowId) ? prevState.openedDetailsRowIdList.filter(function (id) {
248
- return id !== rowId;
249
- }) : [].concat((0, _toConsumableArray3.default)(prevState.openedDetailsRowIdList), [rowId])
249
+ openedDetailsRowIdList: prevState.openedDetailsRowIdList.find(function (item) {
250
+ return item.id === rowId && item.type === type;
251
+ }) ? prevState.openedDetailsRowIdList.filter(function (item) {
252
+ return item.id !== rowId || item.type !== type;
253
+ }) : [].concat((0, _toConsumableArray3.default)(prevState.openedDetailsRowIdList), [{ id: rowId, type: type }])
250
254
  };
251
255
  });
252
256
  this.props.addNewRowRefs();
@@ -288,7 +292,8 @@ var HiTableBody = function (_React$Component) {
288
292
  lookupColumns = _props.lookupColumns,
289
293
  loading = _props.loading,
290
294
  fixedColumnWidth = _props.fixedColumnWidth,
291
- disableContextMenu = _props.disableContextMenu;
295
+ disableContextMenu = _props.disableContextMenu,
296
+ detailRowsOptions = _props.detailRowsOptions;
292
297
  var _state = this.state,
293
298
  openedParentRowId = _state.openedParentRowId,
294
299
  openedDetailsRowIdList = _state.openedDetailsRowIdList;
@@ -360,9 +365,6 @@ var HiTableBody = function (_React$Component) {
360
365
  // has children
361
366
  var hasChildren = row.hasOwnProperty('children') && row.children.length > 0;
362
367
 
363
- // has detail rows
364
- var hasDetailRows = row.hasOwnProperty('detailRows') && row.detailRows.length > 0;
365
-
366
368
  var BodyRowProps = (0, _extends3.default)({
367
369
  columns: columns,
368
370
  dateLocale: dateLocale,
@@ -374,9 +376,9 @@ var HiTableBody = function (_React$Component) {
374
376
  }, hasChildren && {
375
377
  openedAsParent: openedParentRowId === row.rowId,
376
378
  onClick: _this3.setOpenedParentRowId // if row has children, onClick display the children
377
- }, hasDetailRows && {
378
- onOpenRowDetails: _this3.toggleOpenedDetailsRowId
379
379
  }, {
380
+ onOpenRowDetails: _this3.toggleOpenedDetailsRowId,
381
+ detailRowsOptions: detailRowsOptions,
380
382
  orderedColumns: orderedColumns
381
383
  }, selectable && {
382
384
  selectable: selectable,
@@ -399,7 +401,6 @@ var HiTableBody = function (_React$Component) {
399
401
  parentIndicatorColumn: row.parentIndicatorColumn,
400
402
  parentLabel: row.parentLabel,
401
403
  parentLabelIcon: row.parentLabelIcon,
402
- parentDetailRows: row.detailRows,
403
404
  children: row.children,
404
405
  onClose: _this3.setOpenedParentRowId
405
406
  }, BodyRowProps)));
@@ -408,21 +409,27 @@ var HiTableBody = function (_React$Component) {
408
409
  }
409
410
 
410
411
  // add opened detail rows
411
- if (hasDetailRows && openedDetailsRowIdList.includes(row.rowId)) {
412
- row.detailRows.forEach(function (detailRow) {
413
- var detailRowProps = {
414
- row: detailRow,
415
- columns: columns,
416
- orderedColumns: orderedColumns,
417
- view: view,
418
- dense: dense,
419
- sticky: sticky,
420
- isDetail: true,
421
- fixedColumnWidth: fixedColumnWidth,
422
- disableContextMenu: disableContextMenu
423
- };
424
-
425
- tableRows.push(_react2.default.createElement(_BodyRow2.default, (0, _extends3.default)({ key: row.rowId + '-' + detailRow.rowId }, detailRowProps)));
412
+ if (row.details && row.details.length > 0) {
413
+ row.details.forEach(function (detail) {
414
+ if (detail.rows.length > 0 && openedDetailsRowIdList.find(function (item) {
415
+ return item.id === row.rowId && item.type === detail.type;
416
+ })) {
417
+ detail.rows.forEach(function (detailRow) {
418
+ var detailRowProps = {
419
+ row: detailRow,
420
+ columns: columns,
421
+ orderedColumns: orderedColumns,
422
+ view: view,
423
+ dense: dense,
424
+ sticky: sticky,
425
+ isDetail: true,
426
+ fixedColumnWidth: fixedColumnWidth,
427
+ disableContextMenu: disableContextMenu
428
+ };
429
+
430
+ tableRows.push(_react2.default.createElement(_BodyRow2.default, (0, _extends3.default)({ key: row.rowId + '-' + detailRow.rowId }, detailRowProps)));
431
+ });
432
+ }
426
433
  });
427
434
  }
428
435
  });
@@ -461,7 +468,8 @@ HiTableBody.defaultProps = {
461
468
  sticky: true,
462
469
  view: 'l',
463
470
  loading: false,
464
- disableContextMenu: true
471
+ disableContextMenu: true,
472
+ detailRowsOptions: {}
465
473
  };
466
474
  HiTableBody.propTypes = process.env.NODE_ENV !== "production" ? {
467
475
  /**
@@ -489,6 +497,10 @@ HiTableBody.propTypes = process.env.NODE_ENV !== "production" ? {
489
497
  * Densité d'affichage (joue sur la hauteur des lignes)
490
498
  */
491
499
  dense: _propTypes2.default.bool,
500
+ /**
501
+ * Options utilisées pour décrire le comportement de lignes de détails
502
+ */
503
+ detailRowsOptions: _propTypes2.default.object,
492
504
  /**
493
505
  * Active/désactive le menu contextuel au clic droit sur les cellules du tableau
494
506
  */
@@ -154,9 +154,8 @@ var styles = exports.styles = function styles(theme) {
154
154
  color: theme.palette.text.secondary,
155
155
  minWidth: 32
156
156
  },
157
- beta: {
158
- minWidth: 64,
159
- maxWidth: 80
157
+ betaWithoutAccountSelector: {
158
+ marginLeft: 1.5 * theme.spacing.unit
160
159
  },
161
160
  searchInput: {
162
161
  backgroundColor: theme.palette.background1 + ' !important'
@@ -353,7 +352,7 @@ var HiTopBar = function (_React$Component) {
353
352
  accountSelectorContent
354
353
  ),
355
354
  beta && _react2.default.createElement(_HiColoredLabel2.default, {
356
- className: classes.beta,
355
+ className: (0, _classnames2.default)((0, _defineProperty3.default)({}, classes.betaWithoutAccountSelector, !hasAccountSelector)),
357
356
  label: 'BETA',
358
357
  beta: true,
359
358
  color: theme.palette.neutral.dark
@@ -32,7 +32,7 @@ export const styles = theme => ({
32
32
  * Label with background color & text color
33
33
  */
34
34
  function HiColoredLabel(props) {
35
- const { classes, label, color, active, beta } = props;
35
+ const { classes, className, label, color, active, beta } = props;
36
36
  let fontWeight = 400;
37
37
  if (beta) {
38
38
  fontWeight = 600;
@@ -42,7 +42,7 @@ function HiColoredLabel(props) {
42
42
  return React.createElement(
43
43
  'div',
44
44
  {
45
- className: classNames(classes.root, { [classes.beta]: beta }),
45
+ className: classNames(classes.root, { [classes.beta]: beta }, className),
46
46
  style: {
47
47
  backgroundColor: active ? color : fade(color, 0.08),
48
48
  color: active ? getContrastedTextColor(color, '#4C4C4C', '#FFF') : color,
@@ -67,6 +67,10 @@ HiColoredLabel.propTypes = process.env.NODE_ENV !== "production" ? {
67
67
  * Surcharge les classes du composant
68
68
  */
69
69
  classes: PropTypes.object,
70
+ /**
71
+ * Surcharge les classes du composant
72
+ */
73
+ className: PropTypes.string,
70
74
  /**
71
75
  * Couleur du text & du background
72
76
  */
@@ -13,7 +13,7 @@ export const styles = theme => ({
13
13
  }, theme.typography.body1, {
14
14
  borderBottom: `1px solid ${theme.palette.input.bottomLine}`,
15
15
  paddingLeft: 8,
16
- backgroundColor: '#f5f5f5',
16
+ backgroundColor: theme.palette.background2,
17
17
  '&$focused': {
18
18
  backgroundColor: '#ffffff'
19
19
  },
@@ -1,3 +1,4 @@
1
+ import _extends from 'babel-runtime/helpers/extends';
1
2
  import _objectWithoutProperties from 'babel-runtime/helpers/objectWithoutProperties';
2
3
  import React from 'react';
3
4
  import PropTypes from 'prop-types';
@@ -76,9 +77,10 @@ export default class BodyCellBuilder extends React.PureComponent {
76
77
  onOpenDetails,
77
78
  lookedUp,
78
79
  fixedColumnWidth,
79
- disableContextMenu
80
+ disableContextMenu,
81
+ detailInfos
80
82
  } = _props,
81
- props = _objectWithoutProperties(_props, ['ukey', 'type', 'data', 'view', 'width', 'padding', 'align', 'dense', 'ellipsis', 'onSelect', 'selectable', 'selected', 'sticky', 'dateLocale', 'numberLocale', 'childrenCount', 'onOpenDetails', 'lookedUp', 'fixedColumnWidth', 'disableContextMenu']);
83
+ props = _objectWithoutProperties(_props, ['ukey', 'type', 'data', 'view', 'width', 'padding', 'align', 'dense', 'ellipsis', 'onSelect', 'selectable', 'selected', 'sticky', 'dateLocale', 'numberLocale', 'childrenCount', 'onOpenDetails', 'lookedUp', 'fixedColumnWidth', 'disableContextMenu', 'detailInfos']);
82
84
 
83
85
  const layoutProps = {
84
86
  type,
@@ -93,7 +95,9 @@ export default class BodyCellBuilder extends React.PureComponent {
93
95
  sticky,
94
96
  childrenCount,
95
97
  lookedUp,
96
- fixedColumnWidth
98
+ fixedColumnWidth,
99
+ detailInfos,
100
+ onOpenDetails
97
101
  };
98
102
 
99
103
  let cellContent;
@@ -206,13 +210,16 @@ export default class BodyCellBuilder extends React.PureComponent {
206
210
  break;
207
211
 
208
212
  case cst.TYPE_STATUS:
209
- cellElement = React.createElement(CellStatus, {
213
+ cellElement = React.createElement(CellStatus, _extends({
210
214
  code: data.value,
211
- nbOperations: data.count_operations,
212
215
  value: data.label ? data.label : data.value,
213
- onOpenDetails: onOpenDetails,
214
216
  sticky: sticky
215
- });
217
+ }, detailInfos && {
218
+ nbOperations: detailInfos.total,
219
+ onOpenDetails: onOpenDetails
220
+ }));
221
+ delete layoutProps.detailInfos;
222
+ delete layoutProps.onOpenDetails;
216
223
  break;
217
224
 
218
225
  case cst.TYPE_THIRD_PARTY_SECURITY:
@@ -255,7 +262,8 @@ export default class BodyCellBuilder extends React.PureComponent {
255
262
  }
256
263
  BodyCellBuilder.defaultProps = {
257
264
  ellipsis: 'right',
258
- disableContextMenu: true
265
+ disableContextMenu: true,
266
+ detailInfos: null
259
267
  };
260
268
  BodyCellBuilder.propTypes = process.env.NODE_ENV !== "production" ? {
261
269
  /**
@@ -286,6 +294,10 @@ BodyCellBuilder.propTypes = process.env.NODE_ENV !== "production" ? {
286
294
  * Densité, défini la hauteur de la ligne
287
295
  */
288
296
  dense: PropTypes.bool,
297
+ /**
298
+ * Ajoute un Chip affichant le nombre de ligne de détails de la ligne et permettant de les affichés via onOpenDetails
299
+ */
300
+ detailInfos: PropTypes.object,
289
301
  /**
290
302
  * Active/désactive le menu contextuel au clic droit sur les cellules du tableau
291
303
  */
@@ -62,7 +62,7 @@ class CellLayout extends React.Component {
62
62
  classes, type, children,
63
63
  align = cst.ALIGN_RIGHT_TYPES.includes(type) ? 'right' : 'left',
64
64
  view, dense, width = cst.DEFAULT_WIDTHS[type][view], fixedColumnWidth, sticky,
65
- selectable, selected, onSelect, childrenCount, theme, padding,
65
+ selectable, selected, onSelect, childrenCount, detailInfos, onOpenDetails, theme, padding,
66
66
  lookedUp
67
67
  } = this.props;
68
68
 
@@ -123,6 +123,22 @@ class CellLayout extends React.Component {
123
123
  { color: theme.palette.business.primary.normal, className: classes.pins },
124
124
  childrenCount
125
125
  )
126
+ ),
127
+ detailInfos && React.createElement(
128
+ 'div',
129
+ {
130
+ style: {
131
+ position: 'absolute',
132
+ top: dense ? 2 : 6,
133
+ right: 0
134
+ },
135
+ onClick: onOpenDetails
136
+ },
137
+ React.createElement(
138
+ HiPins,
139
+ { color: theme.palette.business.secondary.normal, className: classes.pins },
140
+ detailInfos.total
141
+ )
126
142
  )
127
143
  )
128
144
  );
@@ -136,7 +152,8 @@ CellLayout.defaultProps = {
136
152
  dense: false,
137
153
  fixedColumnWidth: true,
138
154
  sticky: false,
139
- padding: 8
155
+ padding: 8,
156
+ detailInfos: null
140
157
  };
141
158
  CellLayout.propTypes = process.env.NODE_ENV !== "production" ? {
142
159
  /**
@@ -151,6 +168,10 @@ CellLayout.propTypes = process.env.NODE_ENV !== "production" ? {
151
168
  * Densité, défini la hauteur de la ligne
152
169
  */
153
170
  dense: PropTypes.bool,
171
+ /**
172
+ * Ajoute un Chip affichant le nombre de ligne de détails de la ligne et permettant de les affichés via onOpenDetails
173
+ */
174
+ detailInfos: PropTypes.object,
154
175
  /**
155
176
  * Recherche lookup sur cette colonne
156
177
  */