dom-render
Advanced tools
Comparing version 1.0.49 to 1.0.50
{ | ||
"name": "dom-render", | ||
"version": "1.0.49", | ||
"version": "1.0.50", | ||
"main": "DomRender.js", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
101
README.MD
@@ -208,2 +208,103 @@ ![Single Page Application Framworks](assets/banner.png) | ||
# validation | ||
```html | ||
<div class="row mb-3"> | ||
<div class="col"> | ||
<span>์์ด๋</span> | ||
<input class="w-100" type="text" name="id" placeholder="์์ด๋" dr-value-link="this.form.id.value" dr-event-blur="this.form.id.valid()" required/> | ||
<span dr-on-init="this.form.id.msgElement" class="d-none"></span> | ||
</div> | ||
</div> | ||
<div class="row mb-3"> | ||
<div class="col"> | ||
<span>๋น๋ฐ๋ฒํธ</span> | ||
<input class="w-100" type="password" name="id" placeholder="์ซ์, ์๋ฌธ, ํน์๋ฌธ์ ์กฐํฉ ์ต์ 8์~20์" dr-value-link="this.form.password.value" dr-event-blur="this.form.password.valid()" required/> | ||
<span dr-on-init="this.form.password.msgElement" >password valid message section</span> | ||
<input class="w-100" type="password" name="id" placeholder="๋น๋ฐ๋ฒํธ ์ฌ์ ๋ ฅ" dr-value-link="this.form.confirmPassword" required/> | ||
<span dr-class="{'d-block': this.form.password != this.form.confirmPassword, 'text-danger': this.form.password != this.form.confirmPassword}">2nd input password valid message section</span> | ||
</div> | ||
</div> | ||
<div class="row mb-3"> | ||
<div class="col"> | ||
<span>์ด๋ฉ์ผ</span> | ||
<input class="w-100" type="email" name="id" placeholder="์ด๋ฉ์ผ" dr-value-link="this.form.email" required/> | ||
<span class="">2nd input password valid message section</span> | ||
</div> | ||
</div> | ||
</div> | ||
``` | ||
```typescript | ||
class SignUp { | ||
public form = new class extends Validation { | ||
id = new class extends Validation { | ||
public msgElement!: HTMLElement; | ||
valid(): boolean { | ||
let valid = false; | ||
if (this.length == 0) { | ||
this.msgElement.className = 'd-block text-danger'; | ||
this.msgElement.textContent = '์์ด๋๋ฅผ ์ ๋ ฅํด์ฃผ์ธ์.'; | ||
} else if (this.length < 3 || this.length > 20) { | ||
this.msgElement.className = 'd-block text-danger'; | ||
this.msgElement.textContent = '์์ด๋๋ 4๊ธ์ ์ด์ 20์ ๋ฏธ๋ง ์ด์ด์ผ ํฉ๋๋ค.'; | ||
} else { | ||
let isExist = false; | ||
if (isExist) { | ||
this.msgElement.className = 'd-block text-danger'; | ||
this.msgElement.textContent = '์ด๋ฏธ ์ฌ์ฉ์ค์ธ ์์ด๋์ ๋๋ค. ๋ค๋ฅธ ์์ด๋๋ฅผ ์ด์ฉํด์ฃผ์ธ์.'; | ||
} else { | ||
this.msgElement.className = 'd-block text-success'; | ||
this.msgElement.textContent = '์ฌ์ฉ ๊ฐ๋ฅํ ์์ด๋์ ๋๋ค.'; | ||
valid = true; | ||
} | ||
} | ||
return valid; | ||
} | ||
}(); | ||
password = new class extends Validation { | ||
public msgElement!: HTMLElement; | ||
valid(): boolean { | ||
let valid = false; | ||
let regExp = /^.*(?=.)(?=.*[0-9])(?=.*[a-zA-Z]).*$/; | ||
const ERROR_REQUIRE_PW = '๋น๋ฐ๋ฒํธ๋ฅผ ์ ๋ ฅํด์ฃผ์ธ์.'; | ||
const ERROR_PW_LENGTH = '๋น๋ฐ๋ฒํธ๋ 8๊ธ์~20๊ธ์๋ก ์ด๋ฃจ์ด์ ธ์ผ ํฉ๋๋ค.'; | ||
const ERROR_PW_REGEXP = '๋น๋ฐ๋ฒํธ๋ ์ซ์, ์๋ฌธ, ํน์๋ฌธ์ ์กฐํฉ์ผ๋ก ์ด๋ฃจ์ด์ ธ์ผ ํฉ๋๋ค.'; | ||
const SUCCESS_AVAILABLE_USER_PW = '์ฌ์ฉ ๊ฐ๋ฅํ ๋น๋ฐ๋ฒํธ์ ๋๋ค.'; | ||
if (this.length == 0) { | ||
this.msgElement.className = 'd-block text-danger'; | ||
this.msgElement.textContent = ERROR_REQUIRE_PW; | ||
} else if (this.length < 8 || this.length > 20) { | ||
this.msgElement.className = 'd-block text-danger'; | ||
this.msgElement.textContent = ERROR_PW_LENGTH; | ||
} else { | ||
if (regExp.test(this.value)) { | ||
this.msgElement.className = 'd-block text-success'; | ||
this.msgElement.textContent = SUCCESS_AVAILABLE_USER_PW; | ||
valid = true; | ||
} else { | ||
this.msgElement.className = 'd-block text-danger'; | ||
this.msgElement.textContent = ERROR_PW_REGEXP; | ||
} | ||
} | ||
return valid; | ||
} | ||
}(); | ||
confirmPassword = new class extends Validation { | ||
value = ''; | ||
valid(): boolean { | ||
return true; | ||
} | ||
}(); | ||
email = new class extends Validation { | ||
value = ''; | ||
valid(): boolean { | ||
return true; | ||
} | ||
}(); | ||
valid() { | ||
return this.childValid() | ||
} | ||
}(); | ||
} | ||
``` | ||
# Detect Get, Set | ||
@@ -210,0 +311,0 @@ OnBeforeReturnSet |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
175324
52
3155
390