devextreme-cli 1.3.0-beta.0 → 1.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (91) hide show
  1. package/index.js +1 -1
  2. package/package.json +32 -9
  3. package/src/application.js +1 -1
  4. package/src/applications/application.angular.js +46 -10
  5. package/src/applications/application.react.js +6 -4
  6. package/src/applications/application.vue.js +102 -35
  7. package/src/commands.json +34 -25
  8. package/src/templates/react/application/src/App.js +3 -3
  9. package/src/templates/react/application/src/Content.js +1 -1
  10. package/src/templates/react/application/src/{NotAuthenticatedContent.js → UnauthenticatedContent.js} +1 -1
  11. package/src/templates/react/application/src/api/auth.js +1 -1
  12. package/src/templates/react/application/src/app-info.js +4 -2
  13. package/src/templates/react/application/src/components/change-password-form/change-password-form.js +1 -1
  14. package/src/templates/react/application/src/components/create-account-form/create-account-form.js +1 -1
  15. package/src/templates/react/application/src/components/footer/footer.js +2 -2
  16. package/src/templates/react/application/src/components/header/header.js +37 -37
  17. package/src/templates/react/application/src/components/login-form/login-form.js +1 -1
  18. package/src/templates/react/application/src/components/reset-password-form/reset-password-form.js +2 -2
  19. package/src/templates/react/application/src/components/side-navigation-menu/side-navigation-menu.js +5 -5
  20. package/src/templates/react/application/src/components/user-panel/user-panel.js +8 -2
  21. package/src/templates/react/application/src/dx-styles.scss +6 -1
  22. package/src/templates/react/application/src/layouts/side-nav-inner-toolbar/side-nav-inner-toolbar.js +1 -1
  23. package/src/templates/react/application/src/layouts/side-nav-outer-toolbar/side-nav-outer-toolbar.js +1 -1
  24. package/src/templates/react/application/src/layouts/single-card/single-card.js +11 -10
  25. package/src/templates/react/application/src/utils/media-query.js +1 -1
  26. package/src/templates/react/application/src/utils/patches.scss +1 -1
  27. package/src/templates/react/sample-pages/home/home.js +47 -46
  28. package/src/templates/react/sample-pages/profile/profile.js +3 -3
  29. package/src/templates/react/sample-pages/tasks/tasks.js +70 -68
  30. package/src/templates/vue-v2/application/devextreme.json +38 -0
  31. package/src/templates/{vue → vue-v2}/application/src/App.vue +3 -3
  32. package/src/templates/{vue → vue-v2}/application/src/app-info.js +0 -0
  33. package/src/templates/{vue → vue-v2}/application/src/app-navigation.js +0 -0
  34. package/src/templates/{vue → vue-v2}/application/src/auth.js +0 -0
  35. package/src/templates/{vue/application/src/components/the-footer.vue → vue-v2/application/src/components/app-footer.vue} +0 -0
  36. package/src/templates/{vue → vue-v2}/application/src/components/header-toolbar.vue +8 -1
  37. package/src/templates/{vue → vue-v2}/application/src/components/side-nav-menu.vue +0 -0
  38. package/src/templates/{vue → vue-v2}/application/src/components/user-panel.vue +0 -0
  39. package/src/templates/{vue → vue-v2}/application/src/dx-styles.scss +4 -0
  40. package/src/templates/{vue → vue-v2}/application/src/layouts/side-nav-inner-toolbar.vue +0 -0
  41. package/src/templates/{vue → vue-v2}/application/src/layouts/side-nav-outer-toolbar.vue +0 -0
  42. package/src/templates/{vue → vue-v2}/application/src/layouts/single-card.vue +0 -0
  43. package/src/templates/{vue → vue-v2}/application/src/main.js +0 -0
  44. package/src/templates/{vue → vue-v2}/application/src/router.js +3 -3
  45. package/src/templates/{vue → vue-v2}/application/src/themes/metadata.additional.json +0 -0
  46. package/src/templates/{vue → vue-v2}/application/src/themes/metadata.base.json +0 -0
  47. package/src/templates/{vue → vue-v2}/application/src/utils/media-query.js +0 -0
  48. package/src/templates/{vue → vue-v2}/application/src/views/change-password-form.vue +2 -3
  49. package/src/templates/{vue → vue-v2}/application/src/views/create-account-form.vue +2 -3
  50. package/src/templates/{vue → vue-v2}/application/src/views/login-form.vue +2 -3
  51. package/src/templates/{vue → vue-v2}/application/src/views/reset-password-form.vue +2 -3
  52. package/src/templates/{vue → vue-v2}/application/vue.config.js +0 -0
  53. package/src/templates/{vue → vue-v2}/page/page.vue +0 -0
  54. package/src/templates/{vue/sample-pages/home.vue → vue-v2/sample-pages/home-page.vue} +5 -5
  55. package/src/templates/{vue/sample-pages/profile.vue → vue-v2/sample-pages/profile-page.vue} +1 -1
  56. package/src/templates/{vue/sample-pages/tasks.vue → vue-v2/sample-pages/tasks-page.vue} +1 -0
  57. package/src/templates/{vue → vue-v3}/application/devextreme.json +3 -0
  58. package/src/templates/vue-v3/application/src/App.vue +101 -0
  59. package/src/templates/vue-v3/application/src/app-info.js +3 -0
  60. package/src/templates/vue-v3/application/src/app-navigation.js +21 -0
  61. package/src/templates/vue-v3/application/src/auth.js +101 -0
  62. package/src/templates/vue-v3/application/src/components/app-footer.vue +21 -0
  63. package/src/templates/vue-v3/application/src/components/header-toolbar.vue +161 -0
  64. package/src/templates/vue-v3/application/src/components/side-nav-menu.vue +204 -0
  65. package/src/templates/vue-v3/application/src/components/user-panel.vue +114 -0
  66. package/src/templates/vue-v3/application/src/dx-styles.scss +57 -0
  67. package/src/templates/vue-v3/application/src/layouts/side-nav-inner-toolbar.vue +192 -0
  68. package/src/templates/vue-v3/application/src/layouts/side-nav-outer-toolbar.vue +144 -0
  69. package/src/templates/vue-v3/application/src/layouts/single-card.vue +83 -0
  70. package/src/templates/vue-v3/application/src/main.js +10 -0
  71. package/src/templates/vue-v3/application/src/router.js +130 -0
  72. package/src/templates/vue-v3/application/src/themes/metadata.additional.json +12 -0
  73. package/src/templates/vue-v3/application/src/themes/metadata.base.json +7 -0
  74. package/src/templates/vue-v3/application/src/utils/media-query.js +33 -0
  75. package/src/templates/vue-v3/application/src/views/change-password-form.vue +115 -0
  76. package/src/templates/vue-v3/application/src/views/create-account-form.vue +155 -0
  77. package/src/templates/vue-v3/application/src/views/login-form.vue +146 -0
  78. package/src/templates/vue-v3/application/src/views/reset-password-form.vue +117 -0
  79. package/src/templates/vue-v3/application/vue.config.js +3 -0
  80. package/src/templates/vue-v3/page/page.vue +13 -0
  81. package/src/templates/vue-v3/sample-pages/home-page.vue +173 -0
  82. package/src/templates/vue-v3/sample-pages/profile-page.vue +88 -0
  83. package/src/templates/vue-v3/sample-pages/tasks-page.vue +133 -0
  84. package/src/themebuider.js +42 -63
  85. package/src/utility/latest-versions.js +3 -3
  86. package/src/utility/package-manager.js +8 -2
  87. package/src/{layout.js → utility/prompts/layout.js} +4 -4
  88. package/src/utility/prompts/prompts.js +16 -0
  89. package/src/utility/prompts/vue-version.js +29 -0
  90. package/src/utility/run-command.js +8 -6
  91. package/src/utility/prompts.js +0 -11
