-
-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'feature/update-front' into 'develop'
Met à jour les dépendances + Refactoring
- Loading branch information
Showing
130 changed files
with
4,869 additions
and
3,437 deletions.
There are no files selected for viewing
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
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 |
---|---|---|
@@ -1 +1 @@ | ||
VUE_APP_API_URL='http://robert.local' | ||
VUE_APP_API_URL='http://robert2.local' |
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
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 |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// Copyright (c) 2019 Steve Mallon | ||
// @see https://github.com/sjmallon/vue-visjs/blob/v0.4.2/src/utils.js | ||
/* eslint-disable import/prefer-default-export */ | ||
|
||
import { DataSet, DataView } from '@robert2/vis-timeline'; | ||
|
||
const arrayDiff = (arr1, arr2) => arr1.filter((x) => arr2.indexOf(x) === -1); | ||
|
||
export const mountVisData = (vm) => { | ||
if (vm.items instanceof DataSet || vm.items instanceof DataView) { | ||
return vm.items; | ||
} | ||
|
||
// We attach deep watcher on the prop to propagate changes in the DataSet | ||
const callback = (value) => { | ||
if (!Array.isArray(value)) { | ||
return; | ||
} | ||
|
||
const newIds = new DataSet(value).getIds(); | ||
const diff = arrayDiff(vm.data.getIds(), newIds); | ||
vm.data.update(value); | ||
vm.data.remove(diff); | ||
}; | ||
vm.$watch('items', callback, { deep: true }); | ||
|
||
return new DataSet(vm.items); | ||
}; |
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,102 @@ | ||
import '@robert2/vis-timeline/index.scss'; | ||
import moment from 'moment'; | ||
import { Timeline as TimelineCore, DataSet, DataView } from '@robert2/vis-timeline'; | ||
import { mountVisData } from './_utils'; | ||
|
||
const Timeline = { | ||
props: { | ||
items: { | ||
type: [Array, DataSet, DataView], | ||
default: () => [], | ||
}, | ||
options: { | ||
type: Object, | ||
}, | ||
}, | ||
data: () => ({ | ||
data: null, | ||
}), | ||
created() { | ||
// @see https://github.com/almende/vis/issues/2524 | ||
this.timeline = null; | ||
}, | ||
mounted() { | ||
this.data = mountVisData(this); | ||
this.timeline = new TimelineCore( | ||
this.$refs.visualization, | ||
this.data, | ||
this.fullOptions, | ||
); | ||
|
||
// - Binding des événements globaux. | ||
const globalsEvents = { | ||
itemover: 'item-over', | ||
itemout: 'item-out', | ||
rangechanged: 'range-changed', | ||
doubleClick: 'double-click', | ||
}; | ||
Object.entries(globalsEvents).forEach(([originalName, name]) => { | ||
this.timeline.on(originalName, (props) => { this.$emit(name, props); }); | ||
}); | ||
|
||
// - Binding des événements liés aux données. | ||
const dataEvents = { | ||
add: 'item-added', | ||
update: 'item-updated', | ||
remove: 'item-removed', | ||
}; | ||
Object.entries(dataEvents).forEach(([originalName, name]) => { | ||
this.data.on(originalName, (event, properties, senderId) => { | ||
this.$emit(name, { event, properties, senderId }); | ||
}); | ||
}); | ||
}, | ||
computed: { | ||
fullOptions() { | ||
return { | ||
xss: { | ||
filterOptions: { | ||
whiteList: { | ||
i: 'class', | ||
strong: 'class', | ||
em: 'class', | ||
}, | ||
}, | ||
}, | ||
tooltip: { | ||
followMouse: true, | ||
overflowMethod: 'flip', | ||
}, | ||
moment: (date) => moment(date), | ||
...(this.options || {}), | ||
onMove: (item, callback) => { | ||
this.$emit('item-moved', item, callback); | ||
}, | ||
onRemove: (item, callback) => { | ||
this.$emit('item-remove', item, callback); | ||
}, | ||
}; | ||
}, | ||
}, | ||
watch: { | ||
fullOptions: { | ||
deep: true, | ||
handler() { | ||
this.timeline.setOptions(this.fullOptions); | ||
}, | ||
}, | ||
}, | ||
beforeDestroy() { | ||
this.timeline.destroy(); | ||
}, | ||
methods: { | ||
moveTo(time, options) { | ||
this.timeline.moveTo(time, options); | ||
}, | ||
}, | ||
render() { | ||
return <div ref="visualization"></div>; | ||
}, | ||
}; | ||
|
||
export default Timeline; |
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.