aio-popup 6.3.0 → 6.4.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.
- package/index.css +1 -0
- package/index.d.ts +6 -0
- package/index.js +26 -11
- package/package.json +1 -1
package/index.css
CHANGED
package/index.d.ts
CHANGED
|
@@ -43,6 +43,12 @@ export type AP_alert = {
|
|
|
43
43
|
closeText?: string;
|
|
44
44
|
animate?: boolean;
|
|
45
45
|
onClose?: boolean | (() => void);
|
|
46
|
+
actions?: {
|
|
47
|
+
text: string;
|
|
48
|
+
callback: any;
|
|
49
|
+
className?: string;
|
|
50
|
+
id: string;
|
|
51
|
+
}[];
|
|
46
52
|
};
|
|
47
53
|
export type AP_snackebar = {
|
|
48
54
|
id?: string;
|
package/index.js
CHANGED
|
@@ -529,7 +529,7 @@ const SnackebarBar = () => {
|
|
|
529
529
|
return _jsx("div", { className: 'aio-popup-snackebar-bar', style: { transition: `${item.time || 8}s linear` } });
|
|
530
530
|
};
|
|
531
531
|
export function Alert(props) {
|
|
532
|
-
let { icon, type = '', title = '', text = '', time = 10, className, closeText = 'Close', onClose, rtl } = props;
|
|
532
|
+
let { icon, type = '', title = '', text = '', time = 10, className, closeText = 'Close', onClose, rtl, actions = [] } = props;
|
|
533
533
|
let $$ = {
|
|
534
534
|
id: '',
|
|
535
535
|
time: 0,
|
|
@@ -553,6 +553,10 @@ export function Alert(props) {
|
|
|
553
553
|
</div>
|
|
554
554
|
<div class='aio-popup-alert-footer'>
|
|
555
555
|
<button class='aio-popup-alert-close ${$$.id}'>${closeText}</button>
|
|
556
|
+
${actions.map((o) => {
|
|
557
|
+
const { className, id, text } = o;
|
|
558
|
+
return `<button data-action='${id}' class='aio-popup-alert-action${className ? ' ' + className : ''}'>${text}</button>`;
|
|
559
|
+
}).join(' ')}
|
|
556
560
|
</div>
|
|
557
561
|
<div class='aio-popup-time'></div>
|
|
558
562
|
</div>
|
|
@@ -603,10 +607,21 @@ export function Alert(props) {
|
|
|
603
607
|
dom.addClass('not-mounted');
|
|
604
608
|
}
|
|
605
609
|
},
|
|
610
|
+
callAction(e) {
|
|
611
|
+
const target = $(e.target);
|
|
612
|
+
const actionId = target.attr('data-action');
|
|
613
|
+
const action = actions.find((o) => o.id === actionId);
|
|
614
|
+
if (!action) {
|
|
615
|
+
return;
|
|
616
|
+
}
|
|
617
|
+
action.callback();
|
|
618
|
+
},
|
|
606
619
|
render() {
|
|
607
620
|
$('body').append($$.getRender());
|
|
608
621
|
$('button.' + $$.id).off('click', $$.close);
|
|
609
622
|
$('button.' + $$.id).on('click', $$.close);
|
|
623
|
+
$('button.aio-popup-alert-action').off('click', $$.callAction);
|
|
624
|
+
$('button.aio-popup-alert-action').on('click', $$.callAction);
|
|
610
625
|
$$.toggleClass(true);
|
|
611
626
|
}
|
|
612
627
|
};
|
|
@@ -731,16 +746,16 @@ function getEasing(highlight) {
|
|
|
731
746
|
const { easing } = highlight;
|
|
732
747
|
var easingNames = [
|
|
733
748
|
'linear',
|
|
734
|
-
'easeInQuad',
|
|
735
|
-
'easeInSine',
|
|
736
|
-
'easeInCirc',
|
|
737
|
-
'easeInBack',
|
|
738
|
-
'easeOutQuad',
|
|
739
|
-
'easeOutSine',
|
|
740
|
-
'easeOutCirc',
|
|
741
|
-
'easeInOutQuad',
|
|
742
|
-
'easeInOutSine',
|
|
743
|
-
'easeInOutBack',
|
|
749
|
+
'easeInQuad', //1
|
|
750
|
+
'easeInSine', //5
|
|
751
|
+
'easeInCirc', //7
|
|
752
|
+
'easeInBack', //8
|
|
753
|
+
'easeOutQuad', //9
|
|
754
|
+
'easeOutSine', //13
|
|
755
|
+
'easeOutCirc', //15
|
|
756
|
+
'easeInOutQuad', //18
|
|
757
|
+
'easeInOutSine', //22
|
|
758
|
+
'easeInOutBack', //25
|
|
744
759
|
'easeOutBounce', //27
|
|
745
760
|
];
|
|
746
761
|
if (typeof easing === 'number') {
|