-
Notifications
You must be signed in to change notification settings - Fork 125
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: (Core) component for object marker with document changes (#3178)
* Object marker directive changes Object marker directive changes renaimg the dir and committing the build issues renaimg the dir and committing the build issues Updating the RC verion of style to the latest Updating the RC verion of style to the latest Update object-marker.component.spec.ts updating the documentation updating the documentation Updating the comments Updating the comments adding icon to the content dynamically adding icon to the content dynamically updating the test cases updating the test cases updating the code change for the glyph icon change updating the code change for the glyph icon change updating the test cases updating the test cases * updating the template in Object Marker updating the template in Object Marker * underline on hover fixed underline on hover fixed Update package-lock.json removing unwanter variables and adding label properties removing unwanter variables and adding label properties Revert "Update package-lock.json" This reverts commit 76bdbdb. * documentation changes documentation changes * Object marker directive changes Object marker directive changes renaimg the dir and committing the build issues renaimg the dir and committing the build issues Updating the RC verion of style to the latest Updating the RC verion of style to the latest Update object-marker.component.spec.ts updating the documentation updating the documentation Updating the comments Updating the comments adding icon to the content dynamically adding icon to the content dynamically updating the test cases updating the test cases updating the code change for the glyph icon change updating the code change for the glyph icon change updating the test cases updating the test cases updating the template in Object Marker updating the template in Object Marker underline on hover fixed underline on hover fixed Update package-lock.json removing unwanter variables and adding label properties removing unwanter variables and adding label properties Revert "Update package-lock.json" This reverts commit 76bdbdb. * Update package-lock.json
- Loading branch information
1 parent
ef81011
commit 48961d4
Showing
21 changed files
with
348 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
...core/component-docs/object-marker/examples/object-marker-Icon-text-example.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<span fd-object-marker glyph="add-favorite" aria-label="Favourite Icon with Text" label="Favourite"></span> | ||
<span fd-object-marker glyph="flag" aria-label="Flag Icon with Text" label="Flag"></span> | ||
<span fd-object-marker glyph="user-edit" aria-label="Edit Icon with Text" label="Edit"></span> | ||
<span fd-object-marker glyph="private" aria-label="Locked Icon with Text" label="Locked"></span> | ||
<span fd-object-marker glyph="request" aria-label="Request Icon with Text" label="Request"></span> |
15 changes: 15 additions & 0 deletions
15
...core/component-docs/object-marker/examples/object-marker-clickable-example.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<a | ||
fd-object-marker | ||
glyph="add-favorite" | ||
clickable="true" | ||
aria-label="Object Maker with Text Clickable" | ||
label="Favourite" | ||
></a> | ||
<a | ||
fd-object-marker | ||
[glyph]="glyph" | ||
clickable="true" | ||
aria-label="Object Maker with Text Clickable" | ||
(click)="changeGlyph()" | ||
label="Locked" | ||
></a> |
12 changes: 12 additions & 0 deletions
12
...p/core/component-docs/object-marker/examples/object-marker-clickable-example.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { Component } from '@angular/core'; | ||
|
||
@Component({ | ||
selector: 'fd-object-marker-clickable-example', | ||
templateUrl: './object-marker-clickable-example.component.html' | ||
}) | ||
export class ObjectMarkerClickableExampleComponent { | ||
glyph = 'private'; | ||
changeGlyph(): void { | ||
this.glyph = 'add-favorite'; | ||
} | ||
} |
5 changes: 5 additions & 0 deletions
5
...s/src/app/core/component-docs/object-marker/examples/object-marker-example.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<span fd-object-marker glyph="add-favorite" title="Favorite" aria-label="Favourite Icon" aria-hidden="true"></span> | ||
<span fd-object-marker glyph="flag" title="Flag" aria-label="Favourite Flag" aria-hidden="true"></span> | ||
<span fd-object-marker glyph="request" title="Request" aria-label="Favourite Request" aria-hidden="true"></span> | ||
<span fd-object-marker glyph="user-edit" title="Editable" aria-label="Favourite Editable" aria-hidden="true"></span> | ||
<span fd-object-marker glyph="private" title="Private" aria-label="Favourite Private" aria-hidden="true"></span> |
19 changes: 19 additions & 0 deletions
19
...ocs/src/app/core/component-docs/object-marker/examples/object-marker-example.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { Component } from '@angular/core'; | ||
|
||
@Component({ | ||
selector: 'fd-object-marker-example', | ||
templateUrl: './object-marker-example.component.html' | ||
}) | ||
export class ObjectMarkerExampleComponent {} | ||
|
||
@Component({ | ||
selector: 'fd-object-marker-icon-text-example', | ||
templateUrl: './object-marker-Icon-text-example.component.html' | ||
}) | ||
export class ObjectMarkerIconAndTextExampleComponent {} | ||
|
||
@Component({ | ||
selector: 'fd-object-marker-text-example', | ||
templateUrl: './object-marker-text-example.component.html' | ||
}) | ||
export class ObjectMarkerTextExampleComponent {} |
4 changes: 4 additions & 0 deletions
4
.../app/core/component-docs/object-marker/examples/object-marker-text-example.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<span fd-object-marker aria-label="Object Maker with Text" label="Draft"></span> | ||
<span fd-object-marker aria-label="Object Maker with Text" label="Request"></span> | ||
<a fd-object-marker clickable="true" aria-label="Object Maker with only Text Clickable" label="Locked"></a> | ||
<a fd-object-marker clickable="true" aria-label="Object Maker with only Text Clickable" label="Edit"></a> |
46 changes: 46 additions & 0 deletions
46
apps/docs/src/app/core/component-docs/object-marker/object-marker-docs.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
<fd-docs-section-title id="icon-only" componentName="objectmarker"> | ||
Object marker Only Icon Example | ||
</fd-docs-section-title> | ||
<description> | ||
Standard list of icon used of the Object marker use <code>glyph</code> property to add icon. | ||
</description> | ||
<component-example> | ||
<fd-object-marker-example></fd-object-marker-example> | ||
</component-example> | ||
<code-example [exampleFiles]="objectMarkerIconOnly"></code-example> | ||
<separator></separator> | ||
|
||
<fd-docs-section-title id="Object-marker-text" componentName="objectmarker"> | ||
Object marker Text and clickable Text | ||
</fd-docs-section-title> | ||
<description> | ||
Standard Object marker Text and clickable use <code>clickable</code> boolean property to add hovering effects. | ||
</description> | ||
<component-example> | ||
<fd-object-marker-text-example></fd-object-marker-text-example> | ||
</component-example> | ||
<code-example [exampleFiles]="objectMarkerText"></code-example> | ||
<separator></separator> | ||
|
||
<fd-docs-section-title id="icon-text" componentName="objectmarker"> | ||
Object marker Icon and text readonly. | ||
</fd-docs-section-title> | ||
<description> Standard Object marker with icon and text use <code>glyph</code> property to add icon. </description> | ||
<component-example> | ||
<fd-object-marker-icon-text-example></fd-object-marker-icon-text-example> | ||
</component-example> | ||
<code-example [exampleFiles]="objectMarkerIconandText"></code-example> | ||
<separator></separator> | ||
|
||
<fd-docs-section-title id="clickable" componentName="objectmarker"> | ||
Object marker icon and text clickable. | ||
</fd-docs-section-title> | ||
<description> | ||
Standard Object marker with icon and text with clickable use <code>clickable</code> boolean property to add hovering | ||
effects. | ||
</description> | ||
<component-example> | ||
<fd-object-marker-clickable-example></fd-object-marker-clickable-example> | ||
</component-example> | ||
<code-example [exampleFiles]="objectMarkerClickable"></code-example> | ||
<separator></separator> |
48 changes: 48 additions & 0 deletions
48
apps/docs/src/app/core/component-docs/object-marker/object-marker-docs.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import { Component, OnInit } from '@angular/core'; | ||
import { ExampleFile } from '../../../documentation/core-helpers/code-example/example-file'; | ||
import * as ObjectMarkerExample from '!raw-loader!./examples/object-marker-example.component.html'; | ||
import * as ObjectMarkerIconandText from '!raw-loader!./examples/object-marker-Icon-text-example.component.html'; | ||
import * as ObjectMarkerClickable from '!raw-loader!./examples/object-marker-clickable-example.component.html'; | ||
import * as ObjectMarkerText from '!raw-loader!./examples/object-marker-text-example.component.html'; | ||
import * as ObjectMarkerClickAble from '!raw-loader!./examples/object-marker-clickable-example.component.ts'; | ||
|
||
@Component({ | ||
selector: 'fd-object-marker-docs', | ||
templateUrl: './object-marker-docs.component.html' | ||
}) | ||
export class ObjectMarkerDocsComponent { | ||
objectMarkerIconOnly: ExampleFile[] = [ | ||
{ | ||
language: 'html', | ||
code: ObjectMarkerExample, | ||
fileName: 'object-marker-example' | ||
} | ||
]; | ||
objectMarkerIconandText: ExampleFile[] = [ | ||
{ | ||
language: 'html', | ||
code: ObjectMarkerIconandText, | ||
fileName: 'object-marker-example' | ||
} | ||
]; | ||
objectMarkerText: ExampleFile[] = [ | ||
{ | ||
language: 'html', | ||
code: ObjectMarkerText, | ||
fileName: 'object-marker-example' | ||
} | ||
]; | ||
objectMarkerClickable: ExampleFile[] = [ | ||
{ | ||
language: 'html', | ||
code: ObjectMarkerClickable, | ||
fileName: 'object-marker-clickable-example' | ||
}, | ||
{ | ||
language: 'typescript', | ||
code: ObjectMarkerClickAble, | ||
fileName: 'object-marker-clickable-example', | ||
component: 'ObjectMarkerClickableExampleComponent' | ||
} | ||
]; | ||
} |
39 changes: 39 additions & 0 deletions
39
apps/docs/src/app/core/component-docs/object-marker/object-marker-docs.module.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import { NgModule, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core'; | ||
import { Routes, RouterModule } from '@angular/router'; | ||
import { ObjectMarkerModule } from '@fundamental-ngx/core'; | ||
import { ObjectMarkerDocsComponent } from './object-marker-docs.component'; | ||
import { ObjectMarkerHeaderComponent } from './object-marker-header/object-marker-header.component'; | ||
import { ApiComponent } from '../../../documentation/core-helpers/api/api.component'; | ||
import { API_FILES } from '../../api-files'; | ||
import { | ||
ObjectMarkerExampleComponent, | ||
ObjectMarkerIconAndTextExampleComponent, | ||
ObjectMarkerTextExampleComponent | ||
} from './examples/object-marker-example.component'; | ||
import { SharedDocumentationPageModule } from '../../../documentation/shared-documentation-page.module'; | ||
import { ObjectMarkerClickableExampleComponent } from './examples/object-marker-clickable-example.component'; | ||
|
||
const routes: Routes = [ | ||
{ | ||
path: '', | ||
component: ObjectMarkerHeaderComponent, | ||
children: [ | ||
{ path: '', component: ObjectMarkerDocsComponent }, | ||
{ path: 'api', component: ApiComponent, data: { content: API_FILES.objectMarker } } | ||
] | ||
} | ||
]; | ||
|
||
@NgModule({ | ||
imports: [RouterModule.forChild(routes), ObjectMarkerModule, SharedDocumentationPageModule], | ||
exports: [RouterModule], | ||
declarations: [ | ||
ObjectMarkerDocsComponent, | ||
ObjectMarkerHeaderComponent, | ||
ObjectMarkerExampleComponent, | ||
ObjectMarkerIconAndTextExampleComponent, | ||
ObjectMarkerClickableExampleComponent, | ||
ObjectMarkerTextExampleComponent | ||
] | ||
}) | ||
export class ObjectMarkerDocsModule {} |
12 changes: 12 additions & 0 deletions
12
...ore/component-docs/object-marker/object-marker-header/object-marker-header.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<header>Object Marker</header> | ||
<description> | ||
<p> | ||
Object Marker is replacing the Badges With the self-explanatory statuses Flag and Favorite are always displayed | ||
as an icon, | ||
</p> | ||
<p>Generic indication of marked object with diffrent set of icon.</p> | ||
</description> | ||
<import module="ObjectMarkerModule"></import> | ||
|
||
<fd-header-tabs></fd-header-tabs> | ||
<router-outlet></router-outlet> |
7 changes: 7 additions & 0 deletions
7
.../core/component-docs/object-marker/object-marker-header/object-marker-header.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { Component, OnInit } from '@angular/core'; | ||
|
||
@Component({ | ||
selector: 'fd-object-marker-header', | ||
templateUrl: './object-marker-header.component.html' | ||
}) | ||
export class ObjectMarkerHeaderComponent {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
@import '~fundamental-styles/dist/object-marker'; |
41 changes: 41 additions & 0 deletions
41
libs/core/src/lib/object-marker/object-marker.component.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import { Component, ViewChild } from '@angular/core'; | ||
import { async, ComponentFixture, TestBed } from '@angular/core/testing'; | ||
import { By } from '@angular/platform-browser'; | ||
import { ObjectMarkerComponent } from './object-marker.component'; | ||
|
||
@Component({ | ||
selector: 'fd-test-object-marker', | ||
template: ` <span fd-object-marker>Test Object Marker</span> ` | ||
}) | ||
class TestObjectMarkerComponent { | ||
@ViewChild(ObjectMarkerComponent, { static: true }) | ||
objectMarkerComponent: ObjectMarkerComponent; | ||
} | ||
|
||
describe('ObjectMarkerComponent', () => { | ||
let component: ObjectMarkerComponent; | ||
let fixture: ComponentFixture<TestObjectMarkerComponent>; | ||
|
||
beforeEach(async(() => { | ||
TestBed.configureTestingModule({ | ||
declarations: [ObjectMarkerComponent, TestObjectMarkerComponent] | ||
}).compileComponents(); | ||
})); | ||
|
||
beforeEach(() => { | ||
fixture = TestBed.createComponent(TestObjectMarkerComponent); | ||
component = fixture.componentInstance.objectMarkerComponent; | ||
fixture.detectChanges(); | ||
}); | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
|
||
it('Should Add Clickable Class', () => { | ||
component.clickable = true; | ||
component.buildComponentCssClass(); | ||
fixture.detectChanges(); | ||
expect(component.elementRef().nativeElement.classList.contains('fd-object-marker--link')).toBe(true); | ||
}); | ||
}); |
64 changes: 64 additions & 0 deletions
64
libs/core/src/lib/object-marker/object-marker.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
import { | ||
Component, | ||
OnInit, | ||
ViewEncapsulation, | ||
ChangeDetectionStrategy, | ||
Input, | ||
OnChanges, | ||
ElementRef | ||
} from '@angular/core'; | ||
import { CssClassBuilder, applyCssClass } from '../utils/public_api'; | ||
|
||
@Component({ | ||
// tslint:disable-next-line:component-selector | ||
selector: '[fd-object-marker]', | ||
template: ` <i class="fd-object-marker__icon" [ngClass]="' sap-icon--' + glyph" *ngIf="glyph"></i> | ||
<span *ngIf="label" class="fd-object-marker__text">{{ label }}</span> | ||
<ng-content></ng-content>`, | ||
styleUrls: ['./object-marker.component.scss'], | ||
encapsulation: ViewEncapsulation.None, | ||
changeDetection: ChangeDetectionStrategy.OnPush | ||
}) | ||
export class ObjectMarkerComponent implements OnChanges, OnInit, CssClassBuilder { | ||
/** User's custom classes */ | ||
@Input() | ||
class: string; | ||
/** Glyph (icon) of the Object Status.*/ | ||
@Input() | ||
glyph: string; | ||
|
||
/** Whether the Object Status is clickable. */ | ||
@Input() | ||
clickable = false; | ||
|
||
/** Define the text content of the Object Status */ | ||
@Input() | ||
label: string; | ||
|
||
/** @hidden */ | ||
constructor(private readonly _elementRef: ElementRef) {} | ||
|
||
@applyCssClass | ||
/** CssClassBuilder interface implementation | ||
* function must return single string | ||
* function is responsible for order which css classes are applied | ||
*/ | ||
buildComponentCssClass(): string[] { | ||
return ['fd-object-marker', this.clickable ? 'fd-object-marker--link' : '', this.class]; | ||
} | ||
|
||
/** @hidden */ | ||
ngOnChanges(): void { | ||
this.buildComponentCssClass(); | ||
} | ||
|
||
/** @hidden */ | ||
ngOnInit(): void { | ||
this.buildComponentCssClass(); | ||
} | ||
|
||
/** @hidden */ | ||
elementRef(): ElementRef<any> { | ||
return this._elementRef; | ||
} | ||
} |
Oops, something went wrong.