Skip to content
This repository has been archived by the owner on Jun 27, 2023. It is now read-only.

Commit

Permalink
Merge pull request #139 from alvarosaburido/feature/color-input
Browse files Browse the repository at this point in the history
feat(input): added color picker input
  • Loading branch information
alvarosabu authored Sep 29, 2020
2 parents dd831ca + c2f431a commit ba36fd9
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 1 deletion.
6 changes: 6 additions & 0 deletions dev/typescript/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ import {
InputBase,
email,
pattern,
ColorInput,
} from '../../src';
export default defineComponent({
Expand Down Expand Up @@ -142,6 +143,11 @@ export default defineComponent({
label: 'Custom Field',
name: 'customField1',
}),
new ColorInput({
label: 'Color',
name: 'color',
value: '#4DBA87',
}),
],
});
function handleSubmit(values) {
Expand Down
3 changes: 2 additions & 1 deletion dev/typescript/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ import App from './App.vue';
import './styles/main.scss';

import { createDynamicForms } from '../../src';
//import { createDynamicForms } from '../../dist/as-dynamic-forms.esm';

// import { createDynamicForms } from '../../dist/as-dynamic-forms.esm';

const VueDynamicForms = createDynamicForms({
autoValidate: true,
Expand Down
5 changes: 5 additions & 0 deletions dev/vue/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ import {
email,
pattern,
TextAreaInput,
ColorInput,
} from '../../src';
export default defineComponent({
Expand Down Expand Up @@ -89,6 +90,10 @@ export default defineComponent({
cols: 20,
rows: 5,
}),
new ColorInput({
label: 'Color',
value: '#4DBA87',
}),
],
});
function handleSubmit(values) {
Expand Down
1 change: 1 addition & 0 deletions src/components/dynamic-input/DynamicInput.vue
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ export default defineComponent({
case 'email':
case 'password':
case 'url':
case 'color':
component = h(TextInput, attributes.value);
break;
case 'select':
Expand Down
4 changes: 4 additions & 0 deletions src/core/models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,10 @@ export class RadioInput extends InputBase<boolean> {
type = 'radio';
}

export class ColorInput extends InputBase<string> {
type = 'color';
}

export class FormControl<T> extends InputBase<T> {
valid = true;
invalid = false;
Expand Down

0 comments on commit ba36fd9

Please sign in to comment.