Browse Source

force update upon external request

tripeur 4 years ago
parent
commit
d23664872a
4 changed files with 6 additions and 2 deletions
  1. 1 0
      lib/Timeline.js
  2. 0 0
      lib/Timeline.js.map
  3. 1 1
      package.json
  4. 4 1
      src/Timeline.ts

+ 1 - 0
lib/Timeline.js

@@ -179,6 +179,7 @@ let Timeline = class Timeline extends lit_element_1.LitElement {
                 ressource[key] = value;
                 this.rows = this.rows.map(r => r.id == ressource.id ? ressource : r);
             }
+            this.requestUpdate();
         }
     }
     setRowsTitle(title) {

File diff suppressed because it is too large
+ 0 - 0
lib/Timeline.js.map


+ 1 - 1
package.json

@@ -1,6 +1,6 @@
 {
   "name": "jc-timeline",
-  "version": "0.1.3",
+  "version": "0.1.5",
   "description": "web component to manage ressources in time",
   "main": "./lib/main.js",
   "types": "./lib/main.d.ts",

+ 4 - 1
src/Timeline.ts

@@ -226,7 +226,7 @@ class Timeline extends LitElement {
         const tmp = this.rows.filter(r=>r.id===id)
         return tmp.length > 0 ? tmp[0] : null;
     }
-    updateRessource<K extends keyof Ressource>(id:string,key:K,value:Ressource[K]):void{
+    updateRessource<K extends keyof Ressource>(id:string,key:K,value:Ressource[K]):Ressource|null{
         const ressource = this.getRessourceFromId(id);
         if(ressource){
           if (key == "parent") {
@@ -239,7 +239,10 @@ class Timeline extends LitElement {
             ressource[key] = value;
             this.rows = this.rows.map(r=>r.id==ressource.id ? ressource : r);
           }
+          this._updateEventPosition(ressource);
+          return ressource 
         }
+        return null
     }
     setRowsTitle(title: string):void {
         this.rowsTitle = title;

Some files were not shown because too many files changed in this diff