From 62dceb0e81b15b1ec1951cc483ba87a828093b0c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tu=C4=9F=C3=A7e=20K=C3=BC=C3=A7=C3=BCko=C4=9Flu?= Date: Fri, 8 Jan 2021 17:28:57 +0300 Subject: [PATCH] update LiveEditor --- src/views/chart/BarChartDoc.vue | 151 +++++++++++++++++++++++++- src/views/chart/ComboChartDoc.vue | 62 ++++++++++- src/views/chart/DoughnutChartDoc.vue | 49 ++++++++- src/views/chart/LineChartDoc.vue | 130 +++++++++++++++++++++- src/views/chart/PieChartDoc.vue | 49 ++++++++- src/views/chart/PolarAreaChartDoc.vue | 47 +++++++- src/views/chart/RadarChartDoc.vue | 64 ++++++++++- src/views/liveeditor/LiveEditor.vue | 34 ++++-- src/views/sidebar/SidebarDoc.vue | 75 ++++++++++++- src/views/toast/ToastDoc.vue | 107 +++++++++++++++++- src/views/tooltip/TooltipDoc.vue | 61 ++++++++++- 11 files changed, 804 insertions(+), 25 deletions(-) diff --git a/src/views/chart/BarChartDoc.vue b/src/views/chart/BarChartDoc.vue index 457ff28f8..034692590 100755 --- a/src/views/chart/BarChartDoc.vue +++ b/src/views/chart/BarChartDoc.vue @@ -2,6 +2,9 @@
+
+ +
 
\ No newline at end of file
+
+
+
\ No newline at end of file
diff --git a/src/views/chart/ComboChartDoc.vue b/src/views/chart/ComboChartDoc.vue
index 4bf7d83b7..53428774e 100755
--- a/src/views/chart/ComboChartDoc.vue
+++ b/src/views/chart/ComboChartDoc.vue
@@ -2,6 +2,9 @@
 	
+
+ +
 
\ No newline at end of file
+
+
+
\ No newline at end of file
diff --git a/src/views/chart/DoughnutChartDoc.vue b/src/views/chart/DoughnutChartDoc.vue
index f8ce14ee0..c4c5a8b90 100755
--- a/src/views/chart/DoughnutChartDoc.vue
+++ b/src/views/chart/DoughnutChartDoc.vue
@@ -2,6 +2,9 @@
 	
+
+ +
 
\ No newline at end of file
+
+
+
\ No newline at end of file
diff --git a/src/views/chart/LineChartDoc.vue b/src/views/chart/LineChartDoc.vue
index 334f70d08..bee253812 100755
--- a/src/views/chart/LineChartDoc.vue
+++ b/src/views/chart/LineChartDoc.vue
@@ -2,6 +2,9 @@
 	
+
+ +
 
\ No newline at end of file
+
+
+
\ No newline at end of file
diff --git a/src/views/chart/PieChartDoc.vue b/src/views/chart/PieChartDoc.vue
index 8f6c4dc0b..95d92cb43 100755
--- a/src/views/chart/PieChartDoc.vue
+++ b/src/views/chart/PieChartDoc.vue
@@ -2,6 +2,9 @@
 	
+
+ +
 
\ No newline at end of file
+
+
+
\ No newline at end of file
diff --git a/src/views/chart/PolarAreaChartDoc.vue b/src/views/chart/PolarAreaChartDoc.vue
index c4adcb99d..6772589a3 100755
--- a/src/views/chart/PolarAreaChartDoc.vue
+++ b/src/views/chart/PolarAreaChartDoc.vue
@@ -2,6 +2,9 @@
 	
+
+ +
 
\ No newline at end of file
+
+
+
\ No newline at end of file
diff --git a/src/views/chart/RadarChartDoc.vue b/src/views/chart/RadarChartDoc.vue
index 947b781d6..de6c5383d 100755
--- a/src/views/chart/RadarChartDoc.vue
+++ b/src/views/chart/RadarChartDoc.vue
@@ -2,6 +2,9 @@
 	
+
+ +
 
