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

feat(input): added color picker input #139

Merged
merged 2 commits into from
Sep 29, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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