Browse Source

try to fix update problem

tripeur 4 years ago
parent
commit
51b7f59c52
4 changed files with 5 additions and 3 deletions
  1. 1 1
      lib/Timeline.d.ts
  2. 3 1
      lib/Timeline.js
  3. 0 0
      lib/Timeline.js.map
  4. 1 1
      package.json

+ 1 - 1
lib/Timeline.d.ts

@@ -49,7 +49,7 @@ declare class Timeline extends LitElement {
     _removeRessourceById(id: string, depth?: number): TimelineContent;
     getRessources(): Array<Ressource>;
     getRessourceFromId(id: string): Ressource | 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;
     setRowsTitle(title: string): void;
     getEventById(id: string): Event | undefined;
     addEvents(list: Array<IEvent>): Array<Event | undefined>;

+ 3 - 1
lib/Timeline.js

@@ -179,8 +179,10 @@ 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();
+            this._updateEventPosition(ressource);
+            return ressource;
         }
+        return null;
     }
     setRowsTitle(title) {
         this.rowsTitle = 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.5",
+  "version": "0.1.6",
   "description": "web component to manage ressources in time",
   "main": "./lib/main.js",
   "types": "./lib/main.d.ts",

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