Angular 분할기 구성 요소 개요

    Ignite UI for Angular 레이아웃을 만들고, 크기를 조정하고, 확장하고, 축소할 수 있는 여러 개의 수직 또는 수평으로 배열된 창으로 분할하는 기능을 제공합니다. 이러한 상호 작용은 창 사이의 분할 막대에 노출된 UI를 통해 수행됩니다. 간단한 Splitter 레이아웃은 아래 데모에서 시연됩니다.

    Angular Splitter Example

    Getting Started with Ignite UI for Angular Splitter

    Ignite UI for Angular Splitter 구성 요소를 시작하려면 먼저 Ignite UI for Angular 설치해야 합니다. 기존 Angular 애플리케이션에서 다음 명령을 입력합니다.

    ng add igniteui-angular
    

    Ignite UI for Angular에 대한 전체 소개는 시작 항목을 참조하십시오.

    다음 단계는 다음 단계를 가져오는 것입니다.IgxSplitterModule 당신의 app.module.ts 파일.

    // app.module.ts
    ...
    import { IgxSplitterModule } from 'igniteui-angular';
    // import { IgxSplitterModule } from '@infragistics/igniteui-angular'; for licensed package
    
    @NgModule({
        ...
        imports: [..., IgxSplitterModule],
        ...
    })
    export class AppModule {}
    

    또는16.0.0 독립 실행형 의존성으로 가져오IgxSplitterComponent 거나, 토큰을IGX_SPLITTER_DIRECTIVES 사용해 컴포넌트와 그 지원 컴포넌트, 명령어를 가져올 수도 있습니다.

    // home.component.ts
    
    import { IGX_SPLITTER_DIRECTIVES } from 'igniteui-angular';
    // import { IGX_SPLITTER_DIRECTIVES } from '@infragistics/igniteui-angular'; for licensed package
    
    @Component({
        selector: 'app-home',
        template: `
        <igx-splitter>
            <igx-splitter-pane>
                Pane 1
            </igx-splitter-pane>
            <igx-splitter-pane>
                Pane 2
            </igx-splitter-pane>
        </igx-splitter>
        `,
        styleUrls: ['home.component.scss'],
        standalone: true,
        imports: [IGX_SPLITTER_DIRECTIVES]
        /* or imports: [IgxSplitterComponent, IgxSplitterPaneComponent] */
    })
    export class HomeComponent {}
    

    Now that you have the Ignite UI for Angular Splitter module or directives imported, you can start using the igx-splitter component.

    Using the Angular Splitter

    igxSplitterigx-splitter 태그로 초기화됩니다. 단일 igx-splitter 구성 요소 아래에 여러 분할 창을 정의할 수 있습니다. 창의 콘텐츠는 템플릿으로 작성 가능하며 크기 조정이 가능한 자체 컨테이너로 렌더링됩니다.

    <!-- splitter.component.html -->
    <igx-splitter>
        <igx-splitter-pane>
            ...
        </igx-splitter-pane>
        <igx-splitter-pane>
            ...
        </igx-splitter-pane>
        <igx-splitter-pane>
            ...
        </igx-splitter-pane>
    </igx-splitter>
    

    Orientation

    The splitter can be vertical or horizontal, which is defined by the type input. The default value is Vertical.

    public type = SplitterType.Horizontal;
    
    <igx-splitter [type]="type">
        <igx-splitter-pane>
            ...
        </igx-splitter-pane>
        <igx-splitter-pane>
            ...
        </igx-splitter-pane>
    </igx-splitter>
    

    Collapsible Splitter

    You can make the splitter collapsible or not by showing or hiding the splitter's handle and expanders, using the nonCollapsible input. The default value is false, so the splitter is collapsible.

    <igx-splitter [nonCollapsible]="true">
        <igx-splitter-pane>
            ...
        </igx-splitter-pane>
        <igx-splitter-pane>
            ...
        </igx-splitter-pane>
    </igx-splitter>
    

    Configuring panes

    The igxSplitterPane component contains several input properties. You can set the initial pane size by using the size input property. The minSize and maxSize input properties can be used to set the minimum or maximum allowed size of the pane. Resizing beyond minSize and maxSize is not allowed.

    <igx-splitter>
        <igx-splitter-pane size='300px' minSize='100px'>
            ...
        </igx-splitter-pane>
        <igx-splitter-pane size='300px' maxSize='500px'>
            ...
        </igx-splitter-pane>
    </igx-splitter>
    

    You can also forbid the resizing of a pane by setting its resizable input property to false.

    <igx-splitter>
        <igx-splitter-pane [resizable]='false'>
            ...
        </igx-splitter-pane>
        <igx-splitter-pane>
            ...
        </igx-splitter-pane>
    </igx-splitter>
    

    Nested panes

    분할 구성 요소를 중첩하여 분할 창 내부에 더 복잡한 레이아웃을 만들 수 있습니다.

    public typeHorizontal = SplitterType.Horizontal;
    public typeVertical = SplitterType.Vertical;
    
    <igx-splitter style='height: 30vh;' [type]='typeHorizontal' >
        <igx-splitter-pane>
            <igx-splitter [type]='typeVertical' [style.width]='"100%"'>
                <igx-splitter-pane>
                    Pane1.1
                </igx-splitter-pane>
                <igx-splitter-pane>
                    Pane1.2
                </igx-splitter-pane>
            </igx-splitter>
        </igx-splitter-pane>
        <igx-splitter-pane>
            <igx-splitter [type]='typeVertical' [style.width]='"100%"'>
                <igx-splitter-pane>
                    Pane2.1
                </igx-splitter-pane>
                <igx-splitter-pane>
                    Pane2.2
                </igx-splitter-pane>
            </igx-splitter>
        </igx-splitter-pane>
    </igx-splitter>
    

    Demo

    키보드 탐색

    키보드 탐색은 기본적으로 Splitter 구성 요소에서 사용할 수 있습니다. 분할 막대에 초점을 맞추고 다음 키 조합 중 하나를 누르면 설명된 동작이 수행됩니다.

    Key combinations

    • Arrow Up - Moves the splitter bar up in a vertical splitter
    • Arrow Down - Moves the splitter bar down in a vertical splitter
    • Arrow Left - Moves the splitter bar left in a horizontal splitter
    • Arrow Right - Moves the splitter bar right in a horizontal splitter
    • Ctrl + Arrow Up - Expands/Collapses a pane in a vertical splitter
    • Ctrl + Arrow Down - Expands/Collapses a pane in a vertical splitter
    • Ctrl + Arrow Left - Expands/Collapses a pane in a horizontal splitter
    • Ctrl + Arrow Right - Expands/Collapses a pane in a horizontal splitter

    스타일링

    Splitter Theme Property Map

    기본 속성을 수정하면 모든 관련 종속 속성이 자동으로 업데이트되어 변경 내용이 반영됩니다.

    기본 속성 종속 속성 설명
    $bar색 $handle색 바 드래그 핸들 색상
    $expander색화살 확장기 색상
    $focus색집중 스플리터 바에 사용되는 색상

    To get started with styling the igxSplitter component, you need to import the index file, where all the theme functions and component mixins live:

    @use "igniteui-angular/theming" as *;
    
    // IMPORTANT: Prior to Ignite UI for Angular version 13 use:
    // @import '~igniteui-angular/lib/core/styles/themes/index';
    

    You can change the default styles of the splitter by creating a new theme that extends the splitter-theme. By providing just the base parameters, the theme will automatically generate all necessary styles for the interaction states.

    // In splitter-styling-sample.component.scss
    
    $splitter-theme: splitter-theme(
      $bar-color: #011627,
      $handle-color: #ecaa53,
      $expander-color: #ecaa53,
      $size: 4px
    );
    

    Using CSS Variables

    다음 단계는 사용자 정의 스플리터 테마를 전달하는 것입니다.

    @include css-vars($custom-splitter-theme);
    

    Demo

    새 테마를 적용한 최종 결과입니다.

    Styling with Tailwind

    스플리터는 저희 맞춤형 Tailwind 유틸리티 클래스를 사용해 스타일링할 수 있습니다. 먼저 Tailwind를 꼭 설정 하세요.

    전역 스타일시트의 순풍 가져오기와 함께 다음과 같이 원하는 테마 유틸리티를 적용할 수 있습니다.

    @import "tailwindcss";
    ...
    @use 'igniteui-theming/tailwind/utilities/material.css';
    

    유틸리티 파일에는 테마 변형 두 가지lightdark 모두 포함되어 있습니다.

    • 라이트 테마에는 클래스를 사용light-* 하세요.
    • 어두운 테마에는 클래스를 사용dark-* 하세요.
    • 접두사 뒤에 컴포넌트 이름을 덧붙이세요,light-splitterdark-splitter 예: .

    이 클래스들이 적용되면 동적 테마 계산이 가능합니다. 그 다음에는 생성된 CSS 변수를 무arbitrary properties 시할 수 있습니다. 콜론 다음에는 유효한 CSS 색상 형식(HEX, CSS 변수, RGB 등)을 입력하세요.

    전체 속성 목록은 스플리터 테마에서 확인할 수 있습니다. 문법은 다음과 같습니다:

    <igx-splitter
      class="!light-splitter ![--bar-color:#7B9E89]">
      ...
    </igx-splitter>
    
    Note

    느낌표(!)는 유틸리티 클래스가 우선순위가 되도록 보장하기 위해 필요합니다. Tailwind는 레이어에 스타일을 적용하는데, 이 스타일을 중요하게 표시하지 않으면 컴포넌트의 기본 테마에 의해 덮어쓰여집니다.

    Custom sizing

    You can either use the --size variable, targeting the igx-splitter directly:

    igx-splitter {
      --size: 10px;
    }
    

    Or you can use the universal --igx-splitter-size variable to target all instances:

    <div class="my-app">
      <igx-splitter></igx-splitter>
    </div>
    
    .my-app {
      --igx-splitter-size: 10px;
    }
    

    API References

    Theming Dependencies

    우리 커뮤니티는 활동적이며 항상 새로운 아이디어를 환영합니다.