@@ -11,7 +11,7 @@
11
11
  <router-view name="content" />
12
12
  </div>
13
13
  <template #footer>
14
- <the-footer />
14
+ <app-footer />
15
15
  </template>
16
16
  </router-view>
17
17
  </div>
@@ -19,7 +19,7 @@
19
19
  </template>
20
20
 
21
21
  <script>
22
- import TheFooter from "./components/the-footer";
22
+ import AppFooter from "./components/app-footer";
23
23
  import { sizes, subscribe, unsubscribe } from "./utils/media-query";
24
24
 
25
25
  function getScreenSizeInfo() {
@@ -60,7 +60,7 @@ export default {
60
60
  },
61
61
 
62
62
  components: {
63
- TheFooter
63
+ AppFooter
64
64
  }
65
65
  };
66
66
  </script>
@@ -77,7 +77,8 @@ export default {
77
77
  userMenuItems: [
78
78
  {
79
79
  text: "Profile",
80
- icon: "user"
80
+ icon: "user",
81
+ onClick: this.onProfileClick
81
82
  },
82
83
  {
83
84
  text: "Logout",
@@ -94,6 +95,12 @@ export default {
94
95
  path: "/login-form",
95
96
  query: { redirect: this.$route.path }
96
97
  });
98
+ },
99
+ onProfileClick() {
100
+ this.$router.push({
101
+ path: "/profile",
102
+ query: { redirect: this.$route.path }
103
+ });
97
104
  }
98
105
  },
