@@ -17,12 +17,20 @@
|
|||||||
</button>
|
</button>
|
||||||
<div>
|
<div>
|
||||||
<button
|
<button
|
||||||
v-if="doc"
|
v-if="doc && !selected"
|
||||||
class="icon"
|
class="icon"
|
||||||
@click="$emit('select-collection')"
|
@click="$emit('select-collection')"
|
||||||
v-tooltip.left="$t('import')"
|
v-tooltip.left="$t('import')"
|
||||||
>
|
>
|
||||||
<i class="material-icons">topic</i>
|
<i class="material-icons">check_box_outline_blank</i>
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
v-if="doc && selected"
|
||||||
|
class="icon"
|
||||||
|
@click="$emit('unselect-collection')"
|
||||||
|
v-tooltip.left="$t('delete')"
|
||||||
|
>
|
||||||
|
<i class="material-icons">check_box</i>
|
||||||
</button>
|
</button>
|
||||||
<v-popover>
|
<v-popover>
|
||||||
<button class="tooltip-target icon" v-tooltip.left="$t('more')">
|
<button class="tooltip-target icon" v-tooltip.left="$t('more')">
|
||||||
@@ -122,6 +130,7 @@ export default {
|
|||||||
collection: Object,
|
collection: Object,
|
||||||
doc: Boolean,
|
doc: Boolean,
|
||||||
isFiltered: Boolean,
|
isFiltered: Boolean,
|
||||||
|
selected: Boolean,
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
|||||||
@@ -64,11 +64,13 @@
|
|||||||
:collection="collection"
|
:collection="collection"
|
||||||
:doc="doc"
|
:doc="doc"
|
||||||
:isFiltered="filterText.length > 0"
|
:isFiltered="filterText.length > 0"
|
||||||
|
:selected="selected.some((coll) => coll == collection)"
|
||||||
@edit-collection="editCollection(collection, index)"
|
@edit-collection="editCollection(collection, index)"
|
||||||
@add-folder="addFolder($event)"
|
@add-folder="addFolder($event)"
|
||||||
@edit-folder="editFolder($event)"
|
@edit-folder="editFolder($event)"
|
||||||
@edit-request="editRequest($event)"
|
@edit-request="editRequest($event)"
|
||||||
@select-collection="$emit('use-collection', collection)"
|
@select-collection="$emit('use-collection', collection)"
|
||||||
|
@unselect-collection="$emit('remove-collection', collection)"
|
||||||
/>
|
/>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
@@ -92,6 +94,7 @@ import { getSettingSubject } from "~/newstore/settings"
|
|||||||
export default {
|
export default {
|
||||||
props: {
|
props: {
|
||||||
doc: Boolean,
|
doc: Boolean,
|
||||||
|
selected: { type: Array, default: () => [] },
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
|||||||
@@ -85,7 +85,12 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<aside class="sticky-inner inner-right lg:max-w-md">
|
<aside class="sticky-inner inner-right lg:max-w-md">
|
||||||
<Collections @use-collection="useSelectedCollection($event)" :doc="true" />
|
<Collections
|
||||||
|
:selected="selected"
|
||||||
|
@use-collection="useSelectedCollection($event)"
|
||||||
|
@remove-collection="removeSelectedCollection($event)"
|
||||||
|
:doc="true"
|
||||||
|
/>
|
||||||
</aside>
|
</aside>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -103,6 +108,7 @@ export default {
|
|||||||
collectionJSON: "[]",
|
collectionJSON: "[]",
|
||||||
items: [],
|
items: [],
|
||||||
docsMarkdown: "",
|
docsMarkdown: "",
|
||||||
|
selected: [],
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
@@ -191,7 +197,17 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
useSelectedCollection(collection) {
|
useSelectedCollection(collection) {
|
||||||
let importCollection = `[${JSON.stringify(collection, null, 2)}]`
|
if (this.selected.find((coll) => coll == collection)) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
this.selected.push(collection)
|
||||||
|
let importCollection = JSON.stringify(this.selected, null, 2)
|
||||||
|
this.collectionJSON = JSON.stringify(JSON.parse(importCollection), null, 2)
|
||||||
|
},
|
||||||
|
|
||||||
|
removeSelectedCollection(collection) {
|
||||||
|
this.selected = this.selected.filter((coll) => coll != collection)
|
||||||
|
let importCollection = JSON.stringify(this.selected, null, 2)
|
||||||
this.collectionJSON = JSON.stringify(JSON.parse(importCollection), null, 2)
|
this.collectionJSON = JSON.stringify(JSON.parse(importCollection), null, 2)
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user