Skip to content

Commit 3747339

Browse files
committed
refactor: change form components names.
1 parent 08729d6 commit 3747339

22 files changed

+70
-70
lines changed

src/components/Form/CFormRadio.vue

Lines changed: 0 additions & 9 deletions
This file was deleted.

src/components/Form/CFormInput.vue renamed to src/components/Form/CInput.vue

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,12 @@
3737

3838
<script>
3939
import CFormGroup from './CFormGroup'
40-
import { formInputProps as props } from './formProps'
41-
40+
import { inputProps as props } from './formProps'
4241
import * as allFormMixins from './formMixins'
4342
const mixins = Object.values(allFormMixins)
4443
4544
export default {
46-
name: 'CFormInput',
45+
name: 'CInput',
4746
inheritAttrs: false,
4847
components: { CFormGroup },
4948
mixins,

src/components/Form/CFormCheckbox.vue renamed to src/components/Form/CInputCheckbox.vue

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,11 @@
3535

3636
<script>
3737
import { safeId, validationComputedProps } from './formMixins'
38-
import { formCheckboxProps as props } from './formProps'
38+
import { inputCheckboxProps as props } from './formProps'
3939
import CFormGroup from './CFormGroup'
40+
4041
export default {
41-
name: 'CFormCheckbox',
42+
name: 'CInputCheckbox',
4243
inheritAttrs: false,
4344
components: { CFormGroup },
4445
mixins: [safeId, validationComputedProps],

src/components/Form/CFormFile.vue renamed to src/components/Form/CInputFile.vue

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,11 @@
4444
<script>
4545
import * as allFormMixins from './formMixins'
4646
const mixins = Object.values(allFormMixins).filter((i, key) => key !== 'watchValue')
47-
import { formFileProps as props } from './formProps'
47+
import { inputFileProps as props } from './formProps'
4848
import CFormGroup from './CFormGroup'
49+
4950
export default {
50-
name: 'CFormFile',
51+
name: 'CInputFile',
5152
inheritAttrs: false,
5253
components: { CFormGroup },
5354
mixins,

src/components/Form/CInputRadio.vue

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<script>
2+
import CInputCheckbox from './CInputCheckbox'
3+
4+
export default {
5+
name: 'CInputRadio',
6+
extends: CInputCheckbox,
7+
type: 'radio'
8+
}
9+
</script>

src/components/Form/CFormSelect.vue renamed to src/components/Form/CSelect.vue

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,11 @@
5757
<script>
5858
import * as allFormMixins from './formMixins'
5959
const mixins = Object.values(allFormMixins)
60-
import { formSelectProps as props } from './formProps'
60+
import { selectProps as props } from './formProps'
6161
import CFormGroup from './CFormGroup'
62+
6263
export default {
63-
name: 'CFormSelect',
64+
name: 'CSelect',
6465
inheritAttrs: false,
6566
components: { CFormGroup },
6667
slots: [

src/components/Form/CFormTextarea.vue renamed to src/components/Form/CTextarea.vue

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,12 @@
3535

3636
<script>
3737
import CFormGroup from './CFormGroup'
38-
import { formTextareaProps as props} from './formProps'
39-
38+
import { textareaProps as props} from './formProps'
4039
import * as allFormMixins from './formMixins'
4140
const mixins = Object.values(allFormMixins)
4241
4342
export default {
44-
name: 'CFormTextarea',
43+
name: 'CTextarea',
4544
inheritAttrs: false,
4645
components: { CFormGroup },
4746
mixins,

src/components/Form/formProps.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,20 +43,20 @@ const textInputsProps = {
4343
}
4444

4545
// Html props: disabled, required, accept, id, placeholder
46-
export const formFileProps = Object.assign(
46+
export const inputFileProps = Object.assign(
4747
{}, formGroupAlwaysSharedProps, props, {
4848
custom: Boolean,
4949
placeholder: String,
5050
multiple: Boolean
5151
})
5252

5353
// Html props: disabled, required, rows, cols, placeholder, id
54-
export const formTextareaProps = Object.assign(
54+
export const textareaProps = Object.assign(
5555
{}, formGroupSharedProps, props, textInputsProps
5656
)
5757

5858
// HTML props: disabled, required, placeholder, id
59-
export const formInputProps = Object.assign(
59+
export const inputProps = Object.assign(
6060
{}, formGroupSharedProps, props, textInputsProps, {
6161
type: {
6262
type: String,
@@ -65,7 +65,7 @@ export const formInputProps = Object.assign(
6565
})
6666

6767
// Html props: disabled, id required don't use multiple
68-
export const formSelectProps = Object.assign(
68+
export const selectProps = Object.assign(
6969
{}, formGroupSharedProps, props, {
7070
options: Array,
7171
value: [String, Number, Boolean, Array],
@@ -75,7 +75,7 @@ export const formSelectProps = Object.assign(
7575
})
7676

7777
// Html props: id, disabled, required
78-
export const formCheckboxProps = Object.assign(
78+
export const inputCheckboxProps = Object.assign(
7979
{}, formGroupAlwaysSharedProps, universalProps, {
8080
checked: Boolean,
8181
value: {

src/components/Form/index.js

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
import CForm from './CForm'
2-
import CFormInput from './CFormInput'
3-
import CFormCheckbox from './CFormCheckbox'
4-
import CFormFile from './CFormFile'
5-
import CFormTextarea from './CFormTextarea'
6-
import CFormSelect from './CFormSelect'
7-
import CFormRadio from './CFormRadio'
82
import CFormGroup from './CFormGroup'
3+
import CInput from './CInput'
4+
import CInputCheckbox from './CInputCheckbox'
5+
import CInputFile from './CInputFile'
6+
import CInputRadio from './CInputRadio'
7+
import CSelect from './CSelect'
8+
import CTextarea from './CTextarea'
99

1010
export {
1111
CForm,
12-
CFormInput,
13-
CFormCheckbox,
14-
CFormFile,
15-
CFormTextarea,
16-
CFormSelect,
17-
CFormRadio,
18-
CFormGroup
12+
CFormGroup,
13+
CInput,
14+
CInputCheckbox,
15+
CInputFile,
16+
CInputRadio,
17+
CSelect,
18+
CTextarea
1919
}

src/components/Form/tests/CFormInput.spec.js renamed to src/components/Form/tests/CInput.spec.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { mount } from '@vue/test-utils'
2-
import Component from '../CFormInput'
2+
import Component from '../CInput'
33

4-
const ComponentName = 'CFormInput'
4+
const ComponentName = 'CInput'
55
const wrapper = mount(Component, {
66
propsData: {
77
id: 'some_id',

0 commit comments

Comments
 (0)