MARIA KERN NETZ98 GMBH MAGENTO 2 UI COMPONENTS THE JS PART

Similar documents
The UIComponent Ally or Enemy?

Templates and Databinding. SWE 432, Fall 2017 Design and Implementation of Software for the Web

Introduction to Theming in Magento Go"

CSCI 201 Google Chrome DevTools

Single Page Applications using AngularJS

Course Details. Skills Gained. Who Can Benefit. Prerequisites. View Online URL:

React(.js) the Domino Way High-Performance Client for Domino. Knut Herrmann

Magento 2 Certified Professional Developer. Exam Study Guide

Ajax Category Products Extension for Magento 2

Vue.js Framework. Internet Engineering. Spring Pooya Parsa Professor: Bahador Bakhshi CE & IT Department, Amirkabir University of Technology

AngularJS Fundamentals

What's New in Sitecore CMS 6.4

Sweet Themes Are Made of This: The Magento PWA Studio

This course is designed for web developers that want to learn HTML5, CSS3, JavaScript and jquery.

Magento Technical Guidelines

CHOOSING THE RIGHT HTML5 FRAMEWORK To Build Your Mobile Web Application

Full Stack Developer with Java

Extension user guide Cms Tree

HTML version of slides:

GOOGLE AMP EXTENSION FOR MAGENTO 2 USER GUIDE

a Very Short Introduction to AngularJS

MASTERS COURSE IN FULL STACK WEB APPLICATION DEVELOPMENT W W W. W E B S T A C K A C A D E M Y. C O M

Knockout for APEX Dick Dral

Index. alt, 38, 57 class, 86, 88, 101, 107 href, 24, 51, 57 id, 86 88, 98 overview, 37. src, 37, 57. backend, WordPress, 146, 148

Syllabus- Java + Android. Java Fundamentals

Introduction to Sencha Ext JS

Building mobile app using Cordova and AngularJS, common practices. Goran Kopevski

ANGULARJS INTERVIEW QUESTIONS

Stepic Plugins Documentation

C++ Important Questions with Answers

P a g e 1. Danish Technological Institute. Scripting and Web Languages Online Course k Scripting and Web Languages

Frontend UI Training. Whats App :

Financial. AngularJS. AngularJS.

Platform-Independent UI Models: Extraction from UI Prototypes and rendering as W3C Web Components

CS260 Intro to Java & Android 05.Android UI(Part I)

Financial. AngularJS. AngularJS. Download Full Version :

FRONTEND CANCEL ORDER FOR MAGENTO 2

ANGULARJS - MOCK TEST ANGULARJS MOCK TEST II

CS260 Intro to Java & Android 05.Android UI(Part I)

Simple AngularJS thanks to Best Practices

Stencil: The Time for Vanilla Web Components has Arrived

Building Custom UIs for APS 2.0 Applications. Timur Nizametdinov, APS Dynamic UI Lead Developer

Quick Start Manual. Not2Order for Magento 2. Start here

Integrating New Visualizations with Pentaho Using the Viz API

A WEB BASED OFFICE MARKET. CS 297 Project Report Presented to Dr. Christopher Pollett San José State University

Advanced Development with the ArcGIS API for JavaScript. Jeremy Bartley, Kelly Hutchins, Derek Swingley

PHP WITH ANGULAR CURRICULUM. What you will Be Able to Achieve During This Course

Frontend guide. Everything you need to know about HTML, CSS, JavaScript and DOM. Dejan V Čančarević

SIMPLE DETAILS ON CONFIGURABLE PRODUCT FOR MAGENTO 2

CUSTOM OPTION TEMPLATE FOR MAGENTO 2

React.js. a crash course. Jake Zimmerman January 29th, 2016

HTML Advanced Portlets. Your Guides: Ben Rimmasch, Rahul Agrawal

Unravel. Rapid Web Application Reverse Engineering via Interaction Recording, Source Tracing, and Library Detection

