Angular Tile Manager 개요
Tile Manager 컴포넌트를 사용하면 개별 타일에 콘텐츠를 표시할 수 있습니다. 이를 통해 사용자는 이러한 타일을 재정렬하고 크기를 조정하여 상호 작용할 수 있으므로 기본 설정에 따라 콘텐츠의 레이아웃과 모양을 자유롭게 사용자 지정할 수 있습니다. 이러한 유연성은 콘텐츠를 보다 개인화되고 효율적인 방식으로 보고 관리할 수 있도록 하여 사용자 환경을 향상시킵니다.
Angular 타일 관리자 예제
다음 Ignite UI for Angular Tile Manager Example은 작동 중인 컴포넌트를 보여줍니다.
import { Component, CUSTOM_ELEMENTS_SCHEMA, OnInit} from '@angular/core' ;
import { IgxAvatarComponent, IgxCardComponent, IgxCardContentDirective, IgxCardHeaderComponent, IgxCardHeaderTitleDirective, IgxCardThumbnailDirective, IgxIconComponent, IgxIconService, IgxListComponent, IgxListItemComponent, IgxListLineDirective, IgxListThumbnailDirective} from 'igniteui-angular' ;
import { defineComponents, IgcTileManagerComponent } from 'igniteui-webcomponents' ;
defineComponents(IgcTileManagerComponent);
@Component ({
selector : 'app-tile-manager' ,
styleUrls : ['./tile-manager.component.scss' ],
templateUrl : './tile-manager.component.html' ,
imports : [IgxCardComponent, IgxCardHeaderComponent, IgxCardHeaderTitleDirective, IgxCardThumbnailDirective, IgxCardContentDirective, IgxListComponent, IgxListItemComponent, IgxListThumbnailDirective, IgxAvatarComponent, IgxIconComponent],
schemas : [CUSTOM_ELEMENTS_SCHEMA]
})
export class TileManagerComponent implements OnInit {
constructor (protected _iconService: IgxIconService ) {}
public ngOnInit ( ) {
const listIcon =
'<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="#e3e3e3"><path d="M11 7h6v2h-6zm0 4h6v2h-6zm0 4h6v2h-6zM7 7h2v2H7zm0 4h2v2H7zm0 4h2v2H7zM20.1 3H3.9c-.5 0-.9.4-.9.9v16.2c0 .4.4.9.9.9h16.2c.4 0 .9-.5.9-.9V3.9c0-.5-.5-.9-.9-.9zM19 19H5V5h14v14z"/></svg>' ;
const calendarIcon =
'<svg xmlns="http://www.w3.org/2000/svg" enable-background="new 0 0 24 24" height="24px" viewBox="0 0 24 24" width="24px" fill="#e3e3e3"><path d="M19,4h-1V2h-2v2H8V2H6v2H5C3.89,4,3.01,4.9,3.01,6L3,20c0,1.1,0.89,2,2,2h14c1.1,0,2-0.9,2-2V6C21,4.9,20.1,4,19,4z M19,20 H5V10h14V20z M9,14H7v-2h2V14z M13,14h-2v-2h2V14z M17,14h-2v-2h2V14z M9,18H7v-2h2V18z M13,18h-2v-2h2V18z M17,18h-2v-2h2V18z"/></svg>'
const productIcon =
'<svg xmlns="http://www.w3.org/2000/svg" enable-background="new 0 0 24 24" height="24px" viewBox="0 0 24 24" width="24px" fill="#e3e3e3"><path d="M13,10h-2V8h2V10z M13,6h-2V1h2V6z M7,18c-1.1,0-1.99,0.9-1.99,2S5.9,22,7,22s2-0.9,2-2S8.1,18,7,18z M17,18 c-1.1,0-1.99,0.9-1.99,2s0.89,2,1.99,2s2-0.9,2-2S18.1,18,17,18z M8.1,13h7.45c0.75,0,1.41-0.41,1.75-1.03L21,4.96L19.25,4l-3.7,7 H8.53L4.27,2H1v2h2l3.6,7.59l-1.35,2.44C4.52,15.37,5.48,17,7,17h12v-2H7L8.1,13z"/></svg>'
this ._iconService.addSvgIconFromText("list" , listIcon, "material" );
this ._iconService.addSvgIconFromText("calendar" , calendarIcon, "material" );
this ._iconService.addSvgIconFromText("product" , productIcon, "material" );
}
}
ts コピー <igc-tile-manager id ="tile-manager1" column-count ="3" gap ="20px" resize-mode ="hover" drag-mode ="tile-header" >
<igc-tile row-span ="3" >
<span slot ="title" > Order info</span >
<igx-list >
<igx-list-item >
<igx-avatar igxListThumbnail shape ="circle" >
<igx-icon igxListThumbnail name ="list" collection ="material" class ="material-icons" > </igx-icon >
</igx-avatar >
<div igxListLineTitle class ="content" >
<p > OrderID</p >
<p > 10293</p >
</div >
</igx-list-item >
<igx-list-item >
<igx-avatar igxListThumbnail shape ="circle" class ="avatar" >
<igx-icon name ="list" collection ="material" class ="material-icons" > </igx-icon >
</igx-avatar >
<div igxListLineTitle class ="content" >
<p > Customer Name</p >
<p > Tortuga Restaurante</p >
</div >
</igx-list-item >
<igx-list-item >
<igx-avatar igxListThumbnail shape ="circle" class ="avatar" >
<igx-icon name ="calendar" collection ="material" class ="material-icons" > </igx-icon >
</igx-avatar >
<div igxListLineTitle class ="content" >
<p > Order Date</p >
<p > August 29, 1996</p >
</div >
</igx-list-item >
<igx-list-item >
<igx-avatar igxListThumbnail shape ="circle" class ="avatar" >
<igx-icon name ="calendar" collection ="material" class ="material-icons" > </igx-icon >
</igx-avatar >
<div igxListLineTitle class ="content" >
<p > Shipped Date</p >
<p > September 11, 1996</p >
</div >
</igx-list-item >
<igx-list-item >
<igx-avatar igxListThumbnail shape ="circle" class ="avatar" >
<igx-icon name ="list" collection ="material" class ="material-icons" > </igx-icon >
</igx-avatar >
<div igxListLineTitle class ="content" >
<p > Product Name</p >
<p > Carnavon Tigers</p >
</div >
</igx-list-item >
<igx-list-item >
<igx-avatar igxListThumbnail shape ="circle" class ="avatar" >
<igx-icon name ="list" collection ="material" class ="material-icons" > </igx-icon >
</igx-avatar >
<div igxListLineTitle class ="content" >
<p > Ship Country</p >
<p > Mexico</p >
</div >
</igx-list-item >
</igx-list >
</igc-tile >
<igc-tile col-span ="2" row-span ="2" >
<span slot ="title" > Order Line Items</span >
<div class ="group" >
<div class ="card" >
<igx-card elevated >
<igx-card-header >
<div igxCardThumbnail >
<igx-avatar shape ="circle" collection ="material" >
<igx-icon name ="product" collection ="material" class ="material-icons" > </igx-icon >
</igx-avatar >
</div >
<h3 igxCardHeaderTitle > Carnavon Tigers</h3 >
</igx-card-header >
<igx-card-content class ="column" >
<div class ="body-content" >
<span > Quantity</span > <span > 12</span >
</div >
<div class ="body-content" >
<span > Unit Price</span > <span > $50</span >
</div >
</igx-card-content >
</igx-card >
</div >
<div class ="card" >
<igx-card elevated >
<igx-card-header >
<div igxCardThumbnail >
<igx-avatar shape ="circle" >
<igx-icon name ="product" collection ="material" class ="material-icons" > </igx-icon >
</igx-avatar >
</div >
<span slot ="title" > Guarana Fantastica</span >
</igx-card-header >
<igx-card-content class ="column" >
<div class ="body-content" >
<span > Quantity</span > <span > 10</span >
</div >
<div class ="body-content" >
<span > Unit Price</span > <span > $4</span >
</div >
</igx-card-content >
</igx-card >
</div >
<div class ="card" >
<igx-card elevated >
<igx-card-header >
<div igxCardThumbnail >
<igx-avatar shape ="circle" >
<igx-icon name ="product" collection ="material" class ="material-icons" > </igx-icon >
</igx-avatar >
</div >
<span slot ="title" > Vegie-spread</span >
</igx-card-header >
<igx-card-content class ="column" >
<div class ="body-content" >
<span > Quantity</span > <span > 5</span >
</div >
<div class ="body-content" >
<span > Unit Price</span > <span > $35</span >
</div >
</igx-card-content >
</igx-card >
</div >
<div class ="card" >
<igx-card elevated >
<igx-card-header >
<div igxCardThumbnail >
<igx-avatar shape ="circle" >
<igx-icon name ="product" collection ="material" class ="material-icons" > </igx-icon >
</igx-avatar >
</div >
<span slot ="title" > Rhonbrau Klosterbier</span >
</igx-card-header >
<igx-card-content class ="column" >
<div class ="body-content" >
<span > Quantity</span > <span > 7</span >
</div >
<div class ="body-content" >
<span > Unit Price</span > <span > $6</span >
</div >
</igx-card-content >
</igx-card >
</div >
</div >
</igc-tile >
<igc-tile >
<span slot ="title" > Order Value</span >
<div class ="string" >
<h3 > $8.66K</h3 >
</div >
</igc-tile >
<igc-tile >
<span slot ="title" > Item quantity</span >
<div class ="string" >
<h3 > 4</h3 >
</div >
</igc-tile >
</igc-tile-manager >
html コピー igc-tile-manager {
margin-bottom : 5px ;
}
.group {
display : flex;
flex-direction : row;
flex-wrap : wrap;
margin-top : 15px ;
}
.card {
min-height : 30px ;
min-width : 250px ;
max-width : 320px ;
margin : 0 15px 15px 15px
}
igx-card-content {
color: var(--content-text-color);
}
.body-content {
width : 100% ;
display : flex;
flex-direction : row;
justify-content : space-between;
align-items : center;
}
.string {
text-align : center;
margin-top : 50px ;
color : var(--ig-gray-800 );
}
.sample {
overflow : auto;
}
.content {
display : flex;
justify-content : space-between;
}
scss コピー
이 샘플이 마음에 드시나요? 전체 Ignite UI for Angular 툴킷에 액세스하고 몇 분 안에 나만의 앱을 구축해 보세요. 무료로 다운로드하세요.
iframe 권한 정책으로 인해 이 예제의 전체 화면 버튼은 오른쪽 상단 모서리에 있는 '전체 화면으로 확장' 버튼을 클릭하여 예제를 독립 실행형 모드로 열 때만 작동합니다.
Ignite UI for Angular Tile Manager 시작하기
Ignite UI Tile Manager는 표준 웹 구성 요소 이므로 Angular 애플리케이션에서 사용할 수 있습니다.
사용을 시작하려면 먼저 다음 명령을 실행하여 Ignite UI for Web Components 패키지를 설치해야 합니다.
npm install igniteui-webcomponents --save
cmd
다음으로, 파일 또는 사용 IgcTileManager
중인 구성 요소.ts
파일에서 인수를 main.ts
사용하여 IgcTileManagerComponent
함수를 호출 defineCustomElements()
해야 합니다.
import { defineComponents, IgcTileManagerComponent } from 'igniteui-webcomponents' ;
defineComponents(IgcTileManagerComponent);
ts
또한 구성 요소의 구성에 스키마를 포함해야 CUSTOM_ELEMENTS_SCHEMA
합니다
import { Component, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core' ;
@Component ({
schemas : [CUSTOM_ELEMENTS_SCHEMA]
})
export class AppComponent {
typescript
이제 Angular Tile Manager의 기본 구성부터 시작할 수 있습니다.
용법
Tile Manager는 기본 타일 레이아웃 동작을 제공하여 최대화 또는 일반 상태의 타일 배치를 관리합니다. 타일은 서로 독립적으로 크기를 조정할 수 있으며 복잡한 레이아웃을 형성하는 데 사용할 수 있습니다. 최종 사용자는 타일을 끌어다 놓아 순서를 변경할 수 있으므로 유연하고 직관적인 환경을 제공할 수 있습니다.
타일 매니저는 사용할 수 있는 두 가지 컴포넌트를 제공합니다.
IgcTileComponent
- 이 컴포넌트는 타일 매니저 내에 표시되는 개별 타일을 나타냅니다.
IgcTileManagerComponent
- 모든 타일 구성 요소를 포함하는 기본 구성 요소로, 전체 타일 레이아웃의 컨테이너 역할을 합니다.
<igc-tile-manager >
<igc-tile >
<p > Tile 1</p >
</igc-tile >
<igc-tile >
<p > Tile 2</p >
</igc-tile >
<igc-tile >
<p > Tile 3</p >
</igc-tile >
</igc-tile-manager >
html
Ignite UI for Angular에 대한 전체 소개는 시작 항목을 참조하십시오.
Tile Manager 컴포넌트 사용에 대한 자세한 내용은이 주제를 참조하세요.