├── .browserslistrc ├── .eslintrc.js ├── .gitignore ├── LICENSE ├── README.md ├── babel.config.js ├── deploy.sh ├── docs ├── Step1_The_App_Bar.md ├── Step2_The_Home_Component.md ├── Step3_The_Routing.md ├── Step4_The_Profile_Area.md ├── Step5_Details.md ├── Step6_Detail_Header.md ├── Step7_Detail_FilterBar.md ├── Step8_Detail_add_new_item.md ├── images │ ├── Step5.png │ ├── add-dialog.png │ ├── details-header.png │ ├── details-splitted.png │ ├── details.png │ ├── filterbar.png │ ├── filteredbytext.png │ ├── header-before-events.png │ ├── header-folder-structure.png │ └── step6-result.png ├── step1.png ├── step2.png └── step4.png ├── package-lock.json ├── package.json ├── postcss.config.js ├── public ├── favicon.ico └── index.html ├── src ├── App.vue ├── assets │ ├── img │ │ ├── broccolli.png │ │ ├── chicken.png │ │ ├── kettle.png │ │ ├── lettuce.png │ │ ├── milk.png │ │ ├── soap.png │ │ ├── storagebin.png │ │ └── tortillachips.png │ ├── logo.png │ └── profile.png ├── data │ ├── data.json │ └── products.json ├── main.js ├── router.js ├── store.js └── views │ ├── AppBar.vue │ ├── Detail.vue │ ├── FilterBar.vue │ ├── Header.vue │ └── Home.vue └── vue.config.js /.browserslistrc: -------------------------------------------------------------------------------- 1 | > 1% 2 | last 2 versions 3 | -------------------------------------------------------------------------------- /.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | root: true, 3 | env: { 4 | node: true 5 | }, 6 | extends: ["plugin:vue/essential", "@vue/prettier"], 7 | rules: { 8 | "no-console": process.env.NODE_ENV === "production" ? "error" : "off", 9 | "no-debugger": process.env.NODE_ENV === "production" ? "error" : "off" 10 | }, 11 | parserOptions: { 12 | parser: "babel-eslint" 13 | } 14 | }; 15 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | node_modules 3 | /dist 4 | 5 | # local env files 6 | .env.local 7 | .env.*.local 8 | 9 | # Log files 10 | npm-debug.log* 11 | yarn-debug.log* 12 | yarn-error.log* 13 | 14 | # Editor directories and files 15 | .idea 16 | .vscode 17 | *.suo 18 | *.ntvs* 19 | *.njsproj 20 | *.sln 21 | *.sw? 22 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [yyyy] [name of copyright owner] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Smart Store app Vue.js 2 | 3 | The [Smart Store app Vue.js](https://5d1cb04456271f7e20187559--tender-wescoff-2ef166.netlify.com) is a [Vue.js](https://vuejs.org/) sample application, demonstrating the usage of the [UI5 Web Components](https://github.com/SAP/ui5-webcomponents). You can find a step by step tutorial below on how to build the app by yourself. You don't have to clone the repo, the app will be built from scratch. 4 | 5 | Note: no previous experience with [UI5 Web Components](https://github.com/SAP/ui5-webcomponents) is required. 6 | To take the most of the tutorial, a basic knowledge with [Vue.js](https://vuejs.org/) is desirable. 7 | 8 | ## Prerequisites 9 | - [Node.js](https://nodejs.org/) - **version 8.10 or later** (check the version with `node -v`) 10 | - npm - **version 6 or later** (check the version with `npm -v`) 11 | - [Vue CLI](https://cli.vuejs.org/) - 🛠️ Standard Tooling for Vue.js Development 12 | 13 | ## Short story 14 | 15 | The Smart Store app enables a store manager to control his/her multiple stores. It provides the most important information and status of the stores and urgent tasks that should be addressed by the store manager. 16 | 17 | ## Getting started 18 | 19 | 1. Bootstrap the app with [Create Vue.js App](https://vuejs.org/v2/guide/) executing the following commands in your terminal. 20 | 21 | ```sh 22 | vue create smart-store-app 23 | cd smart-store-app 24 | ``` 25 | 26 | 2. Install the UI5 Web Components. 27 | 28 | ```sh 29 | npm install @ui5/webcomponents 30 | ``` 31 | 32 | 3. Consume the UI5 Web Components. 33 | 34 | All the components can be imported from `"@ui5/webcomponents/dist/";` 35 | Import one of the available components in the `src/App.vue`. 36 | ```js 37 | import "@ui5/webcomponents/dist/Button"; // loads ui5-button 38 | ``` 39 | 40 | Then, you can add the `ui5-button` in `src/App.vue` and that`s it! 41 | 42 | ```js 43 | export default { 44 | name: "app", 45 | template: `Hello world!`, 46 | data: function() {} 47 | }; 48 | ``` 49 | 4. Launch the app and you should see the `ui5-button` rendered on the screen. 50 | ```sh 51 | npm run serve 52 | ``` 53 | ## Build the Smart Store app 54 | 55 | ### [Step #1 - The App Bar](./docs/Step1_The_App_Bar.md) 56 | ### [Step #2 - The Home Component](./docs/Step2_The_Home_Component.md) 57 | ### [Step #3 - The Routing](./docs/Step3_The_Routing.md) 58 | ### [Step #4 - The Profile Area](./docs/Step4_The_Profile_Area.md) 59 | ### [Step #5 - Detail Page](./docs/Step5_Details.md) 60 | ### [Step #6 - Detail Page Header](./docs/Step6_Detail_Header.md) 61 | ### [Step #7 - Detail Page Filter Bar](./docs/Step7_Detail_FilterBar.md) 62 | ### [Step #8 - Detail Page Create Item Dialog](./docs/Step8_Detail_add_new_item.md) 63 | 64 | ## Resources 65 | 66 | [Sources of Smart Store App Vue.js](https://5d1cb04456271f7e20187559--tender-wescoff-2ef166.netlify.com) 67 | 68 | [Smart Store app React (original)](https://ilhan007.github.io/ui5con-app) 69 | 70 | [List of all available UI5 Web Components](https://sap.github.io/ui5-webcomponents/playground) 71 | -------------------------------------------------------------------------------- /babel.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | presets: ["@vue/app"] 3 | }; 4 | -------------------------------------------------------------------------------- /deploy.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | # abort on errors 4 | set -e 5 | 6 | # build 7 | npm run build 8 | 9 | # navigate into the build output directory 10 | cd dist 11 | 12 | # if you are deploying to a custom domain 13 | # echo 'www.example.com' > CNAME 14 | 15 | git init 16 | git add -A 17 | git commit -m 'deploy' 18 | 19 | # if you are deploying to https://.github.io 20 | # git push -f git@github.com:/.github.io.git master 21 | 22 | # if you are deploying to https://.github.io/ 23 | git push -f git@github.com:StErMi/ui5con-app-vue.git master:gh-pages 24 | 25 | cd - -------------------------------------------------------------------------------- /docs/Step1_The_App_Bar.md: -------------------------------------------------------------------------------- 1 | # Application bar 2 | 3 | Let`s create this beautiful application bar! 4 | ![App bar](./step1.png?raw=true "App bar") 5 | 6 | 1. Remove the following files (generated by default) as they would not be needed. 7 | - ```src/assets/logo.png``` 8 | - ```src/components/HelloWorld.vue``` 9 | - ```src/views/About.vue``` 10 | - ```src/views/Home.vue``` 11 | 12 | 2. Remove the usage of those files from 13 | - ```src/App.vue``` 14 | - ```src/router.js``` 15 | 16 | 3. We will use the `ui5-shellbar` for an app bar, so let's import it in the `src/App.vue`. The component has several convenient attributes that we are going to use. 17 | Note: We are replacing the `ui5-button` from the previous step with the `ui5-shellbar`. 18 | 19 | ```js 20 | 30 | 31 | 41 | ``` 42 | 43 | 1. Copy the `logo.png` and `profile.png` files from `src/assets` from [Sources of Smart Store](https://github.com/stermi/ui5con-app-vue/tree/master/src/assets) (look for a "download" button, when you click on one of the images). 44 | 45 | 2. Then, import those images and set them to the `logo` and `profile` attributes of the `ui5-shellbar`. 46 | 47 | ```js 48 | 60 | 61 | 78 | ``` 79 | 80 | ### [Step #2 - The Home Component](./Step2_The_Home_Component.md) 81 | -------------------------------------------------------------------------------- /docs/Step2_The_Home_Component.md: -------------------------------------------------------------------------------- 1 | # Home component 2 | 3 | In this step we will make use of ```ui5-card``` as main building block for our home view. We will create the "Featured" section. As you can see below, it consists of two "cards" - "Inventory" and "Security". Each of them has a header and content section with a list of important information. 4 | 5 | ![Home](./step2.png?raw=true "Home") 6 | 7 | 1. Create `Home.vue` file under `src/views/`. 8 | 9 | 2. Copy the `data.json` file in `src/data/` 10 | from [Sources of Smart Store](https://github.com/stermi/ui5con-app-vue/blob/master/src/data/). The file has some mockup data, that we will need to fill into the cards. 11 | 12 | 1. Import the `ui5-card` (and other components) in `src/App.vue` to have all UI5 WebComponents imported at one place. 13 | 14 | ```js 15 | // App.vue 16 | import logo from "./assets/logo.png"; 17 | import profile from "./assets/profile.png"; 18 | 19 | import "@ui5/webcomponents/dist/ShellBar"; 20 | import "@ui5/webcomponents/dist/Card"; 21 | import "@ui5/webcomponents/dist/Title"; 22 | import "@ui5/webcomponents/dist/Label"; 23 | import "@ui5/webcomponents/dist/List"; 24 | import "@ui5/webcomponents/dist/CustomListItem"; 25 | import "@ui5/webcomponents/dist/StandardListItem"; 26 | ``` 27 | 28 | 4. Let's start with the "Featured" section. 29 | Create the `Home` component in `src/views/Home.vue`. Note that we import the `data.json` and set its content to the component state, so we can later use it. 30 | 31 | ```js 32 | // Home.js 33 | 39 | 40 | 52 | ``` 53 | 54 | 5. Now, let's add the `ui5-card`. We will also use `ui5-list` (List) and `ui5-li` (StandardListItem) for the `ui5-card` content. 55 | You can get familiar with the API of those components - [Card API](https://sap.github.io/ui5-webcomponents/playground/components/Card/) and [List API](https://sap.github.io/ui5-webcomponents/playground/components/List/). What is going below? 56 | We are just using the API of the UI5 WebComponents ("heading", "subtitle" and "status") and the `v-for` syntax to map the data and the cards will render nicely. 57 | 58 | ```html 59 | 86 | ``` 87 | 88 | 1. Import the `Home` component into the `src/App.vue`. You should be able to see the cards with data inside. OK, the cards are currently expanded to full width and the layout does not look like the picture in the begining - we will handle it in the following step. 89 | ```js 90 | // App.vue 91 | 105 | 106 | 133 | ``` 134 | 135 | 7. The layouting and ordering of the cards is responsibility of the app developer. Replace the content of `src/App.vue ` with the content of [App.vue ](https://github.com/stermi/ui5con-app-vue/blob/master/src/App.vue). Nothing magical, we make use of `display:flex` for the layouting and setting some `min-width` to the `ui5-card`. 136 | 137 | 8. You can copy the rest of the sections in the `Home` component from [Sources of Smart Store (Home.vue)](https://github.com/stermi/ui5con-app-vue/blob/master/src/Home.vue), but don`t forget to copy all the UI5 components imports from the [Sources of Smart Store (App.vue)](https://github.com/stermi/ui5con-app-vue/blob/master/src/App.vue) as some of them are used in these cards. 138 | 139 | ### [Step #3 - The Routing](./Step3_The_Routing.md) 140 | -------------------------------------------------------------------------------- /docs/Step3_The_Routing.md: -------------------------------------------------------------------------------- 1 | # App Routing 2 | 3 | In this step we will create an empty Detail component and set up a routing and navigation between the Home and Detail component. 4 | 5 | 6 | 1. Create `Detail.vue` file under `src/views/`. 7 | 8 | 2. Create the `Detail` component, that will return just the words "Hello World" for now. 9 | 10 | ```js 11 | // Detail.js 12 | 15 | 16 | 26 | ``` 27 | 3. Install the `vue-router`. 28 | ```js 29 | npm install vue-router --save 30 | ``` 31 | 32 | 4. Update the `App.vue` and replace the `` tag in the template with `` and remove all the Home component references. 33 | 5. Create the router configuration file in `src/router.js` with the following content: 34 | 35 | ```js 36 | // src/router.js 37 | import Vue from "vue"; 38 | import Router from "vue-router"; 39 | import Home from "./views/Home.vue"; 40 | import Detail from "./views/Detail.vue"; 41 | 42 | Vue.use(Router); 43 | 44 | export default new Router({ 45 | mode: "history", 46 | base: process.env.BASE_URL, 47 | routes: [ 48 | { 49 | path: "/", 50 | name: "home", 51 | component: Home 52 | }, 53 | { 54 | path: "/detail", 55 | name: "detail", 56 | component: Detail 57 | } 58 | ] 59 | }); 60 | ``` 61 | 6. Update the `main.js` configuration file to let the Vue app use the new router configuraton like this: 62 | 63 | ```js 64 | // src/main.js 65 | import Vue from 'vue' 66 | import App from './App.vue' 67 | import router from './router' 68 | 69 | Vue.config.productionTip = false 70 | 71 | new Vue({ 72 | router, 73 | render: h => h(App) 74 | }).$mount('#app') 75 | ``` 76 | 77 | 7. Now, let's navigate to the `Detail` component by clicking the header of our "Inventory" card. This would require changes in the `Home` component. 78 | 79 | - Bind for the ui5-card `headerClick` event to the method `navToDetail` like this `@headerClick="navToDetail"` 80 | - Add the method `navToDetail` to the list of implemented methods. It will just need to redirect the browser to the `Detail` route we have defined inside the router config `src/router.js` 81 | 82 | ```js 83 | // src/views/Home.vue 84 | 101 | ``` 102 | 103 | Now, you can click the header of the "Inventory" card and navigate to the `Detail` component. 104 | 105 | ### [Step #4 - The Profile Area](./Step4_The_Profile_Area.md) 106 | -------------------------------------------------------------------------------- /docs/Step4_The_Profile_Area.md: -------------------------------------------------------------------------------- 1 | # Profile Area 2 | 3 | What is an admin UI without a profile area? We will create one for our smart store manager and let him change the application theming with one click! 4 | 5 | ![Profile Area](./step4.png?raw=true "Profile Area") 6 | 7 | 1. We will enhance our app bar for this purpose and make it a separate component. 8 | - Create `AppBar.vue` in `src/views`. 9 | - Create the `AppBar` component. 10 | 11 | ```js 12 | // AppBar.vue 13 | 25 | 26 | 41 | 42 | ``` 43 | 44 | 2. Don't forget to update the `App.vue` 45 | 46 | ```js 47 | // App.vue 48 | 55 | 56 | 78 | ``` 79 | 80 | 3. Now, let's add the profile popover. We will use the `ui5-popover` that will open, when the `ui5-shellbar` `profileClick` event is fired, e.g. when someone clicks on the profile image. 81 | 82 | - Add ref to the `ui5-shellbar`. 83 | - Bind for the `profileClick` event to the `onProfileClicked` method like this `@profileClick="onProfileClicked"`. 84 | - Add the `import "@ui5/webcomponents/dist/Popover";` and `import "@ui5/webcomponents/dist/Label";` imports among the other in `src/App.vue`. 85 | - Open the `ui5-popover` in the listener `onProfileClicked`. 86 | 87 | ```js 88 | // AppBar.js 89 | 123 | 124 | 143 | ``` 144 | 145 | Now, you should be able to open the profile area by clicking the profile image! 146 | 147 | 1. Add the theme switch. By default the UI5 WebComponents come with Fiori 3 (known as SAP Quartz), but a high-contrast theme is also supported. To switch to another theme, you can use the framework method `setTheme` from `@ui5/webcomponents-base/Theming`. 148 | We will use the `ui5-switch` component to switch between Fiori 3 and High Contrast Black. 149 | 150 | - Add the `import "@ui5/webcomponents/dist/Switch";` import in `src/App.vue` 151 | - Add the `import "@ui5/webcomponents/dist/ThemePropertiesProvider"`; to enable dynamic theme switching 152 | - Add the `import { setTheme } from "@ui5/webcomponents-base/Theming"`; in `src/views/AppBar.vue` 153 | - Bind for the `ui5-switch` `change` event 154 | - Switch the theme in the event listener `onThemeSwitchPressed` 155 | 156 | ```js 157 | // AppBar.js 158 | 198 | 199 | 225 | ``` 226 | 227 | [Step #5 - Detail Page](./Step5_Details.md) 228 | -------------------------------------------------------------------------------- /docs/Step5_Details.md: -------------------------------------------------------------------------------- 1 | # Page Overview 2 | 3 | Lets now have a look at the Detail page. 4 | We will try to build a page following some guidelines mentioned in [List Report Floorplan](https://experience.sap.com/fiori-design-web/list-report-floorplan-sap-fiori-element/). 5 | 6 | ![Details Header](./images/details.png?raw=true "Detail Header") 7 | 8 | As React is recommending to split your components for an easier maintainability, we will create 2 more components - `Header` and `FilterBar` which represent 2 of the main building blocks of the Detail page. 9 | 10 | ![Details Header Splitted](./images/details-splitted.png?raw=true "Detail Header Splitted") 11 | 12 | 13 | We will be working with a data set called `product.json`, placed inside a `src/data/` directory. 14 | 15 | 16 | In order to have all resources available, copy [these files](https://github.com/stermi/ui5con-app-vue/tree/master/public/img) to your `/src/assets/img` folder. 17 | 18 | 19 | The `Detail` page will have a global state which holds the following information: 20 | - `products`: - all of the items listed in `products.json` (we will query this set and set the result to the `filteredProducts` ) 21 | - `filteredProducts`: currently visibile items in the table (this will be changed a lot based on the user interactions) 22 | - `filterType`: the type of the filter that is currently applied to the page 23 | 24 | Lets now define a state to our component and add a file for styling it (Detail.vue). 25 | 26 | ```js 27 | 60 | ``` 61 | 62 | Lets now render something on the screen. As we mentioned above, we will have 2 components `Header` and `FilterBar`, separated from the `Detail`. 63 | 64 | Add the following template to the Detail.vue. 65 | 66 | ```html 67 | 128 | ``` 129 | 130 | We now can see the table displayed in our page. We need to add some styling for the layout of the page to `Detail.vue`. An example of styling would be the following: 131 | 132 | ```css 133 | 151 | ``` 152 | 153 | Last thing we should do for this page is to style a bit the badge of the status column. We can define a method `getBadgeType` which returns a value to be set to the `color-scheme` property of the badge. 154 | 155 | Here is an example of the implementation add the `getBadgeType` method to the `methods` section: 156 | 157 | ```js 158 | getBadgeType(type) { 159 | switch (type) { 160 | case "In-Stock": 161 | return "8"; 162 | case "Deterioating": 163 | return "2"; 164 | case "Re-Stock": 165 | return "1"; 166 | default: 167 | return "0"; 168 | } 169 | } 170 | ``` 171 | 172 | and call this method when binding the `color-scheme` of the badge in the last cell of the row: 173 | 174 | ```html 175 | {{item.status}} 176 | ``` 177 | 178 | In the end of this step, you should be able to see the following: 179 | 180 | ![Step 5 finished](./images/Step5.png?raw=true "Step 5 Result") 181 | 182 | ### [Step #6 - Detail Header](./Step6_Detail_Header.md) 183 | -------------------------------------------------------------------------------- /docs/Step6_Detail_Header.md: -------------------------------------------------------------------------------- 1 | # Detail Page Header 2 | 3 | It is now time to add a Header component for our Detail Page. 4 | The Header component should look like the following: 5 | 6 | ![Details Header](./images/details-header.png?raw=true "Details Header") 7 | 8 | 9 | You should now create a file called `Header.vue` component inside `src/views`. 10 | 11 | An empty `Header` component should looks like this: 12 | 13 | ```js 14 | 17 | 18 | 26 | ``` 27 | 28 | To place this component inside the `Detail` component, add a
tag to the Detail's `` tag. 29 | 30 | Don't forget to import the Header either in the Detail.vue and add it to the list of components: 31 | ```js 32 | import Header from "@/views/Header.vue" 33 | ``` 34 | 35 | 36 | 37 | e.g. 38 | 39 | ```html 40 |