@hipay/hipay-material-ui 1.0.0-beta.22 → 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 +67 -8
- package/HiChip/HiChipSwitch.js +6 -0
- package/HiDatePicker/HiDatePicker.js +35 -21
- package/HiDatePicker/HiDateRangePicker.js +92 -50
- package/HiDatePicker/HiDateRangeSelector.js +15 -4
- package/HiDatePicker/Overlays/Overlay.js +1 -1
- package/HiDatePicker/stylesheet.js +3 -0
- package/HiForm/HiInput.js +12 -2
- package/HiForm/HiPasswordField.js +8 -3
- package/HiLoader/HiLoader.js +7 -4
- package/HiPins/HiPins.js +6 -4
- package/HiSelect/HiSelect.js +26 -6
- package/HiSelect/HiSuggestSelect.js +2 -1
- package/HiSelect/SelectInput.js +3 -8
- package/HiSelectableList/HiSelectableList.js +51 -49
- package/HiSelectableList/HiSelectableListItem.js +18 -2
- package/HiTable/BodyCellBuilder.js +22 -12
- package/HiTable/BodyCells/CellAccount.js +13 -4
- 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 +13 -4
- package/HiTable/BodyCells/CellText.js +17 -7
- package/HiTable/BodyCells/CellThirdPartySecurity.js +12 -3
- package/HiTable/BodyRow.js +12 -3
- package/HiTable/ColumnFilter.js +2 -5
- 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 +79 -8
- package/es/HiChip/HiChipSwitch.js +6 -0
- package/es/HiDatePicker/HiDatePicker.js +30 -21
- package/es/HiDatePicker/HiDateRangePicker.js +86 -52
- package/es/HiDatePicker/HiDateRangeSelector.js +14 -4
- package/es/HiDatePicker/Overlays/Overlay.js +1 -1
- package/es/HiDatePicker/stylesheet.js +3 -0
- package/es/HiForm/HiInput.js +12 -2
- package/es/HiForm/HiPasswordField.js +8 -3
- package/es/HiLoader/HiLoader.js +3 -3
- package/es/HiPins/HiPins.js +4 -4
- package/es/HiSelect/HiSelect.js +25 -6
- package/es/HiSelect/HiSuggestSelect.js +2 -1
- package/es/HiSelect/SelectInput.js +3 -8
- package/es/HiSelectableList/HiSelectableList.js +51 -49
- package/es/HiSelectableList/HiSelectableListItem.js +15 -2
- package/es/HiTable/BodyCellBuilder.js +8 -2
- package/es/HiTable/BodyCells/CellAccount.js +7 -2
- 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 +7 -2
- 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 +2 -5
- 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 +99120 -65306
- package/umd/hipay-material-ui.production.min.js +5 -5
- package/utils/HiIconBuilder.js +6 -2
@@ -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
|
package/es/HiChip/HiChip.js
CHANGED
@@ -27,14 +27,24 @@ export const styles = theme => ({
|
|
27
27
|
},
|
28
28
|
'&$deletable': {
|
29
29
|
paddingRight: 4
|
30
|
+
},
|
31
|
+
'&$leftIccon': {
|
32
|
+
paddingLeft: 4
|
30
33
|
}
|
31
34
|
}),
|
32
35
|
leftNavigation: {},
|
33
36
|
rightNavigation: {},
|
34
37
|
deletable: {},
|
38
|
+
leftIccon: {},
|
35
39
|
icon: {
|
36
40
|
marginRight: 4
|
37
41
|
},
|
42
|
+
iconClickable: {
|
43
|
+
cursor: 'pointer',
|
44
|
+
'&:hover, &:focus': {
|
45
|
+
color: theme.palette.business.primary.normal
|
46
|
+
}
|
47
|
+
},
|
38
48
|
eraseIcon: {
|
39
49
|
// Remove grey highlight
|
40
50
|
WebkitTapHighlightColor: 'transparent',
|
@@ -78,15 +88,33 @@ export const styles = theme => ({
|
|
78
88
|
});
|
79
89
|
|
80
90
|
function HiChip(props) {
|
81
|
-
const {
|
91
|
+
const {
|
92
|
+
label,
|
93
|
+
classes,
|
94
|
+
icon,
|
95
|
+
id,
|
96
|
+
img,
|
97
|
+
onPrevious,
|
98
|
+
onNext,
|
99
|
+
onDelete,
|
100
|
+
prefix,
|
101
|
+
onIconClick,
|
102
|
+
titleDelete,
|
103
|
+
titleIcon,
|
104
|
+
titleImg,
|
105
|
+
titleNext,
|
106
|
+
titlePrevious
|
107
|
+
} = props;
|
82
108
|
|
83
109
|
return React.createElement(
|
84
110
|
'div',
|
85
111
|
{
|
112
|
+
id: id,
|
86
113
|
className: classNames(classes.root, {
|
87
114
|
[classes.leftNavigation]: onPrevious,
|
88
115
|
[classes.rightNavigation]: onNext,
|
89
|
-
[classes.deletable]: onDelete
|
116
|
+
[classes.deletable]: onDelete,
|
117
|
+
[classes.leftIccon]: icon
|
90
118
|
})
|
91
119
|
},
|
92
120
|
prefix && React.createElement(
|
@@ -95,13 +123,22 @@ function HiChip(props) {
|
|
95
123
|
prefix,
|
96
124
|
' : '
|
97
125
|
),
|
98
|
-
img && React.createElement('img', { className: classes.badge, src: img, alt: img }),
|
99
|
-
icon && React.createElement(HiIconBuilder, {
|
126
|
+
img && React.createElement('img', { className: classes.badge, src: img, alt: img, title: titleImg }),
|
127
|
+
icon && React.createElement(HiIconBuilder, {
|
128
|
+
className: classNames(classes.icon, {
|
129
|
+
[classes.iconClickable]: onIconClick
|
130
|
+
}),
|
131
|
+
icon: icon,
|
132
|
+
size: 16,
|
133
|
+
onClick: onIconClick,
|
134
|
+
titleAccess: titleIcon
|
135
|
+
}),
|
100
136
|
onPrevious && React.createElement(HiIconBuilder, {
|
101
137
|
className: classNames(classes.navigate),
|
102
138
|
icon: 'menuLeft',
|
103
139
|
onClick: onPrevious,
|
104
|
-
size: 16
|
140
|
+
size: 16,
|
141
|
+
titleAccess: titlePrevious
|
105
142
|
}),
|
106
143
|
React.createElement(
|
107
144
|
'span',
|
@@ -112,13 +149,15 @@ function HiChip(props) {
|
|
112
149
|
className: classNames(classes.navigate),
|
113
150
|
icon: 'menuRight',
|
114
151
|
onClick: onNext,
|
115
|
-
size: 16
|
152
|
+
size: 16,
|
153
|
+
titleAccess: titleNext
|
116
154
|
}),
|
117
155
|
onDelete && React.createElement(HiIconBuilder, {
|
118
156
|
classes: { root: classes.eraseIcon },
|
119
157
|
icon: 'closeCircle',
|
120
158
|
onClick: onDelete,
|
121
|
-
size: 16
|
159
|
+
size: 16,
|
160
|
+
titleAccess: titleDelete
|
122
161
|
})
|
123
162
|
);
|
124
163
|
}
|
@@ -132,6 +171,10 @@ HiChip.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
132
171
|
* Icone affiché à gauche
|
133
172
|
*/
|
134
173
|
icon: PropTypes.string,
|
174
|
+
/**
|
175
|
+
* Identifiant de l'élément
|
176
|
+
*/
|
177
|
+
id: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
135
178
|
/**
|
136
179
|
* Ajoute une image à gauche du Chip
|
137
180
|
*/
|
@@ -144,6 +187,10 @@ HiChip.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
144
187
|
* Fonction de callback au clic sur l'icon close si cancelable = true
|
145
188
|
*/
|
146
189
|
onDelete: PropTypes.func,
|
190
|
+
/**
|
191
|
+
* Fonction de callback au clic sur l'icon à gauche
|
192
|
+
*/
|
193
|
+
onIconClick: PropTypes.func,
|
147
194
|
/**
|
148
195
|
* Fonction de callback au clic sur l'icon next
|
149
196
|
*/
|
@@ -151,7 +198,31 @@ HiChip.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
151
198
|
/**
|
152
199
|
* Fonction de callback au clic sur l'icon previous
|
153
200
|
*/
|
154
|
-
onPrevious: PropTypes.func
|
201
|
+
onPrevious: PropTypes.func,
|
202
|
+
/**
|
203
|
+
* Préfixe dans le HiChip
|
204
|
+
*/
|
205
|
+
prefix: PropTypes.string,
|
206
|
+
/**
|
207
|
+
* Titre de l'icône supprimer
|
208
|
+
*/
|
209
|
+
titleDelete: PropTypes.string,
|
210
|
+
/**
|
211
|
+
* Titre de l'icône
|
212
|
+
*/
|
213
|
+
titleIcon: PropTypes.string,
|
214
|
+
/**
|
215
|
+
* Titre de la balise img
|
216
|
+
*/
|
217
|
+
titleImg: PropTypes.string,
|
218
|
+
/**
|
219
|
+
* Titre de la navigation suivante
|
220
|
+
*/
|
221
|
+
titleNext: PropTypes.string,
|
222
|
+
/**
|
223
|
+
* Titre de la navigation précédente
|
224
|
+
*/
|
225
|
+
titlePrevious: PropTypes.string
|
155
226
|
} : {};
|
156
227
|
|
157
228
|
export default withStyles(styles, { name: 'HmuiHiChip' })(HiChip);
|
@@ -138,6 +138,7 @@ class HiChipSwitch extends React.PureComponent {
|
|
138
138
|
|
139
139
|
render() {
|
140
140
|
const {
|
141
|
+
id,
|
141
142
|
label,
|
142
143
|
classes,
|
143
144
|
activeIcon,
|
@@ -163,6 +164,7 @@ class HiChipSwitch extends React.PureComponent {
|
|
163
164
|
return React.createElement(
|
164
165
|
'div',
|
165
166
|
{
|
167
|
+
id: id,
|
166
168
|
className: classNames(classes.root, {
|
167
169
|
[classes.active]: !!active,
|
168
170
|
[classes.inactive]: !active
|
@@ -223,6 +225,10 @@ HiChipSwitch.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
223
225
|
* Surcharge les classes du composant
|
224
226
|
*/
|
225
227
|
classes: PropTypes.object,
|
228
|
+
/**
|
229
|
+
* Identifiant de l'élément
|
230
|
+
*/
|
231
|
+
id: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
226
232
|
/**
|
227
233
|
* Label qu'affiche le ChipFilter
|
228
234
|
*/
|
@@ -40,6 +40,7 @@ class HiDatePicker extends React.Component {
|
|
40
40
|
this.renderMonthPickerOverlay = this.renderMonthPickerOverlay.bind(this);
|
41
41
|
this.renderTimePickerOverlay = this.renderTimePickerOverlay.bind(this);
|
42
42
|
this.renderYearPickerOverlay = this.renderYearPickerOverlay.bind(this);
|
43
|
+
this.handleInputChange = this.handleInputChange.bind(this);
|
43
44
|
}
|
44
45
|
|
45
46
|
componentWillUnmount() {
|
@@ -51,27 +52,33 @@ class HiDatePicker extends React.Component {
|
|
51
52
|
this.props.onReset();
|
52
53
|
}
|
53
54
|
|
55
|
+
handleInputChange(event) {
|
56
|
+
this.props.onChange(event.target.value);
|
57
|
+
}
|
58
|
+
|
54
59
|
handleDayChange(day, modifiers) {
|
55
|
-
if (
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
if (this.props.
|
62
|
-
|
63
|
-
|
64
|
-
|
60
|
+
if (day) {
|
61
|
+
if (modifiers.selected) {
|
62
|
+
// Deselect day
|
63
|
+
this.props.onChange(undefined);
|
64
|
+
} else {
|
65
|
+
// Keep Time if set
|
66
|
+
if (this.props.enableTime && day !== undefined) {
|
67
|
+
if (this.props.value) {
|
68
|
+
day.setHours(this.props.value.getHours(), this.props.value.getMinutes());
|
69
|
+
} else {
|
70
|
+
day.setHours(0, 0);
|
71
|
+
}
|
65
72
|
}
|
73
|
+
this.props.onChange(day);
|
74
|
+
}
|
75
|
+
if (day instanceof Date && !this.props.enableTime && modifiers.selected !== true) {
|
76
|
+
// Hide overlay & remove focus on input
|
77
|
+
document.activeElement.blur();
|
78
|
+
} else if (day instanceof Date && this.props.enableTime && modifiers.selected !== true) {
|
79
|
+
// Open Time panel after date selection
|
80
|
+
this.openPanel('time');
|
66
81
|
}
|
67
|
-
this.props.onChange(day);
|
68
|
-
}
|
69
|
-
if (day instanceof Date && !this.props.enableTime && modifiers.selected !== true) {
|
70
|
-
// Hide overlay & remove focus on input
|
71
|
-
document.activeElement.blur();
|
72
|
-
} else if (day instanceof Date && this.props.enableTime && modifiers.selected !== true) {
|
73
|
-
// Open Time panel after date selection
|
74
|
-
this.openPanel('time');
|
75
82
|
}
|
76
83
|
}
|
77
84
|
|
@@ -205,7 +212,7 @@ class HiDatePicker extends React.Component {
|
|
205
212
|
captionElement: this.renderCaption,
|
206
213
|
classNames: classes,
|
207
214
|
disabledDays: effectiveDisabledDays,
|
208
|
-
selectedDays: value,
|
215
|
+
selectedDays: typeof value === 'object' ? value : undefined,
|
209
216
|
locale,
|
210
217
|
firstDayOfWeek: 1,
|
211
218
|
fromMonth: minimumDate,
|
@@ -221,7 +228,9 @@ class HiDatePicker extends React.Component {
|
|
221
228
|
onReset: this.handleReset
|
222
229
|
}, {
|
223
230
|
onBlur: this.handleBlur
|
224
|
-
}, props
|
231
|
+
}, props, {
|
232
|
+
onChange: this.handleInputChange
|
233
|
+
});
|
225
234
|
|
226
235
|
return React.createElement(
|
227
236
|
'div',
|
@@ -314,6 +323,6 @@ HiDatePicker.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
314
323
|
/**
|
315
324
|
* Date sélectionnée
|
316
325
|
*/
|
317
|
-
value: PropTypes.instanceOf(Date)
|
326
|
+
value: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.string])
|
318
327
|
} : {};
|
319
328
|
export default withStyles(styles, { name: 'HmuiHiDatePicker' })(HiDatePicker);
|