@@ -165,13 +142,14 @@
import AceEditor from 'vue2-ace-editor'
import 'brace/mode/elixir'
import 'default-passive-events'
-import { AutoLinkerInput, MascotsInput } from './inputComponents'
+import { AutoLinkerInput, EditableKeyword, MascotsInput } from './inputComponents'
export default {
name: 'Inputs',
components: {
editor: AceEditor,
AutoLinkerInput,
+ EditableKeyword,
MascotsInput
},
props: {
@@ -183,7 +161,7 @@ export default {
required: false
},
data: {
- type: Object || Array,
+ type: [Object, Array],
default: function() {
return {}
}
@@ -287,43 +265,12 @@ export default {
methods: {
addIconToIcons() {},
addValueToIcons() {},
- addRowToEditableKeyword() {
- const updatedValue = this.editableKeywordData(this.data).reduce((acc, el, i) => {
- return { ...acc, [el[0]]: el[1] }
- }, {})
- this.updateSetting({ ...updatedValue, '': [] }, this.settingGroup.group, this.settingGroup.key, this.setting.key)
- },
- deleteEditableKeywordRow(index) {
- const filteredValues = this.editableKeywordData(this.data).filter((el, i) => index !== i)
- const updatedValue = filteredValues.reduce((acc, el, i) => {
- return { ...acc, [el[0]]: el[1] }
- }, {})
- this.updateSetting(updatedValue, this.settingGroup.group, this.settingGroup.key, this.setting.key)
- },
deleteIcondRow(index) {},
- editableKeywordWithInput(key) {
- return key === ':replace'
- },
- editableKeywordWithInteger(type) {
- return Array.isArray(type)
- ? type.includes('keyword') && type.includes('integer')
- : false
- },
- editableKeywordWithSelect(type) {
- return type === 'map' ||
- (Array.isArray(type) && type.includes('keyword') && type.findIndex(el => el.includes('list') && el.includes('string')) !== -1)
- },
- editableKeywordData(data) {
- return Object.keys(data).map(key => [key, data[key]])
- },
- parseEditableKeyword(value, inputType, index) {
- const updatedValue = this.editableKeywordData(this.data).reduce((acc, el, i) => {
- if (index === i) {
- return inputType === 'key' ? { ...acc, [value]: el[1] } : { ...acc, [el[0]]: value }
- }
- return { ...acc, [el[0]]: el[1] }
- }, {})
- this.updateSetting(updatedValue, this.settingGroup.group, this.settingGroup.key, this.setting.key)
+ editableKeyword(key, type) {
+ return key === ':replace' ||
+ (Array.isArray(type) && type.includes('keyword') && type.includes('integer')) ||
+ type === 'map' ||
+ (Array.isArray(type) && type.includes('keyword') && type.findIndex(el => el.includes('list') && el.includes('string')) !== -1)
},
parseIcons(value, inputType, index) {},
parseRateLimiter(value, input, typeOfInput, typeOfLimit, currentValue) {
diff --git a/src/views/settings/components/inputComponents/EditableKeyword.vue b/src/views/settings/components/inputComponents/EditableKeyword.vue
new file mode 100644
index 00000000..f1f106cd
--- /dev/null
+++ b/src/views/settings/components/inputComponents/EditableKeyword.vue
@@ -0,0 +1,109 @@
+
+
+
+
+
+
+
diff --git a/src/views/settings/components/inputComponents/index.js b/src/views/settings/components/inputComponents/index.js
index eb2d7b83..922dea1b 100644
--- a/src/views/settings/components/inputComponents/index.js
+++ b/src/views/settings/components/inputComponents/index.js
@@ -1,2 +1,3 @@
export { default as AutoLinkerInput } from './AutoLinkerInput'
export { default as MascotsInput } from './MascotsInput'
+export { default as EditableKeyword } from './EditableKeyword'