@hipay/hipay-material-ui 1.0.0-beta.5 → 1.0.0-beta.7
Sign up to get free protection for your applications and to get access to all the features.
- package/HI-CHANGELOG.md +42 -0
- package/HiAlertModal/HiAlertModal.js +247 -0
- package/HiAlertModal/index.js +16 -0
- package/HiColoredLabel/HiColoredLabel.js +2 -1
- package/HiDatePicker/HiDateRangeSelector.js +8 -0
- package/HiExpansionPanel/HiExpansionPanel.js +231 -0
- package/HiExpansionPanel/index.js +16 -0
- package/HiForm/HiFormControl.js +3 -0
- package/HiSelect/HiSelect.js +50 -34
- package/HiSelectableList/HiSelectableListItem.js +35 -9
- package/HiTable/BodyCells/CellCountry.js +1 -1
- package/HiTopBar/HiTopBar.js +0 -4
- package/es/HiAlertModal/HiAlertModal.js +189 -0
- package/es/HiAlertModal/index.js +1 -0
- package/es/HiColoredLabel/HiColoredLabel.js +2 -1
- package/es/HiDatePicker/HiDateRangeSelector.js +8 -0
- package/es/HiExpansionPanel/HiExpansionPanel.js +170 -0
- package/es/HiExpansionPanel/index.js +1 -0
- package/es/HiForm/HiFormControl.js +3 -0
- package/es/HiSelect/HiSelect.js +49 -34
- package/es/HiSelectableList/HiSelectableListItem.js +31 -9
- package/es/HiTable/BodyCells/CellCountry.js +1 -1
- package/es/HiTopBar/HiTopBar.js +0 -4
- package/es/styles/createHiMuiTheme.js +4 -0
- package/hmu/images/countries/ad.svg +151 -0
- package/hmu/images/countries/ae.svg +6 -0
- package/hmu/images/countries/af.svg +83 -0
- package/hmu/images/countries/ag.svg +15 -0
- package/hmu/images/countries/ai.svg +767 -0
- package/hmu/images/countries/al.svg +5 -0
- package/hmu/images/countries/am.svg +5 -0
- package/hmu/images/countries/ao.svg +13 -0
- package/hmu/images/countries/aq.svg +6 -0
- package/hmu/images/countries/ar.svg +32 -0
- package/hmu/images/countries/as.svg +33 -0
- package/hmu/images/countries/at.svg +6 -0
- package/hmu/images/countries/au.svg +9 -0
- package/hmu/images/countries/aw.svg +186 -0
- package/hmu/images/countries/ax.svg +18 -0
- package/hmu/images/countries/az.svg +8 -0
- package/hmu/images/countries/ba.svg +12 -0
- package/hmu/images/countries/bb.svg +6 -0
- package/hmu/images/countries/bd.svg +4 -0
- package/hmu/images/countries/be.svg +7 -0
- package/hmu/images/countries/bf.svg +7 -0
- package/hmu/images/countries/bg.svg +7 -0
- package/hmu/images/countries/bh.svg +11 -0
- package/hmu/images/countries/bi.svg +15 -0
- package/hmu/images/countries/bj.svg +14 -0
- package/hmu/images/countries/bl.svg +7 -0
- package/hmu/images/countries/bm.svg +99 -0
- package/hmu/images/countries/bn.svg +36 -0
- package/hmu/images/countries/bo.svg +686 -0
- package/hmu/images/countries/bq.svg +5 -0
- package/hmu/images/countries/br.svg +45 -0
- package/hmu/images/countries/bs.svg +13 -0
- package/hmu/images/countries/bt.svg +89 -0
- package/hmu/images/countries/bv.svg +13 -0
- package/hmu/images/countries/bw.svg +7 -0
- package/hmu/images/countries/by.svg +61 -0
- package/hmu/images/countries/bz.svg +146 -0
- package/hmu/images/countries/ca.svg +4 -0
- package/hmu/images/countries/cc.svg +19 -0
- package/hmu/images/countries/cd.svg +5 -0
- package/hmu/images/countries/cf.svg +15 -0
- package/hmu/images/countries/cg.svg +12 -0
- package/hmu/images/countries/ch.svg +9 -0
- package/hmu/images/countries/ci.svg +7 -0
- package/hmu/images/countries/ck.svg +9 -0
- package/hmu/images/countries/cl.svg +13 -0
- package/hmu/images/countries/cm.svg +15 -0
- package/hmu/images/countries/cn.svg +11 -0
- package/hmu/images/countries/co.svg +7 -0
- package/hmu/images/countries/cr.svg +7 -0
- package/hmu/images/countries/cu.svg +13 -0
- package/hmu/images/countries/cv.svg +13 -0
- package/hmu/images/countries/cw.svg +14 -0
- package/hmu/images/countries/cx.svg +15 -0
- package/hmu/images/countries/cy.svg +6 -0
- package/hmu/images/countries/cz.svg +12 -0
- package/hmu/images/countries/de.svg +5 -0
- package/hmu/images/countries/dj.svg +13 -0
- package/hmu/images/countries/dk.svg +5 -0
- package/hmu/images/countries/dm.svg +152 -0
- package/hmu/images/countries/do.svg +6745 -0
- package/hmu/images/countries/dz.svg +5 -0
- package/hmu/images/countries/ec.svg +141 -0
- package/hmu/images/countries/ee.svg +7 -0
- package/hmu/images/countries/eg.svg +38 -0
- package/hmu/images/countries/eh.svg +15 -0
- package/hmu/images/countries/er.svg +8 -0
- package/hmu/images/countries/es-ct.svg +4 -0
- package/hmu/images/countries/es.svg +581 -0
- package/hmu/images/countries/et.svg +14 -0
- package/hmu/images/countries/eu.svg +28 -0
- package/hmu/images/countries/fi.svg +5 -0
- package/hmu/images/countries/fj.svg +124 -0
- package/hmu/images/countries/fk.svg +90 -0
- package/hmu/images/countries/fm.svg +11 -0
- package/hmu/images/countries/fo.svg +12 -0
- package/hmu/images/countries/fr.svg +7 -0
- package/hmu/images/countries/ga.svg +7 -0
- package/hmu/images/countries/gb-eng.svg +5 -0
- package/hmu/images/countries/gb-nir.svg +137 -0
- package/hmu/images/countries/gb-sct.svg +4 -0
- package/hmu/images/countries/gb-wls.svg +9 -0
- package/hmu/images/countries/gb.svg +15 -0
- package/hmu/images/countries/gd.svg +27 -0
- package/hmu/images/countries/ge.svg +6 -0
- package/hmu/images/countries/gf.svg +5 -0
- package/hmu/images/countries/gg.svg +9 -0
- package/hmu/images/countries/gh.svg +6 -0
- package/hmu/images/countries/gi.svg +33 -0
- package/hmu/images/countries/gl.svg +4 -0
- package/hmu/images/countries/gm.svg +14 -0
- package/hmu/images/countries/gn.svg +7 -0
- package/hmu/images/countries/gp.svg +7 -0
- package/hmu/images/countries/gq.svg +23 -0
- package/hmu/images/countries/gr.svg +22 -0
- package/hmu/images/countries/gs.svg +205 -0
- package/hmu/images/countries/gt.svg +204 -0
- package/hmu/images/countries/gu.svg +39 -0
- package/hmu/images/countries/gw.svg +13 -0
- package/hmu/images/countries/gy.svg +9 -0
- package/hmu/images/countries/hk.svg +32 -0
- package/hmu/images/countries/hm.svg +9 -0
- package/hmu/images/countries/hn.svg +18 -0
- package/hmu/images/countries/hr.svg +59 -0
- package/hmu/images/countries/ht.svg +122 -0
- package/hmu/images/countries/hu.svg +7 -0
- package/hmu/images/countries/id.svg +6 -0
- package/hmu/images/countries/ie.svg +7 -0
- package/hmu/images/countries/il.svg +14 -0
- package/hmu/images/countries/im.svg +36 -0
- package/hmu/images/countries/in.svg +25 -0
- package/hmu/images/countries/io.svg +148 -0
- package/hmu/images/countries/iq.svg +10 -0
- package/hmu/images/countries/ir.svg +219 -0
- package/hmu/images/countries/is.svg +12 -0
- package/hmu/images/countries/it.svg +7 -0
- package/hmu/images/countries/je.svg +32 -0
- package/hmu/images/countries/jm.svg +8 -0
- package/hmu/images/countries/jo.svg +16 -0
- package/hmu/images/countries/jp.svg +11 -0
- package/hmu/images/countries/ke.svg +23 -0
- package/hmu/images/countries/kg.svg +15 -0
- package/hmu/images/countries/kh.svg +69 -0
- package/hmu/images/countries/ki.svg +36 -0
- package/hmu/images/countries/km.svg +16 -0
- package/hmu/images/countries/kn.svg +14 -0
- package/hmu/images/countries/kp.svg +15 -0
- package/hmu/images/countries/kr.svg +24 -0
- package/hmu/images/countries/kw.svg +13 -0
- package/hmu/images/countries/ky.svg +63 -0
- package/hmu/images/countries/kz.svg +23 -0
- package/hmu/images/countries/la.svg +12 -0
- package/hmu/images/countries/lb.svg +15 -0
- package/hmu/images/countries/lc.svg +8 -0
- package/hmu/images/countries/li.svg +43 -0
- package/hmu/images/countries/lk.svg +22 -0
- package/hmu/images/countries/lr.svg +14 -0
- package/hmu/images/countries/ls.svg +8 -0
- package/hmu/images/countries/lt.svg +7 -0
- package/hmu/images/countries/lu.svg +5 -0
- package/hmu/images/countries/lv.svg +6 -0
- package/hmu/images/countries/ly.svg +13 -0
- package/hmu/images/countries/ma.svg +4 -0
- package/hmu/images/countries/mc.svg +6 -0
- package/hmu/images/countries/md.svg +72 -0
- package/hmu/images/countries/me.svg +118 -0
- package/hmu/images/countries/mf.svg +7 -0
- package/hmu/images/countries/mg.svg +7 -0
- package/hmu/images/countries/mh.svg +7 -0
- package/hmu/images/countries/mk.svg +5 -0
- package/hmu/images/countries/ml.svg +7 -0
- package/hmu/images/countries/mm.svg +16 -0
- package/hmu/images/countries/mn.svg +13 -0
- package/hmu/images/countries/mo.svg +9 -0
- package/hmu/images/countries/mp.svg +86 -0
- package/hmu/images/countries/mq.svg +7 -0
- package/hmu/images/countries/mr.svg +6 -0
- package/hmu/images/countries/ms.svg +39 -0
- package/hmu/images/countries/mt.svg +49 -0
- package/hmu/images/countries/mu.svg +8 -0
- package/hmu/images/countries/mv.svg +6 -0
- package/hmu/images/countries/mw.svg +10 -0
- package/hmu/images/countries/mx.svg +385 -0
- package/hmu/images/countries/my.svg +15 -0
- package/hmu/images/countries/mz.svg +21 -0
- package/hmu/images/countries/na.svg +16 -0
- package/hmu/images/countries/nc.svg +7 -0
- package/hmu/images/countries/ne.svg +6 -0
- package/hmu/images/countries/nf.svg +9 -0
- package/hmu/images/countries/ng.svg +6 -0
- package/hmu/images/countries/ni.svg +131 -0
- package/hmu/images/countries/nl.svg +7 -0
- package/hmu/images/countries/no.svg +7 -0
- package/hmu/images/countries/np.svg +14 -0
- package/hmu/images/countries/nr.svg +12 -0
- package/hmu/images/countries/nu.svg +26 -0
- package/hmu/images/countries/nz.svg +41 -0
- package/hmu/images/countries/om.svg +116 -0
- package/hmu/images/countries/pa.svg +14 -0
- package/hmu/images/countries/pe.svg +279 -0
- package/hmu/images/countries/pf.svg +19 -0
- package/hmu/images/countries/pg.svg +9 -0
- package/hmu/images/countries/ph.svg +28 -0
- package/hmu/images/countries/pk.svg +15 -0
- package/hmu/images/countries/pl.svg +6 -0
- package/hmu/images/countries/pm.svg +7 -0
- package/hmu/images/countries/pn.svg +62 -0
- package/hmu/images/countries/pr.svg +13 -0
- package/hmu/images/countries/ps.svg +15 -0
- package/hmu/images/countries/pt.svg +57 -0
- package/hmu/images/countries/pw.svg +11 -0
- package/hmu/images/countries/py.svg +157 -0
- package/hmu/images/countries/qa.svg +4 -0
- package/hmu/images/countries/re.svg +7 -0
- package/hmu/images/countries/ro.svg +7 -0
- package/hmu/images/countries/rs.svg +292 -0
- package/hmu/images/countries/ru.svg +7 -0
- package/hmu/images/countries/rw.svg +13 -0
- package/hmu/images/countries/sa.svg +26 -0
- package/hmu/images/countries/sb.svg +13 -0
- package/hmu/images/countries/sc.svg +14 -0
- package/hmu/images/countries/sd.svg +13 -0
- package/hmu/images/countries/se.svg +16 -0
- package/hmu/images/countries/sg.svg +13 -0
- package/hmu/images/countries/sh.svg +74 -0
- package/hmu/images/countries/si.svg +18 -0
- package/hmu/images/countries/sj.svg +7 -0
- package/hmu/images/countries/sk.svg +9 -0
- package/hmu/images/countries/sl.svg +7 -0
- package/hmu/images/countries/sm.svg +91 -0
- package/hmu/images/countries/sn.svg +8 -0
- package/hmu/images/countries/so.svg +11 -0
- package/hmu/images/countries/sr.svg +6 -0
- package/hmu/images/countries/ss.svg +8 -0
- package/hmu/images/countries/st.svg +16 -0
- package/hmu/images/countries/sv.svg +618 -0
- package/hmu/images/countries/sx.svg +56 -0
- package/hmu/images/countries/sy.svg +6 -0
- package/hmu/images/countries/sz.svg +45 -0
- package/hmu/images/countries/tc.svg +67 -0
- package/hmu/images/countries/td.svg +7 -0
- package/hmu/images/countries/tf.svg +15 -0
- package/hmu/images/countries/tg.svg +14 -0
- package/hmu/images/countries/th.svg +7 -0
- package/hmu/images/countries/tj.svg +22 -0
- package/hmu/images/countries/tk.svg +5 -0
- package/hmu/images/countries/tl.svg +13 -0
- package/hmu/images/countries/tm.svg +213 -0
- package/hmu/images/countries/tn.svg +13 -0
- package/hmu/images/countries/to.svg +10 -0
- package/hmu/images/countries/tr.svg +8 -0
- package/hmu/images/countries/tt.svg +5 -0
- package/hmu/images/countries/tv.svg +27 -0
- package/hmu/images/countries/tw.svg +14 -0
- package/hmu/images/countries/tz.svg +13 -0
- package/hmu/images/countries/ua.svg +6 -0
- package/hmu/images/countries/ug.svg +30 -0
- package/hmu/images/countries/um.svg +23 -0
- package/hmu/images/countries/un.svg +16 -0
- package/hmu/images/countries/us.svg +12 -0
- package/hmu/images/countries/uy.svg +28 -0
- package/hmu/images/countries/uz.svg +30 -0
- package/hmu/images/countries/va.svg +483 -0
- package/hmu/images/countries/vc.svg +8 -0
- package/hmu/images/countries/ve.svg +26 -0
- package/hmu/images/countries/vg.svg +133 -0
- package/hmu/images/countries/vi.svg +31 -0
- package/hmu/images/countries/vn.svg +11 -0
- package/hmu/images/countries/vu.svg +18 -0
- package/hmu/images/countries/wf.svg +7 -0
- package/hmu/images/countries/ws.svg +7 -0
- package/hmu/images/countries/ye.svg +7 -0
- package/hmu/images/countries/yt.svg +7 -0
- package/hmu/images/countries/za.svg +17 -0
- package/hmu/images/countries/zm.svg +27 -0
- package/hmu/images/countries/zw.svg +21 -0
- package/hmu/images/hipay-white-logo.svg +42 -0
- package/hmu/images/logo_visa_75wx45h.gif +0 -0
- package/index.es.js +1 -1
- package/index.js +1 -1
- package/package.json +1 -1
- package/styles/createHiMuiTheme.js +4 -0
- package/umd/hipay-material-ui.development.js +828 -782
- package/umd/hipay-material-ui.production.min.js +4 -4
package/HiSelect/HiSelect.js
CHANGED
@@ -163,46 +163,28 @@ var HiSelect = function (_React$PureComponent) {
|
|
163
163
|
|
164
164
|
// Check if value is in options
|
165
165
|
var valueInOptions = false;
|
166
|
-
var val =
|
166
|
+
var val = props.value;
|
167
167
|
// No options provided.
|
168
|
-
if (!
|
168
|
+
if (!props.options.length || !val || !val.length) {
|
169
169
|
valueInOptions = true;
|
170
|
+
} else {
|
171
|
+
// Check if an option match value prop.
|
172
|
+
props.options.forEach(function (item) {
|
173
|
+
if (!valueInOptions && val.indexOf(item.id) !== -1) {
|
174
|
+
valueInOptions = true;
|
175
|
+
}
|
176
|
+
});
|
170
177
|
}
|
171
|
-
|
172
|
-
_this.props.options.forEach(function (item) {
|
173
|
-
if (!val.length) {
|
174
|
-
valueInOptions = true;
|
175
|
-
}
|
176
|
-
if (!valueInOptions && val.indexOf(item.id) !== -1) {
|
177
|
-
valueInOptions = true;
|
178
|
-
}
|
179
|
-
});
|
178
|
+
|
180
179
|
if (!valueInOptions) {
|
181
180
|
throw new Error('prop value provided does not match any option.');
|
182
181
|
}
|
183
182
|
|
184
183
|
if (props.hierarchic === true && props.options.length > 1) {
|
185
|
-
|
186
|
-
// hierarchy[parentId] => children
|
187
|
-
// hierarchySelected[parentId] => selected children
|
188
|
-
var hierarchy = {};
|
189
|
-
var hierarchySelected = {};
|
190
|
-
var value = props.value || [];
|
191
|
-
if (!Array.isArray(value)) value = [props.value];
|
192
|
-
props.options.forEach(function (option) {
|
193
|
-
if (option.hasChildren === true && !hierarchy.hasOwnProperty(option.id)) {
|
194
|
-
hierarchy[option.id] = [];
|
195
|
-
hierarchySelected[option.id] = [];
|
196
|
-
} else if (option.hasOwnProperty('parentId')) {
|
197
|
-
hierarchy[option.parentId].push(option.id);
|
198
|
-
if (value.includes(option.id)) {
|
199
|
-
hierarchySelected[option.parentId].push(option.id);
|
200
|
-
}
|
201
|
-
}
|
202
|
-
});
|
184
|
+
var hierarchyTrees = _this.buildHierarchyTrees(props);
|
203
185
|
|
204
|
-
_this.state.hierarchy = hierarchy;
|
205
|
-
_this.state.hierarchySelected = hierarchySelected;
|
186
|
+
_this.state.hierarchy = hierarchyTrees.hierarchy;
|
187
|
+
_this.state.hierarchySelected = hierarchyTrees.hierarchySelected;
|
206
188
|
}
|
207
189
|
|
208
190
|
if (props.options.length > 0) {
|
@@ -241,6 +223,34 @@ var HiSelect = function (_React$PureComponent) {
|
|
241
223
|
});
|
242
224
|
this.setState({ nbOptions: optionsLength });
|
243
225
|
}
|
226
|
+
|
227
|
+
if (nextProps.hierarchic === true && nextProps.options.length > 1) {
|
228
|
+
var hierarchyTrees = this.buildHierarchyTrees(nextProps);
|
229
|
+
this.setState({ hierarchy: hierarchyTrees.hierarchy, hierarchySelected: hierarchyTrees.hierarchySelected });
|
230
|
+
}
|
231
|
+
}
|
232
|
+
}, {
|
233
|
+
key: 'buildHierarchyTrees',
|
234
|
+
value: function buildHierarchyTrees(props) {
|
235
|
+
// Construct two associative arrays
|
236
|
+
// hierarchy[parentId] => children
|
237
|
+
// hierarchySelected[parentId] => selected children
|
238
|
+
var hierarchy = {};
|
239
|
+
var hierarchySelected = {};
|
240
|
+
var value = props.value || [];
|
241
|
+
if (!Array.isArray(value)) value = [props.value];
|
242
|
+
props.options.forEach(function (option) {
|
243
|
+
if (option.hasChildren === true && !hierarchy.hasOwnProperty(option.id)) {
|
244
|
+
hierarchy[option.id] = [];
|
245
|
+
hierarchySelected[option.id] = [];
|
246
|
+
} else if (option.hasOwnProperty('parentId')) {
|
247
|
+
hierarchy[option.parentId].push(option.id);
|
248
|
+
if (value.includes(option.id)) {
|
249
|
+
hierarchySelected[option.parentId].push(option.id);
|
250
|
+
}
|
251
|
+
}
|
252
|
+
});
|
253
|
+
return { hierarchy: hierarchy, hierarchySelected: hierarchySelected };
|
244
254
|
}
|
245
255
|
|
246
256
|
// Key down on list items
|
@@ -290,7 +300,8 @@ var HiSelect = function (_React$PureComponent) {
|
|
290
300
|
hoverIcon = _props.hoverIcon,
|
291
301
|
checkedIcon = _props.checkedIcon,
|
292
302
|
hierarchic = _props.hierarchic,
|
293
|
-
id = _props.id
|
303
|
+
id = _props.id,
|
304
|
+
placeholder = _props.placeholder;
|
294
305
|
var _state = this.state,
|
295
306
|
open = _state.open,
|
296
307
|
suggestions = _state.suggestions,
|
@@ -325,7 +336,7 @@ var HiSelect = function (_React$PureComponent) {
|
|
325
336
|
}
|
326
337
|
|
327
338
|
if (displayAsChip) {
|
328
|
-
var chipFilter = _react2.default.createElement(_HiChip2.default, { label: display, onDelete: this.handleRequestDelete });
|
339
|
+
var chipFilter = _react2.default.createElement(_HiChip2.default, { label: placeholder || display, onDelete: this.handleRequestDelete });
|
329
340
|
if (display) {
|
330
341
|
display = chipFilter;
|
331
342
|
}
|
@@ -359,7 +370,7 @@ var HiSelect = function (_React$PureComponent) {
|
|
359
370
|
null,
|
360
371
|
_react2.default.createElement(_SelectInput2.default, {
|
361
372
|
id: id,
|
362
|
-
value: display,
|
373
|
+
value: placeholder || display,
|
363
374
|
open: open,
|
364
375
|
focused: focused,
|
365
376
|
type: type,
|
@@ -811,6 +822,11 @@ HiSelect.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
811
822
|
* Les items parents sont sélectionnables
|
812
823
|
*/
|
813
824
|
parentItemSelectable: _propTypes2.default.bool,
|
825
|
+
/**
|
826
|
+
* Placeholder affiché lorsque le select est fermé
|
827
|
+
* Surcharge le placeholder par défaut
|
828
|
+
*/
|
829
|
+
placeholder: _propTypes2.default.string,
|
814
830
|
/**
|
815
831
|
* Affiche un input de recherche permettant de filtrer les options
|
816
832
|
*/
|
@@ -69,6 +69,10 @@ var _HiIconBuilder = require('../utils/HiIconBuilder');
|
|
69
69
|
|
70
70
|
var _HiIconBuilder2 = _interopRequireDefault(_HiIconBuilder);
|
71
71
|
|
72
|
+
var _HiColoredLabel = require('../HiColoredLabel');
|
73
|
+
|
74
|
+
var _HiColoredLabel2 = _interopRequireDefault(_HiColoredLabel);
|
75
|
+
|
72
76
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
73
77
|
|
74
78
|
var styles = exports.styles = function styles(theme) {
|
@@ -112,9 +116,10 @@ var styles = exports.styles = function styles(theme) {
|
|
112
116
|
fontWeight: 'inherit',
|
113
117
|
width: '100%'
|
114
118
|
}),
|
115
|
-
listItemSecondaryText: (0, _extends3.default)({}, theme.typography.
|
119
|
+
listItemSecondaryText: (0, _extends3.default)({}, theme.typography.body5, {
|
116
120
|
fontWeight: theme.typography.fontWeightLight,
|
117
|
-
marginLeft: theme.spacing.unit
|
121
|
+
marginLeft: theme.spacing.unit,
|
122
|
+
color: theme.palette.neutral.normal
|
118
123
|
}),
|
119
124
|
listItemInfoText: (0, _extends3.default)({
|
120
125
|
whiteSpace: 'nowrap',
|
@@ -213,13 +218,18 @@ var HiSelectableListItem = function (_React$Component) {
|
|
213
218
|
'div',
|
214
219
|
{ className: classes.listItemContent, 'data-id': item.id },
|
215
220
|
!effectiveCheckbox && _react2.default.createElement(_HiIconBuilder2.default, { icon: item.icon, className: classes.icon }),
|
216
|
-
item
|
217
|
-
_react2.default.createElement(
|
221
|
+
_this.getItemLabel(item),
|
222
|
+
_react2.default.createElement(
|
223
|
+
'span',
|
224
|
+
{ className: classes.listItemSecondaryText },
|
225
|
+
item.secondaryLabel
|
226
|
+
),
|
218
227
|
childrenIndicator
|
219
228
|
);
|
220
229
|
case 'image':
|
221
230
|
var img = '';
|
222
231
|
if (typeof item.img !== 'undefined') {
|
232
|
+
|
223
233
|
img = _react2.default.createElement('img', { src: item.img, className: classes.imgListItem });
|
224
234
|
}
|
225
235
|
|
@@ -227,8 +237,12 @@ var HiSelectableListItem = function (_React$Component) {
|
|
227
237
|
'div',
|
228
238
|
{ className: classes.listItemContent, 'data-id': item.id },
|
229
239
|
img,
|
230
|
-
item
|
231
|
-
_react2.default.createElement(
|
240
|
+
_this.getItemLabel(item),
|
241
|
+
_react2.default.createElement(
|
242
|
+
'span',
|
243
|
+
{ className: classes.listItemSecondaryText },
|
244
|
+
item.secondaryLabel
|
245
|
+
),
|
232
246
|
childrenIndicator
|
233
247
|
);
|
234
248
|
case 'primary-highlight':
|
@@ -238,7 +252,7 @@ var HiSelectableListItem = function (_React$Component) {
|
|
238
252
|
return _react2.default.createElement(
|
239
253
|
'div',
|
240
254
|
{ className: itemPrimaryHighlightClass, 'data-id': item.id },
|
241
|
-
item
|
255
|
+
_this.getItemLabel(item)
|
242
256
|
);
|
243
257
|
case 'text':
|
244
258
|
default:
|
@@ -253,8 +267,12 @@ var HiSelectableListItem = function (_React$Component) {
|
|
253
267
|
__html: (0, _hiHelpers.escapeHTML)(item.labelHighlight)
|
254
268
|
}
|
255
269
|
}),
|
256
|
-
!item.labelHighlight && item
|
257
|
-
_react2.default.createElement(
|
270
|
+
!item.labelHighlight && _this.getItemLabel(item),
|
271
|
+
_react2.default.createElement(
|
272
|
+
'span',
|
273
|
+
{ className: classes.listItemSecondaryText },
|
274
|
+
item.secondaryLabel
|
275
|
+
),
|
258
276
|
childrenIndicator
|
259
277
|
);
|
260
278
|
}
|
@@ -274,6 +292,14 @@ var HiSelectableListItem = function (_React$Component) {
|
|
274
292
|
value: function toggleHover() {
|
275
293
|
this.setState({ hover: !this.state.hover });
|
276
294
|
}
|
295
|
+
}, {
|
296
|
+
key: 'getItemLabel',
|
297
|
+
value: function getItemLabel(item) {
|
298
|
+
if (item.color) {
|
299
|
+
return _react2.default.createElement(_HiColoredLabel2.default, { color: item.color, label: item.label });
|
300
|
+
}
|
301
|
+
return item.label;
|
302
|
+
}
|
277
303
|
|
278
304
|
/**
|
279
305
|
* Build list item from type
|
@@ -112,7 +112,7 @@ var CellCountry = function (_React$PureComponent) {
|
|
112
112
|
view = _props.view;
|
113
113
|
|
114
114
|
|
115
|
-
var path = '/static/images/countries/' + isoCode.toLowerCase() + '.svg';
|
115
|
+
var path = '/static/hmu/images/countries/' + isoCode.toLowerCase() + '.svg';
|
116
116
|
|
117
117
|
var tooltipContent = _react2.default.createElement(
|
118
118
|
'div',
|
package/HiTopBar/HiTopBar.js
CHANGED
@@ -508,10 +508,6 @@ HiTopBar.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
508
508
|
* Fonction de callback au click sur l'accountSelector'
|
509
509
|
*/
|
510
510
|
onClickAccountSelector: _propTypes2.default.func,
|
511
|
-
/**
|
512
|
-
* Fonction de callback au click sur le menu
|
513
|
-
*/
|
514
|
-
onClickInputButton: _propTypes2.default.func.isRequired,
|
515
511
|
/**
|
516
512
|
* Fonction de callback au click sur le menu
|
517
513
|
*/
|
@@ -0,0 +1,189 @@
|
|
1
|
+
import _extends from 'babel-runtime/helpers/extends';
|
2
|
+
import _objectWithoutProperties from 'babel-runtime/helpers/objectWithoutProperties';
|
3
|
+
// @inheritedComponent Dialog
|
4
|
+
|
5
|
+
import React from 'react';
|
6
|
+
import PropTypes from 'prop-types';
|
7
|
+
import Dialog, { DialogActions, DialogContent, DialogContentText, DialogTitle } from 'material-ui/Dialog';
|
8
|
+
import { withStyles } from '../styles';
|
9
|
+
import HiButton from '../HiButton';
|
10
|
+
|
11
|
+
export const styles = theme => ({
|
12
|
+
classContent: {
|
13
|
+
fontSize: 14,
|
14
|
+
lineHeight: '24px',
|
15
|
+
color: '#484848'
|
16
|
+
},
|
17
|
+
classPaper: {
|
18
|
+
maxWidth: 300
|
19
|
+
},
|
20
|
+
classCancelButton: {
|
21
|
+
float: 'right'
|
22
|
+
},
|
23
|
+
classTitle: {
|
24
|
+
fontSize: 20,
|
25
|
+
fontFamily: theme.typography.fontFamily,
|
26
|
+
fontWeight: theme.typography.fontWeightLight,
|
27
|
+
lineHeight: '24px'
|
28
|
+
},
|
29
|
+
classAction: {
|
30
|
+
display: 'inline-block'
|
31
|
+
},
|
32
|
+
classDialogRoot: {
|
33
|
+
backgroundColor: 'rgba(0, 0, 0, 0.28)'
|
34
|
+
}
|
35
|
+
});
|
36
|
+
|
37
|
+
/**
|
38
|
+
* Pop up d'alert
|
39
|
+
*/
|
40
|
+
class HiAlertModal extends React.PureComponent {
|
41
|
+
|
42
|
+
constructor(props) {
|
43
|
+
super(props);
|
44
|
+
|
45
|
+
this.handleClickCancel = () => {
|
46
|
+
if (this.props.onCancelClick) {
|
47
|
+
this.props.onCancelClick();
|
48
|
+
}
|
49
|
+
};
|
50
|
+
|
51
|
+
this.handleClickSubmit = () => {
|
52
|
+
if (this.props.onSubmitClick) {
|
53
|
+
this.props.onSubmitClick();
|
54
|
+
}
|
55
|
+
};
|
56
|
+
|
57
|
+
this.handleOnClose = () => {
|
58
|
+
if (this.props.onClose) {
|
59
|
+
this.props.onClose();
|
60
|
+
}
|
61
|
+
};
|
62
|
+
|
63
|
+
this.handleOnClose = this.handleOnClose.bind(this);
|
64
|
+
this.handleClickCancel = this.handleClickCancel.bind(this);
|
65
|
+
this.handleClickSubmit = this.handleClickSubmit.bind(this);
|
66
|
+
}
|
67
|
+
|
68
|
+
// Appelé au clic du bouton d'annulation
|
69
|
+
|
70
|
+
|
71
|
+
// Appelé au clic du bouton de soumission
|
72
|
+
|
73
|
+
|
74
|
+
// Appelé si clic en dehors de la pop up
|
75
|
+
|
76
|
+
|
77
|
+
// Render
|
78
|
+
render() {
|
79
|
+
const _props = this.props,
|
80
|
+
{
|
81
|
+
labelSubmitButton,
|
82
|
+
labelCancelButton,
|
83
|
+
content,
|
84
|
+
title,
|
85
|
+
positive,
|
86
|
+
negative,
|
87
|
+
open,
|
88
|
+
onCancelClick,
|
89
|
+
onSubmitClick,
|
90
|
+
classes
|
91
|
+
} = _props,
|
92
|
+
props = _objectWithoutProperties(_props, ['labelSubmitButton', 'labelCancelButton', 'content', 'title', 'positive', 'negative', 'open', 'onCancelClick', 'onSubmitClick', 'classes']);
|
93
|
+
return React.createElement(
|
94
|
+
Dialog,
|
95
|
+
_extends({
|
96
|
+
open: open,
|
97
|
+
onClose: this.handleOnClose,
|
98
|
+
classes: { paper: classes.classPaper, root: classes.classDialogRoot }
|
99
|
+
}, props),
|
100
|
+
React.createElement(
|
101
|
+
DialogTitle,
|
102
|
+
{ disableTypography: true, classes: { root: classes.classTitle } },
|
103
|
+
title
|
104
|
+
),
|
105
|
+
React.createElement(
|
106
|
+
DialogContent,
|
107
|
+
null,
|
108
|
+
React.createElement(
|
109
|
+
DialogContentText,
|
110
|
+
{ classes: { root: classes.classContent } },
|
111
|
+
content
|
112
|
+
)
|
113
|
+
),
|
114
|
+
React.createElement(
|
115
|
+
DialogActions,
|
116
|
+
{ classes: { root: classes.classAction } },
|
117
|
+
React.createElement(
|
118
|
+
HiButton,
|
119
|
+
{
|
120
|
+
onClick: this.handleClickSubmit,
|
121
|
+
positive: positive,
|
122
|
+
negative: negative
|
123
|
+
},
|
124
|
+
labelSubmitButton
|
125
|
+
),
|
126
|
+
React.createElement(
|
127
|
+
HiButton,
|
128
|
+
{
|
129
|
+
classes: { root: classes.classCancelButton },
|
130
|
+
onClick: this.handleClickCancel
|
131
|
+
},
|
132
|
+
labelCancelButton
|
133
|
+
)
|
134
|
+
)
|
135
|
+
);
|
136
|
+
}
|
137
|
+
}
|
138
|
+
|
139
|
+
HiAlertModal.defaultProps = {
|
140
|
+
negative: false,
|
141
|
+
positive: false
|
142
|
+
};
|
143
|
+
HiAlertModal.propTypes = process.env.NODE_ENV !== "production" ? {
|
144
|
+
/**
|
145
|
+
* Surcharge les classes du composant
|
146
|
+
*/
|
147
|
+
classes: PropTypes.object,
|
148
|
+
/**
|
149
|
+
* Texte contenu dans la modal
|
150
|
+
*/
|
151
|
+
content: PropTypes.string,
|
152
|
+
/**
|
153
|
+
* Texte sur le bouton d'annulation
|
154
|
+
*/
|
155
|
+
labelCancelButton: PropTypes.string,
|
156
|
+
/**
|
157
|
+
* Texte sur le bouton de soumission
|
158
|
+
*/
|
159
|
+
labelSubmitButton: PropTypes.string,
|
160
|
+
/**
|
161
|
+
* Colore le bouton de soumission en rouge
|
162
|
+
*/
|
163
|
+
negative: PropTypes.bool,
|
164
|
+
/**
|
165
|
+
* Fonction de callback appelée au clic sur le bouton d'annulation
|
166
|
+
*/
|
167
|
+
onCancelClick: PropTypes.func,
|
168
|
+
/**
|
169
|
+
* Fonction de callback appelée au clic en dehors de la pop up
|
170
|
+
*/
|
171
|
+
onClose: PropTypes.func,
|
172
|
+
/**
|
173
|
+
* Fonction de callback appelée au clic sur le bouton de soumission
|
174
|
+
*/
|
175
|
+
onSubmitClick: PropTypes.func,
|
176
|
+
/**
|
177
|
+
* pop up ouverte ou pas
|
178
|
+
*/
|
179
|
+
open: PropTypes.bool.isRequired,
|
180
|
+
/**
|
181
|
+
* Colore le bouton de soumission en vert
|
182
|
+
*/
|
183
|
+
positive: PropTypes.bool,
|
184
|
+
/**
|
185
|
+
* Titre de la modal
|
186
|
+
*/
|
187
|
+
title: PropTypes.string
|
188
|
+
} : {};
|
189
|
+
export default withStyles(styles, { name: 'HmuiHiAlertModal' })(HiAlertModal);
|
@@ -0,0 +1 @@
|
|
1
|
+
export { default } from './HiAlertModal';
|
@@ -78,7 +78,8 @@ HiColoredLabel.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
78
78
|
} : {};
|
79
79
|
|
80
80
|
HiColoredLabel.defaultProps = {
|
81
|
-
active: false
|
81
|
+
active: false,
|
82
|
+
color: '#737373'
|
82
83
|
};
|
83
84
|
|
84
85
|
export default withStyles(styles, { name: 'HmuiHiColoredLabel' })(HiColoredLabel);
|
@@ -127,6 +127,9 @@ class HiDateRangeSelector extends React.Component {
|
|
127
127
|
if (selectedOption) {
|
128
128
|
this.props.onChange('from', selectedOption.from.toDate());
|
129
129
|
this.props.onChange('to', selectedOption.to.toDate());
|
130
|
+
if (this.props.returnSelectValue === true) {
|
131
|
+
this.props.onChange('period', value);
|
132
|
+
}
|
130
133
|
}
|
131
134
|
}
|
132
135
|
};
|
@@ -231,6 +234,7 @@ HiDateRangeSelector.defaultProps = {
|
|
231
234
|
availableOptionKeys: ['cd', 'pd', 'cw', 'pw', 'cm', 'pm', 'cq', 'pq', 'cy', 'custom'],
|
232
235
|
defaultPreset: 'cd',
|
233
236
|
enableTime: false,
|
237
|
+
returnSelectValue: false,
|
234
238
|
locale: 'fr-FR',
|
235
239
|
format: 'YYYY-DD-MM',
|
236
240
|
translations: {
|
@@ -325,6 +329,10 @@ HiDateRangeSelector.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
325
329
|
* true si champs obligatoire
|
326
330
|
*/
|
327
331
|
required: PropTypes.bool,
|
332
|
+
/**
|
333
|
+
* Retourne la valeur du select de la période au change du select
|
334
|
+
*/
|
335
|
+
returnSelectValue: PropTypes.bool.isRequired,
|
328
336
|
/**
|
329
337
|
* Date de fin sélectionnée
|
330
338
|
*/
|
@@ -0,0 +1,170 @@
|
|
1
|
+
import _extends from 'babel-runtime/helpers/extends';
|
2
|
+
import _objectWithoutProperties from 'babel-runtime/helpers/objectWithoutProperties';
|
3
|
+
// @inheritedComponent ExpansionPanel
|
4
|
+
|
5
|
+
import React from 'react';
|
6
|
+
import PropTypes from 'prop-types';
|
7
|
+
import ExpansionPanel, { ExpansionPanelSummary, ExpansionPanelDetails } from 'material-ui/ExpansionPanel';
|
8
|
+
import Typography from 'material-ui/Typography';
|
9
|
+
import MenuDownIcon from 'mdi-material-ui/MenuDown';
|
10
|
+
import { withStyles } from '../styles';
|
11
|
+
|
12
|
+
export const styles = theme => ({
|
13
|
+
heading: {
|
14
|
+
fontSize: 20,
|
15
|
+
lineHeight: '24px',
|
16
|
+
fontWeight: theme.typography.fontWeightLight
|
17
|
+
},
|
18
|
+
secondaryHeading: {
|
19
|
+
fontSize: 11,
|
20
|
+
color: '#737373',
|
21
|
+
textAlign: 'right',
|
22
|
+
lineHeight: '24px',
|
23
|
+
fontWeight: theme.typography.fontWeightRegular,
|
24
|
+
verticalAlign: 'middle',
|
25
|
+
'&>svg': {
|
26
|
+
fontSize: 18,
|
27
|
+
marginLeft: 3,
|
28
|
+
marginBottom: -5
|
29
|
+
}
|
30
|
+
},
|
31
|
+
column: {
|
32
|
+
flexBasis: '100%'
|
33
|
+
},
|
34
|
+
panelSummary: {
|
35
|
+
'&>div:first-child': {
|
36
|
+
margin: '12px 0',
|
37
|
+
'&>div:last-child': {
|
38
|
+
paddingRight: 8
|
39
|
+
}
|
40
|
+
},
|
41
|
+
'&>div:last-child': {
|
42
|
+
width: 16,
|
43
|
+
height: 16
|
44
|
+
}
|
45
|
+
},
|
46
|
+
panelSummaryExpanded: {
|
47
|
+
borderBottom: '1px solid #E3E6E7',
|
48
|
+
minHeight: 0
|
49
|
+
},
|
50
|
+
expandMoreIcon: {
|
51
|
+
margin: 0,
|
52
|
+
fontSize: 18,
|
53
|
+
width: 20
|
54
|
+
},
|
55
|
+
panel: {
|
56
|
+
boxShadow: 'none',
|
57
|
+
border: 'none'
|
58
|
+
},
|
59
|
+
panelDetails: {
|
60
|
+
padding: '8px 24px 8px'
|
61
|
+
},
|
62
|
+
disabledPanel: {
|
63
|
+
backgroundColor: '#ffffff',
|
64
|
+
opacity: 1
|
65
|
+
},
|
66
|
+
expandIconExpanded: {
|
67
|
+
transform: 'translateY(-50%) rotate(-90deg)'
|
68
|
+
}
|
69
|
+
});
|
70
|
+
|
71
|
+
class HiExpansionPanel extends React.PureComponent {
|
72
|
+
|
73
|
+
render() {
|
74
|
+
const _props = this.props,
|
75
|
+
{
|
76
|
+
disabled,
|
77
|
+
heading,
|
78
|
+
secondaryHeading,
|
79
|
+
secondaryHeadingDisabled,
|
80
|
+
secondaryHeadingIcon,
|
81
|
+
children,
|
82
|
+
classes
|
83
|
+
} = _props,
|
84
|
+
props = _objectWithoutProperties(_props, ['disabled', 'heading', 'secondaryHeading', 'secondaryHeadingDisabled', 'secondaryHeadingIcon', 'children', 'classes']);
|
85
|
+
|
86
|
+
const effectiveDisabled = disabled || !children;
|
87
|
+
|
88
|
+
return React.createElement(
|
89
|
+
ExpansionPanel,
|
90
|
+
_extends({
|
91
|
+
disabled: effectiveDisabled,
|
92
|
+
classes: { root: classes.panel, disabled: classes.disabledPanel }
|
93
|
+
}, props),
|
94
|
+
React.createElement(
|
95
|
+
ExpansionPanelSummary,
|
96
|
+
{
|
97
|
+
classes: {
|
98
|
+
root: classes.panelSummary,
|
99
|
+
disabled: classes.disabledPanel,
|
100
|
+
expanded: classes.panelSummaryExpanded,
|
101
|
+
expandIconExpanded: classes.expandIconExpanded
|
102
|
+
},
|
103
|
+
expandIcon: React.createElement(MenuDownIcon, { classes: { root: classes.expandMoreIcon } })
|
104
|
+
},
|
105
|
+
React.createElement(
|
106
|
+
'div',
|
107
|
+
{ className: classes.column },
|
108
|
+
React.createElement(
|
109
|
+
Typography,
|
110
|
+
{ classes: { root: classes.heading } },
|
111
|
+
heading
|
112
|
+
)
|
113
|
+
),
|
114
|
+
React.createElement(
|
115
|
+
'div',
|
116
|
+
{ className: classes.column },
|
117
|
+
React.createElement(
|
118
|
+
Typography,
|
119
|
+
{ classes: { root: classes.secondaryHeading } },
|
120
|
+
!effectiveDisabled ? secondaryHeading : secondaryHeadingDisabled,
|
121
|
+
secondaryHeadingIcon
|
122
|
+
)
|
123
|
+
)
|
124
|
+
),
|
125
|
+
!!children && React.createElement(
|
126
|
+
ExpansionPanelDetails,
|
127
|
+
{ classes: { root: classes.panelDetails } },
|
128
|
+
children
|
129
|
+
)
|
130
|
+
);
|
131
|
+
}
|
132
|
+
}
|
133
|
+
|
134
|
+
HiExpansionPanel.defaultProps = {
|
135
|
+
disabled: false,
|
136
|
+
secondaryHeading: '',
|
137
|
+
secondaryHeadingIcon: '',
|
138
|
+
secondaryHeadingDisabled: 'PAS ENCORE COMPLETE'
|
139
|
+
};
|
140
|
+
HiExpansionPanel.propTypes = process.env.NODE_ENV !== "production" ? {
|
141
|
+
/**
|
142
|
+
* Contenu du panel
|
143
|
+
*/
|
144
|
+
children: PropTypes.any,
|
145
|
+
/**
|
146
|
+
* Surcharge les classes du composant
|
147
|
+
*/
|
148
|
+
classes: PropTypes.object,
|
149
|
+
/**
|
150
|
+
* Désactivé
|
151
|
+
*/
|
152
|
+
disabled: PropTypes.bool,
|
153
|
+
/**
|
154
|
+
* Titre principal du panel
|
155
|
+
*/
|
156
|
+
heading: PropTypes.string.isRequired,
|
157
|
+
/**
|
158
|
+
* Titre secondaire du panel
|
159
|
+
*/
|
160
|
+
secondaryHeading: PropTypes.string,
|
161
|
+
/**
|
162
|
+
* Titre secondaire si désactivé
|
163
|
+
*/
|
164
|
+
secondaryHeadingDisabled: PropTypes.string,
|
165
|
+
/**
|
166
|
+
* Icone dans le titre secondaire du panel
|
167
|
+
*/
|
168
|
+
secondaryHeadingIcon: PropTypes.any
|
169
|
+
} : {};
|
170
|
+
export default withStyles(styles, { name: 'HmuiHiExpansionPanel' })(HiExpansionPanel);
|
@@ -0,0 +1 @@
|
|
1
|
+
export { default } from './HiExpansionPanel';
|