Skip to content

Commit

Permalink
Add draggable lists to create Kanban boards
Browse files Browse the repository at this point in the history
  • Loading branch information
white-gecko committed Aug 23, 2024
1 parent 42612f9 commit 24f167a
Show file tree
Hide file tree
Showing 6 changed files with 173 additions and 0 deletions.
34 changes: 34 additions & 0 deletions .pnp.cjs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
"vue": "^3.4.21",
"vue-diagrams": "^1.0.1",
"vue-router": "^4.3.0",
"vuedraggable": "^4.1.0",
"yaml": "^2.5.0"
},
"devDependencies": {
Expand Down
1 change: 1 addition & 0 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import 'splitpanes/dist/splitpanes.css'
<li class="nav-item"><RouterLink class="nav-link" active-class="active" to="/edit">Edit</RouterLink></li>
<li class="nav-item"><RouterLink class="nav-link" active-class="active" to="/form">Form</RouterLink></li>
<li class="nav-item"><RouterLink class="nav-link" active-class="active" to="/add">Add</RouterLink></li>
<li class="nav-item"><RouterLink class="nav-link" active-class="active" to="/kanban">Kanban</RouterLink></li>
<li class="nav-item"><RouterLink class="nav-link" active-class="active" to="/source">Source</RouterLink></li>

</ul>
Expand Down
5 changes: 5 additions & 0 deletions src/router/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,11 @@ const router = createRouter({
name: 'InputForm',
component: () => import('../views/InputForm.vue')
},
{
path: '/kanban',
name: 'Kanban',
component: () => import('../views/Kanban.vue')
},
{
path: '/source',
name: 'Source',
Expand Down
113 changes: 113 additions & 0 deletions src/views/Kanban.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
<script setup>
import PropertyList from '../components/PropertyList.vue'
</script>

<template>
<div>
<strong>Kanban with property {{ property_iri }}</strong>

<div class="container-fluid">
<div class="row">
<div class="col-auto">
<PropertyList :property_iri="property_iri" :selectProperty="(property) => {property_iri = property}" />
</div>

<div class="col container" v-if="property_iri">
<div class="row">

<div class="col mx-2 px-2 py-3 bg-light border rounded" v-for="(value, name, index) in dataModel">
<h5>{{ name }}</h5>
<draggable class="draggable-list" :list="value" item-key="key" group="prop_kanban">
<template #item="{ element }">
<div class="list-group-item">
<div class="bg-white mt-3 p-2 border rounded">{{element.resource.value}}</div>
</div>
</template>
</draggable>
</div>

</div>
</div>

</div>
</div>
</div>
</template>

<script>
import dedent from 'dedent-js'
import { mapState } from 'pinia'
import { useSelectionStore } from '../stores/selection'
import { useRdfStore } from '../stores/rdf'
import { cloneDeep } from 'lodash';
import draggable from "vuedraggable"
import { quadStreamToString, quadStreamToStore, stringToStore } from '../helpers/rdf-parse'
import { diff_n3 } from '../helpers/n3-compare'
import rdf from '@rdfjs/data-model'
let idGlobal = 8;
export default {
name: 'Kanban',
components: {
draggable,
},
setup () {
const store = useRdfStore();
return { store }
},
mounted () {
},
watch: {
property_iri (value) {
console.log("property_iri changed: " + value);
this.getResource()
}
},
data () {
return {
originalDataModel: {},
dataModel: {},
property_iri: "",
}
},
methods: {
async getResource () {
console.log('get resource')
const result = await useRdfStore().sendQuery(dedent(`
select distinct ?resource ?value {
?resource <${ this.property_iri }> ?value
}
`))
if (result.resultType === 'bindings') {
const bindingsStream = await result.execute()
this.originalDataModel = {}
for await (const bindings of bindingsStream) {
if (this.originalDataModel[bindings.get("value").value] == undefined) {
this.originalDataModel[bindings.get("value").value] = []
console.log(`create array for ${ bindings.get("value").value }`);
}
this.originalDataModel[bindings.get("value").value].push({"resource": bindings.get("resource"), "value": bindings.get("value").value, "key": bindings.get("resource").value})
}
this.dataModel = cloneDeep(this.originalDataModel)
console.log(this.originalDataModel)
console.log(this.dataModel)
}
},
}
}
</script>

<style scoped>
.col {
overflow: auto;
}
.draggable-list {
min-height: 10vh;
}
.draggable-list > div {
cursor: pointer;
}
</style>
19 changes: 19 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -12569,6 +12569,7 @@ __metadata:
vue: "npm:^3.4.21"
vue-diagrams: "npm:^1.0.1"
vue-router: "npm:^4.3.0"
vuedraggable: "npm:^4.1.0"
yaml: "npm:^2.5.0"
languageName: unknown
linkType: soft
Expand Down Expand Up @@ -14059,6 +14060,13 @@ __metadata:
languageName: node
linkType: hard

"sortablejs@npm:1.14.0":
version: 1.14.0
resolution: "sortablejs@npm:1.14.0"
checksum: 10c0/b792790286d54af5ebb083300d0cb3f96f5cf840e85f4953aa2074a69c1671a3d6a73f8d5fcc948b27c0573575ff98ec32346f7dcfe6230d517d7a81ea7ad314
languageName: node
linkType: hard

"source-map-js@npm:^1.2.0":
version: 1.2.0
resolution: "source-map-js@npm:1.2.0"
Expand Down Expand Up @@ -15495,6 +15503,17 @@ __metadata:
languageName: node
linkType: hard

"vuedraggable@npm:^4.1.0":
version: 4.1.0
resolution: "vuedraggable@npm:4.1.0"
dependencies:
sortablejs: "npm:1.14.0"
peerDependencies:
vue: ^3.0.1
checksum: 10c0/e5121ca53081e63f6a3e1dc4c3c02ae86fd6b896ccf37d9a0f88abb993fd9da3a1b54635541854a2a85b65e30dae00e545a2c208708e7df73424bd64c2e59cbc
languageName: node
linkType: hard

"w3c-keyname@npm:^2.2.4":
version: 2.2.8
resolution: "w3c-keyname@npm:2.2.8"
Expand Down

0 comments on commit 24f167a

Please sign in to comment.