diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts index 1c2ca2d..7af8497 100644 --- a/src/app/app-routing.module.ts +++ b/src/app/app-routing.module.ts @@ -18,9 +18,11 @@ import {TableDemoComponent} from './demo/view/tabledemo.component'; import {ListDemoComponent} from './demo/view/listdemo.component'; import {TreeDemoComponent} from './demo/view/treedemo.component'; import {AppCrudComponent} from './pages/app.crud.component'; +import {AppBlocksDemoComponent} from './demo/view/app.blocksdemo.component'; import {FloatLabelDemoComponent} from './demo/view/floatlabeldemo.component'; -import { InvalidStateDemoComponent } from './demo/view/invalidstatedemo.component'; -import { AppTimelineDemoComponent } from './pages/app.timelinedemo.component'; +import {InvalidStateDemoComponent} from './demo/view/invalidstatedemo.component'; +import {AppTimelineDemoComponent} from './pages/app.timelinedemo.component'; +import {IconsDemoComponent} from './demo/view/iconsdemo.component'; @NgModule({ imports: [ @@ -47,6 +49,8 @@ import { AppTimelineDemoComponent } from './pages/app.timelinedemo.component'; {path: 'pages/crud', component: AppCrudComponent}, {path: 'pages/timeline', component: AppTimelineDemoComponent}, {path: 'pages/empty', component: EmptyDemoComponent}, + {path: 'icons', component: IconsDemoComponent}, + {path: 'blocks', component: AppBlocksDemoComponent}, {path: 'documentation', component: DocumentationComponent} ] }, diff --git a/src/app/app.blockviewer.component.scss b/src/app/app.blockviewer.component.scss new file mode 100644 index 0000000..e45224f --- /dev/null +++ b/src/app/app.blockviewer.component.scss @@ -0,0 +1,148 @@ +.block-section { + margin-bottom: 4rem; + overflow: hidden; +} + +.block-header { + padding: 1rem 2rem; + background-color: var(--surface-section); + border-top-left-radius: 12px; + border-top-right-radius: 12px; + border:1px solid var(--surface-d); + display: flex; + align-items: center; + justify-content: space-between; + + .block-title { + font-weight: 700; + display: inline-flex; + align-items: center; + + .badge-free { + border-radius: 4px; + padding: .25rem .5rem; + background-color: var(--orange-500); + color: white; + margin-left: 1rem; + font-weight: 700; + font-size: .875rem; + } + } + + .block-actions { + display: flex; + align-items: center; + justify-content: space-between; + user-select: none; + margin-left: 1rem; + + a { + display: flex; + align-items: center; + margin-right: .75rem; + padding: .5rem 1rem; + border-radius: 4px; + font-weight: 600; + border: 1px solid transparent; + transition: background-color .2s; + cursor: pointer; + + &:last-child { + margin-right: 0; + } + + &:not(.block-action-disabled):hover { + background-color: var(--surface-c); + } + + &.block-action-active { + border-color: var(--primary-color); + color: var(--primary-color); + } + + &.block-action-copy { + i { + color: var(--primary-color); + font-size: 1.25rem; + } + } + + &.block-action-disabled { + opacity: .6; + cursor: auto !important; + } + + i { + margin-right: .5rem; + } + } + } +} + +.block-content { + padding: 0; + border:1px solid var(--surface-d); + border-top: 0 none; + border-bottom-left-radius: 12px; + border-bottom-right-radius: 12px; + overflow: hidden; +} + +pre[class*="language-"] { + margin: 0 !important; + + &:before, &:after { + display: none !important; + } + + code { + border-left: 0 none !important; + box-shadow: none !important; + background: var(--surface-e) !important; + margin: 0; + color: var(--text-color); + font-size: 14px; + padding: 0 2rem !important; + + .token { + &.tag, + &.keyword { + color: #2196F3 !important; + } + + &.attr-name, + &.attr-string { + color: #2196F3 !important; + } + + &.attr-value { + color: #4CAF50 !important; + } + + &.punctuation { + color: var(--text-color); + } + + &.operator, + &.string { + background: transparent; + } + } + } +} + +@media screen and (max-width: 575px) { + .block-header { + flex-direction: column; + align-items: start; + + .block-actions { + margin-top: 1rem; + margin-left: 0; + } + } +} +::ng-deep pre{ + margin: 0 !important; + padding: 0 !important; +} \ No newline at end of file diff --git a/src/app/app.blockviewer.component.ts b/src/app/app.blockviewer.component.ts new file mode 100644 index 0000000..9d8422a --- /dev/null +++ b/src/app/app.blockviewer.component.ts @@ -0,0 +1,78 @@ +import { Component, Input } from '@angular/core'; +import { environment } from '../environments/environment'; +enum BlockView { + PREVIEW, + CODE +} + +@Component({ + selector: 'block-viewer', + template: ` +
+
+ + {{header}} + Free + New + + +
+
+
+ +
+
+ {{code}} +
+
+
+ `, + styleUrls: ['./app.blockviewer.component.scss'] +}) +export class BlockViewer { + + @Input() header: string; + + @Input() code: string; + + @Input() containerClass: string; + + @Input() previewStyle: string; + + @Input() free: boolean = false; + + @Input() new: boolean = false; + + BlockView = BlockView; + + blockView: BlockView = BlockView.PREVIEW; + + activateView(event: Event, blockView: BlockView) { + if (!this.codeDisabled) { + this.blockView = blockView; + } + + event.preventDefault(); + } + + async copyCode(event: Event) { + if (!this.codeDisabled) { + await navigator.clipboard.writeText(this.code); + } + + event.preventDefault(); + } + + get codeDisabled() { + return this.free ? false : (environment ? environment.production: false); + } + +} diff --git a/src/app/app.code.component.scss b/src/app/app.code.component.scss index c657599..c080de1 100644 --- a/src/app/app.code.component.scss +++ b/src/app/app.code.component.scss @@ -21,7 +21,6 @@ i:not([class~="pi"]) { letter-spacing: .5px; border-radius: 3px; font-weight: 600; - margin: 0 2px; } :host ::ng-deep pre[class*="language-"] { @@ -33,10 +32,11 @@ i:not([class~="pi"]) { } code { - border-left: 10px solid var(--surface-d) !important; + border-left: 0px solid var(--surface-d) !important; box-shadow: none !important; background: var(--surface-b) !important; - margin: 1em 0; + margin: 0 !important; + padding-bottom: 1.5rem; color: var(--text-color); font-size: 14px; diff --git a/src/app/app.menu.component.ts b/src/app/app.menu.component.ts index dbaff1b..f2c69b4 100644 --- a/src/app/app.menu.component.ts +++ b/src/app/app.menu.component.ts @@ -36,7 +36,7 @@ export class AppMenuComponent implements OnInit { }] }, { - label: 'UI Kit', + label: 'UI Components', items: [ {label: 'Form Layout', icon: 'pi pi-fw pi-id-card', routerLink: ['/uikit/formlayout']}, {label: 'Input', icon: 'pi pi-fw pi-check-square', routerLink: ['/uikit/input']}, @@ -55,6 +55,19 @@ export class AppMenuComponent implements OnInit { {label: 'Misc', icon: 'pi pi-fw pi-circle-off', routerLink: ['/uikit/misc']} ] }, + { + label:'UI Blocks', + items:[ + {label: 'Free Blocks', icon: 'pi pi-fw pi-eye', routerLink: ['/blocks'], + badge:'NEW'}, + {label: 'All Blocks', icon: 'pi pi-fw pi-globe', url: ['https://www.primefaces.org/primeblocks-ng/#/']}, + ] + }, + {label:'Icons', + items:[ + {label: 'PrimeIcons', icon: 'pi pi-fw pi-prime', routerLink: ['/icons']}, + ] + }, { label: 'Pages', items: [ diff --git a/src/app/app.menuitem.component.ts b/src/app/app.menuitem.component.ts index d690171..047b304 100644 --- a/src/app/app.menuitem.component.ts +++ b/src/app/app.menuitem.component.ts @@ -25,7 +25,7 @@ import {AppMainComponent} from './app.main.component'; [routerLinkActiveOptions]="{exact: true}" [attr.target]="item.target" [attr.tabindex]="0" pRipple> {{item.label}} - {{item.badge}} + {{item.badge}}

Install PrimeNG

- - npm install primeng@latest --save - npm install primeicons@latest --save - + +npm install primeng@latest --save +npm install primeicons@latest --save +

Add PrimeNG CSS at styles section in angular.json.

- - "styles": [ - "styles.scss" //your styles and overrides - ], - + +"styles": [ + "styles.scss" //your styles and overrides +], +

Last part is adding theme and layout css files, in the CLI app they are defined using link tags in index.html so the demo can switch them on the fly by changing the path however if this is not a requirement, you may also add them to the styles configuration above so they go inside the bundle.

@@ -326,7 +326,6 @@ $menuTooltipTextColor:#ffffff !default;
//reused color variables -//reused color variables $shade000:#ffffff !default; //surface $shade100:#FCFCFC !default; //header background $shade200:rgba($primaryColor,.2) !default; //hover background diff --git a/src/app/demo/view/iconsdemo.component.html b/src/app/demo/view/iconsdemo.component.html new file mode 100644 index 0000000..637507c --- /dev/null +++ b/src/app/demo/view/iconsdemo.component.html @@ -0,0 +1,57 @@ +
+

Icons

+ +
Download
+ +npm install primeicons --save + + +
Getting Started
+

PrimeIcons use the pi pi-{icon} syntax such as pi pi-check. + A standalone icon can be displayed using an element such as i or span

+ + +<i class="pi pi-check"></i> +<i class="pi pi-times"></i> + + + + + +
Size
+

Size of the icons can easily be changed using font-size property.

+ + +<i class="pi pi-check"></i> + + + + + +<i class="pi pi-check" style="font-size: 2rem"></i> + + + + +
Spinning Animation
+

Special pi-spin class applies infinite rotate to an icon.

+ + +<i class="pi pi-spin pi-spinner" style="font-size: 2rem"></i> + + + + +
List of Icons
+

Here is the current list of PrimeIcons, more icons will be added periodically. You may also request new icons at the issue tracker.

+
+ +
+ +
+
+ +
pi-{{icon.properties.name}}
+
+
+
diff --git a/src/app/demo/view/iconsdemo.component.scss b/src/app/demo/view/iconsdemo.component.scss new file mode 100644 index 0000000..d5805f6 --- /dev/null +++ b/src/app/demo/view/iconsdemo.component.scss @@ -0,0 +1,19 @@ +.icon-filter { + width: 100%; + padding: 1rem; + margin: 1rem 0 1.5rem 0; +} + +.icons-list { + text-align: center; + + i { + font-size: 1.5rem; + color: var(--text-color-secondary); + margin-bottom: .5rem; + } + + .md-2 { + padding-bottom: 2rem; + } +} diff --git a/src/app/demo/view/iconsdemo.component.ts b/src/app/demo/view/iconsdemo.component.ts new file mode 100644 index 0000000..341c5a4 --- /dev/null +++ b/src/app/demo/view/iconsdemo.component.ts @@ -0,0 +1,53 @@ +import { Component, OnInit } from '@angular/core'; +import { IconService } from '../service/iconservice'; + +@Component({ + selector: 'app-iconsdemo', + templateUrl: './iconsdemo.component.html', + styleUrls: ['./iconsdemo.component.scss'] +}) +export class IconsDemoComponent implements OnInit { + + icons: any[]; + + filteredIcons: any[]; + + selectedIcon: any; + + constructor(private iconService : IconService) { } + + ngOnInit() { + this.iconService.getIcons().subscribe(data => { + data = data.filter(value => { + return value.icon.tags.indexOf('deprecate') === -1; + }); + + let icons = data; + icons.sort((icon1, icon2) => { + if(icon1.properties.name < icon2.properties.name) + return -1; + else if(icon1.properties.name < icon2.properties.name) + return 1; + else + return 0; + }); + + this.icons = icons; + this.filteredIcons = data; + }); + } + + onFilter(event: KeyboardEvent): void { + const searchText = (event.target as HTMLInputElement).value; + + if (!searchText) { + this.filteredIcons = this.icons; + } + else { + this.filteredIcons = this.icons.filter( it => { + return it.icon.tags[0].includes(searchText); + }); + } + } + +} diff --git a/src/app/demo/view/tabledemo.component.html b/src/app/demo/view/tabledemo.component.html index 33fa0f4..62e2fd6 100644 --- a/src/app/demo/view/tabledemo.component.html +++ b/src/app/demo/view/tabledemo.component.html @@ -1,197 +1,139 @@
-
Default
-

Pagination, sorting, filtering and checkbox selection.

- +
Filter Menu
+ -
-
- List of Customers -
- +
+ + - +
- - - - -
+ +
Name - +
- -
+ +
Country - +
- -
+ +
Agent - + + +
+ Agent Picker +
+
+ + + +
+ + {{option.name}} +
+
+
+
+
- -
+ +
Date - +
- -
+ +
+ Balance + +
+ + +
Status - + + + + + {{option.label}} + + + +
- -
+ +
Activity - + + + +
+ {{activityValues[0]}} + {{activityValues[1]}} +
+
+
+
+ + +
+ Verified +
- - - - - - - Name + + {{customer.name}} - - Country -
- - {{customer.country.name}} -
+ + + {{customer.country.name}} - - Representative -
- - {{customer.representative.name}} -
+ + + {{customer.representative.name}} - - Date + {{customer.date | date: 'MM/dd/yyyy'}} - - Status + + {{customer.balance | currency:'USD':'symbol'}} + + {{customer.status}} - - Activity + - - + +
- No customers found. + No customers found. - +
-
-
-
-
Customized
-

Scrollable table with gridlines (.p-datatable-gridlines), striped rows (.p-datatable-striped) and smaller paddings (p-datatable-sm).

- - -
- List of Customers - - - - -
-
- - - Name - - - Country - - - Representative - - - Date - - - Status - - - Activity - - - - - - - - Name - {{customer.name}} - - - Country - - {{customer.country.name}} - - - Representative - - {{customer.representative.name}} - - - Date - {{customer.date}} - - - Status - {{customer.status}} - - - Activity - - - - - - - No customers found. - - -
-
@@ -203,7 +145,7 @@ Name - Id + Id Country Date Company @@ -216,7 +158,7 @@ {{customer.name}} - {{customer.id}} + {{customer.id}} {{customer.country.name}} {{customer.date}} {{customer.company}} @@ -305,7 +247,7 @@
-
Row Group and Scrolling
+
Subheader Grouping
@@ -319,26 +261,26 @@ - + {{customer.representative.name}} - Name + Name {{customer.name}} - Country + Country {{customer.country.name}} - Company + Company {{customer.company}} - Status + Status {{customer.status}} - Date + Date {{customer.date}} diff --git a/src/app/demo/view/tabledemo.component.ts b/src/app/demo/view/tabledemo.component.ts index 6fc2c50..3626351 100644 --- a/src/app/demo/view/tabledemo.component.ts +++ b/src/app/demo/view/tabledemo.component.ts @@ -1,9 +1,10 @@ -import {Component, OnInit, ViewChild, ChangeDetectorRef} from '@angular/core'; +import {Component, OnInit, ViewChild, ChangeDetectorRef, ElementRef} from '@angular/core'; import {Customer, Representative} from '../domain/customer'; import {CustomerService} from '../service/customerservice'; import {Product} from '../domain/product'; import {ProductService} from '../service/productservice'; import {Table} from 'primeng/table'; +import {InputText} from 'primeng/inputtext'; import { MessageService, ConfirmationService } from 'primeng/api' @Component({ @@ -51,13 +52,19 @@ export class TableDemoComponent implements OnInit { idFrozen: boolean = false; + loading:boolean = true; + @ViewChild('dt') table: Table; + @ViewChild('filter') filter: ElementRef; + constructor(private customerService: CustomerService, private productService: ProductService, private messageService: MessageService, private confirmService: ConfirmationService, private cd: ChangeDetectorRef) {} ngOnInit() { this.customerService.getCustomersLarge().then(customers => { this.customers1 = customers; + this.loading = false; + // @ts-ignore this.customers1.forEach(customer => customer.date = new Date(customer.date)); }); @@ -130,4 +137,9 @@ export class TableDemoComponent implements OnInit { formatCurrency(value) { return value.toLocaleString('en-US', {style: 'currency', currency: 'USD'}); } + + clear(table: Table) { + table.clear(); + this.filter.nativeElement.value = ''; + } } diff --git a/src/assets/demo/images/blocks/hero/hero-1.png b/src/assets/demo/images/blocks/hero/hero-1.png new file mode 100644 index 0000000..18835ad Binary files /dev/null and b/src/assets/demo/images/blocks/hero/hero-1.png differ diff --git a/src/assets/demo/images/blocks/logos/hyper.svg b/src/assets/demo/images/blocks/logos/hyper.svg new file mode 100644 index 0000000..acf30bc --- /dev/null +++ b/src/assets/demo/images/blocks/logos/hyper.svg @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/src/assets/layout/layout.css b/src/assets/layout/layout.css index 42a15d1..22c0a74 100644 --- a/src/assets/layout/layout.css +++ b/src/assets/layout/layout.css @@ -240,7 +240,7 @@ a { } .layout-menu li .layout-menuitem-root-text { text-transform: uppercase; - color: var(--text-color-secondary); + color: var(--surface-900); font-weight: 600; margin-bottom: 0.5rem; font-size: 0.875rem; @@ -273,6 +273,7 @@ a { } .layout-menu li a.router-link-exact-active { font-weight: 700; + color: var(--primary-color); } .layout-menu li.active-menuitem > a .menuitem-toggle-icon:before { content: "\e933"; diff --git a/src/assets/sass/layout/_menu.scss b/src/assets/sass/layout/_menu.scss index 8e8751b..255788b 100644 --- a/src/assets/sass/layout/_menu.scss +++ b/src/assets/sass/layout/_menu.scss @@ -30,7 +30,7 @@ .layout-menuitem-root-text { text-transform: uppercase; - color:var(--text-color-secondary); + color:var(--surface-900); font-weight: 600; margin-bottom: .5rem; font-size: .875rem; @@ -65,6 +65,7 @@ &.router-link-exact-active { font-weight: 700; + color: var(--primary-color); } } diff --git a/src/index.html b/src/index.html index 9ae0616..a50c2c4 100644 --- a/src/index.html +++ b/src/index.html @@ -2,7 +2,7 @@ - Sakai PrimeNG + Sakai - PrimeNG