<!DOCTYPE html><html><head><title>Mask Input Overview</title><metacharset="UTF-8" /><linkrel="shortcut icon"href="https://static.infragistics.com/xplatform/images/browsers/wc.png" ><linkrel="stylesheet"href="https://fonts.googleapis.com/icon?family=Material+Icons" /><linkrel="stylesheet"href="https://fonts.googleapis.com/css?family=Kanit&display=swap" /><linkrel="stylesheet"href="https://fonts.googleapis.com/css?family=Titillium Web" /><linkrel="stylesheet"href="https://static.infragistics.com/xplatform/css/samples/shared.v5.css"type="text/css" /></head><body><divid="root"><divclass="container sample center"><igc-mask-inputid="mask-input"mask="00000"><igc-iconname="location"slot="prefix"></igc-icon><spanslot="helper-text">ZIP Code</span></igc-mask-input></div></div><!-- This script is needed only for parcel and it will be excluded for webpack -->
<% if (false) { %><scriptsrc="src/index.ts"></script><% } %>
</body></html>html
/* shared styles are loaded from: *//* https://static.infragistics.com/xplatform/css/samples */css
Like this sample? Get access to our complete Ignite UI for Web Components toolkit and start building your own apps in minutes. Download it for free.
Usage
먼저 다음 명령을 실행하여 Ignite UI for Web Components 설치해야 합니다.
Ignite UI for Web Components에 대한 전체 소개를 보려면 시작하기 항목을 읽어보세요.
Mask Rules
아래 표에는 지원되는 기본 제공 마스크 규칙이 나와 있습니다.
마스크 캐릭터
설명
0
숫자 [0-9]. 입력이 필요합니다.
9
숫자 [0-9]. 입력은 선택사항입니다.
#
숫자 [0-9], 더하기(+) 또는 빼기(-) 기호입니다. 입력이 필요합니다.
엘
편지 문자. 입력이 필요합니다.
?
편지 문자. 입력은 선택사항입니다.
ㅏ
영숫자(문자 또는 숫자) 문자입니다. 입력이 필요합니다.
ㅏ
영숫자(문자 또는 숫자) 문자입니다. 입력은 선택사항입니다.
&
모든 키보드 문자. 입력이 필요합니다.
씨
모든 키보드 문자. 입력은 선택사항입니다.
\
마스크 플래그를 이스케이프하여 리터럴로 바꿉니다.
이러한 플래그는 구성 요소 유효성 검사에도 참여합니다. 즉, 필수 위치 중 일부가 채워지지 않은 경우 입력이 유효하지 않게 됩니다(채워진 위치가 없거나 비어 있는 값은 여전히 required의 책임입니다). 이는 독립 실행형 입력과 양식에 포함된 경우 모두에 적용됩니다.
Applying Mask
마스크를 적용하는 것은 매우 간단합니다. 당신이 해야 할 일은 입력의 mask 속성에 미리 결정된 패턴을 제공하는 것뿐입니다.
<!DOCTYPE html><html><head><title>Mask Input Applying Mask</title><metacharset="UTF-8" /><linkrel="shortcut icon"href="https://static.infragistics.com/xplatform/images/browsers/wc.png" ><linkrel="stylesheet"href="https://fonts.googleapis.com/icon?family=Material+Icons" /><linkrel="stylesheet"href="https://fonts.googleapis.com/css?family=Kanit&display=swap" /><linkrel="stylesheet"href="https://fonts.googleapis.com/css?family=Titillium Web" /><linkrel="stylesheet"href="https://static.infragistics.com/xplatform/css/samples/shared.v5.css"type="text/css" /></head><body><divid="root"><divclass="container sample center"><igc-mask-inputid="mask-input"mask="(####) 00-00-00 Ext. 9999"><igc-iconname="phone"slot="prefix"></igc-icon><spanslot="helper-text">Phone number</span></igc-mask-input></div></div><!-- This script is needed only for parcel and it will be excluded for webpack -->
<% if (false) { %><scriptsrc="src/index.ts"></script><% } %>
</body></html>html
/* shared styles are loaded from: *//* https://static.infragistics.com/xplatform/css/samples */css
Prompt Character
개발자는 마스크의 채워지지 않은 부분에 사용되는 프롬프트 기호를 사용자 정의할 수 있습니다. 이렇게 하려면 prompt 속성에 문자를 입력하면 됩니다.
IgcMaskInputComponent는 특정 마스크가 적용될 때 양식에 바인딩할 입력 값(형식 지정 또는 원시)을 구성하기 위해 raw 및 withFormatting 옵션 중에서 선택할 수 있는 valueMode 속성을 노출합니다. 기본적으로 valueMode raw로 설정됩니다. 아래 예에서 직접 시도해 보세요.
<!DOCTYPE html><html><head><title>Mask Input Value Modes</title><metacharset="UTF-8" /><linkrel="shortcut icon"href="https://static.infragistics.com/xplatform/images/browsers/wc.png" ><linkrel="stylesheet"href="https://fonts.googleapis.com/icon?family=Material+Icons" /><linkrel="stylesheet"href="https://fonts.googleapis.com/css?family=Kanit&display=swap" /><linkrel="stylesheet"href="https://fonts.googleapis.com/css?family=Titillium Web" /><linkrel="stylesheet"href="https://static.infragistics.com/xplatform/css/samples/shared.v5.css"type="text/css" /></head><body><divid="root"><divclass="container sample center"><igc-mask-inputid="mask-input"><igc-iconname="file"slot="prefix"></igc-icon></igc-mask-input><divid="content"style="width: 100%; height: inherit;"><igc-radio-groupid="radio-group"alignment="horizontal"style="margin-bottom: 10px;"><igc-radioname="position"value="raw"label-position="after"checked>raw</igc-radio><igc-radioname="position"value="withFormatting"label-position="after">withFormatting</igc-radio></igc-radio-group><spanid="value-span">Value:</span></div></div></div><!-- This script is needed only for parcel and it will be excluded for webpack -->
<% if (false) { %><scriptsrc="src/index.ts"></script><% } %>
</body></html>html
/* shared styles are loaded from: *//* https://static.infragistics.com/xplatform/css/samples */css
Styling
구성 요소는 IgcMaskInputComponent 거의 모든 내부 요소에 대한 CSS 부분을 노출합니다. 다음 표에는 노출된 모든 CSS 부분이 나열되어 있습니다.