Repository: DevExpress/devextreme-vue
Pull request #243 (2019-02-07 14:05:19)

Update to vue@2.6
Cherry-pick of #241 


Patch:
diff --git a/package-lock.json b/package-lock.json
index 6580703..7a9ef63 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -5329,9 +5329,9 @@
       }
     },
     "he": {
-      "version": "1.1.1",
-      "resolved": "https://registry.npmjs.org/he/-/he-1.1.1.tgz",
-      "integrity": "sha1-k0EP0hsAlzUVH4howvJx80J+I/0=",
+      "version": "1.2.0",
+      "resolved": "https://registry.npmjs.org/he/-/he-1.2.0.tgz",
+      "integrity": "sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==",
       "dev": true
     },
     "hmac-drbg": {
@@ -12547,9 +12547,9 @@
       }
     },
     "vue": {
-      "version": "2.5.17",
-      "resolved": "https://registry.npmjs.org/vue/-/vue-2.5.17.tgz",
-      "integrity": "sha512-mFbcWoDIJi0w0Za4emyLiW72Jae0yjANHbCVquMKijcavBGypqlF7zHRgMa5k4sesdv7hv2rB4JPdZfR+TPfhQ==",
+      "version": "2.6.3",
+      "resolved": "https://registry.npmjs.org/vue/-/vue-2.6.3.tgz",
+      "integrity": "sha512-yftjtahz4UTAtOlXXuw7UaYD86fWrMDAAzqTdqJJx2FIBqcPmBN6kPBHiBJFGaQELVblb5ijbFMXsx0i0F7q3g==",
       "dev": true
     },
     "vue-hot-reload-api": {
@@ -12654,13 +12654,13 @@
       }
     },
     "vue-template-compiler": {
-      "version": "2.5.17",
-      "resolved": "https://registry.npmjs.org/vue-template-compiler/-/vue-template-compiler-2.5.17.tgz",
-      "integrity": "sha512-63uI4syCwtGR5IJvZM0LN5tVsahrelomHtCxvRkZPJ/Tf3ADm1U1wG6KWycK3qCfqR+ygM5vewUvmJ0REAYksg==",
+      "version": "2.6.3",
+      "resolved": "https://registry.npmjs.org/vue-template-compiler/-/vue-template-compiler-2.6.3.tgz",
+      "integrity": "sha512-SQ3lJk7fwquz8fGac7MwvP9cEBZntokTWITaDrLC0zmyBKjcOfJtWZkMsv+2uSUBDD8kwz8Bsad9xmBWaNULhg==",
       "dev": true,
       "requires": {
         "de-indent": "1.0.2",
-        "he": "1.1.1"
+        "he": "1.2.0"
       }
     },
     "vue-template-es2015-compiler": {
diff --git a/package.json b/package.json
index 6424a27..52affa8 100644
--- a/package.json
+++ b/package.json
@@ -52,9 +52,9 @@
     "tslint": "^5.11.0",
     "typescript": "^2.9.2",
     "url-loader": "^1.1.1",
-    "vue": "^2.5.17",
+    "vue": "^2.6.3",
     "vue-loader": "^14.2.3",
-    "vue-template-compiler": "^2.5.17",
+    "vue-template-compiler": "^2.6.3",
     "webpack": "^4.29.2",
     "webpack-cli": "^3.2.3",
     "webpack-dev-server": "^3.1.14"
diff --git a/src/core/component.ts b/src/core/component.ts
index 4643da0..447b559 100644
--- a/src/core/component.ts
+++ b/src/core/component.ts
@@ -7,7 +7,7 @@ import { pullAllChildren } from "./children-processing";
 import Configuration, { bindOptionWatchers, subscribeOnUpdates } from "./configuration";
 import { IConfigurable } from "./configuration-component";
 import { IExtension, IExtensionComponentNode } from "./extension-component";
-import { camelize, toComparable } from "./helpers";
+import { camelize, extractScopedSlots, toComparable } from "./helpers";
 
 interface IWidgetComponent extends IConfigurable {
     $_instance: any;
@@ -120,9 +120,8 @@ const BaseComponent: VueConstructor<IBaseComponent> = Vue.extend({
                 ...this.$_getExtraIntegrationOptions(),
             };
 
-            const templates = {
-                ...this.$scopedSlots
-            };
+            const templates = extractScopedSlots(this.$scopedSlots, Object.keys(this.$slots));
+
             this.$children.forEach((child: any) => {
                 if (shouldAddTemplate(child)) {
                     const templateName = `${child.$vnode.componentOptions.$_config.fullPath}.${TEMPLATE_PROP}`;
diff --git a/src/core/helpers.ts b/src/core/helpers.ts
index 5f2851f..0a4bcc4 100644
--- a/src/core/helpers.ts
+++ b/src/core/helpers.ts
@@ -25,3 +25,24 @@ export function isEqual(value1, value2) {
 
     return false;
 }
+
+export function extractScopedSlots(
+    obj: Record<string, any>,
+    nonScopedSlots: string[]
+): Record<string, any> {
+
+    const result = {};
+
+    Object.keys(obj).forEach((key: string) => {
+        if (nonScopedSlots && nonScopedSlots.indexOf(key) > -1) {
+            return;
+        }
+
+        const value = obj[key];
+        if (value instanceof Function) {
+            result[key] = value;
+        }
+    });
+
+    return result;
+}


Test patch:
diff --git a/src/core/helpers.test.ts b/src/core/helpers.test.ts
index 965d00b..3fac2d7 100644
--- a/src/core/helpers.test.ts
+++ b/src/core/helpers.test.ts
@@ -1,4 +1,4 @@
-import { isEqual, toComparable } from "./helpers";
+import { extractScopedSlots, isEqual, toComparable } from "./helpers";
 
 describe("toComparable", () => {
 
@@ -42,3 +42,33 @@ describe("isEqual", () => {
         expect(isEqual(testDate1, testDate2)).toBe(true);
     });
 });
+
+describe("extractScopedSlots", () => {
+    // https://github.com/vuejs/vue/issues/9443
+
+    it("removes non-functional fields", () => {
+        const actual = extractScopedSlots(
+            {
+                a() { return true; },
+                b: 123,
+                c: true,
+                d: undefined
+            },
+            []
+        );
+
+        expect(Object.keys(actual)).toEqual(["a"]);
+    });
+
+    it("removes non-scoped slots", () => {
+        const actual = extractScopedSlots(
+            {
+                a() { return true; },
+                b() { return true; }
+            },
+            ["b"]
+        );
+
+        expect(Object.keys(actual)).toEqual(["a"]);
+    });
+});