react-bootstrap-front 3.7.5 → 3.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (32) hide show
  1. package/CHANGELOG +23 -0
  2. package/dist/react-bootstrap-front.js +7 -7
  3. package/package.json +1 -1
  4. package/src/features/advanced/DefaultQuickSearch.js +17 -3
  5. package/src/features/advanced/DropdownWrapper.js +5 -8
  6. package/src/features/advanced/ResponsiveModalInner.scss +0 -1
  7. package/src/features/basic/CalmButton.js +2 -2
  8. package/src/features/basic/InputMonetary.js +3 -1
  9. package/src/features/draft/{InputColorPicker.js → ColorPicker.js} +2 -2
  10. package/src/features/draft/{InputColorPicker.scss → ColorPicker.scss} +0 -0
  11. package/src/features/draft/FontSize.js +71 -0
  12. package/src/features/draft/FontSize.scss +0 -0
  13. package/src/features/draft/Inline.js +43 -0
  14. package/src/features/draft/Inline.scss +0 -0
  15. package/src/features/draft/InputHtml.js +4 -2
  16. package/src/features/draft/InputHtml.scss +5 -0
  17. package/src/features/draft/index.js +3 -1
  18. package/src/features/draft/style.scss +4 -1
  19. package/src/features/filter/DefaultPanel.jsx +11 -1
  20. package/src/features/filter/Filter.js +5 -1
  21. package/src/features/filter/FilterBuilder.jsx +28 -26
  22. package/src/features/filter/FilterBuilder.scss +3 -0
  23. package/src/features/filter/FilterHeader.jsx +1 -1
  24. package/src/features/inline-list/DefaultLineBreak.js +20 -0
  25. package/src/features/inline-list/DefaultLineBreak.scss +0 -0
  26. package/src/features/inline-list/DefaultList.jsx +37 -11
  27. package/src/features/inline-list/index.js +1 -0
  28. package/src/features/inline-list/style.scss +1 -0
  29. package/src/features/list/ActionButton.js +1 -1
  30. package/src/features/list/DefaultHeader.jsx +1 -1
  31. package/src/features/page/DefaultContent.jsx +23 -1
  32. package/src/features/page/DefaultContent.scss +23 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-bootstrap-front",
3
- "version": "3.7.5",
3
+ "version": "3.8.0",
4
4
  "description": "React Bootstrap Components",
