-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Julien Veyssier <[email protected]>
- Loading branch information
Showing
9 changed files
with
365 additions
and
173 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 |
---|---|---|
|
@@ -28,9 +28,7 @@ export default { | |
}, | ||
}, | ||
emits: [ | ||
'delete', | ||
], | ||
emits: [], | ||
data() { | ||
return { | ||
|
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 |
---|---|---|
|
@@ -40,9 +40,7 @@ export default { | |
}, | ||
}, | ||
emits: [ | ||
'delete', | ||
], | ||
emits: [], | ||
data() { | ||
return { | ||
|
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 |
---|---|---|
|
@@ -37,9 +37,7 @@ export default { | |
}, | ||
}, | ||
emits: [ | ||
'delete', | ||
], | ||
emits: [], | ||
data() { | ||
return { | ||
|
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,121 @@ | ||
<template> | ||
<div class="text-list-field"> | ||
<h3 :title="field.description"> | ||
{{ field.name }} | ||
</h3> | ||
<div v-for="(v, i) in arrayValue" | ||
:key="fieldKey + '-' + i" | ||
class="text-list--item"> | ||
<TextInput | ||
class="text-input" | ||
:value="v ?? ''" | ||
:is-output="isOutput" | ||
:label="field.name" | ||
:placeholder="field.description" | ||
:title="field.description" | ||
@update:value="onItemValueChanged(i, $event)" /> | ||
<NcButton v-if="!isOutput" | ||
class="delete-button" | ||
type="secondary" | ||
@click="onDeleteItem(i)"> | ||
<template #icon> | ||
<DeleteIcon /> | ||
</template> | ||
</NcButton> | ||
</div> | ||
<NcButton v-if="!isOutput" | ||
class="more-button" | ||
type="secondary" | ||
@click="onAddItem"> | ||
<template #icon> | ||
<PlusIcon /> | ||
</template> | ||
</NcButton> | ||
</div> | ||
</template> | ||
<script> | ||
import PlusIcon from 'vue-material-design-icons/Plus.vue' | ||
import DeleteIcon from 'vue-material-design-icons/Delete.vue' | ||
import NcButton from '@nextcloud/vue/dist/Components/NcButton.js' | ||
import TextInput from './TextInput.vue' | ||
export default { | ||
name: 'ListOfTextsField', | ||
components: { | ||
TextInput, | ||
NcButton, | ||
PlusIcon, | ||
DeleteIcon, | ||
}, | ||
props: { | ||
fieldKey: { | ||
type: String, | ||
required: true, | ||
}, | ||
value: { | ||
type: [Array, null], | ||
default: null, | ||
}, | ||
field: { | ||
type: Object, | ||
required: true, | ||
}, | ||
isOutput: { | ||
type: Boolean, | ||
default: false, | ||
}, | ||
}, | ||
emits: [ | ||
'update:value', | ||
], | ||
data() { | ||
return { | ||
} | ||
}, | ||
computed: { | ||
arrayValue() { | ||
return this.value ?? [] | ||
}, | ||
}, | ||
watch: { | ||
}, | ||
mounted() { | ||
}, | ||
methods: { | ||
onItemValueChanged(i, itemValue) { | ||
const newValue = this.arrayValue.slice() | ||
newValue[i] = itemValue | ||
this.$emit('update:value', newValue) | ||
console.debug('onvaluechanggeeee', i, itemValue, newValue) | ||
}, | ||
onDeleteItem(i) { | ||
if (this.arrayValue.length === 1 && i === 0) { | ||
this.$emit('update:value', []) | ||
return | ||
} | ||
const newValue = this.arrayValue.slice().splice(i - 1, 1) | ||
this.$emit('update:value', newValue) | ||
console.debug('delete', i) | ||
}, | ||
onAddItem() { | ||
const newValue = [...this.arrayValue, ''] | ||
this.$emit('update:value', newValue) | ||
}, | ||
}, | ||
} | ||
</script> | ||
<style lang="scss"> | ||
// nothing yet | ||
</style> |
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.