Vue Attract: Sort/filterable table based on Vue
Initial commit implementing sortable and filterable tables for attract using Vue.
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
class RowBase {
|
||||
constructor(underlyingObject) {
|
||||
this.underlyingObject = underlyingObject;
|
||||
this.isInitialized = false;
|
||||
}
|
||||
|
||||
thenInit() {
|
||||
this.isInitialized = true
|
||||
return Promise.resolve();
|
||||
}
|
||||
|
||||
getName() {
|
||||
return this.underlyingObject.name;
|
||||
}
|
||||
|
||||
getId() {
|
||||
return this.underlyingObject._id;
|
||||
}
|
||||
|
||||
getProperties() {
|
||||
return this.underlyingObject.properties;
|
||||
}
|
||||
|
||||
getRowClasses() {
|
||||
return {
|
||||
"is-busy": !this.isInitialized
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export { RowBase }
|
@@ -0,0 +1,13 @@
|
||||
class RowObjectsSourceBase {
|
||||
constructor(projectId) {
|
||||
this.projectId = projectId;
|
||||
this.rowObjects = [];
|
||||
}
|
||||
|
||||
// Override this
|
||||
thenInit() {
|
||||
throw Error('Not implemented');
|
||||
}
|
||||
}
|
||||
|
||||
export { RowObjectsSourceBase }
|
@@ -0,0 +1,18 @@
|
||||
import '../../cells/renderer/HeadCell'
|
||||
const TEMPLATE =`
|
||||
<div class="pillar-table-head">
|
||||
<pillar-head-cell
|
||||
v-for="c in columns"
|
||||
:column="c"
|
||||
key="c._id"
|
||||
@sort="(column, direction) => $emit('sort', column, direction)"
|
||||
/>
|
||||
</div>
|
||||
`;
|
||||
|
||||
Vue.component('pillar-table-head', {
|
||||
template: TEMPLATE,
|
||||
props: {
|
||||
columns: Array
|
||||
}
|
||||
});
|
@@ -0,0 +1,27 @@
|
||||
import '../../cells/renderer/CellProxy'
|
||||
|
||||
const TEMPLATE =`
|
||||
<div class="pillar-table-row"
|
||||
:class="rowClasses"
|
||||
>
|
||||
<pillar-cell-proxy
|
||||
v-for="c in columns"
|
||||
:rowObject="rowObject"
|
||||
:column="c"
|
||||
:key="c._id"
|
||||
/>
|
||||
</div>
|
||||
`;
|
||||
|
||||
Vue.component('pillar-table-row', {
|
||||
template: TEMPLATE,
|
||||
props: {
|
||||
rowObject: Object,
|
||||
columns: Array
|
||||
},
|
||||
computed: {
|
||||
rowClasses() {
|
||||
return this.rowObject.getRowClasses();
|
||||
}
|
||||
}
|
||||
});
|
Reference in New Issue
Block a user