aio-popup 6.4.0 → 6.5.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.
Files changed (3) hide show
  1. package/index.d.ts +1 -0
  2. package/index.js +7 -5
  3. package/package.json +1 -1
package/index.d.ts CHANGED
@@ -48,6 +48,7 @@ export type AP_alert = {
48
48
  callback: any;
49
49
  className?: string;
50
50
  id: string;
51
+ close?: boolean;
51
52
  }[];
52
53
  };
53
54
  export type AP_snackebar = {
package/index.js CHANGED
@@ -552,7 +552,7 @@ export function Alert(props) {
552
552
  <div class='aio-popup-alert-text' style="text-align:${rtl ? 'right' : 'left'}">${text}</div>
553
553
  </div>
554
554
  <div class='aio-popup-alert-footer'>
555
- <button class='aio-popup-alert-close ${$$.id}'>${closeText}</button>
555
+ ${onClose !== false ? `<button class='aio-popup-alert-close ${$$.id}'>${closeText}</button>` : ''}
556
556
  ${actions.map((o) => {
557
557
  const { className, id, text } = o;
558
558
  return `<button data-action='${id}' class='aio-popup-alert-action${className ? ' ' + className : ''}'>${text}</button>`;
@@ -569,9 +569,6 @@ export function Alert(props) {
569
569
  if (typeof onClose === 'function') {
570
570
  onClose();
571
571
  }
572
- if (onClose === false) {
573
- return;
574
- }
575
572
  $('.' + $$.id).remove();
576
573
  }, 200);
577
574
  },
@@ -587,6 +584,8 @@ export function Alert(props) {
587
584
  }[type] || '';
588
585
  },
589
586
  startTimer() {
587
+ let timeoutTime = time / 50 * 1000;
588
+ timeoutTime = timeoutTime > 100000 ? 100000 : timeoutTime;
590
589
  setTimeout(() => {
591
590
  if ($$.time >= 100) {
592
591
  $$.time = 100;
@@ -596,7 +595,7 @@ export function Alert(props) {
596
595
  $$.time += 2;
597
596
  $$.updateBarRender();
598
597
  $$.startTimer();
599
- }, time / 50 * 1000);
598
+ }, timeoutTime);
600
599
  },
601
600
  toggleClass(mount) {
602
601
  let dom = $(`.${$$.id}`);
@@ -615,6 +614,9 @@ export function Alert(props) {
615
614
  return;
616
615
  }
617
616
  action.callback();
617
+ if (action.close) {
618
+ $$.close();
619
+ }
618
620
  },
619
621
  render() {
620
622
  $('body').append($$.getRender());
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aio-popup",
3
- "version": "6.4.0",
3
+ "version": "6.5.0",
4
4
  "description": "handle all types of popup and modals in react",
5
5
  "main": "index.js",
6
6
  "scripts": {