Magento Extension User Guide ADMIN LINKS PREVIEW & EDIT. for Magento 2

Ten interesting features of Google s Angular Project

Frontend Frameworks Part 2. SWE 432, Fall 2017 Design and Implementation of Software for the Web

Vue.js Developer friendly, Fast and Versatile

Understanding this structure is pretty straightforward, but nonetheless crucial to working with HTML, CSS, and JavaScript.

Course Outline. ProTech Professional Technical Services, Inc. Comprehensive Angular 7 Course Summary. Description

Rich Client GUI's with RCP & RAP

EECS 4443 Mobile User Interfaces. More About Layouts. Scott MacKenzie. York University. Overview (Review)

WPF and MVVM Study Guides

Lab 1 - Setting up the User s Profile UI

Creating Dynamic UIs with Qt Declarative UI

GUI Design for Android Applications

iframe programming with jquery jquery Summit 2011

If you wish to make an improved product, you must already be engaged in making an inferior one.

"Charting the Course... Comprehensive Angular 6 Course Summary

Standard 1 The student will author web pages using the HyperText Markup Language (HTML)

CREATE SASSY WEB PARTS. Developer Guide to SASS usage in SPFx

Sencha Paris Meetup Switching from Titanium to Sencha Touch: a real life example

EECS 4443 Mobile User Interfaces. More About Layouts. Scott MacKenzie. York University

THE NEW ERA OF WEB DEVELOPMENT. qooxdoo. Andreas Ecker, Derrell Lipman

Cracked IntegralUI Studio for Web all pc software ]

GWT - UIOBJECT CLASS

What if we want the child elements to calculate the offset from the boundaries of the document? CSS LAYOUT. The position Property.

Extending Blue Ocean Keith Zantow

JavaScript Programming

Modern and Responsive Mobile-enabled Web Applications

Mix It Up: Visual Studio 2010 and ASP.NET 4.0. Singapore 25 March 2009

Oracle Developer Day

Research of Mobile Applications Automated Testing Using Uiautomator. Wang Xiu Ming, Huang Xin, Li Gui Zhi, Miao Cui Ping, Shen Ning*

Google Web Toolkit for quick relief of AJAX pain. Kelly Norton & Miguel Méndez

AngularJS AN INTRODUCTION. Introduction to the AngularJS framework

Say goodbye to the pains of Ajax. Yibo

Windows PowerShell Scripting and Toolmaking

Web Programming and Design. MPT Senior Cycle Tutor: Tamara Week 2

GWT MOCK TEST GWT MOCK TEST I

JavaScript Fundamentals_

Advance Mobile& Web Application development using Angular and Native Script

PIMCORE TRAINING GUIDE

Bestseller Products Extension

