diff --git a/public/index.html b/public/index.html
index 3e5a139..ba0af67 100644
--- a/public/index.html
+++ b/public/index.html
@@ -5,11 +5,11 @@
-
<%= htmlWebpackPlugin.options.title %>
+ Decodapz
diff --git a/src/components/AutoDecoder.vue b/src/components/AutoDecoder.vue
index 01bd9d0..6a8992e 100644
--- a/src/components/AutoDecoder.vue
+++ b/src/components/AutoDecoder.vue
@@ -14,9 +14,9 @@
-
-
-
+
@@ -29,18 +29,6 @@ import TextSetting from './TextSetting.vue'
import DropdownSetting from './DropdownSetting.vue'
import CheckboxSetting from './CheckboxSetting.vue'
-function pick(obj, predicate) {
- if (!obj || typeof obj !== 'object') return obj
-
- const newObj = {}
-
- for (const [name, value] of Object.entries(obj)) {
- if (!predicate(name, value)) continue
- newObj[name] = value
- }
- return newObj
-}
-
export default {
name: 'AutoDecoder',
components: {
@@ -60,13 +48,12 @@ export default {
},
data() {
const encoder = this.getEncoder(this.type)
-
Promise.resolve(encoder.encode(this.value)).then((value) => {
this.encodedValue = value
})
return {
- encoder: encoder,
+ encoder,
encodedValue: '',
hasError: false,
isFocused: false
@@ -90,6 +77,17 @@ export default {
}
},
methods: {
+ pick(obj, predicate) {
+ if (!obj || typeof obj !== 'object') return obj
+
+ const newObj = {}
+
+ for (const [name, value] of Object.entries(obj)) {
+ if (!predicate(name, value)) continue
+ newObj[name] = value
+ }
+ return newObj
+ },
async decode(string) {
return await this.decodeValue(this.type.toLowerCase(), string)
},
@@ -118,13 +116,13 @@ export default {
},
computed: {
stringSettings() {
- return pick(this.encoder.settings, (name, setting) => setting.type === String)
+ return this.encoder.stringSettings
},
booleanSettings() {
- return pick(this.encoder.settings, (name, setting) => setting.type === Boolean)
+ return this.encoder.booleanSettings
},
- complexSettings() {
- return pick(this.encoder.settings, (name, setting) => setting.type === Object)
+ objectSettings() {
+ return this.encoder.objectSettings
}
},
mounted() {
diff --git a/src/components/DropdownSetting.vue b/src/components/DropdownSetting.vue
index aca31b6..9b6cb39 100644
--- a/src/components/DropdownSetting.vue
+++ b/src/components/DropdownSetting.vue
@@ -1,15 +1,39 @@
-
-
@@ -24,19 +100,14 @@ export default {