This repository has been archived by the owner on Jul 14, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ref #24
- Loading branch information
Showing
10 changed files
with
285 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
import { fieldable, validatable } from '@mixins'; | ||
import { validator } from '@validators'; | ||
import { isNil } from 'lodash'; | ||
import Element from '../Element'; | ||
|
||
const getPropRequired = (config) => { | ||
if (config.validation) { | ||
return !!config.validation.required; | ||
} | ||
|
||
return false; | ||
}; | ||
|
||
const getProps = (context) => { | ||
const config = context.config; | ||
|
||
const props = { | ||
label: config.label, | ||
autoGrow: config.autoGrow, | ||
outline: config.outline, | ||
rowHeight: config.rowHeight, | ||
rows: config.rows, | ||
color: config.color, | ||
dark: context.isThemeDark, | ||
light: context.isThemeLight, | ||
prependIcon: config.prependIcon, | ||
appendIcon: config.appendIcon, | ||
tooltip: config.tooltip, | ||
clearable: config.clearable, | ||
disabled: config.disabled, | ||
required: getPropRequired(config), | ||
rules: validator.getRules(config, context.validators), | ||
value: context.value, | ||
}; | ||
|
||
return props; | ||
}; | ||
|
||
export default { | ||
extends: Element, | ||
mixins: [ | ||
fieldable, | ||
validatable, | ||
], | ||
render(createElement) { | ||
const self = this; | ||
const data = { | ||
attrs: { | ||
name: self.config.name, | ||
title: self.config.tooltip, | ||
}, | ||
props: getProps(self), | ||
on: { | ||
focus() { | ||
self.sendToEventBus('FocusedIn', { text: self.value }); | ||
}, | ||
input(value) { | ||
self.value = value; | ||
if (isNil(value)) { | ||
self.sendToEventBus('Cleared', { text: value }); | ||
} | ||
self.sendToEventBus('Changed', { text: value }); | ||
self.$emit('input', self.value); | ||
}, | ||
blur() { | ||
self.sendToEventBus('FocusedOut', { text: self.value }); | ||
}, | ||
}, | ||
}; | ||
|
||
const children = [ | ||
createElement( | ||
'v-textarea', | ||
data, | ||
), | ||
]; | ||
|
||
return self.renderElement('div', {}, children); | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import TextArea from './CTextArea'; | ||
|
||
export default { | ||
install(Vue, options) { | ||
const name = `${options.namespace}text-area`; | ||
|
||
Vue.component(name, { | ||
extends: TextArea, | ||
namespace: options.namespace, | ||
name, | ||
}); | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,119 @@ | ||
export default { | ||
group: 'inputs', | ||
type: 'text', | ||
name: 'Text Box', | ||
icon: 'title', | ||
optionGroups: { | ||
validation: { | ||
key: 'validation', | ||
name: 'Validation', | ||
}, | ||
}, | ||
actions: [ | ||
{ | ||
name: 'setInputValue', | ||
help: 'Input field updated', | ||
}, | ||
{ | ||
name: 'setItemDisabledValue', | ||
help: 'Input field disabled value', | ||
}, | ||
], | ||
events: [ | ||
{ | ||
name: 'Changed', | ||
help: 'Input changed', | ||
}, | ||
{ | ||
name: 'Cleared', | ||
help: 'Input cleared / reset', | ||
}, | ||
{ | ||
name: 'FocusedIn', | ||
help: 'Input focused', | ||
}, | ||
{ | ||
name: 'FocusedOut', | ||
help: 'Input focused out / blurred', | ||
}, | ||
], | ||
options: { | ||
color: true, | ||
name: { | ||
type: 'input', | ||
name: 'Input Name', | ||
value: null, | ||
priority: 1, | ||
}, | ||
label: { | ||
type: 'input', | ||
name: 'TextBox Label', | ||
value: 'Text Field', | ||
priority: 2, | ||
}, | ||
prependIcon: { | ||
type: 'input', | ||
name: 'Prepend Icon', | ||
value: null, | ||
priority: 3, | ||
}, | ||
appendIcon: { | ||
type: 'input', | ||
name: 'Append Icon', | ||
value: null, | ||
priority: 4, | ||
}, | ||
autoGrow: { | ||
type: 'check', | ||
name: 'Auto Grow', | ||
value: false, | ||
priority: 5, | ||
}, | ||
placeholder: { | ||
type: 'input', | ||
name: 'Placeholder Text', | ||
value: false, | ||
priority: 6, | ||
}, | ||
outline: { | ||
type: 'check', | ||
name: 'Outline', | ||
value: false, | ||
priority: 7, | ||
}, | ||
rowHeight: { | ||
type: 'input', | ||
name: 'Row Height', | ||
value: 5, | ||
priority: 8, | ||
}, | ||
tooltip: { | ||
type: 'input', | ||
name: 'Tooltip Text', | ||
value: null, | ||
priority: 9, | ||
}, | ||
clearable: { | ||
type: 'check', | ||
name: 'Enable Input Reset', | ||
value: false, | ||
priority: 10, | ||
}, | ||
disabled: { | ||
type: 'check', | ||
name: 'Disable Input', | ||
value: false, | ||
priority: 12, | ||
}, | ||
validation: { | ||
type: 'group', | ||
group: 'validation', | ||
required: { | ||
type: 'check', | ||
name: 'Required', | ||
value: false, | ||
}, | ||
}, | ||
theme: true, | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.