From 38861baf634cb5a4a29c88a77361f724e2860332 Mon Sep 17 00:00:00 2001 From: Nick Petalas Date: Fri, 24 May 2024 09:04:48 +0100 Subject: [PATCH] update all code snippets and imports to use genesis tokens from web-core --- .../05_create-a-user-interface.mdx | 2 +- .../02_training-content-day2.mdx | 8 +-- .../03_training-content-day3.mdx | 4 +- .../04_training-content-day4.mdx | 2 +- .../10_web-training/01_web-training-day1.mdx | 58 +++++++++---------- .../10_web-training/02_web-training-day2.mdx | 24 ++++---- .../10_web-training/03_web-training-day3.mdx | 12 ++-- .../10_web-training/04_web-training-day4.mdx | 38 ++++++------ .../01_basics/02_creating-a-new-page.mdx | 8 +-- docs/04_web/01_basics/03_inserting-a-grid.mdx | 2 +- .../01_basics/05_package-json-basics.mdx | 10 ++-- .../02_web-components/01_form/01_button.mdx | 2 +- .../02_web-components/01_form/02_checkbox.mdx | 4 +- .../02_web-components/01_form/03_combobox.mdx | 10 ++-- .../01_form/06_number-field.mdx | 4 +- .../01_form/09_radio-group.mdx | 4 +- .../02_web-components/01_form/10_radio.mdx | 4 +- .../02_web-components/01_form/11_select.mdx | 10 ++-- .../02_web-components/01_form/12_slider.mdx | 4 +- .../01_form/15_text-area.mdx | 4 +- .../01_form/17_text-field.mdx | 4 +- .../01_grid-pro/3-grid-pro-genesis-column.mdx | 2 +- .../02_grids/02_data-grid.mdx | 4 +- .../03_interaction/04_dialog.mdx | 8 +-- .../03_interaction/05_dropdown-menu.mdx | 2 +- .../03_interaction/08_menu.mdx | 2 +- .../03_interaction/09_modal.mdx | 8 +-- .../03_interaction/12_tree-view.mdx | 2 +- .../04_presentation/03_banner.mdx | 4 +- .../02_foundation-header.mdx | 8 +-- .../docs/api/foundation-header.mainstyles.md | 2 +- ...dation-header.navigation.selecttemplate.md | 4 +- ...gement.entitymanagement.headertempalate.md | 2 +- ...tion-entity-management.entitymanagement.md | 2 +- ...ation-entity-management.mainapplication.md | 4 +- ...nagement.mainapplication.selecttemplate.md | 4 +- .../docs/api/foundation-login.definition.md | 2 +- .../docs/api/foundation-login.login.md | 4 +- .../docs/api/foundation-login.styles.md | 2 +- .../docs/api/foundation-login.template.md | 2 +- ...foundation-testing.createcomponentsuite.md | 4 +- .../09_filters/01_foundation-filters.mdx | 2 +- .../10_foundation-layout.mdx | 16 ++--- ...ation-layout.foundationlayoutcomponents.md | 28 ++++----- ...ndation-layout.layoutcomponentwithstate.md | 4 +- .../api/foundation-layout.layoutstyles.md | 2 +- .../api/foundation-layout.layouttemplate.md | 2 +- docs/04_web/12_forms/02_forms-filters.mdx | 4 +- .../14_release-notes/05_previous.mdx | 2 +- 49 files changed, 173 insertions(+), 177 deletions(-) diff --git a/docs/01_getting-started/02_quick-start/05_create-a-user-interface.mdx b/docs/01_getting-started/02_quick-start/05_create-a-user-interface.mdx index 76942ea3d8..f37c58006a 100644 --- a/docs/01_getting-started/02_quick-start/05_create-a-user-interface.mdx +++ b/docs/01_getting-started/02_quick-start/05_create-a-user-interface.mdx @@ -25,7 +25,7 @@ We will make use of the Entity Management component, which includes CRUD functio Add the code below to the **home.template.ts** in the path **client/web/src/routes/home/home.template.ts**. ```html title="home.template.ts" -import {html} from '@microsoft/fast-element'; +import {html} from '@genesislcap/web-core'; import type {Home} from './home'; export const HomeTemplate = html` diff --git a/docs/01_getting-started/06_developer-training/02_training-content-day2.mdx b/docs/01_getting-started/06_developer-training/02_training-content-day2.mdx index 2e9fd4eaae..82fb4b538a 100644 --- a/docs/01_getting-started/06_developer-training/02_training-content-day2.mdx +++ b/docs/01_getting-started/06_developer-training/02_training-content-day2.mdx @@ -92,7 +92,7 @@ We want to be able to insert a Trade grid with data into our project. For this, First, open the file **home.ts** to import the micro front-ends needed, as well as declaring EntityManagement after the imports. ```ts {1,3,5} -import {customElement, FASTElement, observable} from '@microsoft/fast-element'; +import {customElement, GenesisElement, observable} from '@genesislcap/web-core'; ... import {EntityManagement} from '@genesislcap/foundation-entity-management'; @@ -155,7 +155,7 @@ const COLUMNS = [ template, styles, }) -export class Home extends FASTElement { +export class Home extends GenesisElement { @observable columns: any = COLUMNS; constructor() { @@ -167,7 +167,7 @@ export class Home extends FASTElement { We can now insert the grid into our page. Open the file **home.template.ts** and insert the *entity-management* tag using the class attributes we just created. ```jsx {5-11} -import {html, } from '@microsoft/fast-element'; +import {html, } from '@genesislcap/web-core'; import type {Home} from './home'; export const HomeTemplate = html` @@ -372,7 +372,7 @@ Note that the `tradeFormSchema` variable, declared above, pretty much describes Go back to the **home.template.ts** file to import the variables schema and add the properties `createFormUiSchema` `updateFormUiSchema`. ```jsx {3,14,15} -import {html, repeat, when, ref} from '@microsoft/fast-element'; +import {html, repeat, when, ref} from '@genesislcap/web-core'; import type {Home} from './home'; import { tradeFormCreateSchema, tradeFormUpdateSchema } from './schemas'; ... diff --git a/docs/01_getting-started/06_developer-training/03_training-content-day3.mdx b/docs/01_getting-started/06_developer-training/03_training-content-day3.mdx index 8a02f96bbe..66f7863924 100644 --- a/docs/01_getting-started/06_developer-training/03_training-content-day3.mdx +++ b/docs/01_getting-started/06_developer-training/03_training-content-day3.mdx @@ -780,7 +780,7 @@ Open the file **home.ts** and import *Grid Pro* and *Connect*. Then, add them as import {ZeroGridPro} from '@genesislcap/foundation-zero-grid-pro'; import {Connect} from '@genesislcap/foundation-comms'; ... -export class Home extends FASTElement { +export class Home extends GenesisElement { @observable columns: any = COLUMNS; public positionsGrid!: ZeroGridPro; @@ -796,7 +796,7 @@ export class Home extends FASTElement { Finally, go to the file **home.template.ts** and import the required components. Then, add a constant holding the Position columns, and some `
`s to format the final HTML. ```html {1,5-12,15,16,28-42} -import {html, repeat, when, ref} from '@microsoft/fast-element'; +import {html, repeat, when, ref} from '@genesislcap/web-core'; import type {Home} from './home'; import { tradeFormCreateSchema, tradeFormUpdateSchema } from './schemas'; diff --git a/docs/01_getting-started/06_developer-training/04_training-content-day4.mdx b/docs/01_getting-started/06_developer-training/04_training-content-day4.mdx index a0856d4402..cfd5ba474e 100644 --- a/docs/01_getting-started/06_developer-training/04_training-content-day4.mdx +++ b/docs/01_getting-started/06_developer-training/04_training-content-day4.mdx @@ -274,7 +274,7 @@ const COLUMNS = [ template, styles, }) -export class Home extends FASTElement { +export class Home extends GenesisElement { ... constructor() { super(); diff --git a/docs/01_getting-started/10_web-training/01_web-training-day1.mdx b/docs/01_getting-started/10_web-training/01_web-training-day1.mdx index 92e6416094..989b89bac3 100644 --- a/docs/01_getting-started/10_web-training/01_web-training-day1.mdx +++ b/docs/01_getting-started/10_web-training/01_web-training-day1.mdx @@ -199,11 +199,7 @@ This includes **@genesislcap** dependencies. This is where you can change versio "@genesislcap/foundation-zero-grid-pro": "14.15.2", "@genesislcap/foundation-reporting": "14.15.2", "@genesislcap/g2plot-chart": "14.15.2", - "@microsoft/fast-components": "^2.21.6", - "@microsoft/fast-element": "^1.7.0", - "@microsoft/fast-foundation": "^2.33.4", - "@microsoft/fast-router": "^0.4.2", - "@microsoft/fast-web-utilities": "^5.1.0", + "@genesislcap/web-core": "14.178.0", "rxjs": "^7.5.4", "tslib": "^2.3.1" } @@ -266,13 +262,13 @@ The second approach involves design systems and we will cover this topic later i Create folder **./client/web/src/routes/playground/** and create a new empty file called **playground.ts** in there. Then, add this code to **playground.ts**: ```typescript title="../playground/playground.ts" -import { FASTElement, customElement } from "@microsoft/fast-element"; +import { GenesisElement, customElement } from "@genesislcap/web-core"; @customElement({ name: "marketdata-component" }) // custom element being created -export class MarketdataComponent extends FASTElement {} +export class MarketdataComponent extends GenesisElement {} ``` -We've just created a new Web Component extending FASTElement (so, again, we don't have to start from scratch and implement a myriad of attributes and methods). +We've just created a new Web Component extending GenesisElement (so, again, we don't have to start from scratch and implement a myriad of attributes and methods). This component could be anything, like a custom button or even a business component. But, for now, it's just empty and doesn't do much. However, we could already use it anywhere in HTML with the following markup if we wanted: @@ -314,7 +310,7 @@ You should see the **Playground** menu item now. To create an HTML template for our element, we have to import and use the html-tagged template helper and pass the template to the @customElement decorator. ```ts {1,3-7,9} title='playground.ts' -import { FASTElement, customElement, html } from "@microsoft/fast-element"; +import { GenesisElement, customElement, html } from "@genesislcap/web-core"; const myTemplate = html`
@@ -323,7 +319,7 @@ const myTemplate = html` `; @customElement({ name: "marketdata-component", template: myTemplate }) // custom element being created -export class MarketdataComponent extends FASTElement {} +export class MarketdataComponent extends GenesisElement {} ``` As you see, we're defining a const called `myTemplate`, which contains the HTML code. This constant is then passed to the definition of our `customElement` through the `template` parameter. This way, when we use this component, it will display the HTML associated with it. @@ -352,14 +348,14 @@ Let's add an attribute to our MarketdataComponent. Use @attr for primitive prope ```typescript {1,5} title='playground.ts' import { - FASTElement, + GenesisElement, customElement, html, attr, -} from "@microsoft/fast-element"; +} from "@genesislcap/web-core"; @customElement({ name: "marketdata-component", template: myTemplate }) -export class MarketdataComponent extends FASTElement { +export class MarketdataComponent extends GenesisElement { @attr lastPrice: number = 0; } ``` @@ -368,11 +364,11 @@ Having the lastPrice always as zero doesn't make our MarketdataComponent very us ```typescript {8-13,19-25} title='playground.ts' import { - FASTElement, + GenesisElement, customElement, html, attr, -} from "@microsoft/fast-element"; +} from "@genesislcap/web-core"; const myTemplate = html`
@@ -382,7 +378,7 @@ const myTemplate = html` `; @customElement({ name: "marketdata-component", template: myTemplate }) // custom element being created -export class MarketdataComponent extends FASTElement { +export class MarketdataComponent extends GenesisElement { @attr lastPrice: number = 0; public getLastPriceRealTime() { @@ -411,7 +407,7 @@ FAST also provides directives, such as `when` and `repeat` that are very useful Examples: ```typescript {5} -import { FASTElement, customElement, observable, html, when } from "@microsoft/fast-element"; +import { GenesisElement, customElement, observable, html, when } from "@genesislcap/web-core"; const template = html` ... @@ -424,14 +420,14 @@ const template = html` name: "my-app", template }) -export class MyApp extends FASTElement { +export class MyApp extends GenesisElement { @observable ready: boolean = false; ... } ``` ```typescript {5} -import { FASTElement, customElement, observable, html, repeat } from "@microsoft/fast-element"; +import { GenesisElement, customElement, observable, html, repeat } from "@genesislcap/web-core"; const template = html` ... @@ -444,7 +440,7 @@ const template = html` name: "friend-list", template }) -export class FriendList extends FASTElement { +export class FriendList extends GenesisElement { @observable friends: Person[] = []; ... } @@ -456,18 +452,18 @@ Please review the [directives](https://www.fast.design/docs/fast-element/using-d ### Styling our component -FASTElement provides a **css** tagged template helper that allows for the creation of ElementStyles. +GenesisElement provides a **css** tagged template helper that allows for the creation of ElementStyles. Add this code: ```typescript {6,9-13} title='playground.ts' import { - FASTElement, + GenesisElement, customElement, html, attr, css, -} from "@microsoft/fast-element"; +} from "@genesislcap/web-core"; ... const marketdataComponentCSS = css` h4 { @@ -488,12 +484,12 @@ This is the final code: ```typescript title='playground.ts' import { - FASTElement, + GenesisElement, customElement, html, attr, css, -} from "@microsoft/fast-element"; +} from "@genesislcap/web-core"; const marketdataComponentCSS = css` h4 { @@ -513,7 +509,7 @@ const myTemplate = html` template: myTemplate, styles: marketdataComponentCSS, }) // custom element being created -export class MarketdataComponent extends FASTElement { +export class MarketdataComponent extends GenesisElement { @attr lastPrice: number = 0; public getLastPriceRealTime() { @@ -545,7 +541,7 @@ Instrument AAPL 227.12 Steps: -- import _observable_ and _repeat_ from from `@microsoft/fast-element` +- import _observable_ and _repeat_ from from `@genesislcap/web-core` - add a list called **_instruments_** to the MarketdataComponent. Feel free to initialize it with a few instruments, such as `@observable instruments: String[] = ["MSFT", "AAPL"];` - change the `lastPrice` attribute to a list of prices. Feel free to initialize it with corresponding prices, such as `@observable lastPrices: number[] = [101.23, 227.12];` - change `getLastPriceRealTime` to receive the instrument name and return the corresponding price; @@ -638,7 +634,7 @@ npm run bootstrap import { Navigation } from '@genesislcap/foundation-header'; @customElement({ name, template, styles }) -export class MainApplication extends FASTElement { +export class MainApplication extends GenesisElement { @inject(MainRouterConfig) config!: MainRouterConfig; @inject(Navigation) navigation!: Navigation; @@ -662,7 +658,7 @@ export const MainTemplate: ViewTemplate = html` 4. Make sure the `foundation-header` tag is part of the html that you set as the markup for the `defaultLayout` in your router configuration. ```js {3} title='client/web/src/layouts/default.ts' -export const defaultLayout = new FASTElementLayout(html` +export const defaultLayout = new GenesisElementLayout(html`