You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@echarts.apache.org by GitBox <gi...@apache.org> on 2020/10/21 13:22:21 UTC

[GitHub] [incubator-echarts] 100pah commented on a change in pull request #13358: Custom morph2

100pah commented on a change in pull request #13358:
URL: https://github.com/apache/incubator-echarts/pull/13358#discussion_r509273972



##########
File path: src/data/DataDiffer.ts
##########
@@ -61,107 +86,215 @@ class DataDiffer<Ctx = unknown> {
 
         // Visible in callback via `this.context`;
         this.context = context;
+
+        this._diffModeMultiple = diffMode === 'multiple';
     }
 
     /**
      * Callback function when add a data
      */
-    add(func: DiffCallbackAdd): DataDiffer {
+    add(func: DiffCallbackAdd): this {
         this._add = func;
         return this;
     }
 
     /**
      * Callback function when update a data
      */
-    update(func: DiffCallbackUpdate): DataDiffer {
+    update(func: DiffCallbackUpdate): this {
         this._update = func;
         return this;
     }
 
+    /**
+     * Callback function when update a data and only work in `cbMode: 'byKey'`.
+     */
+    updateManyToOne(func: DiffCallbackUpdateManyToOne): this {
+        this._updateManyToOne = func;
+        return this;
+    }
+
+    /**
+     * Callback function when update a data and only work in `cbMode: 'byKey'`.
+     */
+    updateOneToMany(func: DiffCallbackUpdateOneToMany): this {
+        this._updateOneToMany = func;
+        return this;
+    }
+
     /**
      * Callback function when remove a data
      */
-    remove(func: DiffCallbackRemove): DataDiffer {
+    remove(func: DiffCallbackRemove): this {
         this._remove = func;
         return this;
     }
 
     execute(): void {
+        this[this._diffModeMultiple ? '_executeByKey' : '_executeByIndex']();
+    }
+
+    private _executeByIndex(): void {

Review comment:
       I have modified the name in the new commit.
   I mean that is "one by one" mapping, without any many-to-one or one-to-many case.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org