\ No newline at end of file
+
+
+
\ No newline at end of file
diff --git a/src/views/liveeditor/LiveEditor.vue b/src/views/liveeditor/LiveEditor.vue
index 89be88050..cbc1da8e8 100644
--- a/src/views/liveeditor/LiveEditor.vue
+++ b/src/views/liveeditor/LiveEditor.vue
@@ -121,7 +121,7 @@ export default {
             let content = this.sources.template.content;
             let style = this.sources.template.style || '';
             let scriptText = 'script';
-            let _files = {}, components = '', imports = '';
+            let _files = {}, element = '', components = '', imports = '', directives = '';
 
             _files[`src/components/${name}${extension}`] = {       
                 content: `${content}
@@ -130,6 +130,13 @@ export default {
 ${style}`   
             }
 
+            if(name === 'ToastDemo'){
+                imports += `import ToastService from 'primevue/toastservice';
+`;
+                directives += `app.use(ToastService);
+`;
+            }
+
             if(this.components) {
                 this.components.forEach(comp => {
                     imports += `import ${comp} from "primevue/${comp.toLowerCase()}";
@@ -139,6 +146,15 @@ ${style}`
                 })
             } 
 
+            if(name !== 'TooltipDemo') {
+                element += `app.component("${name.slice(0, -4)}", ${name.slice(0, -4)});`;
+            }
+
+            if(name === 'TooltipDemo' || name === 'BadgeDemo'){
+                directives += `app.directive('${name.slice(0, -4).toLowerCase()}', ${name.slice(0, -4)});
+`;
+            }
+
             _files['src/main.js'] = {
                 content: `import { createApp } from "vue";
 import "primeflex/primeflex.css";
@@ -147,11 +163,12 @@ import "primevue/resources/primevue.min.css";
 import "primeicons/primeicons.css";
 import App from "./App.vue";
 import PrimeVue from "primevue/config";
-import ${this.name.slice(0, -4)} from "primevue/${this.name.slice(0, -4).toLowerCase()}";
+import ${name.slice(0, -4)} from "primevue/${name.slice(0, -4).toLowerCase()}";
 ${imports}
 const app = createApp(App);
 app.use(PrimeVue, { ripple: true });
-app.component("${this.name.slice(0, -4)}", ${this.name.slice(0, -4)});
+${directives}
+${element}
 ${components}
 app.mount("#app");
 `
@@ -443,20 +460,23 @@ img.flag {
                 });
             }
 
-            if(this.name === 'EditorDemo') {
+            if(name === 'EditorDemo') {
                 extDependencies['quill'] =  "^1.3.7";
             }
-            if(this.name === 'FullCalendarDemo') {
+            if(name === 'FullCalendarDemo') {
                 extDependencies['@fullcalendar/core'] = "5.4.0";
                 extDependencies['@fullcalendar/daygrid'] = "5.4.0";
                 extDependencies['@fullcalendar/interaction'] = "5.4.0";
                 extDependencies['@fullcalendar/timegrid'] = "5.4.0";
             }
+            if(name === 'ChartDemo') {
+                extDependencies['chart.js'] = "2.7.3";
+            }
 
-            let mittComponents = ['OrganizationChartDemo', 'ConfirmDialogDemo', 'ConfirmPopupDemo'];
+            let mittComponents = ['ToastDemo', 'OrganizationChartDemo', 'ConfirmDialogDemo', 'ConfirmPopupDemo'];
 
             mittComponents.forEach(cmp => {
-                if(this.name === cmp) {
+                if(name === cmp) {
                     extDependencies['mitt'] = "^2.1.0";
                 }
             });
diff --git a/src/views/sidebar/SidebarDoc.vue b/src/views/sidebar/SidebarDoc.vue
index 7f1399d0b..fd5ca95b3 100755
--- a/src/views/sidebar/SidebarDoc.vue
+++ b/src/views/sidebar/SidebarDoc.vue
@@ -209,9 +209,12 @@ import Sidebar from 'primevue/sidebar';
 			
 
 			
-				
-					View on GitHub
-				
+				
 
 
\ No newline at end of file
+
+
+
\ No newline at end of file
diff --git a/src/views/toast/ToastDoc.vue b/src/views/toast/ToastDoc.vue
index 09bcf3136..e350e1f87 100755
--- a/src/views/toast/ToastDoc.vue
+++ b/src/views/toast/ToastDoc.vue
@@ -282,9 +282,12 @@ this.$toast.add({severity:'success', summary: 'Specific Message', group: 'mykey'
 			
 
 			
-				
-					View on GitHub
-				
+                
 
 
+
+
diff --git a/src/views/tooltip/TooltipDoc.vue b/src/views/tooltip/TooltipDoc.vue
index 74a1298cc..a4bf58a8c 100755
--- a/src/views/tooltip/TooltipDoc.vue
+++ b/src/views/tooltip/TooltipDoc.vue
@@ -89,9 +89,12 @@ directives: {
 			
 
 			
-				
-					View on GitHub
-				
+                
 
 
\ No newline at end of file
+
+
+
\ No newline at end of file