페이징 수정
parent
95cf737c18
commit
10c97085b7
@ -1,11 +1,142 @@
|
||||
/**************************************************************************
|
||||
* doctx 탐지
|
||||
**************************************************************************/
|
||||
Element.prototype.detectDoctx = function(){
|
||||
|
||||
let parent = this.parentElement;
|
||||
|
||||
if(parent == null){
|
||||
return null;
|
||||
}
|
||||
|
||||
if(parent.hasAttribute("data-doctx")){
|
||||
return parent.getAttribute("data-doctx");
|
||||
}
|
||||
|
||||
return parent.detectDoctx();
|
||||
}
|
||||
|
||||
/**************************************************************************
|
||||
* 페이징 표시하는 SPAN
|
||||
**************************************************************************/
|
||||
class PagingInfoSpan extends HTMLSpanElement {
|
||||
constructor() {
|
||||
super();
|
||||
let nm = this.getAttribute("name");
|
||||
let a = nm.substr(0,nm.indexOf("PagingInfo"))
|
||||
let b = this.getAttribute("data-ref-doctx");
|
||||
this.id = a+"--"+b+"PagingInfo";
|
||||
}
|
||||
|
||||
connectedCallback(){
|
||||
if(this.isConnected){
|
||||
let nm = this.getAttribute("name");
|
||||
let prefix = nm.substr(0,nm.indexOf("PagingInfo"))
|
||||
|
||||
let doctx = this.getAttribute("data-ref-doctx");
|
||||
if(doctx == null){
|
||||
doctx = this.detectDoctx();
|
||||
}
|
||||
if(doctx != null){
|
||||
this.setAttribute("data-ref-doctx", doctx);
|
||||
this.id = prefix+"--"+doctx+"PagingInfo";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
customElements.define("paging-info", PagingInfoSpan, { extends: "span" });
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
* name으로 참조하는 label
|
||||
**************************************************************************/
|
||||
class NameLabel extends HTMLLabelElement {
|
||||
constructor() {
|
||||
super();
|
||||
}
|
||||
|
||||
connectedCallback(){
|
||||
if(this.isConnected){
|
||||
|
||||
let doctx = this.getAttribute("data-ref-doctx");
|
||||
if(doctx == null){
|
||||
doctx = this.detectDoctx();
|
||||
}
|
||||
if(doctx != null){
|
||||
this.setAttribute("data-ref-doctx", doctx);
|
||||
this.htmlFor = this.getAttribute("for")+"--"+doctx;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
customElements.define("name-label", NameLabel, { extends: "label" });
|
||||
|
||||
/**************************************************************************
|
||||
* name과 doctx로 id를 생성하는 SELECT
|
||||
**************************************************************************/
|
||||
class IdSelect extends HTMLSelectElement {
|
||||
constructor() {
|
||||
super();
|
||||
}
|
||||
|
||||
connectedCallback(){
|
||||
if(this.isConnected){
|
||||
let doctx = this.getAttribute("data-ref-doctx");
|
||||
if(doctx == null){
|
||||
doctx = this.detectDoctx();
|
||||
}
|
||||
if(doctx != null){
|
||||
this.setAttribute("data-ref-doctx", doctx);
|
||||
this.id = this.getAttribute("name")+"--"+doctx;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
customElements.define("id-select", IdSelect, { extends: "select" });
|
||||
|
||||
/**************************************************************************
|
||||
* name과 doctx로 id를 생성하는 TEXTAREA
|
||||
**************************************************************************/
|
||||
class IdTextArea extends HTMLTextAreaElement {
|
||||
constructor() {
|
||||
super();
|
||||
}
|
||||
|
||||
connectedCallback(){
|
||||
if(this.isConnected){
|
||||
let doctx = this.getAttribute("data-ref-doctx");
|
||||
if(doctx == null){
|
||||
doctx = this.detectDoctx();
|
||||
}
|
||||
if(doctx != null){
|
||||
this.setAttribute("data-ref-doctx", doctx);
|
||||
this.id = this.getAttribute("name")+"--"+doctx;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
customElements.define("id-textarea", IdTextArea, { extends: "textarea" });
|
||||
|
||||
/**************************************************************************
|
||||
* name과 doctx로 id를 생성하는 INPUT
|
||||
**************************************************************************/
|
||||
class IdInput extends HTMLInputElement {
|
||||
constructor() {
|
||||
super();
|
||||
}
|
||||
|
||||
connectedCallback(){
|
||||
if(this.isConnected){
|
||||
let doctx = this.getAttribute("data-ref-doctx");
|
||||
if(doctx == null){
|
||||
doctx = this.detectDoctx();
|
||||
}
|
||||
if(doctx != null){
|
||||
this.setAttribute("data-ref-doctx", doctx);
|
||||
this.id = this.getAttribute("name")+"--"+doctx;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
customElements.define("id-input", IdInput, { extends: "input" });
|
||||
|
Loading…
Reference in New Issue