Skip to content

Commit ca79019

Browse files
committed
fix(all): remove multi, use isMulti only
1 parent 42fd0b7 commit ca79019

File tree

17 files changed

+39
-39
lines changed

17 files changed

+39
-39
lines changed

packages/common/src/demoschema.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,7 @@ const superSchema = {
5353
? [
5454
...genereateField(curr, 'isClearable', { isClearable: true }),
5555
...genereateField(curr, 'isSearchable', { isSearchable: true }),
56-
...genereateField(curr, 'isMulti', { isMulti: true }),
57-
...genereateField(curr, 'multi', { multi: true })
56+
...genereateField(curr, 'isMulti', { isMulti: true })
5857
]
5958
: []),
6059
...(curr === 'checkbox'

packages/common/src/select/index.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,18 +57,16 @@ Select.defaultProps = {
5757
pluckSingleValue: true
5858
};
5959

60-
const DataDrivenSelect = ({ multi, ...props }) => {
61-
const isMulti = props.isMulti || multi;
60+
const DataDrivenSelect = ({ isMulti, ...props }) => {
6261
const closeMenuOnSelect = !isMulti;
6362
return <Select hideSelectedOptions={false} isMulti={isMulti} {...props} closeMenuOnSelect={closeMenuOnSelect} />;
6463
};
6564

6665
DataDrivenSelect.propTypes = {
6766
value: PropTypes.any,
6867
onChange: PropTypes.func,
69-
multi: PropTypes.bool,
70-
placeholder: PropTypes.string,
7168
isMulti: PropTypes.bool,
69+
placeholder: PropTypes.string,
7270
classNamePrefix: PropTypes.string.isRequired
7371
};
7472

packages/mui-component-mapper/src/components/select.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,12 @@ const Select = (props) => {
3434
{...input}
3535
options={options.filter((option) => Object.prototype.hasOwnProperty.call(option, 'value') && option.value !== null)}
3636
placeholder={placeholder || 'Please choose'}
37-
value={options.filter(({ value }) => (rest.multi ? input.value.includes(value) : value === input.value))}
38-
isMulti={rest.multi}
37+
value={options.filter(({ value }) => (rest.isMulti ? input.value.includes(value) : value === input.value))}
38+
isMulti={rest.isMulti}
3939
isSearchable={!!isSearchable}
4040
isClearable={false}
4141
hideSelectedOptions={false}
42-
closeMenuOnSelect={!rest.multi}
42+
closeMenuOnSelect={!rest.isMulti}
4343
noOptionsMessage={() => 'No option found'}
4444
invalid={invalid}
4545
isDisabled={isDisabled}
@@ -50,7 +50,7 @@ const Select = (props) => {
5050
shrink: true
5151
}
5252
}}
53-
onChange={(option) => input.onChange(rest.multi ? selectValue(option) : option ? option.value : undefined)}
53+
onChange={(option) => input.onChange(rest.isMulti ? selectValue(option) : option ? option.value : undefined)}
5454
input={input}
5555
label={label}
5656
isRequired={isRequired}

packages/parsers/src/parsers/miq.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ const miqParser = (
7474
}
7575

7676
if (field.options.force_multi_value) {
77-
newField.multi = true;
77+
newField.isMulti = true;
7878
}
7979

8080
if (options.length !== 0) {

packages/parsers/src/tests/miq/miq-schemas/output.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ const output = {
265265
title: 'Dropdown multiselect',
266266
dataType: 'string',
267267
component: componentTypes.SELECT,
268-
multi: true,
268+
isMulti: true,
269269
options: [
270270
{
271271
label: '<None>',

packages/pf3-component-mapper/demo/demo-schemas/sandbox.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ const output = {
5050
label: 'bar'
5151
}
5252
],
53-
multi: true
53+
isMulti: true
5454
},
5555
{
5656
title: 'Text boxes',
@@ -409,7 +409,7 @@ const output = {
409409
title: 'Dropdown multiselect',
410410
dataType: 'string',
411411
component: components.SELECT,
412-
multi: true,
412+
isMulti: true,
413413
options: [
414414
{
415415
label: '<None>',
@@ -459,7 +459,7 @@ const output = {
459459
label: 'Clearable dropdown',
460460
title: 'Clearable dropdown',
461461
component: components.SELECT,
462-
multi: true,
462+
isMulti: true,
463463
isClearable: true,
464464
options: [
465465
{

packages/pf3-component-mapper/demo/index.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ const selectSchema = {
2626
component: 'select',
2727
name: 'async-single',
2828
label: 'Async single',
29-
multi: true,
29+
isMulti: true,
3030
loadOptions
3131
},{
3232
component: 'select',
@@ -39,7 +39,7 @@ const selectSchema = {
3939
name: 'async-multi-search',
4040
label: 'Async multi search',
4141
isSearchable: true,
42-
multi: true,
42+
isMulti: true,
4343
loadOptions
4444
}, {
4545
component: 'select',
@@ -61,7 +61,7 @@ const selectSchema = {
6161
validateOnMount: true,
6262
isDisabled: true,
6363
isClearable: true,
64-
multi: true,
64+
isMulti: true,
6565
isSearchable: true,
6666
placeholder: 'Placeholder',
6767
validate: [{
@@ -84,7 +84,7 @@ const selectSchema = {
8484
isRequired: true,
8585
validateOnMount: true,
8686
isClearable: true,
87-
multi: false,
87+
isMulti: false,
8888
isSearchable: true,
8989
placeholder: 'Placeholder',
9090
validate: [{

packages/pf3-component-mapper/src/components/select/select.js

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -171,13 +171,12 @@ class Select extends Component {
171171
const [title, isPlaceholder] = getDropdownText(input.value, props.placeholder, options);
172172
const searchableInput = {
173173
...input,
174-
onChange:
175-
props.isMulti || props.multi
176-
? input.onChange
177-
: (...args) => {
178-
this.handleToggleOpen();
179-
return input.onChange(...args);
180-
}
174+
onChange: props.isMulti
175+
? input.onChange
176+
: (...args) => {
177+
this.handleToggleOpen();
178+
return input.onChange(...args);
179+
}
181180
};
182181
return (
183182
<div className={`${props.classNamePrefix}-button`}>
@@ -217,7 +216,7 @@ class Select extends Component {
217216
tabSelectsValue={false}
218217
menuIsOpen
219218
backspaceRemovesValue={false}
220-
isMulti={props.isMulti || props.multi}
219+
isMulti={props.isMulti}
221220
placeholder="Search..."
222221
components={{
223222
ClearIndicator,

packages/pf3-component-mapper/src/tests/form-fields/select/select.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ describe('<SelectField />', () => {
8686
const wrapper = mount(
8787
<SelectField
8888
{...initialProps}
89-
multi
89+
isMulti
9090
input={{
9191
name: 'select-input',
9292
onChange: changeSpy,

packages/pf4-component-mapper/demo/demo-schemas/sandbox.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ const output = {
259259
dataType: 'string',
260260
isSearchable: true,
261261
isClearable: true,
262-
multi: true,
262+
isMulti: true,
263263
component: components.SELECT,
264264
loadOptions: asyncLoadOptions
265265
},
@@ -270,7 +270,7 @@ const output = {
270270
dataType: 'string',
271271
isSearchable: true,
272272
isClearable: false,
273-
multi: true,
273+
isMulti: true,
274274
component: components.SELECT,
275275
options: [
276276
{
@@ -326,7 +326,7 @@ const output = {
326326
dataType: 'string',
327327
component: components.SELECT,
328328
isSearchable: true,
329-
multi: true,
329+
isMulti: true,
330330
simpleValue: false,
331331
options: [
332332
{
@@ -397,7 +397,7 @@ const output = {
397397
name: 'dropdown_list_5',
398398
label: 'Creatable multi select',
399399
component: components.SELECT,
400-
multi: true,
400+
isMulti: true,
401401
isClearable: true,
402402
selectVariant: 'createable',
403403
options: [

0 commit comments

Comments
 (0)