diff --git a/client/src/data/user.settings.default.json b/client/src/data/user.settings.default.json index 0698f71f..5f1bc19d 100644 --- a/client/src/data/user.settings.default.json +++ b/client/src/data/user.settings.default.json @@ -175,9 +175,6 @@ "type": ["kvp"], "value": [ { - "id": "kvp0", - "type": "kvp", - "text": "", "value": { "key": "kvpKey", "value": "kvpValue" diff --git a/client/src/structs/settings/types/collection.js b/client/src/structs/settings/types/collection.js index 011a1eb1..6abc3e2e 100644 --- a/client/src/structs/settings/types/collection.js +++ b/client/src/structs/settings/types/collection.js @@ -8,16 +8,24 @@ * LICENSE file in the root directory of this source tree. */ -import BaseSetting from './basesetting'; import Setting from '../setting'; +import Base from './basesetting'; +import SettingsSet from '../settingsset'; +import SettingsCategory from '../settingscategory'; +import SettingsScheme from '../settingsscheme'; -export default class CollectionSetting extends BaseSetting { +export default class CollectionSetting extends Base { - constructor(args) { - super(args); + constructor(args, ...merge) { + super(args, ...merge); this.subtype = args.type[0]; - args.type = 'collection'; - this.sub = new Setting({ type: this.subtype }); + this.args.type = 'collection'; + this.items = this.value.map(item => this.create(item)); + } + + create(item) { + item.type = this.subtype; + return new Setting(item); } /** diff --git a/client/src/styles/partials/bdsettings/collection.scss b/client/src/styles/partials/bdsettings/collection.scss new file mode 100644 index 00000000..81ade0b9 --- /dev/null +++ b/client/src/styles/partials/bdsettings/collection.scss @@ -0,0 +1,53 @@ +.bd-formCollection { + display: flex; + flex-direction: column; + + div:first-child { + flex: 1 1 auto; + } + + .bd-collectionItem { + display: flex; + flex-grow: 1; + margin-top: 5px; + + .bd-removeCollectionItem { + width: 20px; + flex: 0 1 auto; + display: flex; + justify-content: center; + align-items: center; + cursor: pointer; + + &:hover { + svg { + fill: #FFF; + } + } + + svg { + width: 16px; + height: 16px; + fill: #ccc; + } + } + } + + .bd-newCollectionItem { + font-weight: 500; + color: #ccc; + font-size: 26px; + width: 20px; + height: 20px; + margin-top: 5px; + text-align: center; + display: flex; + justify-content: center; + align-items: center; + cursor: pointer; + + &:hover { + color: #FFF; + } + } +} diff --git a/client/src/styles/partials/bdsettings/index.scss b/client/src/styles/partials/bdsettings/index.scss index 56081af4..fbadb580 100644 --- a/client/src/styles/partials/bdsettings/index.scss +++ b/client/src/styles/partials/bdsettings/index.scss @@ -8,3 +8,4 @@ @import './updater.scss'; @import './window-preferences'; @import './kvp'; +@import './collection'; diff --git a/client/src/ui/components/bd/setting/Collection.vue b/client/src/ui/components/bd/setting/Collection.vue index 0a61edf2..c5755140 100644 --- a/client/src/ui/components/bd/setting/Collection.vue +++ b/client/src/ui/components/bd/setting/Collection.vue @@ -10,19 +10,33 @@ diff --git a/client/src/ui/components/bd/setting/KeyValuePair.vue b/client/src/ui/components/bd/setting/KeyValuePair.vue index b0e2cade..67806e98 100644 --- a/client/src/ui/components/bd/setting/KeyValuePair.vue +++ b/client/src/ui/components/bd/setting/KeyValuePair.vue @@ -26,10 +26,10 @@ props: ['setting'], methods: { keyChange(e) { - this.setting.value.key = e.target.value; + this.setting.value = { key: e.target.value, value: this.setting.value.value } }, valueChange(e) { - this.setting.value.value = e.target.value; + this.setting.value = { key: this.setting.value.key, value: e.target.value } } } }