5
5
  "keywords": [
6
6
  "Bootstrap 4",
@@ -8,10 +8,14 @@ export default class DefaultQuickSearch extends Component {
8
8
  name: PropTypes.string.isRequired,
9
9
  label: PropTypes.string,
10
10
  icon: PropTypes.element.isRequired,
11
+ plus: PropTypes.element,
12
+ reset: PropTypes.element,
11
13
  };
12
14
 
13
15
  static defaultProps = {
14
16
  label: '',
17
+ plus: null,
18
+ reset: null,
15
19
  };
16
20
 
17
21
  static getDerivedStateFromProps(props, state) {
@@ -38,11 +42,11 @@ export default class DefaultQuickSearch extends Component {
38
42
  this.setState({ search: event.target.value });
39
43
  }
40
44
 
41
- onSubmit(event) {
45
+ onSubmit(event, mode) {
42
46
  if (event) {
43
47
  event.preventDefault();
44
48
  }
45
- this.props.onSubmit(this.state.search);
49
+ this.props.onSubmit(this.state.search, mode);
46
50
  }
47
51
 
48
52
  render() {
@@ -58,9 +62,19 @@ export default class DefaultQuickSearch extends Component {
58
62
  onChange={this.onChange}
59
63
  />
60
64
  <div className="input-group-append">
61
- <button type="button" className="btn btn-outline-secondary bg-light" onClick={this.onSubmit}>
65
+ <button type="button" title="Recherche simple" className="btn btn-outline-secondary bg-light" onClick={(ev) => this.onSubmit(ev, "simple")}>
62
66
  {this.props.icon}
63
67
  </button>
68
+ {this.props.plus &&
69
+ <button type="button" title="Recherche mois stricte" className="btn btn-outline-secondary bg-light" onClick={(ev) => this.onSubmit(ev, "plus")}>
70
+ {this.props.plus}
71
+ </button>
72
+ }
73
+ {this.props.reset &&
74
+ <button type="button" title="Initialiser la recherche" className="btn btn-outline-secondary bg-light text-warning" onClick={(ev) => this.onSubmit(ev, "reset")}>
75
+ {this.props.reset}
76
+ </button>
77
+ }
64
78
  </div>
65
79
  </div>
66
80
  </form>
@@ -39,16 +39,13 @@ export default class DropdownWrapper extends Component {
39
39
  }
40
40
 
41
41
  render() {
42
+ const clonedTrigger = React.cloneElement(
43
+ this.props.trigger,
44
+ {ref: this.state.ref, onClick: this.onClick, title: this.props.tooltip}
45
+ )
42
46
  return (
43
47
  <>
44
- <div
45
- ref={this.state.ref}
46
- className={classnames('advanced-dropdown-wrapper', this.props.className)}
47
- onClick={this.onClick}
48
- title={this.props.tooltip}
49
- >
50
- {this.props.trigger}
51
- </div>
48
+ {clonedTrigger}
52
49
  {this.state.open && (
53
50
  <Dropdown align={this.props.align} myRef={this.state.ref} onClose={this.onClose}>
54
51
  <div onClick={this.onClose}>{this.props.children}</div>
@@ -33,7 +33,6 @@
33
33
  margin-left: 20px;
34
34
  margin-right: 10px;
35
35
  padding: 2px;
36
- background-color: theme-color('secondary');
37
36
  }
38
37
  .nav-link-inner-btn:hover {
39
38
  background-color: theme-color('secondary-light');
@@ -99,13 +99,13 @@ export default class CalmButton extends Component {
99
99
  {this.props.options.map(option => {
100
100
  return (
101
101
  <DropdownMenuOption
102
- key={`text-${option.id}`}
102
+ key={`text-${option.value}`}
103
103
  label={option.label}
104
104
  onClick={ev => {
105
105
  if (ev) {
106
106
  ev.preventDefault();
107
107
  }
108
- option.onClick();
108
+ this.props.onClick(option.value);
109
109
  this.onOptionsMenuClose();
110
110
  }}
111
111
  />
@@ -12,7 +12,7 @@ export default function InputMonetary(props) {
12
12
  const rnd = getRandomInt(10000, 99999);
13
13
  myId = `${myId}-${rnd}`;
14
14
  }
15
- const value = props.value || 0;
15
+ const value = props.value || (props.allowNull ? '' : 0);
16
16
  return (
17
17
  <InputGroup {...props} id={myId}>
18
18
  {props.prepend && props.prepend !== '' && (
@@ -94,6 +94,7 @@ export default function InputMonetary(props) {
94
94
  }
95
95
 
96
96
  InputMonetary.propTypes = {
97
+ allowNull: PropTypes.bool,
97
98
  autoComplete: PropTypes.string,
98
99
  disabled: PropTypes.bool,
99
100
  error: PropTypes.element,
@@ -125,6 +126,7 @@ InputMonetary.propTypes = {
125
126
  };
126
127
 
127
128
  InputMonetary.defaultProps = {
129
+ allowNull: false,
128
130
  autoComplete: 'off',
129
131
  disabled: false,
130
132
  error: false,
@@ -35,12 +35,12 @@ export default class ColorPicker extends Component {
35
35
  type="button"
36
36
  className={classnames(this.props.className, 'btn btn-light')}
37
37
  >
38
- 'Color'
38
+ Color
39
39
  </button>
40
40
  );
41
41
  const { color } = this.props.currentState;
42
42
  return (
43
- <DropdownWrapper trigger={trigger} className="" align="bottom-right" myRef={this.state.myRef}>
43
+ <DropdownWrapper trigger={trigger} className="rbf-inline-wrapper btn-group pl-2" align="bottom-right" myRef={this.state.myRef}>
44
44
  <DropdownMenu>
45
45
  <ChromePicker color={color} onChangeComplete={this.onChange} />
46
46
  </DropdownMenu>
@@ -0,0 +1,71 @@
1
+ import React, { Component } from 'react';
2
+ import classnames from 'classnames';
3
+ import PropTypes from 'prop-types';
4
+ import { DropdownWrapper } from '../advanced'
5
+ import { DropdownMenu, DropdownMenuOption } from '../basic';
6
+
7
+ export default class FontSize extends Component {
8
+ static propTypes = {
9
+ expanded: PropTypes.bool,
10
+ onExpandEvent: PropTypes.func,
11
+ onChange: PropTypes.func,
12
+ currentState: PropTypes.object,
13
+ };
14
+
15
+ constructor(props) {
16
+ super(props);
17
+ this.state = {
18
+ myRef: React.createRef()
19
+ }
20
+ }
21
+
22
+ stopPropagation = (event) => {
23
+ event.stopPropagation();
24
+ };
25
+
26
+ onChange = (color) => {
27
+ const { onChange } = this.props;
28
+ onChange('color', color.hex);
29
+ }
30
+
31
+ render() {
32
+ const trigger = (
33
+ <button
34
+ type="button"
35
+ className={classnames(this.props.className, 'btn btn-light')}
36
+ >
37
+ Size
38
+ </button>
39
+ );
40
+ const {
41
+ config: { icon, className, dropdownClassName, options, title },
42
+ onChange,
43
+ expanded,
44
+ doCollapse,
45
+ onExpandEvent,
46
+ doExpand,
47
+ translations,
48
+ } = this.props;
49
+ let { currentState: { fontSize: currentFontSize } } = this.props;
50
+ let { defaultFontSize } = this.state;
51
+ defaultFontSize = Number(defaultFontSize);
52
+ currentFontSize = currentFontSize ||
53
+ (options && options.indexOf(defaultFontSize) >= 0 && defaultFontSize);
54
+ return (
55
+ <DropdownWrapper trigger={trigger} className="rbf-inline-wrapper btn-group pl-2" align="bottom-right" myRef={this.state.myRef}>
56
+ <DropdownMenu>
57
+ {options.map((size, index) =>
58
+ (<DropdownMenuOption
59
+ className="rdw-fontsize-option"
60
+ active={currentFontSize === size}
61
+ onClick={() => onChange(size)}
62
+ key={index}
63
+ >
64
+ {size}
65
+ </DropdownMenuOption>),
66
+ )}
67
+ </DropdownMenu>
68
+ </DropdownWrapper>
69
+ );
70
+ }
71
+ }
File without changes
@@ -0,0 +1,43 @@
1
+ import React, { Component } from 'react';
2
+ import classnames from 'classnames';
3
+ import PropTypes from 'prop-types';
4
+
5
+ export default class Inline extends Component {
6
+ static propTypes = {
7
+ expanded: PropTypes.bool,
8
+ onExpandEvent: PropTypes.func,
9
+ onChange: PropTypes.func,
10
+ currentState: PropTypes.object,
11
+ };
12
+
13
+ constructor(props) {
14
+ super(props);
15
+ this.state = {
16
+ myRef: React.createRef()
17
+ }
18
+ }
19
+ render() {
20
+ const { config, currentState, onChange, translations } = this.props;
21
+ return (
22
+ <div className={classnames('rbf-inline-wrapper btn-group pl-2', config.className)} aria-label="rdw-inline-control">
23
+ {
24
+ config.options
25
+ .map((style, index) =>
26
+ (<button
27
+ key={index}
28
+ onClick={() => onChange(style)}
29
+ className={classnames("btn btn-light", config[style].className, (currentState[style] === true ||
30
+ (style === 'MONOSPACE' && currentState.CODE)) && "active")}
31
+ title={config[style].title || translations[`components.controls.inline.${style}`]}
32
+ >
33
+ <img
34
+ alt=""
35
+ src={config[style].icon}
36
+ />
37
+ </button>),
38
+ )
39
+ }
40
+ </div>
41
+ );
42
+ }
43
+ }
File without changes
@@ -5,7 +5,7 @@ import { EditorState, Modifier } from 'draft-js';
5
5
  import { Editor } from 'react-draft-wysiwyg';
6
6
  import { convertToHTML, convertFromHTML } from 'draft-convert';
7
7
  import { htmlToString } from '../helpers';
8
- import { InputColorPicker } from './';
8
+ import { ColorPicker, Inline, FontSize } from './';
9
9
  import '../../../node_modules/react-draft-wysiwyg/dist/react-draft-wysiwyg.css';
10
10
 
11
11
  const myStyle = {
@@ -249,13 +249,15 @@ export default class InputTextarea extends Component {
249
249
  options: ['inline','fontSize','colorPicker'],
250
250
  inline: {
251
251
  inDropdown: false,
252
+ component: Inline,
252
253
  options: ['bold', 'italic', 'underline', 'superscript', 'subscript'],
253
254
  },
254
255
  fontSize: {
256
+ component: FontSize,
255
257
  options: [7, 8, 9, 10, 11, 12, 14, 16, 18, 24, 30, 36, 48, 60, 72, 96],
256
258
  },
257
259
  colorPicker: {
258
- component: InputColorPicker
260
+ component: ColorPicker
259
261
  }
260
262
  };
261
263
  return (
@@ -1,3 +1,8 @@
1
1
  .public-DraftStyleDefault-block {
2
2
  margin: 0;
3
3
  }
4
+
5
+ .rdw-editor-toolbar {
6
+ padding: 5px;
7
+ border: 1px solid theme-color('secondary-light');
8
+ }
@@ -1,2 +1,4 @@
1
- export { default as InputColorPicker } from "./InputColorPicker";
1
+ export { default as ColorPicker } from "./ColorPicker";
2
+ export { default as FontSize } from "./FontSize";
3
+ export { default as Inline } from "./Inline";
2
4
  export { default as InputHtml } from "./InputHtml";
@@ -1 +1,4 @@
1
- @import './InputColorPicker';
1
+ @import './ColorPicker';
2
+ @import './FontSize';
3
+ @import './Inline';
4
+ @import './InputHtml';
@@ -73,6 +73,7 @@ export default class DefaultPanel extends Component {
73
73
  validPanelIcon: PropTypes.element.isRequired,
74
74
  cancelPanelIcon: PropTypes.element.isRequired,
75
75
  onToggleFilter: PropTypes.func.isRequired,
76
+ clearIcon: PropTypes.element.isRequired,
76
77
  sortNoneIcon: PropTypes.element,
77
78
  sortUpIcon: PropTypes.element,
78
79
  sortDownIcon: PropTypes.element,
@@ -178,7 +179,11 @@ export default class DefaultPanel extends Component {
178
179
  let { filter } = this.state;
179
180
  const col = event.target.name;
180
181
  const oper = event.target.value;
181
- filter.updateFilterOperator(col.replace('oper-', ''), oper);
182
+ if (oper !== '') {
183
+ filter.updateFilterOperator(col.replace('oper-', ''), oper);
184
+ } else {
185
+ filter.removeFilter(col.replace('oper-', ''));
186
+ }
182
187
  this.setState({ filter, local: true });
183
188
  }
184
189
 
@@ -253,6 +258,11 @@ export default class DefaultPanel extends Component {
253
258
  {this.props.cancelPanelIcon}
254
259
  </button>
255
260
  )}
261
+ {this.props.onClearFilter &&
262
+ <button className="btn btn-warning text-light" onClick={this.props.onClearFilter}>
263
+ {this.props.clearIcon}
264
+ </button>
265
+ }
256
266
  <button className="btn btn-primary text-light" onClick={this.onValid}>
257
267
  {this.props.validPanelIcon}
258
268
  </button>
@@ -192,7 +192,11 @@ export default class Filter {
192
192
  removeFilter(name, action = 'default') {
193
193
  let elem = this.data.filters.find(elt => elt.getFilterName() === name);
194
194
  if (elem) {
195
- elem.removeFilterCrit(action);
195
+ if (action === 'default') {
196
+ this.data.filters = this.data.filters.filter(elt => elt.getFilterName() !== name)
197
+ } else {
198
+ elem.removeFilterCrit(action);
199
+ }
196
200
  }
197
201
  }
198
202
 
@@ -27,33 +27,33 @@ import { InputAutocomplete, FilterHeader } from './';
27
27
  const getOptionsForType = (type, update = false) => {
28
28
  let options = [
29
29
  {value: '', label: ''},
30
- {value: FILTER_OPER_EQUAL, label: '='},
31
- {value: FILTER_OPER_NOT_EQUAL, label: '!='},
32
- {value: FILTER_OPER_EMPTY, label: 'ø'},
33
- {value: FILTER_OPER_NOT_EMPTY, label: '!ø'},
30
+ {value: FILTER_OPER_EQUAL, label: 'Est égal à'},
31
+ {value: FILTER_OPER_NOT_EQUAL, label: 'Est différenrt de'},
32
+ {value: FILTER_OPER_EMPTY, label: 'Est vide'},
33
+ {value: FILTER_OPER_NOT_EMPTY, label: 'N\'est pas vide'},
34
34
  ];
35
35
  if (type !== 'date' && type !== 'datetime' && type !== 'picker' && type !== 'select') {
36
36
  options.push(
37
- {value: FILTER_OPER_LIKE, label: '*'},
38
- {value: FILTER_OPER_NOT_LIKE, label: '!*'},
39
- {value: FILTER_OPER_START_WITH, label: '^*'},
40
- {value: FILTER_OPER_END_WITH, label: '*$'},
41
- {value: FILTER_OPER_SOUND_LIKE, label: '~'}
37
+ {value: FILTER_OPER_LIKE, label: 'Contient'},
38
+ {value: FILTER_OPER_NOT_LIKE, label: 'Ne contient pas'},
39
+ {value: FILTER_OPER_START_WITH, label: 'Commence par'},
40
+ {value: FILTER_OPER_END_WITH, label: 'Termine par'},
41
+ {value: FILTER_OPER_SOUND_LIKE, label: 'Ressemble à'}
42
42
  );
43
43
  }
44
44
  if (type !== 'picker' && type !== 'select') {
45
45
  options.push(
46
- {value: FILTER_OPER_GREATER, label: '>'},
47
- {value: FILTER_OPER_GREATER_OR_EQUAL, label: '>='},
48
- {value: FILTER_OPER_GREATER_OR_EQUAL_OR_NULL, label: '>=ø'},
49
- {value: FILTER_OPER_LOWER, label: '<'},
50
- {value: FILTER_OPER_LOWER_OR_EQUAL, label: '<='},
51
- {value: FILTER_OPER_LOWER_OR_EQUAL_OR_NULL, label: '<=ø'},
46
+ {value: FILTER_OPER_GREATER, label: 'Supérieur à'},
47
+ {value: FILTER_OPER_GREATER_OR_EQUAL, label: 'Supérieur ou égal à'},
48
+ {value: FILTER_OPER_GREATER_OR_EQUAL_OR_NULL, label: 'Vide ou supérieur et égal à'},
49
+ {value: FILTER_OPER_LOWER, label: 'Inférieur à'},
50
+ {value: FILTER_OPER_LOWER_OR_EQUAL, label: 'Inférieur ou égal à'},
51
+ {value: FILTER_OPER_LOWER_OR_EQUAL_OR_NULL, label: 'Vide ou inférieur et égal à'},
52
52
  );
53
53
  };
54
- if (update && (type === 'date' || type === 'datetime' || type === 'monetary')) {
54
+ if (update && (type === 'date' || type === 'datetime' || type === 'monetary' || type === 'number')) {
55
55
  options.push(
56
- {value: FILTER_OPER_BETWEEN, label: '<.>'}
56
+ {value: FILTER_OPER_BETWEEN, label: 'Compris entre'}
57
57
  );
58
58
  }
59
59
  return options;
@@ -71,7 +71,6 @@ export default class FilterBuilder extends Component {
71
71
  delIcon: PropTypes.element.isRequired,
72
72
  calIcon: PropTypes.element.isRequired,
73
73
  className: PropTypes.string,
74
- clearIcon: PropTypes.element.isRequired,
75
74
  withHeader: PropTypes.bool,
76
75
  };
77
76
  static defaultProps = {
@@ -118,6 +117,9 @@ export default class FilterBuilder extends Component {
118
117
  colOper = FILTER_OPER_EQUAL;
119
118
  }
120
119
  }
120
+ if (value === null) {
121
+ value = '';
122
+ }
121
123
  const prepend = (
122
124
  <select
123
125
  id={`oper-${colFilterable}`}
@@ -155,7 +157,7 @@ export default class FilterBuilder extends Component {
155
157
  display={col.filterable.display}
156
158
  value={value}
157
159
  size={this.props.size}
158
- clearIcon={this.props.clearIcon}
160
+ clearIcon={this.props.delIcon}
159
161
  onSearch={col.filterable.onSearch}
160
162
  onSelect={this.props.onChange}
161
163
  />
@@ -176,7 +178,7 @@ export default class FilterBuilder extends Component {
176
178
  value={value}
177
179
  onChange={this.props.onChange}
178
180
  calIcon={this.props.calIcon}
179
- delIcon={this.props.clearIcon}
181
+ delIcon={this.props.delIcon}
180
182
  />
181
183
  </div>
182
184
  {colOper === FILTER_OPER_BETWEEN && this.props.onUpdate &&
@@ -189,7 +191,7 @@ export default class FilterBuilder extends Component {
189
191
  value={elem.getFilterCrit('between')}
190
192
  onChange={this.props.onUpdate}
191
193
  calIcon={this.props.calIcon}
192
- delIcon={this.props.clearIcon}
194
+ delIcon={this.props.delIcon}
193
195
  />
194
196
  </div>
195
197
  }
@@ -210,7 +212,7 @@ export default class FilterBuilder extends Component {
210
212
  value={value}
211
213
  onChange={this.props.onChange}
212
214
  calIcon={this.props.calIcon}
213
- delIcon={this.props.clearIcon}
215
+ delIcon={this.props.delIcon}
214
216
  />
215
217
  </div>
216
218
  {colOper === FILTER_OPER_BETWEEN && this.props.onUpdate &&
@@ -223,7 +225,7 @@ export default class FilterBuilder extends Component {
223
225
  value={elem.getFilterCrit('between')}
224
226
  onChange={this.props.onUpdate}
225
227
  calIcon={this.props.calIcon}
226
- delIcon={this.props.clearIcon}
228
+ delIcon={this.props.delIcon}
227
229
  />
228
230
  </div>
229
231
  }
@@ -365,7 +367,7 @@ export default class FilterBuilder extends Component {
365
367
  this.props.onRemove(ev);
366
368
  }}
367
369
  >
368
- {this.props.clearIcon}
370
+ {this.props.delIcon}
369
371
  </button>
370
372
  </div>
371
373
  </div>
@@ -411,7 +413,7 @@ export default class FilterBuilder extends Component {
411
413
  this.props.onChange(ev);
412
414
  }}
413
415
  >
414
- {this.props.clearIcon}
416
+ {this.props.delIcon}
415
417
  </button>
416
418
  <button
417
419
  type="button"
@@ -466,7 +468,7 @@ export default class FilterBuilder extends Component {
466
468
  this.props.onRemove(ev);
467
469
  }}
468
470
  >
469
- {this.props.clearIcon}
471
+ {this.props.delIcon}
470
472
  </button>
471
473
  </div>
472
474
  </div>
@@ -1,5 +1,6 @@
1
1
  .filter-filter-builder {
2
2
  .input-group-prepend {
3
+ width: 180px;
3
4
  label, select, span {
4
5
  height: 100%;
5
6
  background-color: theme-color('light') !important;
@@ -9,6 +10,8 @@
9
10
  min-width: 50px;
10
11
  select{
11
12
  padding: 0px;
13
+ padding-right: 20px;
14
+ color: theme-color('dark') !important;
12
15
  }
13
16
  }
14
17
  }
@@ -40,7 +40,7 @@ export default function FilterHeader(props) {
40
40
  borderColor="secondary-light"
41
41
  />
42
42
  </div>
43
- <div className="col-xxs-w16 form-group">
43
+ <div className="col-xxs-none form-group">
44
44
  <label htmlFor="filter-oper" className="text-secondary">
45
45
  <span>Condition</span>
46
46
  </label>
@@ -0,0 +1,20 @@
1
+ import React, { Component } from 'react';
2
+ import classnames from 'classnames';
3
+
4
+ export default class DefaultLineBreak extends Component {
5
+ render() {
6
+ let rowOddEven = '';
7
+ if (this.props.counter) {
8
+ rowOddEven = this.props.counter % 2 === 0 ? 'row-even' : 'row-odd';
9
+ }
10
+ return (
11
+ <div
12
+ className={classnames("inline-default-list-wrapper row row-line no-gutters", rowOddEven)}
13
+ >
14
+ <div class="col col-xs-w36">
15
+ {this.props.label}
16
+ </div>
17
+ </div>
18
+ );
19
+ }
20
+ }
File without changes
@@ -1,10 +1,11 @@
1
1
  import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
- import { DefaultHeader, DefaultLine, DefaultLineAction } from './';
3
+ import { DefaultHeader, DefaultLine, DefaultLineAction, DefaultLineBreak } from './';
4
4
  import { rbfIntl } from '../intl';
5
5
 
6
6
  export const DefaultList = props => {
7
- let counter = 1;
7
+ let counter = 1;
8
+ let previous = null;
8
9
  return (
9
10
  <div className="ui-inline-list-default-list">
10
11
  <div className="inline-list">
@@ -12,15 +13,38 @@ export const DefaultList = props => {
12
13
  {props.lines && (
13
14
  <div className="ui-inline-list-default-list-content">
14
15
  {Array.isArray(props.items) &&
15
- props.items.map(item => (
16
- <DefaultLine
17
- {...props}
18
- key={item.id}
19
- id={item.id}
20
- item={item}
21
- counter={props.oddEven ? counter++ : 0}
22
- />
23
- ))}
16
+ props.items.map(item => {
17
+ let myBreak = false;
18
+ if (props.breakpoint) {
19
+ myBreak = props.breakpoint(previous, item);
20
+ }
21
+ previous = item;
22
+ if (myBreak !== false) {
23
+ return (
24
+ <>
25
+ <DefaultLineBreak label={myBreak} counter={props.oddEven ? counter++ : 0}/>
26
+ <DefaultLine
27
+ {...props}
28
+ key={item.id}
29
+ id={item.id}
30
+ item={item}
31
+ counter={props.oddEven ? counter++ : 0}
32
+ />
33
+ </>
34
+ );
35
+ } else {
36
+ return (
37
+ <DefaultLine
38
+ {...props}
39
+ key={item.id}
40
+ id={item.id}
41
+ item={item}
42
+ counter={props.oddEven ? counter++ : 0}
43
+ />
44
+ )
45
+ }
46
+ })
47
+ }
24
48
  </div>
25
49
  )}
26
50
  {props.lines &&
@@ -47,6 +71,7 @@ export const DefaultList = props => {
47
71
  };
48
72
 
49
73
  DefaultList.propTypes = {
74
+ breakpoint: PropTypes.func,
50
75
  title: PropTypes.bool,
51
76
  lines: PropTypes.bool,
52
77
  oddEven: PropTypes.bool,
@@ -54,6 +79,7 @@ DefaultList.propTypes = {
54
79
  t: PropTypes.func,
55
80
  };
56
81
  DefaultList.defaultProps = {
82
+ breakpoint: false,
57
83
  title: true,
58
84
  lines: true,
59
85
  oddEven: true,
@@ -2,6 +2,7 @@ export * from './ColLink';
2
2
  export { default as DefaultLine } from './DefaultLine';
3
3
  export * from './InlineEmpty';
4
4
  export { default as MobileLineAction } from './MobileLineAction';
5
+ export { default as DefaultLineBreak } from './DefaultLineBreak';
5
6
  export { default as DefaultLineAction } from './DefaultLineAction';
6
7
  export { default as MobileLineText } from './MobileLineText';
7
8
  export * from './ResponsiveInlineList.jsx';
@@ -4,6 +4,7 @@
4
4
  @import './ResponsiveInlineList';
5
5
  @import './DefaultLine';
6
6
  @import './MobileLineAction';
7
+ @import './DefaultLineBreak';
7
8
  @import './DefaultLineAction';
8
9
  @import './MobileLineText';
9
10
  @import './ResponsiveInlineHeader';
@@ -149,7 +149,7 @@ export default class ActionButton extends Component {
149
149
  );
150
150
  } else {
151
151
  if (this.state.options && Array.isArray(this.state.options)) {
152
- if (this.state.options.length > 1) {
152
+ if (this.state.options.length >= 1) {
153
153
  const trigger = (
154
154
  <button
155
155
  type="button"