Arjen de Blok. Senior Technical Consultant bij ICT Groep ( sinds 1995 Programmeren sinds 1990 Technologiën. Links

Decoupled Drupal with Angular

12/05/2017. Geneva ServiceNow Custom Application Development

XAP: extensible Ajax Platform

Kendo UI. Builder by Progress : What's New

Learn Web Development CodersTrust Polska course outline. Hello CodersTrust! Unit 1. HTML Structuring the Web Prerequisites Learning pathway.

1.1 Customize the Layout and Appearance of a Web Page. 1.2 Understand ASP.NET Intrinsic Objects. 1.3 Understand State Information in Web Applications

UI Course HTML: (Html, CSS, JavaScript, JQuery, Bootstrap, AngularJS) Introduction. The World Wide Web (WWW) and history of HTML

Transcription:

MARIA KERN NETZ98 GMBH MAGENTO 2 UI COMPONENTS THE JS PART

Magento 2 UI Components The JS part Maria Kern Senior Frontend Architect at netz98 GmbH www.netz98.de @maja_kern CommerceHero: maria-kern

AGENDA 1 DEFINITION 4 INITIALIZATION PROCESS 2 BASIC STRUCTURE 5 REAL LIFE EXAMPLE 3 USEFUL FUNCTIONS AND PROPERTIES 6 DEBUGGING 4 3

UI components definition

UI COMPONENTS DEFINITION The UI components are: the base for many user interface (UI) elements (buttons, fields, tables, minicart) designed for simple and flexible rendering of user interfaces defined in the module Magento_UI used in Magento frontend and backend 5

UI COMPONENTS DEFINITION BACKEND FRONTEND 6

UI COMPONENTS DEFINITION BACKEND Magento_Ui/js/form/components/fieldset FRONTEND Magento_Ui/js/form/ element/abstract Magento_Ui/js/grid/toolbar Magento_Ui/js/grid/listing 7

UI COMPONENTS DEFINITION BACKEND Magento_Ui/js/form/components/fieldset FRONTEND Magento_Checkout/js/view/cart/totals Magento_Ui/js/form/ element/abstract Magento_Ui/js/grid/toolbar Magento_Ui/js/grid/listing Magento_Checkout/js/view/minicart 8

Basic structure of UI components

BASIC STRUCTURE OF UI COMPONENTS JS DEPENDENCY AND INHERITANCE uiclass uielement uicollection / uicomponent 10

BASIC STRUCTURE OF UI COMPONENTS JS DEPENDENCY AND INHERITANCE uiclass <UI_Module_dir>/view/base/web/js/lib/ core/class.js uielement <UI_Module_dir>/view/base/web/js/lib/ core/element/element.js uicollection / uicomponent <UI_Module_dir>/view/base/web/js/lib/ core/collection.js 11

BASIC STRUCTURE OF UI COMPONENTS JS DEPENDENCY AND INHERITANCE uiclass uielement <UI_Module_dir>/view/base/web/js/lib/ core/class.js the uiclass is an abstract class where all components are extended from <UI_Module_dir>/view/base/web/js/lib/ core/element/element.js uicollection / uicomponent <UI_Module_dir>/view/base/web/js/lib/ core/collection.js 12

MAGENTO 2 UI COMPONENTS - THE JS PART BASIC STRUCTURE OF UI COMPONENTS JS DEPENDENCY AND INHERITANCE uiclass <UI_Module_dir>/view/base/web/js/lib/ core/class.js custom component 1 uielement uicollection / uicomponent <UI_Module_dir>/view/base/web/js/lib/ core/element/element.js use uielement class as base class of your own component, if you won t have child <UI_Module_dir>/view/base/web/js/lib/ core/collection.js components custom component 2 custom component 3 child component other child component other child component 13

MAGENTO 2 UI COMPONENTS - THE JS PART BASIC STRUCTURE OF UI COMPONENTS JS DEPENDENCY AND INHERITANCE uiclass <UI_Module_dir>/view/base/web/js/lib/ core/class.js custom component 1 uielement uicollection / uicomponent <UI_Module_dir>/view/base/web/js/lib/ core/element/element.js use uicollection / uicomponent class as base, if your component will <UI_Module_dir>/view/base/web/js/lib/ core/collection.js contain a collection of child UI components custom component 2 custom component 3 child component other child component other child component 14

MAGENTO 2 UI COMPONENTS - THE JS PART BASIC STRUCTURE OF UI COMPONENTS JS DEPENDENCY AND INHERITANCE uiclass <UI_Module_dir>/view/base/web/js/lib/ core/class.js uielement <UI_Module_dir>/view/base/web/js/lib/ core/element/element.js custom component 1 uicollection / uicomponent <UI_Module_dir>/view/base/web/js/lib/ core/collection.js custom component 2 custom component 3 child component other child component other child component 15

Useful functions and properties

USEFUL FUNCTIONS AND PROPERTIES EXTEND AND INITIALIZE extend() implements inheritance of UI components initialize() is called during instantiation 17

USEFUL FUNCTIONS AND PROPERTIES EXTEND AND INITIALIZE extend() implements inheritance of UI components initialize() is called during instantiation DEPENDENCY 18

USEFUL FUNCTIONS AND PROPERTIES EXTEND AND INITIALIZE extend() implements inheritance of UI components initialize() is called during instantiation INHERITANCE 19

USEFUL FUNCTIONS AND PROPERTIES EXTEND AND INITIALIZE extend() implements inheritance of UI components initialize() is called during instantiation OVERWRITE / EXTEND A METHOD 20

USEFUL FUNCTIONS AND PROPERTIES CONFIGURATION AND FIRST LEVEL PROPERTIES Every component has a defaults object > Declaring properties 21

USEFUL FUNCTIONS AND PROPERTIES CONFIGURATION AND FIRST LEVEL PROPERTIES custom properties 22

USEFUL FUNCTIONS AND PROPERTIES CONFIGURATION AND FIRST LEVEL PROPERTIES a lot of given properties 23

USEFUL FUNCTIONS AND PROPERTIES CONFIGURATION AND FIRST LEVEL PROPERTIES Configuration properties will be available as first level properties this.isvisible 24

USEFUL FUNCTIONS AND PROPERTIES CONFIGURATION AND FIRST LEVEL PROPERTIES A lot of default propertiesand methods are already set by the base classes, e.g.: this.index // name of component this.name // full name of component including parents this.template // path to template file this.component this.gettemplate() this.hastemplate() 25

USEFUL FUNCTIONS AND PROPERTIES KNOCKOUT JS Binding data to HTML Elements by data-bind Attribute 26

USEFUL FUNCTIONS AND PROPERTIES KNOCKOUT JS Declaring observable variables 27

USEFUL FUNCTIONS AND PROPERTIES KNOCKOUT JS Declaring observable variables 28

USEFUL FUNCTIONS AND PROPERTIES HANDLING OF CHILDREN The uicollection class (mainly) provides a lot of methods for handling of child components 29

USEFUL FUNCTIONS AND PROPERTIES HANDLING OF CHILDREN The uicollection class (mainly) provides a lot of methods for handling of child components Called for every child component > Child is given as parameter 30

USEFUL FUNCTIONS AND PROPERTIES HANDLING OF CHILDREN The uicollection class (mainly) provides a lot of methods for handling of child components initelement(child) {} this.elems() this.containers this.getchild( nameofchild ) // UI component this.haschild( nameofchild ) // boolean this.insertchild( nameofcomponent ) 31

Initialization process

INITIALIZATION PROCESS All the configurations are translated into json and added to the body 33

INITIALIZATION PROCESS 34

INITIALIZATION PROCESS All the configurations are translated into json and added to the body 35

INITIALIZATION PROCESS All the configurations are translated into json and added to the body 36

INITIALIZATION PROCESS The app calls Magento_Ui/js/core/renderer/layout and passes the UI component s configuration into the layout 37

INITIALIZATION PROCESS layout.js creates instances of UI components and its child components 38

Real life example

REAL LIFE EXAMPLE UI component map-widget 40

REAL LIFE EXAMPLE UI component map-widget 41

REAL LIFE EXAMPLE child UI component productlist productlist could be used in other components as well 42

REAL LIFE EXAMPLE Initialization UI Components JS and Template files 43

REAL LIFE EXAMPLE Parent component Child component 44

REAL LIFE EXAMPLE Parent extends uicollection class initelement(child) {} this.getchild( productlist ) 45

Options for debugging

OPTIONS FOR DEBUGGING Chrome Knockoutjs Context Debugger click on DOM element inside UI component scope 47

OPTIONS FOR DEBUGGING Magento DevTools by MageSpecialist, with Chrome extension list of all initialized UI components on the actual page with link to inspect the DOM element 48

CONCLUSION UI COMPONENTS THE JS PART Advantages easy teamwork standardized programming common procedures and requirements have already been implemented configuring without inline scripting! Disadvantages it takes time to get familiar with sometimes it feels to be restricted in frontend development 49

THANK YOU! http://xxxxxxxxxxxxx/ Slides References: http://devdocs.magento.com/