99
106
  components: {
@@ -8,6 +8,10 @@
8
8
  }
9
9
  }
10
10
 
11
+ .side-nav-outer-toolbar .dx-drawer {
12
+ height: calc(100% - 56px)
13
+ }
14
+
11
15
  .content-block {
12
16
  margin-left: 40px;
13
17
  margin-right: 40px;
@@ -3,9 +3,9 @@ import Router from "vue-router";
3
3
 
4
4
  import auth from "./auth";
5
5
 
6
- <%=^empty%>import Home from "./views/home";
7
- import Profile from "./views/profile";
8
- import Tasks from "./views/tasks";
6
+ <%=^empty%>import Home from "./views/home-page";
7
+ import Profile from "./views/profile-page";
8
+ import Tasks from "./views/tasks-page";
9
9
  <%=/empty%>import defaultLayout from "./layouts/<%=layout%>";
10
10
  import simpleLayout from "./layouts/single-card";
11
11
 
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <form @submit="onSubmit">
2
+ <form @submit.prevent="onSubmit">
3
3
  <dx-form :form-data="formData" :disabled="loading">
4
4
  <dx-item
5
5
  data-field="password"
@@ -80,8 +80,7 @@ components: {
80
80
  },
81
81
  /* eslint-disable no-debugger */
82
82
  methods: {
83
- onSubmit: async function(e) {
84
- e.preventDefault();
83
+ onSubmit: async function() {
85
84
  const { password } = this.formData;
86
85
  this.loading = true;
87
86
 
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <form class="create-account-form" @submit="onSubmit">
2
+ <form class="create-account-form" @submit.prevent="onSubmit">
3
3
  <dx-form :form-data="formData" :disabled="loading">
4
4
  <dx-item
5
5
  data-field="email"
@@ -99,8 +99,7 @@ export default {
99
99
  }
100
100
  },
101
101
  methods: {
102
- onSubmit: async function(e) {
103
- e.preventDefault();
102
+ onSubmit: async function() {
104
103
  const { email, password } = this.formData;
105
104
  this.loading = true;
106
105
 
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <form class="login-form" @submit="onSubmit">
2
+ <form class="login-form" @submit.prevent="onSubmit">
3
3
  <dx-form :form-data="formData" :disabled="loading">
4
4
  <dx-item
5
5
  data-field="email"
@@ -85,8 +85,7 @@ export default {
85
85
  onCreateAccountClick() {
86
86
  this.$router.push("/create-account");
87
87
  },
88
- onSubmit: async function(e) {
89
- e.preventDefault();
88
+ onSubmit: async function() {
90
89
  const { email, password } = this.formData;
91
90
  this.loading = true;
92
91
 
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <form class="reset-password-form" @submit="onSubmit">
2
+ <form class="reset-password-form" @submit.prevent="onSubmit">
3
3
  <dx-form :form-data="formData" :disabled="loading">
4
4
  <dx-item
5
5
  data-field="email"
@@ -73,8 +73,7 @@ export default {
73
73
  }
74
74
  },
75
75
  methods: {
76
- onSubmit: async function(e) {
77
- e.preventDefault();
76
+ onSubmit: async function() {
78
77
  const { email } = this.formData;
79
78
  this.loading = true;
80
79
 
File without changes
@@ -97,7 +97,7 @@
97
97
  and includes the following DevExtreme components:</p>
98
98
  <ul>
99
99
  <li>
100
- <a href="https://js.devexpress.com/Documentation/Guide/Widgets/DataGrid/Overview/" target="_blank" rel="noopener noreferrer">DataGrid</a>
100
+ <a href="https://js.devexpress.com/Documentation/Guide/UI_Components/DataGrid/Getting_Started_with_DataGrid/" target="_blank" rel="noopener noreferrer">DataGrid</a>
101
101
  </li>
102
102
  <li>
103
103
  <a href="https://js.devexpress.com/Documentation/Guide/Widgets/Form/Overview/" target="_blank" rel="noopener noreferrer">Form</a>
@@ -113,16 +113,16 @@
113
113
 
114
114
  <ul>
115
115
  <li>
116
- <a href="https://js.devexpress.com/Documentation/Guide/Vue_Components/Create_a_DevExtreme_Application/#Layouts" target="_blank" rel="noopener noreferrer">Layouts</a>
116
+ <a href="https://js.devexpress.com/Documentation/Guide/Vue_Components/Application_Template/#Layouts" target="_blank" rel="noopener noreferrer">Layouts</a>
117
117
  </li>
118
118
  <li>
119
- <a href="https://js.devexpress.com/Documentation/Guide/Vue_Components/Create_a_DevExtreme_Application/#Add_a_New_View" target="_blank" rel="noopener noreferrer">Add a New View</a>
119
+ <a href="https://js.devexpress.com/Documentation/Guide/Vue_Components/Application_Template/#Add_a_New_View" target="_blank" rel="noopener noreferrer">Add a New View</a>
120
120
  </li>
121
121
  <li>
122
- <a href="https://js.devexpress.com/Documentation/Guide/Vue_Components/Create_a_DevExtreme_Application/#Configure_the_Navigation_Menu" target="_blank" rel="noopener noreferrer">Configure the Navigation Menu</a>
122
+ <a href="https://js.devexpress.com/Documentation/Guide/Vue_Components/Application_Template/#Configure_the_Navigation_Menu" target="_blank" rel="noopener noreferrer">Configure the Navigation Menu</a>
123
123
  </li>
124
124
  <li>
125
- <a href="https://js.devexpress.com/Documentation/Guide/Vue_Components/Create_a_DevExtreme_Application/#Configure_Themes" target="_blank" rel="noopener noreferrer">Configure Themes</a>
125
+ <a href="https://js.devexpress.com/Documentation/Guide/Vue_Components/Application_Template/#Configure_Themes" target="_blank" rel="noopener noreferrer">Configure Themes</a>
126
126
  </li>
127
127
  </ul>
128
128
  <p>
@@ -38,7 +38,7 @@ export default {
38
38
  Prefix: "Mrs.",
39
39
  Position: "Controller",
40
40
  Picture: picture,
41
- BirthDate: new Date("1974/11/15"),
41
+ BirthDate: new Date("1974/11/5"),
42
42
  HireDate: new Date("2005/05/11"),
43
43
  Notes:
44
44
 
@@ -66,6 +66,7 @@
66
66
  <dx-column
67
67
  data-field="Task_Priority"
68
68
  caption="Priority"
69
+ name="Priority"
69
70
  :hiding-priority="1"
70
71
  />
71
72
 
@@ -1,5 +1,8 @@
1
1
  {
2
2
  "applicationEngine": "vue",
3
+ "vue": {
4
+ "version": 3
5
+ },
3
6
  "build": {
4
7
  "commands": [
5
8
  {
@@ -0,0 +1,101 @@
1
+ <template>
2
+ <div id="root">
3
+ <div :class="cssClasses">
4
+ <component
5
+ :is="$route.meta.layout"
6
+ :title="title"
7
+ :is-x-small="screen.getScreenSizeInfo.isXSmall"
8
+ :is-large="screen.getScreenSizeInfo.isLarge"
9
+ >
10
+ <div class="content">
11
+ <router-view></router-view>
12
+ </div>
13
+ <template #footer>
14
+ <app-footer />
15
+ </template>
16
+ </component>
17
+ </div>
18
+ </div>
19
+ </template>
20
+
21
+ <script>
22
+ import AppFooter from "./components/app-footer";
23
+ import { sizes, subscribe, unsubscribe } from "./utils/media-query";
24
+ import {
25
+ getCurrentInstance,
26
+ reactive,
27
+ onMounted,
28
+ onBeforeUnmount,
29
+ computed
30
+ } from "vue";
31
+
32
+ function getScreenSizeInfo() {
33
+ const screenSizes = sizes();
34
+
35
+ return {
36
+ isXSmall: screenSizes["screen-x-small"],
37
+ isLarge: screenSizes["screen-large"],
38
+ cssClasses: Object.keys(screenSizes).filter(cl => screenSizes[cl])
39
+ };
40
+ }
41
+
42
+ export default {
43
+ components: {
44
+ AppFooter
45
+ },
46
+ setup() {
47
+ const vm = getCurrentInstance();
48
+
49
+ const title = vm.proxy.$appInfo.title;
50
+ const screen = reactive({ getScreenSizeInfo: {} });
51
+ screen.getScreenSizeInfo = getScreenSizeInfo();
52
+
53
+ function screenSizeChanged () {
54
+ screen.getScreenSizeInfo = getScreenSizeInfo();
55
+ }
56
+
57
+ onMounted(() => {
58
+ subscribe(screenSizeChanged);
59
+ });
60
+
61
+ onBeforeUnmount(() => {
62
+ unsubscribe(screenSizeChanged);
63
+ });
64
+
65
+ const cssClasses = computed(() => {
66
+ return ["app"].concat(screen.getScreenSizeInfo.cssClasses);
67
+ });
68
+
69
+ return {
70
+ title,
71
+ screen,
72
+ cssClasses
73
+ };
74
+ }
75
+ };
76
+ </script>
77
+
78
+ <style lang="scss">
79
+ html,
80
+ body {
81
+ margin: 0px;
82
+ min-height: 100%;
83
+ height: 100%;
84
+ }
85
+
86
+ #root {
87
+ height: 100%;
88
+ }
89
+
90
+ * {
91
+ box-sizing: border-box;
92
+ }
93
+
94
+ .app {
95
+ @import "./themes/generated/variables.base.scss";
96
+ background-color: darken($base-bg, 5);
97
+ display: flex;
98
+ height: 100%;
99
+ width: 100%;
100
+ }
101
+ </style>
@@ -0,0 +1,3 @@
1
+ export default {
2
+ title: "<%=project%>"
3
+ };
@@ -0,0 +1,21 @@
1
+ export default [<%=^empty%>
2
+ {
3
+ text: "Home",
4
+ path: "/home",
5
+ icon: "home"
6
+ },
7
+ {
8
+ text: "Examples",
9
+ icon: "folder",
10
+ items: [
11
+ {
12
+ text: "Profile",
13
+ path: "/profile"
14
+ },
15
+ {
16
+ text: "Tasks",
17
+ path: "/tasks"
18
+ }
19
+ ]
20
+ }
21
+ <%=/empty%>];
@@ -0,0 +1,101 @@
1
+ const defaultUser = {
2
+ email: 'sandra@example.com',
3
+ avatarUrl: 'https://js.devexpress.com/Demos/WidgetsGallery/JSDemos/images/employees/06.png'
4
+ };
5
+
6
+ export default {
7
+ _user: defaultUser,
8
+ loggedIn() {
9
+ return !!this._user;
10
+ },
11
+
12
+ async logIn(email, password) {
13
+ try {
14
+ // Send request
15
+ console.log(email, password);
16
+ this._user = { ...defaultUser, email };
17
+
18
+ return {
19
+ isOk: true,
20
+ data: this._user
21
+ };
22
+ }
23
+ catch {
24
+ return {
25
+ isOk: false,
26
+ message: "Authentication failed"
27
+ };
28
+ }
29
+ },
30
+
31
+ async logOut() {
32
+ this._user = null;
33
+ },
34
+
35
+ async getUser() {
36
+ try {
37
+ // Send request
38
+
39
+ return {
40
+ isOk: true,
41
+ data: this._user
42
+ };
43
+ }
44
+ catch {
45
+ return {
46
+ isOk: false
47
+ };
48
+ }
49
+ },
50
+
51
+ async resetPassword(email) {
52
+ try {
53
+ // Send request
54
+ console.log(email);
55
+
56
+ return {
57
+ isOk: true
58
+ };
59
+ }
60
+ catch {
61
+ return {
62
+ isOk: false,
63
+ message: "Failed to reset password"
64
+ };
65
+ }
66
+ },
67
+
68
+ async changePassword(email, recoveryCode) {
69
+ try {
70
+ // Send request
71
+ console.log(email, recoveryCode);
72
+
73
+ return {
74
+ isOk: true
75
+ };
76
+ }
77
+ catch {
78
+ return {
79
+ isOk: false,
80
+ message: "Failed to change password"
81
+ }
82
+ }
83
+ },
84
+
85
+ async createAccount(email, password) {
86
+ try {
87
+ // Send request
88
+ console.log(email, password);
89
+
90
+ return {
91
+ isOk: true
92
+ };
93
+ }
94
+ catch {
95
+ return {
96
+ isOk: false,
97
+ message: "Failed to create account"
98
+ };
99
+ }
100
+ }
101
+ };
@@ -0,0 +1,21 @@
1
+ <template>
2
+ <div class="content-block">
3
+ <footer class="footer">
4
+ Copyright © 2011-{{new Date().getFullYear()}} {{this.$appInfo.title}} Inc.
5
+ <br />All trademarks or registered trademarks are property of their
6
+ respective owners.
7
+ </footer>
8
+ </div>
9
+ </template>
10
+
11
+ <style lang="scss">
12
+ @import "../themes/generated/variables.base.scss";
13
+
14
+ .footer {
15
+ display: block;
16
+ color: rgba($base-text-color, alpha($base-text-color) * 0.7);
17
+ border-top: 1px solid rgba(0, 0, 0, 0.1);
18
+ padding-top: 20px;
19
+ padding-bottom: 24px;
20
+ }
21
+ </style>
@@ -0,0 +1,161 @@
1
+ <template>
2
+ <header class="header-component">
3
+ <dx-toolbar class="header-toolbar">
4
+ <dx-item
5
+ :visible="menuToggleEnabled"
6
+ location="before"
7
+ css-class="menu-button"
8
+ >
9
+ <template #default>
10
+ <dx-button
11
+ icon="menu"
12
+ styling-mode="text"
13
+ @click="toggleMenuFunc"
14
+ />
15
+ </template>
16
+ </dx-item>
17
+
18
+ <dx-item
19
+ v-if="title"
20
+ location="before"
21
+ css-class="header-title dx-toolbar-label"
22
+ >
23
+ <div>{{ title }}</div>
24
+ </dx-item>
25
+
26
+ <dx-item
27
+ location="after"
28
+ locate-in-menu="auto"
29
+ menu-item-template="menuUserItem"
30
+ >
31
+ <template #default>
32
+ <div>
33
+ <dx-button
34
+ class="user-button authorization"
35
+ :width="210"
36
+ height="100%"
37
+ styling-mode="text"
38
+ >
39
+ <user-panel :email="email" :menu-items="userMenuItems" menu-mode="context" />
40
+ </dx-button>
41
+ </div>
42
+ </template>
43
+ </dx-item>
44
+
45
+ <template #menuUserItem>
46
+ <user-panel
47
+ :email="email"
48
+ :menu-items="userMenuItems"
49
+ menu-mode="list"
50
+ />
51
+ </template>
52
+ </dx-toolbar>
53
+ </header>
54
+ </template>
55
+
56
+ <script>
57
+ import DxButton from "devextreme-vue/button";
58
+ import DxToolbar, { DxItem } from "devextreme-vue/toolbar";
59
+ import auth from "../auth";
60
+ import { useRouter, useRoute } from 'vue-router';
61
+ import { ref } from 'vue';
62
+
63
+ import UserPanel from "./user-panel";
64
+
65
+ export default {
66
+ props: {
67
+ menuToggleEnabled: Boolean,
68
+ title: String,
69
+ toggleMenuFunc: Function,
70
+ logOutFunc: Function
71
+ },
72
+ setup() {
73
+ const router = useRouter();
74
+ const route = useRoute();
75
+
76
+ const email = ref("");
77
+ auth.getUser().then((e) => email.value = e.data.email);
78
+
79
+ const userMenuItems = [{
80
+ text: "Profile",
81
+ icon: "user",
82
+ onClick: onProfileClick
83
+ },
84
+ {
85
+ text: "Logout",
86
+ icon: "runner",
87
+ onClick: onLogoutClick
88
+ }];
89
+
90
+ function onLogoutClick() {
91
+ auth.logOut();
92
+ router.push({
93
+ path: "/login-form",
94
+ query: { redirect: route.path }
95
+ });
96
+ }
97
+
98
+ function onProfileClick() {
99
+ router.push({
100
+ path: "/profile",
101
+ query: { redirect: route.path }
102
+ });
103
+ }
104
+
105
+ return {
106
+ email,
107
+ userMenuItems
108
+ };
109
+ },
110
+ components: {
111
+ DxButton,
112
+ DxToolbar,
113
+ DxItem,
114
+ UserPanel
115
+ }
116
+ };
117
+ </script>
118
+
119
+ <style lang="scss">
120
+ @import "../themes/generated/variables.base.scss";
121
+ @import "../dx-styles.scss";
122
+
123
+ .header-component {
124
+ flex: 0 0 auto;
125
+ z-index: 1;
126
+ box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24);
127
+
128
+ .dx-toolbar .dx-toolbar-item.menu-button > .dx-toolbar-item-content .dx-icon {
129
+ color: $base-accent;
130
+ }
131
+ }
132
+
133
+ .dx-toolbar.header-toolbar .dx-toolbar-items-container .dx-toolbar-after {
134
+ padding: 0 40px;
135
+
136
+ .screen-x-small & {
137
+ padding: 0 20px;
138
+ }
139
+ }
140
+
141
+ .dx-toolbar .dx-toolbar-item.dx-toolbar-button.menu-button {
142
+ width: $side-panel-min-width;
143
+ text-align: center;
144
+ padding: 0;
145
+ }
146
+
147
+ .header-title .dx-item-content {
148
+ padding: 0;
149
+ margin: 0;
150
+ }
151
+
152
+ .dx-theme-generic {
153
+ .dx-toolbar {
154
+ padding: 10px 0;
155
+ }
156
+
157
+ .user-button > .dx-button-content {
158
+ padding: 3px;
159
+ }
160
+ }
161
+ </style>