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

Commit ba36fd9

Browse files
authored
Merge pull request #139 from alvarosaburido/feature/color-input
feat(input): added color picker input
2 parents dd831ca + c2f431a commit ba36fd9

File tree

5 files changed

+18
-1
lines changed

5 files changed

+18
-1
lines changed

dev/typescript/App.vue

+6
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ import {
5858
InputBase,
5959
email,
6060
pattern,
61+
ColorInput,
6162
} from '../../src';
6263
6364
export default defineComponent({
@@ -142,6 +143,11 @@ export default defineComponent({
142143
label: 'Custom Field',
143144
name: 'customField1',
144145
}),
146+
new ColorInput({
147+
label: 'Color',
148+
name: 'color',
149+
value: '#4DBA87',
150+
}),
145151
],
146152
});
147153
function handleSubmit(values) {

dev/typescript/main.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ import App from './App.vue';
44
import './styles/main.scss';
55

66
import { createDynamicForms } from '../../src';
7-
//import { createDynamicForms } from '../../dist/as-dynamic-forms.esm';
7+
8+
// import { createDynamicForms } from '../../dist/as-dynamic-forms.esm';
89

910
const VueDynamicForms = createDynamicForms({
1011
autoValidate: true,

dev/vue/App.vue

+5
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ import {
3737
email,
3838
pattern,
3939
TextAreaInput,
40+
ColorInput,
4041
} from '../../src';
4142
4243
export default defineComponent({
@@ -89,6 +90,10 @@ export default defineComponent({
8990
cols: 20,
9091
rows: 5,
9192
}),
93+
new ColorInput({
94+
label: 'Color',
95+
value: '#4DBA87',
96+
}),
9297
],
9398
});
9499
function handleSubmit(values) {

src/components/dynamic-input/DynamicInput.vue

+1
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@ export default defineComponent({
135135
case 'email':
136136
case 'password':
137137
case 'url':
138+
case 'color':
138139
component = h(TextInput, attributes.value);
139140
break;
140141
case 'select':

src/core/models.ts

+4
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,10 @@ export class RadioInput extends InputBase<boolean> {
9191
type = 'radio';
9292
}
9393

94+
export class ColorInput extends InputBase<string> {
95+
type = 'color';
96+
}
97+
9498
export class FormControl<T> extends InputBase<T> {
9599
valid = true;
96100
invalid = false;

0 commit comments

Comments
 (0)