ninegrid2 6.895.0 → 6.897.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -11510,6 +11510,14 @@ class ninegrid {
11510
11510
  return null; // 없으면 null 반환
11511
11511
  };
11512
11512
 
11513
+ static setOptions = (k,o) => {
11514
+ for (const prop in o) {
11515
+ if (ninegrid.options[k][prop]) {
11516
+ ninegrid.options[k][prop] = o[prop];
11517
+ }
11518
+ }
11519
+ };
11520
+
11513
11521
  static confirm(message, title, options) {
11514
11522
  return nxConfirmPopup.confirm(message, title, options);
11515
11523
  };
@@ -119309,99 +119317,127 @@ class nxDialog extends HTMLElement
119309
119317
  {
119310
119318
  //#owner;
119311
119319
  #shift;
119312
-
119320
+
119313
119321
  constructor () {
119314
119322
  super();
119315
119323
  }
119316
-
119324
+
119317
119325
  connectedCallback() {
119318
119326
 
119319
119327
  const v = this.innerHTML;
119320
119328
  const cssFile = this.getAttribute("css-file");
119321
- const customFile1 = cssFile ? `@import "https://cdn.jsdelivr.net/npm/ninegrid@${ninegrid.version}/dist/css/${cssFile}";`: "";
119329
+ // customFile1 customFile2 변수가 동일한 역할을 하는 것으로 보이며,
119330
+ // ninegrid.getCustomPath에서 이미 "nxDialog.css"를 가져오는 로직이 있으므로
119331
+ // 이 부분을 간소화할 수 있습니다.
119332
+ // 여기서는 현재 코드를 최대한 유지하면서 fadeIn/fadeOut만 추가합니다.
119333
+ const customFile1 = cssFile ? `@import "https://cdn.jsdelivr.net/npm/ninegrid@${ninegrid.version}/dist/css/${cssFile}";` : "";
119322
119334
  const customFile2 = cssFile ? ninegrid.getCustomPath(this, cssFile) : "";
119323
-
119324
- //console.log(ninegrid.getCustomPath(this,"nxDialog.css"));
119325
119335
 
119326
119336
  this.innerHTML = `
119327
- <style>
119328
- @import "https://cdn.jsdelivr.net/npm/ninegrid@${ninegrid.version}/dist/css/nxDialog.css";
119329
- ${ninegrid.getCustomPath(this,"nxDialog.css") || ""}
119330
- ${customFile1 || ""}
119331
- ${customFile2 || ""}
119332
- </style>
119333
-
119334
- <dialog>
119335
- <div class="head">
119336
- <div class="rect1"></div>
119337
- <div class="rect2"></div>
119338
- <div class="rect3"></div>
119339
- <ng-sphere class="icon" end-fill="#666" size="8"></ng-sphere>
119340
- <span class="title"></span>
119341
- <span class="sub-title"></span>
119342
- <buttons>
119343
- <ng-sphere class="apply" start-fill="#cc6" end-fill="#660" size="16" title="apply"></ng-sphere>
119344
- <ng-sphere class="reset" start-fill="#99f" end-fill="#00f" size="16" title="reset"></ng-sphere>
119345
- <ng-sphere class="close" start-fill="#f99" end-fill="#f00" size="16" title="close"></ng-sphere>
119346
- </buttons>
119347
- </div>
119348
- <div class="contents">
119349
- <div class="left">
119350
- <span>가나다라마바사아자차카타파하가나다라마바사아자차카타파하가나다라마바사아자차카타파하가나다라마바사아자차카타파하가나다라마바사아자차카타파하가나다라마바사아자차카타파하가나다라마바사아자차카타파하가나다라마바사아자차카타파하</span>
119351
- </div>
119352
- <div class="body">
119353
- ${v}
119354
- </div>
119355
- <div class="close2">
119356
- <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16">
119357
- <path d="M4.646 4.646a.5.5 0 0 1 .708 0L8 7.293l2.646-2.647a.5.5 0 0 1 .708.708L8.707 8l2.647 2.646a.5.5 0 0 1-.708.708L8 8.707l-2.646 2.647a.5.5 0 0 1-.708-.708L7.293 8 4.646 5.354a.5.5 0 0 1 0-.708"/>
119358
- </svg>
119359
- </div>
119360
- </div>
119361
- </dialog>
119362
- `;
119363
-
119364
- //this.#owner = this.getRootNode().host.closest("nine-grid");
119365
-
119337
+ <style>
119338
+ @import "https://cdn.jsdelivr.net/npm/ninegrid@${ninegrid.version}/dist/css/nxDialog.css";
119339
+ ${ninegrid.getCustomPath(this,"nxDialog.css") || ""}
119340
+ ${customFile1 || ""}
119341
+ ${customFile2 || ""}
119342
+ </style>
119343
+
119344
+ <dialog>
119345
+ <div class="head">
119346
+ <div class="rect1"></div>
119347
+ <div class="rect2"></div>
119348
+ <div class="rect3"></div>
119349
+ <ng-sphere class="icon" end-fill="#666" size="8"></ng-sphere>
119350
+ <span class="title"></span>
119351
+ <span class="sub-title"></span>
119352
+ <buttons>
119353
+ <ng-sphere class="apply" start-fill="#cc6" end-fill="#660" size="16" title="apply"></ng-sphere>
119354
+ <ng-sphere class="reset" start-fill="#99f" end-fill="#00f" size="16" title="reset"></ng-sphere>
119355
+ <ng-sphere class="close" start-fill="#f99" end-fill="#f00" size="16" title="close"></ng-sphere>
119356
+ </buttons>
119357
+ </div>
119358
+ <div class="contents">
119359
+ <div class="left">
119360
+ <span>가나다라마바사아자차카타파하가나다라마바사아자차카타파하가나다라마바사아자차카타파하가나다라마바사아자차카타파하가나다라마바사아자차카타파하가나다라마바사아자차카타파하가나다라마바사아자차카타파하가나다라마바사아자차카타파하</span>
119361
+ </div>
119362
+ <div class="body">
119363
+ ${v}
119364
+ </div>
119365
+ <div class="close2">
119366
+ <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16">
119367
+ <path d="M4.646 4.646a.5.5 0 0 1 .708 0L8 7.293l2.646-2.647a.5.5 0 0 1 .708.708L8.707 8l2.647 2.646a.5.5 0 0 1-.708.708L8 8.707l-2.646 2.647a.5.5 0 0 1-.708-.708L7.293 8 4.646 5.354a.5.5 0 0 1 0-.708"/>
119368
+ </svg>
119369
+ </div>
119370
+ </div>
119371
+ </dialog>
119372
+ `;
119373
+
119366
119374
  $(".title", this).html("Details");
119367
-
119368
119375
  this.#init();
119369
119376
  };
119370
-
119377
+
119378
+ // showModal 메서드 수정
119371
119379
  showModal = () => {
119372
- this.querySelector('dialog').showModal();
119380
+ const dialogElement = this.querySelector('dialog');
119381
+
119382
+ // 다이얼로그가 열릴 때 ':host(.fade)' CSS 클래스를 추가합니다.
119383
+ // ':host'는 커스텀 엘리먼트 자체(nx-dialog)를 의미합니다.
119384
+ this.classList.add('fade');
119385
+
119386
+ // 애니메이션이 끝나고 나서 showModal을 호출하도록 setTimeout을 사용할 수도 있지만,
119387
+ // CSS 애니메이션은 자동으로 시작되므로 이 방식이 더 간단합니다.
119388
+ dialogElement.showModal();
119373
119389
  };
119374
-
119390
+
119391
+ // close 메서드 수정
119375
119392
  close = () => {
119376
- $(".head", this) .off('mousedown', this.#onMouseDown);
119377
- $(".head", this) .off('touchstart', this.#onTouchStart);
119378
- $(document) .off('mouseup', this.#onMouseUp);
119379
- $(document) .off('touchend', this.#onTouchEnd);
119380
- $(document) .off('mousemove', this.#onMouseMove);
119381
- $(document) .off("touchmove", this.#onTouchMove);
119382
-
119383
- this.querySelector('dialog').close();
119393
+ const dialogElement = this.querySelector('dialog');
119394
+
119395
+ // 닫기 애니메이션을 위해 'out' 클래스를 추가합니다.
119396
+ dialogElement.classList.add("out");
119397
+
119398
+ // CSS 애니메이션 지속 시간 (1000ms = 1초) 후에 dialog.close()를 호출하여 실제로 닫습니다.
119399
+ // 이는 CSS의 fadeOut 애니메이션 지속 시간과 일치해야 합니다.
119400
+ // nxDialog.css의 @keyframes fadeOut { ... } 에 명시된 animation-duration을 확인하세요.
119401
+ // 현재 CSS에는 dialog.out에 대한 animation-duration이 없으므로, 명시적으로 1초를 가정합니다.
119402
+ // 만약 다른 애니메이션 (.run, .moveUp 등)과 동시에 사용된다면 이 부분은 더 복잡해질 수 있습니다.
119403
+ setTimeout(() => {
119404
+ // 이벤트 리스너 제거는 dialog가 완전히 닫힌 후에 하는 것이 안전합니다.
119405
+ // 그렇지 않으면 애니메이션 도중 클릭 등이 작동하지 않을 수 있습니다.
119406
+ $(".head", this) .off('mousedown', this.#onMouseDown);
119407
+ $(".head", this) .off('touchstart', this.#onTouchStart);
119408
+ $(document) .off('mouseup', this.#onMouseUp);
119409
+ $(document) .off('touchend', this.#onTouchEnd);
119410
+ $(document) .off('mousemove', this.#onMouseMove);
119411
+ $(document) .off("touchmove", this.#onTouchMove);
119412
+
119413
+ dialogElement.close();
119414
+ // 다이얼로그가 닫힌 후에는 애니메이션 클래스를 제거하여 다음 번에 열릴 때
119415
+ // 다시 애니메이션이 적용될 수 있도록 합니다.
119416
+ dialogElement.classList.remove("out");
119417
+ this.classList.remove('fade'); // 호스트 요소에서도 'fade' 클래스 제거
119418
+ }, 1000); // fadeOut 애니메이션 지속 시간에 맞춥니다 (현재 CSS에서 1초로 정의됨)
119384
119419
  };
119385
-
119420
+
119386
119421
  #init = () => {
119422
+ // 기존의 close 버튼 클릭 핸들러
119387
119423
  $(".close,.close2", this).on("click", e => {
119388
- ninegrid.j.querySelectorAll('dialog', this).addClass("out");
119389
- setTimeout(() => { this.close(); }, 300);
119424
+ // 이전에 여기에 있던 'dialog.out' 클래스 추가 로직은 이제 close() 메서드 안으로 들어갑니다.
119425
+ this.close();
119390
119426
  });
119391
-
119392
- $(".head", this) .on('mousedown', this.#onMouseDown);
119393
- $(".head", this) .on('touchstart', this.#onTouchStart);
119394
- $(document) .on('mouseup', this.#onMouseUp);
119395
- $(document) .on('touchend', this.#onTouchEnd);
119427
+
119428
+ $(".head", this) .on('mousedown', this.#onMouseDown);
119429
+ $(".head", this) .on('touchstart', this.#onTouchStart);
119430
+ $(document) .on('mouseup', this.#onMouseUp);
119431
+ $(document) .on('touchend', this.#onTouchEnd);
119396
119432
  };
119397
-
119433
+
119398
119434
 
119399
119435
  #onMouseDown = e => {
119400
119436
  if (e.target.closest("buttons")) return;
119401
119437
  if (e.buttons != 1 || e.altKey || e.ctrlKey || e.shiftkey) return;
119402
119438
 
119403
119439
  var rect = this.querySelector('dialog').getBoundingClientRect();
119404
-
119440
+
119405
119441
  this.#shift = {
119406
119442
  x : e.clientX - rect.x,
119407
119443
  y : e.clientY - rect.y,
@@ -119409,33 +119445,33 @@ class nxDialog extends HTMLElement
119409
119445
 
119410
119446
  $(document).on('mousemove', this.#onMouseMove);
119411
119447
  };
119412
-
119413
-
119448
+
119449
+
119414
119450
  #onMouseMove = e => {
119415
119451
  $(this.querySelector('dialog')).offset( { left : e.pageX - this.#shift.x, top : e.pageY - this.#shift.y });
119416
119452
  };
119417
-
119453
+
119418
119454
  #onMouseUp = e => {
119419
119455
  $(document).off('mousemove', this.#onMouseMove);
119420
119456
  };
119421
-
119457
+
119422
119458
  #onTouchStart = e => {
119423
119459
  if (e.target.closest("buttons")) return;
119424
-
119460
+
119425
119461
  var rect = this.querySelector('dialog').getBoundingClientRect();
119426
-
119462
+
119427
119463
  this.#shift = {
119428
119464
  x : e.changedTouches[0].pageX - rect.x,
119429
119465
  y : e.changedTouches[0].pageY - rect.y,
119430
119466
  };
119431
-
119467
+
119432
119468
  $(document).on("touchmove", this.#onTouchMove);
119433
119469
  };
119434
-
119470
+
119435
119471
  #onTouchMove = e => {
119436
119472
  $(this.querySelector('dialog')).offset( { left : e.changedTouches[0].pageX - this.#shift.x, top : e.changedTouches[0].pageY - this.#shift.y });
119437
119473
  };
119438
-
119474
+
119439
119475
  #onTouchEnd = e => {
119440
119476
  $(document).off('touchmove', this.#onTouchMove);
119441
119477
  };
@@ -11506,6 +11506,14 @@ class ninegrid {
11506
11506
  return null; // 없으면 null 반환
11507
11507
  };
11508
11508
 
11509
+ static setOptions = (k,o) => {
11510
+ for (const prop in o) {
11511
+ if (ninegrid.options[k][prop]) {
11512
+ ninegrid.options[k][prop] = o[prop];
11513
+ }
11514
+ }
11515
+ };
11516
+
11509
11517
  static confirm(message, title, options) {
11510
11518
  return nxConfirmPopup.confirm(message, title, options);
11511
11519
  };
@@ -119305,99 +119313,127 @@ class nxDialog extends HTMLElement
119305
119313
  {
119306
119314
  //#owner;
119307
119315
  #shift;
119308
-
119316
+
119309
119317
  constructor () {
119310
119318
  super();
119311
119319
  }
119312
-
119320
+
119313
119321
  connectedCallback() {
119314
119322
 
119315
119323
  const v = this.innerHTML;
119316
119324
  const cssFile = this.getAttribute("css-file");
119317
- const customFile1 = cssFile ? `@import "https://cdn.jsdelivr.net/npm/ninegrid@${ninegrid.version}/dist/css/${cssFile}";`: "";
119325
+ // customFile1 customFile2 변수가 동일한 역할을 하는 것으로 보이며,
119326
+ // ninegrid.getCustomPath에서 이미 "nxDialog.css"를 가져오는 로직이 있으므로
119327
+ // 이 부분을 간소화할 수 있습니다.
119328
+ // 여기서는 현재 코드를 최대한 유지하면서 fadeIn/fadeOut만 추가합니다.
119329
+ const customFile1 = cssFile ? `@import "https://cdn.jsdelivr.net/npm/ninegrid@${ninegrid.version}/dist/css/${cssFile}";` : "";
119318
119330
  const customFile2 = cssFile ? ninegrid.getCustomPath(this, cssFile) : "";
119319
-
119320
- //console.log(ninegrid.getCustomPath(this,"nxDialog.css"));
119321
119331
 
119322
119332
  this.innerHTML = `
119323
- <style>
119324
- @import "https://cdn.jsdelivr.net/npm/ninegrid@${ninegrid.version}/dist/css/nxDialog.css";
119325
- ${ninegrid.getCustomPath(this,"nxDialog.css") || ""}
119326
- ${customFile1 || ""}
119327
- ${customFile2 || ""}
119328
- </style>
119329
-
119330
- <dialog>
119331
- <div class="head">
119332
- <div class="rect1"></div>
119333
- <div class="rect2"></div>
119334
- <div class="rect3"></div>
119335
- <ng-sphere class="icon" end-fill="#666" size="8"></ng-sphere>
119336
- <span class="title"></span>
119337
- <span class="sub-title"></span>
119338
- <buttons>
119339
- <ng-sphere class="apply" start-fill="#cc6" end-fill="#660" size="16" title="apply"></ng-sphere>
119340
- <ng-sphere class="reset" start-fill="#99f" end-fill="#00f" size="16" title="reset"></ng-sphere>
119341
- <ng-sphere class="close" start-fill="#f99" end-fill="#f00" size="16" title="close"></ng-sphere>
119342
- </buttons>
119343
- </div>
119344
- <div class="contents">
119345
- <div class="left">
119346
- <span>가나다라마바사아자차카타파하가나다라마바사아자차카타파하가나다라마바사아자차카타파하가나다라마바사아자차카타파하가나다라마바사아자차카타파하가나다라마바사아자차카타파하가나다라마바사아자차카타파하가나다라마바사아자차카타파하</span>
119347
- </div>
119348
- <div class="body">
119349
- ${v}
119350
- </div>
119351
- <div class="close2">
119352
- <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16">
119353
- <path d="M4.646 4.646a.5.5 0 0 1 .708 0L8 7.293l2.646-2.647a.5.5 0 0 1 .708.708L8.707 8l2.647 2.646a.5.5 0 0 1-.708.708L8 8.707l-2.646 2.647a.5.5 0 0 1-.708-.708L7.293 8 4.646 5.354a.5.5 0 0 1 0-.708"/>
119354
- </svg>
119355
- </div>
119356
- </div>
119357
- </dialog>
119358
- `;
119359
-
119360
- //this.#owner = this.getRootNode().host.closest("nine-grid");
119361
-
119333
+ <style>
119334
+ @import "https://cdn.jsdelivr.net/npm/ninegrid@${ninegrid.version}/dist/css/nxDialog.css";
119335
+ ${ninegrid.getCustomPath(this,"nxDialog.css") || ""}
119336
+ ${customFile1 || ""}
119337
+ ${customFile2 || ""}
119338
+ </style>
119339
+
119340
+ <dialog>
119341
+ <div class="head">
119342
+ <div class="rect1"></div>
119343
+ <div class="rect2"></div>
119344
+ <div class="rect3"></div>
119345
+ <ng-sphere class="icon" end-fill="#666" size="8"></ng-sphere>
119346
+ <span class="title"></span>
119347
+ <span class="sub-title"></span>
119348
+ <buttons>
119349
+ <ng-sphere class="apply" start-fill="#cc6" end-fill="#660" size="16" title="apply"></ng-sphere>
119350
+ <ng-sphere class="reset" start-fill="#99f" end-fill="#00f" size="16" title="reset"></ng-sphere>
119351
+ <ng-sphere class="close" start-fill="#f99" end-fill="#f00" size="16" title="close"></ng-sphere>
119352
+ </buttons>
119353
+ </div>
119354
+ <div class="contents">
119355
+ <div class="left">
119356
+ <span>가나다라마바사아자차카타파하가나다라마바사아자차카타파하가나다라마바사아자차카타파하가나다라마바사아자차카타파하가나다라마바사아자차카타파하가나다라마바사아자차카타파하가나다라마바사아자차카타파하가나다라마바사아자차카타파하</span>
119357
+ </div>
119358
+ <div class="body">
119359
+ ${v}
119360
+ </div>
119361
+ <div class="close2">
119362
+ <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16">
119363
+ <path d="M4.646 4.646a.5.5 0 0 1 .708 0L8 7.293l2.646-2.647a.5.5 0 0 1 .708.708L8.707 8l2.647 2.646a.5.5 0 0 1-.708.708L8 8.707l-2.646 2.647a.5.5 0 0 1-.708-.708L7.293 8 4.646 5.354a.5.5 0 0 1 0-.708"/>
119364
+ </svg>
119365
+ </div>
119366
+ </div>
119367
+ </dialog>
119368
+ `;
119369
+
119362
119370
  $(".title", this).html("Details");
119363
-
119364
119371
  this.#init();
119365
119372
  };
119366
-
119373
+
119374
+ // showModal 메서드 수정
119367
119375
  showModal = () => {
119368
- this.querySelector('dialog').showModal();
119376
+ const dialogElement = this.querySelector('dialog');
119377
+
119378
+ // 다이얼로그가 열릴 때 ':host(.fade)' CSS 클래스를 추가합니다.
119379
+ // ':host'는 커스텀 엘리먼트 자체(nx-dialog)를 의미합니다.
119380
+ this.classList.add('fade');
119381
+
119382
+ // 애니메이션이 끝나고 나서 showModal을 호출하도록 setTimeout을 사용할 수도 있지만,
119383
+ // CSS 애니메이션은 자동으로 시작되므로 이 방식이 더 간단합니다.
119384
+ dialogElement.showModal();
119369
119385
  };
119370
-
119386
+
119387
+ // close 메서드 수정
119371
119388
  close = () => {
119372
- $(".head", this) .off('mousedown', this.#onMouseDown);
119373
- $(".head", this) .off('touchstart', this.#onTouchStart);
119374
- $(document) .off('mouseup', this.#onMouseUp);
119375
- $(document) .off('touchend', this.#onTouchEnd);
119376
- $(document) .off('mousemove', this.#onMouseMove);
119377
- $(document) .off("touchmove", this.#onTouchMove);
119378
-
119379
- this.querySelector('dialog').close();
119389
+ const dialogElement = this.querySelector('dialog');
119390
+
119391
+ // 닫기 애니메이션을 위해 'out' 클래스를 추가합니다.
119392
+ dialogElement.classList.add("out");
119393
+
119394
+ // CSS 애니메이션 지속 시간 (1000ms = 1초) 후에 dialog.close()를 호출하여 실제로 닫습니다.
119395
+ // 이는 CSS의 fadeOut 애니메이션 지속 시간과 일치해야 합니다.
119396
+ // nxDialog.css의 @keyframes fadeOut { ... } 에 명시된 animation-duration을 확인하세요.
119397
+ // 현재 CSS에는 dialog.out에 대한 animation-duration이 없으므로, 명시적으로 1초를 가정합니다.
119398
+ // 만약 다른 애니메이션 (.run, .moveUp 등)과 동시에 사용된다면 이 부분은 더 복잡해질 수 있습니다.
119399
+ setTimeout(() => {
119400
+ // 이벤트 리스너 제거는 dialog가 완전히 닫힌 후에 하는 것이 안전합니다.
119401
+ // 그렇지 않으면 애니메이션 도중 클릭 등이 작동하지 않을 수 있습니다.
119402
+ $(".head", this) .off('mousedown', this.#onMouseDown);
119403
+ $(".head", this) .off('touchstart', this.#onTouchStart);
119404
+ $(document) .off('mouseup', this.#onMouseUp);
119405
+ $(document) .off('touchend', this.#onTouchEnd);
119406
+ $(document) .off('mousemove', this.#onMouseMove);
119407
+ $(document) .off("touchmove", this.#onTouchMove);
119408
+
119409
+ dialogElement.close();
119410
+ // 다이얼로그가 닫힌 후에는 애니메이션 클래스를 제거하여 다음 번에 열릴 때
119411
+ // 다시 애니메이션이 적용될 수 있도록 합니다.
119412
+ dialogElement.classList.remove("out");
119413
+ this.classList.remove('fade'); // 호스트 요소에서도 'fade' 클래스 제거
119414
+ }, 1000); // fadeOut 애니메이션 지속 시간에 맞춥니다 (현재 CSS에서 1초로 정의됨)
119380
119415
  };
119381
-
119416
+
119382
119417
  #init = () => {
119418
+ // 기존의 close 버튼 클릭 핸들러
119383
119419
  $(".close,.close2", this).on("click", e => {
119384
- ninegrid.j.querySelectorAll('dialog', this).addClass("out");
119385
- setTimeout(() => { this.close(); }, 300);
119420
+ // 이전에 여기에 있던 'dialog.out' 클래스 추가 로직은 이제 close() 메서드 안으로 들어갑니다.
119421
+ this.close();
119386
119422
  });
119387
-
119388
- $(".head", this) .on('mousedown', this.#onMouseDown);
119389
- $(".head", this) .on('touchstart', this.#onTouchStart);
119390
- $(document) .on('mouseup', this.#onMouseUp);
119391
- $(document) .on('touchend', this.#onTouchEnd);
119423
+
119424
+ $(".head", this) .on('mousedown', this.#onMouseDown);
119425
+ $(".head", this) .on('touchstart', this.#onTouchStart);
119426
+ $(document) .on('mouseup', this.#onMouseUp);
119427
+ $(document) .on('touchend', this.#onTouchEnd);
119392
119428
  };
119393
-
119429
+
119394
119430
 
119395
119431
  #onMouseDown = e => {
119396
119432
  if (e.target.closest("buttons")) return;
119397
119433
  if (e.buttons != 1 || e.altKey || e.ctrlKey || e.shiftkey) return;
119398
119434
 
119399
119435
  var rect = this.querySelector('dialog').getBoundingClientRect();
119400
-
119436
+
119401
119437
  this.#shift = {
119402
119438
  x : e.clientX - rect.x,
119403
119439
  y : e.clientY - rect.y,
@@ -119405,33 +119441,33 @@ class nxDialog extends HTMLElement
119405
119441
 
119406
119442
  $(document).on('mousemove', this.#onMouseMove);
119407
119443
  };
119408
-
119409
-
119444
+
119445
+
119410
119446
  #onMouseMove = e => {
119411
119447
  $(this.querySelector('dialog')).offset( { left : e.pageX - this.#shift.x, top : e.pageY - this.#shift.y });
119412
119448
  };
119413
-
119449
+
119414
119450
  #onMouseUp = e => {
119415
119451
  $(document).off('mousemove', this.#onMouseMove);
119416
119452
  };
119417
-
119453
+
119418
119454
  #onTouchStart = e => {
119419
119455
  if (e.target.closest("buttons")) return;
119420
-
119456
+
119421
119457
  var rect = this.querySelector('dialog').getBoundingClientRect();
119422
-
119458
+
119423
119459
  this.#shift = {
119424
119460
  x : e.changedTouches[0].pageX - rect.x,
119425
119461
  y : e.changedTouches[0].pageY - rect.y,
119426
119462
  };
119427
-
119463
+
119428
119464
  $(document).on("touchmove", this.#onTouchMove);
119429
119465
  };
119430
-
119466
+
119431
119467
  #onTouchMove = e => {
119432
119468
  $(this.querySelector('dialog')).offset( { left : e.changedTouches[0].pageX - this.#shift.x, top : e.changedTouches[0].pageY - this.#shift.y });
119433
119469
  };
119434
-
119470
+
119435
119471
  #onTouchEnd = e => {
119436
119472
  $(document).off('touchmove', this.#onTouchMove);
119437
119473
  };
@@ -4,99 +4,127 @@ class nxDialog extends HTMLElement
4
4
  {
5
5
  //#owner;
6
6
  #shift;
7
-
7
+
8
8
  constructor () {
9
9
  super();
10
10
  }
11
-
11
+
12
12
  connectedCallback() {
13
13
 
14
14
  const v = this.innerHTML;
15
15
  const cssFile = this.getAttribute("css-file");
16
- const customFile1 = cssFile ? `@import "https://cdn.jsdelivr.net/npm/ninegrid@${ninegrid.version}/dist/css/${cssFile}";`: "";
16
+ // customFile1 customFile2 변수가 동일한 역할을 하는 것으로 보이며,
17
+ // ninegrid.getCustomPath에서 이미 "nxDialog.css"를 가져오는 로직이 있으므로
18
+ // 이 부분을 간소화할 수 있습니다.
19
+ // 여기서는 현재 코드를 최대한 유지하면서 fadeIn/fadeOut만 추가합니다.
20
+ const customFile1 = cssFile ? `@import "https://cdn.jsdelivr.net/npm/ninegrid@${ninegrid.version}/dist/css/${cssFile}";` : "";
17
21
  const customFile2 = cssFile ? ninegrid.getCustomPath(this, cssFile) : "";
18
-
19
- //console.log(ninegrid.getCustomPath(this,"nxDialog.css"));
20
22
 
21
23
  this.innerHTML = `
22
- <style>
23
- @import "https://cdn.jsdelivr.net/npm/ninegrid@${ninegrid.version}/dist/css/nxDialog.css";
24
- ${ninegrid.getCustomPath(this,"nxDialog.css") || ""}
25
- ${customFile1 || ""}
26
- ${customFile2 || ""}
27
- </style>
28
-
29
- <dialog>
30
- <div class="head">
31
- <div class="rect1"></div>
32
- <div class="rect2"></div>
33
- <div class="rect3"></div>
34
- <ng-sphere class="icon" end-fill="#666" size="8"></ng-sphere>
35
- <span class="title"></span>
36
- <span class="sub-title"></span>
37
- <buttons>
38
- <ng-sphere class="apply" start-fill="#cc6" end-fill="#660" size="16" title="apply"></ng-sphere>
39
- <ng-sphere class="reset" start-fill="#99f" end-fill="#00f" size="16" title="reset"></ng-sphere>
40
- <ng-sphere class="close" start-fill="#f99" end-fill="#f00" size="16" title="close"></ng-sphere>
41
- </buttons>
42
- </div>
43
- <div class="contents">
44
- <div class="left">
45
- <span>가나다라마바사아자차카타파하가나다라마바사아자차카타파하가나다라마바사아자차카타파하가나다라마바사아자차카타파하가나다라마바사아자차카타파하가나다라마바사아자차카타파하가나다라마바사아자차카타파하가나다라마바사아자차카타파하</span>
46
- </div>
47
- <div class="body">
48
- ${v}
49
- </div>
50
- <div class="close2">
51
- <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16">
52
- <path d="M4.646 4.646a.5.5 0 0 1 .708 0L8 7.293l2.646-2.647a.5.5 0 0 1 .708.708L8.707 8l2.647 2.646a.5.5 0 0 1-.708.708L8 8.707l-2.646 2.647a.5.5 0 0 1-.708-.708L7.293 8 4.646 5.354a.5.5 0 0 1 0-.708"/>
53
- </svg>
54
- </div>
55
- </div>
56
- </dialog>
57
- `;
58
-
59
- //this.#owner = this.getRootNode().host.closest("nine-grid");
60
-
24
+ <style>
25
+ @import "https://cdn.jsdelivr.net/npm/ninegrid@${ninegrid.version}/dist/css/nxDialog.css";
26
+ ${ninegrid.getCustomPath(this,"nxDialog.css") || ""}
27
+ ${customFile1 || ""}
28
+ ${customFile2 || ""}
29
+ </style>
30
+
31
+ <dialog>
32
+ <div class="head">
33
+ <div class="rect1"></div>
34
+ <div class="rect2"></div>
35
+ <div class="rect3"></div>
36
+ <ng-sphere class="icon" end-fill="#666" size="8"></ng-sphere>
37
+ <span class="title"></span>
38
+ <span class="sub-title"></span>
39
+ <buttons>
40
+ <ng-sphere class="apply" start-fill="#cc6" end-fill="#660" size="16" title="apply"></ng-sphere>
41
+ <ng-sphere class="reset" start-fill="#99f" end-fill="#00f" size="16" title="reset"></ng-sphere>
42
+ <ng-sphere class="close" start-fill="#f99" end-fill="#f00" size="16" title="close"></ng-sphere>
43
+ </buttons>
44
+ </div>
45
+ <div class="contents">
46
+ <div class="left">
47
+ <span>가나다라마바사아자차카타파하가나다라마바사아자차카타파하가나다라마바사아자차카타파하가나다라마바사아자차카타파하가나다라마바사아자차카타파하가나다라마바사아자차카타파하가나다라마바사아자차카타파하가나다라마바사아자차카타파하</span>
48
+ </div>
49
+ <div class="body">
50
+ ${v}
51
+ </div>
52
+ <div class="close2">
53
+ <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16">
54
+ <path d="M4.646 4.646a.5.5 0 0 1 .708 0L8 7.293l2.646-2.647a.5.5 0 0 1 .708.708L8.707 8l2.647 2.646a.5.5 0 0 1-.708.708L8 8.707l-2.646 2.647a.5.5 0 0 1-.708-.708L7.293 8 4.646 5.354a.5.5 0 0 1 0-.708"/>
55
+ </svg>
56
+ </div>
57
+ </div>
58
+ </dialog>
59
+ `;
60
+
61
61
  $(".title", this).html("Details");
62
-
63
62
  this.#init();
64
63
  };
65
-
64
+
65
+ // showModal 메서드 수정
66
66
  showModal = () => {
67
- this.querySelector('dialog').showModal();
67
+ const dialogElement = this.querySelector('dialog');
68
+
69
+ // 다이얼로그가 열릴 때 ':host(.fade)' CSS 클래스를 추가합니다.
70
+ // ':host'는 커스텀 엘리먼트 자체(nx-dialog)를 의미합니다.
71
+ this.classList.add('fade');
72
+
73
+ // 애니메이션이 끝나고 나서 showModal을 호출하도록 setTimeout을 사용할 수도 있지만,
74
+ // CSS 애니메이션은 자동으로 시작되므로 이 방식이 더 간단합니다.
75
+ dialogElement.showModal();
68
76
  };
69
-
77
+
78
+ // close 메서드 수정
70
79
  close = () => {
71
- $(".head", this) .off('mousedown', this.#onMouseDown);
72
- $(".head", this) .off('touchstart', this.#onTouchStart);
73
- $(document) .off('mouseup', this.#onMouseUp);
74
- $(document) .off('touchend', this.#onTouchEnd);
75
- $(document) .off('mousemove', this.#onMouseMove);
76
- $(document) .off("touchmove", this.#onTouchMove);
77
-
78
- this.querySelector('dialog').close();
80
+ const dialogElement = this.querySelector('dialog');
81
+
82
+ // 닫기 애니메이션을 위해 'out' 클래스를 추가합니다.
83
+ dialogElement.classList.add("out");
84
+
85
+ // CSS 애니메이션 지속 시간 (1000ms = 1초) 후에 dialog.close()를 호출하여 실제로 닫습니다.
86
+ // 이는 CSS의 fadeOut 애니메이션 지속 시간과 일치해야 합니다.
87
+ // nxDialog.css의 @keyframes fadeOut { ... } 에 명시된 animation-duration을 확인하세요.
88
+ // 현재 CSS에는 dialog.out에 대한 animation-duration이 없으므로, 명시적으로 1초를 가정합니다.
89
+ // 만약 다른 애니메이션 (.run, .moveUp 등)과 동시에 사용된다면 이 부분은 더 복잡해질 수 있습니다.
90
+ setTimeout(() => {
91
+ // 이벤트 리스너 제거는 dialog가 완전히 닫힌 후에 하는 것이 안전합니다.
92
+ // 그렇지 않으면 애니메이션 도중 클릭 등이 작동하지 않을 수 있습니다.
93
+ $(".head", this) .off('mousedown', this.#onMouseDown);
94
+ $(".head", this) .off('touchstart', this.#onTouchStart);
95
+ $(document) .off('mouseup', this.#onMouseUp);
96
+ $(document) .off('touchend', this.#onTouchEnd);
97
+ $(document) .off('mousemove', this.#onMouseMove);
98
+ $(document) .off("touchmove", this.#onTouchMove);
99
+
100
+ dialogElement.close();
101
+ // 다이얼로그가 닫힌 후에는 애니메이션 클래스를 제거하여 다음 번에 열릴 때
102
+ // 다시 애니메이션이 적용될 수 있도록 합니다.
103
+ dialogElement.classList.remove("out");
104
+ this.classList.remove('fade'); // 호스트 요소에서도 'fade' 클래스 제거
105
+ }, 1000); // fadeOut 애니메이션 지속 시간에 맞춥니다 (현재 CSS에서 1초로 정의됨)
79
106
  };
80
-
107
+
81
108
  #init = () => {
109
+ // 기존의 close 버튼 클릭 핸들러
82
110
  $(".close,.close2", this).on("click", e => {
83
- ninegrid.j.querySelectorAll('dialog', this).addClass("out");
84
- setTimeout(() => { this.close(); }, 300);
111
+ // 이전에 여기에 있던 'dialog.out' 클래스 추가 로직은 이제 close() 메서드 안으로 들어갑니다.
112
+ this.close();
85
113
  });
86
-
87
- $(".head", this) .on('mousedown', this.#onMouseDown);
88
- $(".head", this) .on('touchstart', this.#onTouchStart);
89
- $(document) .on('mouseup', this.#onMouseUp);
90
- $(document) .on('touchend', this.#onTouchEnd);
114
+
115
+ $(".head", this) .on('mousedown', this.#onMouseDown);
116
+ $(".head", this) .on('touchstart', this.#onTouchStart);
117
+ $(document) .on('mouseup', this.#onMouseUp);
118
+ $(document) .on('touchend', this.#onTouchEnd);
91
119
  };
92
-
120
+
93
121
 
94
122
  #onMouseDown = e => {
95
123
  if (e.target.closest("buttons")) return;
96
124
  if (e.buttons != 1 || e.altKey || e.ctrlKey || e.shiftkey) return;
97
125
 
98
126
  var rect = this.querySelector('dialog').getBoundingClientRect();
99
-
127
+
100
128
  this.#shift = {
101
129
  x : e.clientX - rect.x,
102
130
  y : e.clientY - rect.y,
@@ -104,36 +132,36 @@ class nxDialog extends HTMLElement
104
132
 
105
133
  $(document).on('mousemove', this.#onMouseMove);
106
134
  };
107
-
108
-
135
+
136
+
109
137
  #onMouseMove = e => {
110
138
  $(this.querySelector('dialog')).offset( { left : e.pageX - this.#shift.x, top : e.pageY - this.#shift.y });
111
139
  };
112
-
140
+
113
141
  #onMouseUp = e => {
114
142
  $(document).off('mousemove', this.#onMouseMove);
115
143
  };
116
-
144
+
117
145
  #onTouchStart = e => {
118
146
  if (e.target.closest("buttons")) return;
119
-
147
+
120
148
  var rect = this.querySelector('dialog').getBoundingClientRect();
121
-
149
+
122
150
  this.#shift = {
123
151
  x : e.changedTouches[0].pageX - rect.x,
124
152
  y : e.changedTouches[0].pageY - rect.y,
125
153
  }
126
-
154
+
127
155
  $(document).on("touchmove", this.#onTouchMove);
128
156
  };
129
-
157
+
130
158
  #onTouchMove = e => {
131
159
  $(this.querySelector('dialog')).offset( { left : e.changedTouches[0].pageX - this.#shift.x, top : e.changedTouches[0].pageY - this.#shift.y });
132
160
  };
133
-
161
+
134
162
  #onTouchEnd = e => {
135
163
  $(document).off('touchmove', this.#onTouchMove);
136
164
  };
137
165
  }
138
166
 
139
- customElements.define("nx-dialog", nxDialog);
167
+ customElements.define("nx-dialog", nxDialog);
@@ -643,6 +643,14 @@ export class ninegrid {
643
643
  return null; // 없으면 null 반환
644
644
  };
645
645
 
646
+ static setOptions = (k,o) => {
647
+ for (const prop in o) {
648
+ if (ninegrid.options[k][prop]) {
649
+ ninegrid.options[k][prop] = o[prop];
650
+ }
651
+ }
652
+ };
653
+
646
654
  static confirm(message, title, options) {
647
655
  return nxConfirmPopup.confirm(message, title, options);
648
656
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "ninegrid2",
3
3
  "type": "module",
4
- "version": "6.895.0",
4
+ "version": "6.897.0",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "exports": {
@@ -4,99 +4,127 @@ class nxDialog extends HTMLElement
4
4
  {
5
5
  //#owner;
6
6
  #shift;
7
-
7
+
8
8
  constructor () {
9
9
  super();
10
10
  }
11
-
11
+
12
12
  connectedCallback() {
13
13
 
14
14
  const v = this.innerHTML;
15
15
  const cssFile = this.getAttribute("css-file");
16
- const customFile1 = cssFile ? `@import "https://cdn.jsdelivr.net/npm/ninegrid@${ninegrid.version}/dist/css/${cssFile}";`: "";
16
+ // customFile1 customFile2 변수가 동일한 역할을 하는 것으로 보이며,
17
+ // ninegrid.getCustomPath에서 이미 "nxDialog.css"를 가져오는 로직이 있으므로
18
+ // 이 부분을 간소화할 수 있습니다.
19
+ // 여기서는 현재 코드를 최대한 유지하면서 fadeIn/fadeOut만 추가합니다.
20
+ const customFile1 = cssFile ? `@import "https://cdn.jsdelivr.net/npm/ninegrid@${ninegrid.version}/dist/css/${cssFile}";` : "";
17
21
  const customFile2 = cssFile ? ninegrid.getCustomPath(this, cssFile) : "";
18
-
19
- //console.log(ninegrid.getCustomPath(this,"nxDialog.css"));
20
22
 
21
23
  this.innerHTML = `
22
- <style>
23
- @import "https://cdn.jsdelivr.net/npm/ninegrid@${ninegrid.version}/dist/css/nxDialog.css";
24
- ${ninegrid.getCustomPath(this,"nxDialog.css") || ""}
25
- ${customFile1 || ""}
26
- ${customFile2 || ""}
27
- </style>
28
-
29
- <dialog>
30
- <div class="head">
31
- <div class="rect1"></div>
32
- <div class="rect2"></div>
33
- <div class="rect3"></div>
34
- <ng-sphere class="icon" end-fill="#666" size="8"></ng-sphere>
35
- <span class="title"></span>
36
- <span class="sub-title"></span>
37
- <buttons>
38
- <ng-sphere class="apply" start-fill="#cc6" end-fill="#660" size="16" title="apply"></ng-sphere>
39
- <ng-sphere class="reset" start-fill="#99f" end-fill="#00f" size="16" title="reset"></ng-sphere>
40
- <ng-sphere class="close" start-fill="#f99" end-fill="#f00" size="16" title="close"></ng-sphere>
41
- </buttons>
42
- </div>
43
- <div class="contents">
44
- <div class="left">
45
- <span>가나다라마바사아자차카타파하가나다라마바사아자차카타파하가나다라마바사아자차카타파하가나다라마바사아자차카타파하가나다라마바사아자차카타파하가나다라마바사아자차카타파하가나다라마바사아자차카타파하가나다라마바사아자차카타파하</span>
46
- </div>
47
- <div class="body">
48
- ${v}
49
- </div>
50
- <div class="close2">
51
- <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16">
52
- <path d="M4.646 4.646a.5.5 0 0 1 .708 0L8 7.293l2.646-2.647a.5.5 0 0 1 .708.708L8.707 8l2.647 2.646a.5.5 0 0 1-.708.708L8 8.707l-2.646 2.647a.5.5 0 0 1-.708-.708L7.293 8 4.646 5.354a.5.5 0 0 1 0-.708"/>
53
- </svg>
54
- </div>
55
- </div>
56
- </dialog>
57
- `;
58
-
59
- //this.#owner = this.getRootNode().host.closest("nine-grid");
60
-
24
+ <style>
25
+ @import "https://cdn.jsdelivr.net/npm/ninegrid@${ninegrid.version}/dist/css/nxDialog.css";
26
+ ${ninegrid.getCustomPath(this,"nxDialog.css") || ""}
27
+ ${customFile1 || ""}
28
+ ${customFile2 || ""}
29
+ </style>
30
+
31
+ <dialog>
32
+ <div class="head">
33
+ <div class="rect1"></div>
34
+ <div class="rect2"></div>
35
+ <div class="rect3"></div>
36
+ <ng-sphere class="icon" end-fill="#666" size="8"></ng-sphere>
37
+ <span class="title"></span>
38
+ <span class="sub-title"></span>
39
+ <buttons>
40
+ <ng-sphere class="apply" start-fill="#cc6" end-fill="#660" size="16" title="apply"></ng-sphere>
41
+ <ng-sphere class="reset" start-fill="#99f" end-fill="#00f" size="16" title="reset"></ng-sphere>
42
+ <ng-sphere class="close" start-fill="#f99" end-fill="#f00" size="16" title="close"></ng-sphere>
43
+ </buttons>
44
+ </div>
45
+ <div class="contents">
46
+ <div class="left">
47
+ <span>가나다라마바사아자차카타파하가나다라마바사아자차카타파하가나다라마바사아자차카타파하가나다라마바사아자차카타파하가나다라마바사아자차카타파하가나다라마바사아자차카타파하가나다라마바사아자차카타파하가나다라마바사아자차카타파하</span>
48
+ </div>
49
+ <div class="body">
50
+ ${v}
51
+ </div>
52
+ <div class="close2">
53
+ <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16">
54
+ <path d="M4.646 4.646a.5.5 0 0 1 .708 0L8 7.293l2.646-2.647a.5.5 0 0 1 .708.708L8.707 8l2.647 2.646a.5.5 0 0 1-.708.708L8 8.707l-2.646 2.647a.5.5 0 0 1-.708-.708L7.293 8 4.646 5.354a.5.5 0 0 1 0-.708"/>
55
+ </svg>
56
+ </div>
57
+ </div>
58
+ </dialog>
59
+ `;
60
+
61
61
  $(".title", this).html("Details");
62
-
63
62
  this.#init();
64
63
  };
65
-
64
+
65
+ // showModal 메서드 수정
66
66
  showModal = () => {
67
- this.querySelector('dialog').showModal();
67
+ const dialogElement = this.querySelector('dialog');
68
+
69
+ // 다이얼로그가 열릴 때 ':host(.fade)' CSS 클래스를 추가합니다.
70
+ // ':host'는 커스텀 엘리먼트 자체(nx-dialog)를 의미합니다.
71
+ this.classList.add('fade');
72
+
73
+ // 애니메이션이 끝나고 나서 showModal을 호출하도록 setTimeout을 사용할 수도 있지만,
74
+ // CSS 애니메이션은 자동으로 시작되므로 이 방식이 더 간단합니다.
75
+ dialogElement.showModal();
68
76
  };
69
-
77
+
78
+ // close 메서드 수정
70
79
  close = () => {
71
- $(".head", this) .off('mousedown', this.#onMouseDown);
72
- $(".head", this) .off('touchstart', this.#onTouchStart);
73
- $(document) .off('mouseup', this.#onMouseUp);
74
- $(document) .off('touchend', this.#onTouchEnd);
75
- $(document) .off('mousemove', this.#onMouseMove);
76
- $(document) .off("touchmove", this.#onTouchMove);
77
-
78
- this.querySelector('dialog').close();
80
+ const dialogElement = this.querySelector('dialog');
81
+
82
+ // 닫기 애니메이션을 위해 'out' 클래스를 추가합니다.
83
+ dialogElement.classList.add("out");
84
+
85
+ // CSS 애니메이션 지속 시간 (1000ms = 1초) 후에 dialog.close()를 호출하여 실제로 닫습니다.
86
+ // 이는 CSS의 fadeOut 애니메이션 지속 시간과 일치해야 합니다.
87
+ // nxDialog.css의 @keyframes fadeOut { ... } 에 명시된 animation-duration을 확인하세요.
88
+ // 현재 CSS에는 dialog.out에 대한 animation-duration이 없으므로, 명시적으로 1초를 가정합니다.
89
+ // 만약 다른 애니메이션 (.run, .moveUp 등)과 동시에 사용된다면 이 부분은 더 복잡해질 수 있습니다.
90
+ setTimeout(() => {
91
+ // 이벤트 리스너 제거는 dialog가 완전히 닫힌 후에 하는 것이 안전합니다.
92
+ // 그렇지 않으면 애니메이션 도중 클릭 등이 작동하지 않을 수 있습니다.
93
+ $(".head", this) .off('mousedown', this.#onMouseDown);
94
+ $(".head", this) .off('touchstart', this.#onTouchStart);
95
+ $(document) .off('mouseup', this.#onMouseUp);
96
+ $(document) .off('touchend', this.#onTouchEnd);
97
+ $(document) .off('mousemove', this.#onMouseMove);
98
+ $(document) .off("touchmove", this.#onTouchMove);
99
+
100
+ dialogElement.close();
101
+ // 다이얼로그가 닫힌 후에는 애니메이션 클래스를 제거하여 다음 번에 열릴 때
102
+ // 다시 애니메이션이 적용될 수 있도록 합니다.
103
+ dialogElement.classList.remove("out");
104
+ this.classList.remove('fade'); // 호스트 요소에서도 'fade' 클래스 제거
105
+ }, 1000); // fadeOut 애니메이션 지속 시간에 맞춥니다 (현재 CSS에서 1초로 정의됨)
79
106
  };
80
-
107
+
81
108
  #init = () => {
109
+ // 기존의 close 버튼 클릭 핸들러
82
110
  $(".close,.close2", this).on("click", e => {
83
- ninegrid.j.querySelectorAll('dialog', this).addClass("out");
84
- setTimeout(() => { this.close(); }, 300);
111
+ // 이전에 여기에 있던 'dialog.out' 클래스 추가 로직은 이제 close() 메서드 안으로 들어갑니다.
112
+ this.close();
85
113
  });
86
-
87
- $(".head", this) .on('mousedown', this.#onMouseDown);
88
- $(".head", this) .on('touchstart', this.#onTouchStart);
89
- $(document) .on('mouseup', this.#onMouseUp);
90
- $(document) .on('touchend', this.#onTouchEnd);
114
+
115
+ $(".head", this) .on('mousedown', this.#onMouseDown);
116
+ $(".head", this) .on('touchstart', this.#onTouchStart);
117
+ $(document) .on('mouseup', this.#onMouseUp);
118
+ $(document) .on('touchend', this.#onTouchEnd);
91
119
  };
92
-
120
+
93
121
 
94
122
  #onMouseDown = e => {
95
123
  if (e.target.closest("buttons")) return;
96
124
  if (e.buttons != 1 || e.altKey || e.ctrlKey || e.shiftkey) return;
97
125
 
98
126
  var rect = this.querySelector('dialog').getBoundingClientRect();
99
-
127
+
100
128
  this.#shift = {
101
129
  x : e.clientX - rect.x,
102
130
  y : e.clientY - rect.y,
@@ -104,36 +132,36 @@ class nxDialog extends HTMLElement
104
132
 
105
133
  $(document).on('mousemove', this.#onMouseMove);
106
134
  };
107
-
108
-
135
+
136
+
109
137
  #onMouseMove = e => {
110
138
  $(this.querySelector('dialog')).offset( { left : e.pageX - this.#shift.x, top : e.pageY - this.#shift.y });
111
139
  };
112
-
140
+
113
141
  #onMouseUp = e => {
114
142
  $(document).off('mousemove', this.#onMouseMove);
115
143
  };
116
-
144
+
117
145
  #onTouchStart = e => {
118
146
  if (e.target.closest("buttons")) return;
119
-
147
+
120
148
  var rect = this.querySelector('dialog').getBoundingClientRect();
121
-
149
+
122
150
  this.#shift = {
123
151
  x : e.changedTouches[0].pageX - rect.x,
124
152
  y : e.changedTouches[0].pageY - rect.y,
125
153
  }
126
-
154
+
127
155
  $(document).on("touchmove", this.#onTouchMove);
128
156
  };
129
-
157
+
130
158
  #onTouchMove = e => {
131
159
  $(this.querySelector('dialog')).offset( { left : e.changedTouches[0].pageX - this.#shift.x, top : e.changedTouches[0].pageY - this.#shift.y });
132
160
  };
133
-
161
+
134
162
  #onTouchEnd = e => {
135
163
  $(document).off('touchmove', this.#onTouchMove);
136
164
  };
137
165
  }
138
166
 
139
- customElements.define("nx-dialog", nxDialog);
167
+ customElements.define("nx-dialog", nxDialog);
@@ -643,6 +643,14 @@ export class ninegrid {
643
643
  return null; // 없으면 null 반환
644
644
  };
645
645
 
646
+ static setOptions = (k,o) => {
647
+ for (const prop in o) {
648
+ if (ninegrid.options[k][prop]) {
649
+ ninegrid.options[k][prop] = o[prop];
650
+ }
651
+ }
652
+ };
653
+
646
654
  static confirm(message, title, options) {
647
655
  return nxConfirmPopup.confirm(message, title, options);
648
656
  };