Skip to content

Commit 2ca49cf

Browse files
authored
Merge pull request #350 from data-driven-forms/remove-field-affix
[V2] breaking(renderer): remove component types with -field affix.
2 parents e54ea76 + 2a73574 commit 2ca49cf

36 files changed

Lines changed: 156 additions & 158 deletions

File tree

packages/common/src/demoschema.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ const genereateField = (component, name = 'standard', optionsOptional = {}) => [
1616
label: `${component} -- ${name}`,
1717
name: `${component} -- ${name}`,
1818
component,
19-
options: component === 'select-field' || component === 'radio' ? options : undefined,
19+
options: component === 'select' || component === 'radio' ? options : undefined,
2020
...optionsOptional
2121
},
2222
{
@@ -26,7 +26,7 @@ const genereateField = (component, name = 'standard', optionsOptional = {}) => [
2626
}
2727
];
2828

29-
const componentList = ['text-field', 'checkbox', 'date-picker', 'radio', 'select-field', 'switch-field', 'textarea-field', 'time-picker'];
29+
const componentList = ['text-field', 'checkbox', 'date-picker', 'radio', 'select', 'switch', 'textarea', 'time-picker'];
3030

3131
const superSchema = {
3232
fields: [
@@ -49,7 +49,7 @@ const superSchema = {
4949
...genereateField(curr, 'isDisabled', { isDisabled: true }),
5050
...genereateField(curr, 'isReadOnly', { isReadOnly: true }),
5151
...genereateField(curr, 'is required', { isRequired: true }),
52-
...(curr === 'select-field'
52+
...(curr === 'select'
5353
? [
5454
...genereateField(curr, 'isClearable', { isClearable: true }),
5555
...genereateField(curr, 'isSearchable', { isSearchable: true }),
@@ -69,7 +69,7 @@ const superSchema = {
6969
...genereateField(curr, 'multipleoptions is required', { isRequired: true, options })
7070
]
7171
: []),
72-
...(curr === 'switch-field'
72+
...(curr === 'switch'
7373
? [
7474
...genereateField(curr, 'onText', { onText: 'Turned on' }),
7575
...genereateField(curr, 'offText', { offText: 'Turned off' }),

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ export const components = {
2626

2727
const componentMapper = {
2828
[componentTypes.TEXT_FIELD]: TextField,
29-
[componentTypes.TEXTAREA_FIELD]: TextArea,
30-
[componentTypes.SELECT_COMPONENT]: Select,
29+
[componentTypes.TEXTAREA]: TextArea,
30+
[componentTypes.SELECT]: Select,
3131
[componentTypes.CHECKBOX]: Checkbox,
3232
[componentTypes.SUB_FORM]: SubForm,
3333
[componentTypes.RADIO]: Radio,

packages/parsers/src/parsers/miq/constants.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ export const componentMap = {
44
DialogFieldTextBox: componentTypes.TEXT_FIELD,
55
DialogFieldRadioButton: componentTypes.RADIO,
66
DialogFieldCheckBox: componentTypes.CHECKBOX,
7-
DialogFieldTextAreaBox: componentTypes.TEXTAREA_FIELD,
8-
DialogFieldDropDownList: componentTypes.SELECT_COMPONENT,
7+
DialogFieldTextAreaBox: componentTypes.TEXTAREA,
8+
DialogFieldDropDownList: componentTypes.SELECT,
99
DialogFieldDateControl: componentTypes.DATE_PICKER,
1010
DialogFieldDateTimeControl: componentTypes.TIME_PICKER
1111
};

packages/parsers/src/parsers/mozilla.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -235,14 +235,14 @@ const createFieldsFromObject = (schema, uiSchema = {}, keyPrefix) =>
235235
*/
236236
if (field.anyOf) {
237237
field.enum = field.anyOf.map(({ title, ...rest }) => ({ label: title, value: rest.enum[0] }));
238-
field.component = componentTypes.SELECT_COMPONENT;
238+
field.component = componentTypes.SELECT;
239239
delete field.anyOf;
240240
}
241241

242242
/**
243243
* Add default option for select and define options if none were defined
244244
*/
245-
if (field.component === componentTypes.SELECT_COMPONENT || field.component === componentTypes.RADIO) {
245+
if (field.component === componentTypes.SELECT || field.component === componentTypes.RADIO) {
246246
if (!field.enum) {
247247
field.enum = [
248248
{ label: 'Yes', value: true },
@@ -253,7 +253,7 @@ const createFieldsFromObject = (schema, uiSchema = {}, keyPrefix) =>
253253
/**
254254
* Need update PF select component. No option to have empty default state
255255
*/
256-
if (!field.isRequired && field.component === componentTypes.SELECT_COMPONENT) {
256+
if (!field.isRequired && field.component === componentTypes.SELECT) {
257257
field.enum.unshift({
258258
label: 'Please Choose',
259259
disabled: field.isRequired

packages/parsers/src/parsers/mozilla/mozilla-helpers.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@ export const componentMapper = (type, dataType) =>
5959
updown: { component: componentTypes.TEXT_FIELD, type: 'number', dataType },
6060
number: { component: componentTypes.TEXT_FIELD, type: 'number', dataType },
6161
range: { component: componentTypes.TEXT_FIELD, type: 'range', dataType },
62-
textarea: { component: componentTypes.TEXTAREA_FIELD, dataType },
63-
select: { component: componentTypes.SELECT_COMPONENT, dataType },
62+
textarea: { component: componentTypes.TEXTAREA, dataType },
63+
select: { component: componentTypes.SELECT, dataType },
6464
boolean: { component: componentTypes.CHECKBOX, type: 'checkbox', dataType },
6565
checkbox: { component: componentTypes.CHECKBOX, type: 'checkbox', dataType },
6666
checkboxes: { component: componentTypes.CHECKBOX, type: 'checkbox', dataType },

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

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ const output = {
9595
name: 'textarea_box_1',
9696
label: 'Text Area',
9797
title: 'Text Area',
98-
component: componentTypes.TEXTAREA_FIELD
98+
component: componentTypes.TEXTAREA
9999
}
100100
],
101101
component: componentTypes.SUB_FORM
@@ -214,7 +214,7 @@ const output = {
214214
label: 'Dropdown',
215215
title: 'Dropdown',
216216
dataType: 'string',
217-
component: componentTypes.SELECT_COMPONENT,
217+
component: componentTypes.SELECT,
218218
options: [
219219
{
220220
label: '<None>',
@@ -239,7 +239,7 @@ const output = {
239239
label: 'Dropdown default value',
240240
title: 'Dropdown default value',
241241
dataType: 'string',
242-
component: componentTypes.SELECT_COMPONENT,
242+
component: componentTypes.SELECT,
243243
options: [
244244
{
245245
label: '<None>',
@@ -264,7 +264,7 @@ const output = {
264264
label: 'Dropdown multiselect',
265265
title: 'Dropdown multiselect',
266266
dataType: 'string',
267-
component: componentTypes.SELECT_COMPONENT,
267+
component: componentTypes.SELECT,
268268
multi: true,
269269
options: [
270270
{
@@ -290,7 +290,7 @@ const output = {
290290
label: 'Dropdown sort by value',
291291
title: 'Dropdown sort by value',
292292
dataType: 'string',
293-
component: componentTypes.SELECT_COMPONENT,
293+
component: componentTypes.SELECT,
294294
options: [
295295
{
296296
label: '<None>',
@@ -381,7 +381,7 @@ const output = {
381381
name: 'textarea_box_2',
382382
label: 'Text Area',
383383
title: 'Text Area',
384-
component: componentTypes.TEXTAREA_FIELD
384+
component: componentTypes.TEXTAREA
385385
},
386386
{
387387
name: 'check_box_3',
@@ -400,7 +400,7 @@ const output = {
400400
label: 'Dropdown',
401401
title: 'Dropdown',
402402
dataType: 'string',
403-
component: componentTypes.SELECT_COMPONENT,
403+
component: componentTypes.SELECT,
404404
options: [
405405
{
406406
label: '<None>',

packages/parsers/src/tests/mozilla/expected-parser-results.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ export const simpleSchemaResult = {
4646
{
4747
name: 'bio',
4848
dataType: 'string',
49-
component: 'textarea-field',
49+
component: 'textarea',
5050
label: 'Bio',
5151
title: 'Bio',
5252
autoFocus: false,
@@ -138,7 +138,7 @@ export const nestedSchemaResult = {
138138
label: 'Task details',
139139
title: 'Task details',
140140
description: 'Enter the task details',
141-
component: 'textarea-field',
141+
component: 'textarea',
142142
type: 'string',
143143
validate: [],
144144
autoFocus: false
@@ -218,7 +218,7 @@ export const arraySchemaResult = {
218218
name: 'fixedItemsList.items.0',
219219
dataType: 'string',
220220
label: 'A string value',
221-
component: 'textarea-field',
221+
component: 'textarea',
222222
default: 'lorem ipsum',
223223
validate: []
224224
},
@@ -227,7 +227,7 @@ export const arraySchemaResult = {
227227
dataType: 'boolean',
228228
label: 'a boolean value',
229229
validate: [],
230-
component: 'select-field',
230+
component: 'select',
231231
options: [
232232
{
233233
disabled: true,
@@ -473,7 +473,7 @@ export const numbersSchemaResult = {
473473
label: 'Number enum',
474474
title: 'Number enum',
475475
autoFocus: false,
476-
component: 'select-field',
476+
component: 'select',
477477
type: 'number',
478478
options: [
479479
{
@@ -643,7 +643,7 @@ export const widgetsExpectedResult = {
643643
initialKey: 'select',
644644
title: 'select box',
645645
label: 'select box',
646-
component: 'select-field',
646+
component: 'select',
647647
type: 'boolean',
648648
dataType: 'boolean',
649649
description: 'This is the select-description',
@@ -690,7 +690,7 @@ export const widgetsExpectedResult = {
690690
rows: 5,
691691
type: 'string',
692692
dataType: 'string',
693-
component: 'textarea-field',
693+
component: 'textarea',
694694
title: 'textarea',
695695
label: 'textarea'
696696
},
@@ -757,7 +757,7 @@ export const widgetsExpectedResult = {
757757
name: 'selectWidgetOptions',
758758
type: 'string',
759759
dataType: 'string',
760-
component: 'select-field',
760+
component: 'select',
761761
title: 'Custom select widget with options',
762762
label: 'Custom select widget with options',
763763
options: [

packages/parsers/src/tests/mozilla/mozilla-schema-parser.test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ describe('Mozilla json schema parser', () => {
107107
const expectedSchema = expect.objectContaining({
108108
fields: expect.arrayContaining([
109109
expect.objectContaining({
110-
component: 'select-field',
110+
component: 'select',
111111
dataType: 'string',
112112
name: 'authentication',
113113
options: [
@@ -164,7 +164,7 @@ describe('Mozilla json schema parser', () => {
164164
expect.arrayContaining([
165165
expect.objectContaining({
166166
name: 'authentication',
167-
component: 'select-field',
167+
component: 'select',
168168
type: 'text',
169169
options: [
170170
{

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

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ const output = {
3535
]
3636
},
3737
{
38-
component: 'select-field',
39-
name: 'select-field-1',
38+
component: 'select',
39+
name: 'select-1',
4040
label: 'Dropdown 1',
4141
visible: true,
4242
dataType: 'number',
@@ -223,7 +223,7 @@ const output = {
223223
name: 'textarea_box_1',
224224
label: 'Text Area',
225225
title: 'Text Area',
226-
component: components.TEXTAREA_FIELD
226+
component: components.TEXTAREA
227227
}
228228
],
229229
component: components.SUB_FORM
@@ -356,7 +356,7 @@ const output = {
356356
label: 'Dropdown',
357357
title: 'Dropdown',
358358
dataType: 'string',
359-
component: components.SELECT_COMPONENT,
359+
component: components.SELECT,
360360
initialValue: ['1'],
361361
isSearchable: true,
362362
options: [
@@ -383,7 +383,7 @@ const output = {
383383
label: 'Dropdown default value',
384384
title: 'Dropdown default value',
385385
dataType: 'string',
386-
component: components.SELECT_COMPONENT,
386+
component: components.SELECT,
387387
options: [
388388
{
389389
label: '<None>',
@@ -408,7 +408,7 @@ const output = {
408408
label: 'Dropdown multiselect',
409409
title: 'Dropdown multiselect',
410410
dataType: 'string',
411-
component: components.SELECT_COMPONENT,
411+
component: components.SELECT,
412412
multi: true,
413413
options: [
414414
{
@@ -434,7 +434,7 @@ const output = {
434434
label: 'Dropdown sort by value',
435435
title: 'Dropdown sort by value',
436436
dataType: 'string',
437-
component: components.SELECT_COMPONENT,
437+
component: components.SELECT,
438438
options: [
439439
{
440440
label: '<None>',
@@ -458,7 +458,7 @@ const output = {
458458
name: 'select_clear',
459459
label: 'Clearable dropdown',
460460
title: 'Clearable dropdown',
461-
component: components.SELECT_COMPONENT,
461+
component: components.SELECT,
462462
multi: true,
463463
isClearable: true,
464464
options: [
@@ -576,7 +576,7 @@ const output = {
576576
name: 'textarea_box_2',
577577
label: 'Text Area',
578578
title: 'Text Area',
579-
component: components.TEXTAREA_FIELD
579+
component: components.TEXTAREA
580580
},
581581
{
582582
name: 'check_box_3',
@@ -595,7 +595,7 @@ const output = {
595595
label: 'Dropdown',
596596
title: 'Dropdown',
597597
dataType: 'string',
598-
component: components.SELECT_COMPONENT,
598+
component: components.SELECT,
599599
options: [
600600
{
601601
label: '<None>',

packages/pf3-component-mapper/demo/demo-schemas/wizard-schema.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,13 @@ const wizardSchema = {
2222
},
2323
fields: [
2424
{
25-
component: componentTypes.TEXTAREA_FIELD,
25+
component: componentTypes.TEXTAREA,
2626
name: 'source-name',
2727
type: 'text',
2828
label: 'Source name'
2929
},
3030
{
31-
component: componentTypes.SELECT_COMPONENT,
31+
component: componentTypes.SELECT,
3232
name: 'source-type',
3333
label: 'Source type',
3434
isRequired: true,

0 commit comments

Comments
 (0)