@hipay/hipay-material-ui 1.0.0-beta.23 → 1.0.0-beta.25
Sign up to get free protection for your applications and to get access to all the features.
- 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
package/HiTable/HiTableBody.js
CHANGED
@@ -5,6 +5,14 @@ Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
});
|
6
6
|
exports.styles = undefined;
|
7
7
|
|
8
|
+
var _values = require('babel-runtime/core-js/object/values');
|
9
|
+
|
10
|
+
var _values2 = _interopRequireDefault(_values);
|
11
|
+
|
12
|
+
var _stringify = require('babel-runtime/core-js/json/stringify');
|
13
|
+
|
14
|
+
var _stringify2 = _interopRequireDefault(_stringify);
|
15
|
+
|
8
16
|
var _defineProperty2 = require('babel-runtime/helpers/defineProperty');
|
9
17
|
|
10
18
|
var _defineProperty3 = _interopRequireDefault(_defineProperty2);
|
@@ -51,6 +59,12 @@ var _classnames = require('classnames');
|
|
51
59
|
|
52
60
|
var _classnames2 = _interopRequireDefault(_classnames);
|
53
61
|
|
62
|
+
var _moment = require('moment');
|
63
|
+
|
64
|
+
var _moment2 = _interopRequireDefault(_moment);
|
65
|
+
|
66
|
+
require('moment/locale/fr');
|
67
|
+
|
54
68
|
var _styles = require('../styles');
|
55
69
|
|
56
70
|
var _BodyRow = require('./BodyRow');
|
@@ -69,6 +83,10 @@ var _constants = require('./constants');
|
|
69
83
|
|
70
84
|
var cst = _interopRequireWildcard(_constants);
|
71
85
|
|
86
|
+
var _lodash = require('lodash');
|
87
|
+
|
88
|
+
var _ = _interopRequireWildcard(_lodash);
|
89
|
+
|
72
90
|
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; } }
|
73
91
|
|
74
92
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
@@ -132,7 +150,7 @@ var HiTableBody = function (_React$Component) {
|
|
132
150
|
function HiTableBody(props) {
|
133
151
|
(0, _classCallCheck3.default)(this, HiTableBody);
|
134
152
|
|
135
|
-
var _this = (0, _possibleConstructorReturn3.default)(this, (HiTableBody.__proto__ || (0, _getPrototypeOf2.default)(HiTableBody)).call(this));
|
153
|
+
var _this = (0, _possibleConstructorReturn3.default)(this, (HiTableBody.__proto__ || (0, _getPrototypeOf2.default)(HiTableBody)).call(this, props));
|
136
154
|
|
137
155
|
_this.buildIndicator = function (row) {
|
138
156
|
var _this$props = _this.props,
|
@@ -165,17 +183,52 @@ var HiTableBody = function (_React$Component) {
|
|
165
183
|
|
166
184
|
_this.state = {
|
167
185
|
openedParentRowId: null,
|
168
|
-
openedDetailsRowIdList: []
|
186
|
+
openedDetailsRowIdList: [],
|
187
|
+
dataSource: props.dataSource,
|
188
|
+
groupByIds: {}
|
169
189
|
};
|
170
190
|
|
191
|
+
if (props.groupBy && props.dataSource) {
|
192
|
+
var groupByIds = {};
|
193
|
+
props.dataSource.map(function (row) {
|
194
|
+
var value = row.datas[props.groupBy].value;
|
195
|
+
if (!groupByIds.hasOwnProperty(value)) {
|
196
|
+
groupByIds[value] = [];
|
197
|
+
}
|
198
|
+
groupByIds[value].push(row.datas);
|
199
|
+
});
|
200
|
+
_this.state.groupByIds = groupByIds;
|
201
|
+
}
|
202
|
+
|
171
203
|
_this.buildIndicator = _this.buildIndicator.bind(_this);
|
172
204
|
_this.setOpenedParentRowId = _this.setOpenedParentRowId.bind(_this);
|
173
205
|
_this.toggleOpenedDetailsRowId = _this.toggleOpenedDetailsRowId.bind(_this);
|
174
206
|
_this.positionStickyRowNextButton = _this.positionStickyRowNextButton.bind(_this);
|
207
|
+
|
208
|
+
//Monkeypatch TableRow
|
209
|
+
/*var that = this;
|
210
|
+
TableRow.prototype.shouldComponentUpdate = function shouldComponentUpdate(nextProps, nextState){
|
211
|
+
return (this.state.hovered !== nextState.hovered || this.props.selected !== nextProps.selected) && true;
|
212
|
+
}*/
|
175
213
|
return _this;
|
176
214
|
}
|
177
215
|
|
178
216
|
(0, _createClass3.default)(HiTableBody, [{
|
217
|
+
key: 'deepCompare',
|
218
|
+
value: function deepCompare(object, base) {
|
219
|
+
var that = this;
|
220
|
+
return _.transform(object, function (result, value, key) {
|
221
|
+
if (!_.isEqual(value, base[key])) {
|
222
|
+
result[key] = _.isObject(value) && _.isObject(base[key]) ? that.deepCompare(value, base[key]) : value;
|
223
|
+
}
|
224
|
+
}).length > 0;
|
225
|
+
}
|
226
|
+
|
227
|
+
/*shouldComponentUpdate(nextProps, nextState){
|
228
|
+
this.deepCompare(this.props,nextProps) || this.deepCompare(this.state,nextState);
|
229
|
+
}*/
|
230
|
+
|
231
|
+
}, {
|
179
232
|
key: 'componentDidMount',
|
180
233
|
value: function componentDidMount() {
|
181
234
|
this.positionStickyRowNextButton();
|
@@ -185,6 +238,9 @@ var HiTableBody = function (_React$Component) {
|
|
185
238
|
value: function componentDidUpdate(prevProps, prevState, prevContext) {
|
186
239
|
this.positionStickyRowNextButton();
|
187
240
|
}
|
241
|
+
}, {
|
242
|
+
key: 'setOpenedParentRowId',
|
243
|
+
|
188
244
|
|
189
245
|
/**
|
190
246
|
* Définit l'id de la ligne parente "ouverte" ou null
|
@@ -193,9 +249,6 @@ var HiTableBody = function (_React$Component) {
|
|
193
249
|
*
|
194
250
|
* @param row
|
195
251
|
*/
|
196
|
-
|
197
|
-
}, {
|
198
|
-
key: 'setOpenedParentRowId',
|
199
252
|
value: function setOpenedParentRowId(row) {
|
200
253
|
this.setState(function (prevState) {
|
201
254
|
return {
|
@@ -225,7 +278,7 @@ var HiTableBody = function (_React$Component) {
|
|
225
278
|
}
|
226
279
|
button.parentElement.style.top = '4px';
|
227
280
|
}
|
228
|
-
var label = button.previousSibling
|
281
|
+
var label = button.previousSibling;
|
229
282
|
button.style.left = tableContainer.offsetWidth - label.offsetWidth - 48 - 160 + 'px';
|
230
283
|
}
|
231
284
|
});
|
@@ -272,7 +325,6 @@ var HiTableBody = function (_React$Component) {
|
|
272
325
|
tabId = _props.tabId,
|
273
326
|
columns = _props.columns,
|
274
327
|
orderedColumns = _props.orderedColumns,
|
275
|
-
dataSource = _props.dataSource,
|
276
328
|
onRowClick = _props.onRowClick,
|
277
329
|
selectable = _props.selectable,
|
278
330
|
onSelect = _props.onSelect,
|
@@ -287,7 +339,6 @@ var HiTableBody = function (_React$Component) {
|
|
287
339
|
translations = _props.translations,
|
288
340
|
dateLocale = _props.dateLocale,
|
289
341
|
numberLocale = _props.numberLocale,
|
290
|
-
groupByIds = _props.groupByIds,
|
291
342
|
sortedColumnId = _props.sortedColumnId,
|
292
343
|
lookupColumns = _props.lookupColumns,
|
293
344
|
loading = _props.loading,
|
@@ -296,7 +347,9 @@ var HiTableBody = function (_React$Component) {
|
|
296
347
|
detailRowsOptions = _props.detailRowsOptions;
|
297
348
|
var _state = this.state,
|
298
349
|
openedParentRowId = _state.openedParentRowId,
|
299
|
-
openedDetailsRowIdList = _state.openedDetailsRowIdList
|
350
|
+
openedDetailsRowIdList = _state.openedDetailsRowIdList,
|
351
|
+
groupByIds = _state.groupByIds,
|
352
|
+
dataSource = _state.dataSource;
|
300
353
|
|
301
354
|
|
302
355
|
var nbColumnsDisplayed = 0;
|
@@ -315,31 +368,21 @@ var HiTableBody = function (_React$Component) {
|
|
315
368
|
// Gestion du sticky group by
|
316
369
|
if (typeof groupBy !== 'undefined' && groupBy === sortedColumnId) {
|
317
370
|
var currentGroupByValue = row.datas[groupBy].value;
|
318
|
-
|
319
|
-
if (date instanceof Date && isFinite(date)) {
|
320
|
-
currentGroupByValue = currentGroupByValue.substr(0, 10);
|
321
|
-
}
|
371
|
+
|
322
372
|
// TODO => condition for other columns type
|
323
373
|
if (columns[groupBy].type === cst.TYPE_DATE) {
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
weekday: 'long',
|
333
|
-
day: 'numeric'
|
334
|
-
};
|
335
|
-
label = label.toLocaleString(dateLocale, options);
|
336
|
-
label = label.charAt(0).toUpperCase() + label.substr(1);
|
337
|
-
}
|
374
|
+
|
375
|
+
_moment2.default.locale(dateLocale);
|
376
|
+
var date = (0, _moment2.default)(currentGroupByValue);
|
377
|
+
var label = date.format('dddd D MMMM YYYY');
|
378
|
+
|
379
|
+
if (index === 0 || label !== stickyRowValue) {
|
380
|
+
|
381
|
+
stickyRowValue = label;
|
338
382
|
|
339
383
|
tableRows.push(_react2.default.createElement(_HiStickyRow2.default, {
|
340
384
|
key: 'sticky_row_' + row.rowId,
|
341
385
|
dense: dense,
|
342
|
-
value: stickyRowValue,
|
343
386
|
label: label,
|
344
387
|
length: groupByIds[currentGroupByValue].length,
|
345
388
|
colSpan: nbColumnsDisplayed,
|
@@ -424,7 +467,9 @@ var HiTableBody = function (_React$Component) {
|
|
424
467
|
sticky: sticky,
|
425
468
|
isDetail: true,
|
426
469
|
fixedColumnWidth: fixedColumnWidth,
|
427
|
-
disableContextMenu: disableContextMenu
|
470
|
+
disableContextMenu: disableContextMenu,
|
471
|
+
dateLocale: dateLocale,
|
472
|
+
numberLocale: numberLocale
|
428
473
|
};
|
429
474
|
|
430
475
|
tableRows.push(_react2.default.createElement(_BodyRow2.default, (0, _extends3.default)({ key: row.rowId + '-' + detailRow.rowId }, detailRowProps)));
|
@@ -453,6 +498,31 @@ var HiTableBody = function (_React$Component) {
|
|
453
498
|
})
|
454
499
|
);
|
455
500
|
}
|
501
|
+
}], [{
|
502
|
+
key: 'getDerivedStateFromProps',
|
503
|
+
value: function getDerivedStateFromProps(props, state) {
|
504
|
+
var nextState = {};
|
505
|
+
if (props.groupBy && props.dataSource && props.dataSource.length > 0) {
|
506
|
+
if ((0, _stringify2.default)(props.dataSource) !== (0, _stringify2.default)(state.dataSource)) {
|
507
|
+
var groupByIds = {};
|
508
|
+
props.dataSource.map(function (row) {
|
509
|
+
var value = row.datas[props.groupBy].value;
|
510
|
+
if (!groupByIds.hasOwnProperty(value)) {
|
511
|
+
groupByIds[value] = [];
|
512
|
+
}
|
513
|
+
groupByIds[value].push(row.datas);
|
514
|
+
});
|
515
|
+
nextState.groupByIds = groupByIds;
|
516
|
+
}
|
517
|
+
}
|
518
|
+
if ((0, _stringify2.default)(props.dataSource) !== (0, _stringify2.default)(state.dataSource)) {
|
519
|
+
nextState.dataSource = props.dataSource;
|
520
|
+
}
|
521
|
+
if ((0, _values2.default)(nextState).length > 0) {
|
522
|
+
return nextState;
|
523
|
+
}
|
524
|
+
return null;
|
525
|
+
}
|
456
526
|
}]);
|
457
527
|
return HiTableBody;
|
458
528
|
}(_react2.default.Component);
|
@@ -88,7 +88,9 @@ var HiTableContextMenu = function (_React$Component) {
|
|
88
88
|
|
89
89
|
_this.state = {
|
90
90
|
value: '',
|
91
|
-
label: ''
|
91
|
+
label: '',
|
92
|
+
lookup: true,
|
93
|
+
exclude: true
|
92
94
|
};
|
93
95
|
|
94
96
|
_this.handleContextMenuOpen = _this.handleContextMenuOpen.bind(_this);
|
@@ -102,9 +104,13 @@ var HiTableContextMenu = function (_React$Component) {
|
|
102
104
|
(0, _createClass3.default)(HiTableContextMenu, [{
|
103
105
|
key: 'handleContextMenuOpen',
|
104
106
|
value: function handleContextMenuOpen(event) {
|
107
|
+
var columns = this.props.columns;
|
108
|
+
|
105
109
|
this.setState({
|
106
110
|
value: event.detail.data.value,
|
107
|
-
label: event.detail.data.label
|
111
|
+
label: event.detail.data.label,
|
112
|
+
lookup: columns[event.detail.data.column].lookup !== false,
|
113
|
+
exclude: columns[event.detail.data.column].exclude !== false
|
108
114
|
});
|
109
115
|
}
|
110
116
|
}, {
|
@@ -144,9 +150,12 @@ var HiTableContextMenu = function (_React$Component) {
|
|
144
150
|
classes = _props.classes,
|
145
151
|
tabId = _props.tabId,
|
146
152
|
translations = _props.translations;
|
153
|
+
var _state = this.state,
|
154
|
+
lookup = _state.lookup,
|
155
|
+
exclude = _state.exclude;
|
147
156
|
|
148
157
|
|
149
|
-
var contextMenuItems = [{ id: 'copy', icon: 'contentDuplicate', title: translations.copy, action: this.handleClickCopy }, { id: 'lookup', icon: 'crosshairsGps', title: translations.lookUp, action: this.handleClickLookup }, { id: 'exclude', icon: 'closeCircleOutline', title: translations.exclude, action: this.handleClickExclude }, { id: 'open', icon: 'openInNew', title: translations.openInNewTab, action: this.handleClickOpenNewTab }];
|
158
|
+
var contextMenuItems = [{ id: 'copy', icon: 'contentDuplicate', title: translations.copy, action: this.handleClickCopy }, { id: 'lookup', displayed: lookup, icon: 'crosshairsGps', title: translations.lookUp, action: this.handleClickLookup }, { id: 'exclude', displayed: exclude, icon: 'closeCircleOutline', title: translations.exclude, action: this.handleClickExclude }, { id: 'open', icon: 'openInNew', title: translations.openInNewTab, action: this.handleClickOpenNewTab }];
|
150
159
|
|
151
160
|
return _react2.default.createElement(
|
152
161
|
_reactContextmenu.ContextMenu,
|
@@ -156,19 +165,21 @@ var HiTableContextMenu = function (_React$Component) {
|
|
156
165
|
onShow: this.handleContextMenuOpen
|
157
166
|
},
|
158
167
|
contextMenuItems.map(function (menuItem) {
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
168
|
+
if (menuItem.displayed !== false) {
|
169
|
+
return _react2.default.createElement(
|
170
|
+
_reactContextmenu.MenuItem,
|
171
|
+
{
|
172
|
+
attributes: { className: classes.contextMenuItem },
|
173
|
+
key: 'hitable_context_menu_' + tabId + '_' + menuItem.id,
|
174
|
+
onClick: menuItem.action },
|
175
|
+
_react2.default.createElement(_HiIconBuilder2.default, { icon: menuItem.icon }),
|
176
|
+
_react2.default.createElement(
|
177
|
+
'span',
|
178
|
+
{ className: classes.title },
|
179
|
+
menuItem.title.replace('%s', _this2.state.label)
|
180
|
+
)
|
181
|
+
);
|
182
|
+
}
|
172
183
|
})
|
173
184
|
);
|
174
185
|
}
|
@@ -189,6 +200,10 @@ HiTableContextMenu.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
189
200
|
* Surcharge le style du composant
|
190
201
|
*/
|
191
202
|
classes: _propTypes2.default.object,
|
203
|
+
/**
|
204
|
+
* Liste des objets colonnes utilisé pour savoir quels items du context menu sont affichés
|
205
|
+
*/
|
206
|
+
columns: _propTypes2.default.object.isRequired,
|
192
207
|
/**
|
193
208
|
* Fonction de callback appelée au clic sur l'item redirection
|
194
209
|
* du menu contextuel ouvert au clic droit
|
package/HiTable/HiTableFooter.js
CHANGED
@@ -5,6 +5,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
});
|
6
6
|
exports.styles = undefined;
|
7
7
|
|
8
|
+
var _stringify = require('babel-runtime/core-js/json/stringify');
|
9
|
+
|
10
|
+
var _stringify2 = _interopRequireDefault(_stringify);
|
11
|
+
|
8
12
|
var _getPrototypeOf = require('babel-runtime/core-js/object/get-prototype-of');
|
9
13
|
|
10
14
|
var _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf);
|
@@ -78,6 +82,11 @@ var HiTableFooter = function (_React$Component) {
|
|
78
82
|
}
|
79
83
|
|
80
84
|
(0, _createClass3.default)(HiTableFooter, [{
|
85
|
+
key: 'shouldComponentUpdate',
|
86
|
+
value: function shouldComponentUpdate(nextProps, nextState) {
|
87
|
+
return (0, _stringify2.default)(this.props) !== (0, _stringify2.default)(nextProps) || (0, _stringify2.default)(this.state) !== (0, _stringify2.default)(nextState);
|
88
|
+
}
|
89
|
+
}, {
|
81
90
|
key: 'render',
|
82
91
|
value: function render() {
|
83
92
|
var _props = this.props,
|
package/HiTable/HiTableHead.js
CHANGED
@@ -13,6 +13,10 @@ var _extends2 = require('babel-runtime/helpers/extends');
|
|
13
13
|
|
14
14
|
var _extends3 = _interopRequireDefault(_extends2);
|
15
15
|
|
16
|
+
var _stringify = require('babel-runtime/core-js/json/stringify');
|
17
|
+
|
18
|
+
var _stringify2 = _interopRequireDefault(_stringify);
|
19
|
+
|
16
20
|
var _getPrototypeOf = require('babel-runtime/core-js/object/get-prototype-of');
|
17
21
|
|
18
22
|
var _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf);
|
@@ -163,13 +167,13 @@ var HiTableHead = function (_React$Component) {
|
|
163
167
|
|
164
168
|
var _this = (0, _possibleConstructorReturn3.default)(this, (HiTableHead.__proto__ || (0, _getPrototypeOf2.default)(HiTableHead)).call(this));
|
165
169
|
|
170
|
+
_this.orderColumnsAnchorEl = null;
|
166
171
|
_this.orderColumnsButton = null;
|
167
172
|
|
168
173
|
|
169
174
|
_this.state = {
|
170
175
|
hovered: false,
|
171
|
-
openedOrderColumns: false
|
172
|
-
orderColumnsAnchorEl: null
|
176
|
+
openedOrderColumns: false
|
173
177
|
};
|
174
178
|
|
175
179
|
_this.handleEvent = _this.handleEvent.bind(_this);
|
@@ -179,6 +183,11 @@ var HiTableHead = function (_React$Component) {
|
|
179
183
|
}
|
180
184
|
|
181
185
|
(0, _createClass3.default)(HiTableHead, [{
|
186
|
+
key: 'shouldComponentUpdate',
|
187
|
+
value: function shouldComponentUpdate(nextProps, nextState) {
|
188
|
+
return (0, _stringify2.default)(this.props) !== (0, _stringify2.default)(nextProps) || (0, _stringify2.default)(this.state) !== (0, _stringify2.default)(nextState);
|
189
|
+
}
|
190
|
+
}, {
|
182
191
|
key: 'handleEvent',
|
183
192
|
value: function handleEvent(_ref) {
|
184
193
|
var type = _ref.type;
|
@@ -196,9 +205,9 @@ var HiTableHead = function (_React$Component) {
|
|
196
205
|
key: 'handleOpenOrderColumns',
|
197
206
|
value: function handleOpenOrderColumns() {
|
198
207
|
this.setState({
|
199
|
-
openedOrderColumns: true
|
200
|
-
orderColumnsAnchorEl: (0, _reactDom.findDOMNode)(this.orderColumnsButton)
|
208
|
+
openedOrderColumns: true
|
201
209
|
});
|
210
|
+
this.orderColumnsAnchorEl = (0, _reactDom.findDOMNode)(this.orderColumnsButton);
|
202
211
|
}
|
203
212
|
}, {
|
204
213
|
key: 'handleCloseOrderColumns',
|
@@ -240,8 +249,7 @@ var HiTableHead = function (_React$Component) {
|
|
240
249
|
fixedColumnWidth = _props.fixedColumnWidth;
|
241
250
|
var _state = this.state,
|
242
251
|
hovered = _state.hovered,
|
243
|
-
openedOrderColumns = _state.openedOrderColumns
|
244
|
-
orderColumnsAnchorEl = _state.orderColumnsAnchorEl;
|
252
|
+
openedOrderColumns = _state.openedOrderColumns;
|
245
253
|
|
246
254
|
|
247
255
|
var headerProps = (0, _extends3.default)({
|
@@ -343,7 +351,7 @@ var HiTableHead = function (_React$Component) {
|
|
343
351
|
orderable && _react2.default.createElement(_OrderColumns2.default, {
|
344
352
|
isOpen: openedOrderColumns,
|
345
353
|
onClose: this.handleCloseOrderColumns,
|
346
|
-
anchorEl: orderColumnsAnchorEl,
|
354
|
+
anchorEl: this.orderColumnsAnchorEl,
|
347
355
|
updateOrderedColumns: onColumnsOrderUpdate,
|
348
356
|
columns: columns,
|
349
357
|
orderedColumns: orderedColumns,
|
package/HiTopBar/HiTopBar.js
CHANGED
@@ -245,6 +245,12 @@ var HiTopBar = function (_React$Component) {
|
|
245
245
|
value: function handleClickMenu() {
|
246
246
|
this.props.onClickReturn();
|
247
247
|
}
|
248
|
+
|
249
|
+
//TODO : Cyclic reference passed.
|
250
|
+
/*shouldComponentUpdate(nextProps, nextState){
|
251
|
+
return JSON.stringify(this.props) !== JSON.stringify(nextProps);
|
252
|
+
}*/
|
253
|
+
|
248
254
|
}, {
|
249
255
|
key: 'render',
|
250
256
|
value: function render() {
|
package/README.md
CHANGED
@@ -5,12 +5,14 @@ Voici la documentation du site HiPay Material-UI.
|
|
5
5
|
Avant de commencer, il faut vous familiariser avec REACT :
|
6
6
|
- https://reactjs.org/
|
7
7
|
- https://reactjs.org/docs/optimizing-performance.html
|
8
|
+
|
8
9
|
Et connaitres les [best practices](#best-practices)
|
9
10
|
|
10
11
|
|
11
12
|
## Lancer le projet
|
12
13
|
|
13
14
|
#### Via docker
|
15
|
+
|
14
16
|
Il faut que sur votre poste soit installés
|
15
17
|
- [Docker](https://www.docker.com/community-edition) (minimum version 17)
|
16
18
|
- [Docker Compose](#https://docs.docker.com/compose/install/) (minimum version 1.13.0)
|
@@ -27,6 +29,7 @@ Le site est dispo à cette URL:
|
|
27
29
|
[http://localhost:3222](http://localhost:3222)
|
28
30
|
|
29
31
|
#### En local
|
32
|
+
|
30
33
|
Il faut que sur votre poste soit installés
|
31
34
|
- [node](https://nodejs.org/fr/) (minimum version LTS 8.9.4)
|
32
35
|
- [npm](https://www.npmjs.com/) (minimum version 5.6.0)
|
@@ -115,10 +118,50 @@ git flow feature start PSYCHE-XXX
|
|
115
118
|
- Les [tests unitaires](#tests) doivent passer
|
116
119
|
- La [génération des apis](#generation-des-apis) aussi
|
117
120
|
- Le code doit être bien formatter : [ESLint - Prettier](#esLint-prettier)
|
118
|
-
-
|
121
|
+
- Commit - suivant les conventions de rédaction des messages de commit
|
122
|
+
- Push
|
119
123
|
- Faire la demande de merge request sur la develop
|
120
124
|
- La revue se fera par un membre de l'équipe PSYCHE
|
121
125
|
|
126
|
+
##### Conventional Changelog
|
127
|
+
|
128
|
+
(optionel) installer [commitizen](https://github.com/commitizen/cz-cli) pour s'assurer de commiter selon la convention
|
129
|
+
```sh
|
130
|
+
npm install commitizen -g
|
131
|
+
```
|
132
|
+
|
133
|
+
|
134
|
+
Voici un squelette d’exemple de message de commit conventionnel :
|
135
|
+
```
|
136
|
+
<type de tâche>(<périmètre>): message court
|
137
|
+
|
138
|
+
Description complémentaire/complète
|
139
|
+
|
140
|
+
Référence/action sur un ticket définissant cette tâche
|
141
|
+
```
|
142
|
+
|
143
|
+
On facilite ainsi la lecture du log d’une part, la génération automatique du changelog (ou release notes) d’autre part
|
144
|
+
|
145
|
+
Types de tâche:
|
146
|
+
- <b>fix</b> : commit d'une correction de bug. Se traduit en <b>PATCH</b> dans le changelog
|
147
|
+
- <b>feat</b> : commit d'une nouvelle feature. Se traduit en <b>MINOR</b> dans le changelog
|
148
|
+
- <b>test</b> : commit d'un ajout ou d'une maj de tests
|
149
|
+
- <b>docs</b> : commit d'un ajout ou d'une maj de la documentation OU de l'app de démonstration
|
150
|
+
- <b>perf</b> : commit concernant l'amélioration des performances
|
151
|
+
|
152
|
+
<b>BREAKING CHANGE</b> : si un commit introduit un BREAKING CHANGE, on doit ajouter le tag BREAKING CHANGE dans le corps du commit. Ce commit peut être de n'importe quel type mais il est préférable qu'il soit lié à une feature. Se traduit en <b>MAJOR</b> dans le changelog
|
153
|
+
|
154
|
+
Périmètre (optionel): nom du composant, type de tests, page de la doc
|
155
|
+
|
156
|
+
Exemple:
|
157
|
+
```
|
158
|
+
feat(HiTable): add children rows management
|
159
|
+
|
160
|
+
Handle children rows as subtable based on the same columns as parents.
|
161
|
+
|
162
|
+
PSYCHE-XX
|
163
|
+
```
|
164
|
+
|
122
165
|
## Génération des apis
|
123
166
|
```sh
|
124
167
|
npm run docs:api
|
@@ -178,12 +221,17 @@ Le projet est publié sur un repo privé npm : https://www.npmjs.com/package/@hi
|
|
178
221
|
|
179
222
|
#### Publier une nouvelle version
|
180
223
|
|
181
|
-
|
182
|
-
2. Build
|
224
|
+
Avoir installé [conventional-changelog-cli](https://github.com/conventional-changelog/conventional-changelog/tree/master/packages/conventional-changelog-cli) pour générer le CHANGELOG à partir des commits git.
|
183
225
|
```sh
|
184
|
-
npm
|
226
|
+
npm install -g conventional-changelog-cli
|
185
227
|
```
|
186
|
-
|
228
|
+
|
229
|
+
1. Changer la version dans package.json
|
230
|
+
2. Générer le fichier HI-CHANGELOG.md : ```npm run changelog```
|
231
|
+
3. Commiter la release : ```git ci -am "chore(release): VERSION DATE```
|
232
|
+
4. Build : ```npm run build```
|
233
|
+
5. Publish :
|
234
|
+
|
187
235
|
```sh
|
188
236
|
cd build
|
189
237
|
npm login
|
@@ -192,7 +240,24 @@ npm login
|
|
192
240
|
npm publish
|
193
241
|
```
|
194
242
|
|
195
|
-
|
243
|
+
#### [Semantic Versioning](https://semver.org/)
|
244
|
+
|
245
|
+
Une version MAJOR.MINOR.PATCH, correspond a:
|
246
|
+
|
247
|
+
- MAJOR version introduisant des évolutions non retro-compatibles (API changes...),
|
248
|
+
- MINOR version introduisant des évolutions retro-compatibles, la sortie des versions mineures est basé sur les sprints de la tribu PSYCHE
|
249
|
+
- PATCH version corrigeant des bugs
|
250
|
+
Des tags additionels peuvent être ajouter selon le contexte (ex: 1.0.0-beta.24).
|
251
|
+
|
252
|
+
En production, chaque releases (MAJOR, MINOR & PATCH) doit faire l'objet d'une communication interne aux tribus utilisatrices.
|
253
|
+
|
254
|
+
Les projets peuvent se baser sur une version MINOR: ```^2.5.0```, ce qui signifient "compatible avec la version 2.5.0".
|
255
|
+
|
256
|
+
Ainsi les PATCH seront automatiquement pris en compte.
|
257
|
+
L'intégration d'une MINOR doit faire l'objet d'une recette (voir HI-CHANGELOG.md).
|
258
|
+
Le passage à une autre MAJOR doit faire l'objet d'une recette (voir HI-CHANGELOG.md BREAKING CHANGE).
|
259
|
+
|
260
|
+
# Si ERR d'authentification
|
196
261
|
npm adduser
|
197
262
|
admin
|
198
263
|
admin123
|