aio-popup 6.6.0 → 6.6.2
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.d.ts +7 -5
- package/index.js +16 -14
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -2,11 +2,12 @@ import { ReactNode } from 'react';
|
|
|
2
2
|
import './index.css';
|
|
3
3
|
export type AP_position = 'fullscreen' | 'center' | 'popover' | 'left' | 'right' | 'top' | 'bottom';
|
|
4
4
|
export type AP_attrsKey = 'backdrop' | 'modal' | 'header' | 'body' | 'footer';
|
|
5
|
-
export type AP_header =
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
5
|
+
export type AP_header = {
|
|
6
|
+
html?: ((p: {
|
|
7
|
+
removeModal: () => void;
|
|
8
|
+
state: any;
|
|
9
|
+
setState: any;
|
|
10
|
+
}) => ReactNode);
|
|
10
11
|
title?: string;
|
|
11
12
|
subtitle?: string;
|
|
12
13
|
before?: ReactNode;
|
|
@@ -32,6 +33,7 @@ export type AP_modal = {
|
|
|
32
33
|
fitHorizontal?: boolean;
|
|
33
34
|
setAttrs?: AP_setAttrs;
|
|
34
35
|
pageSelector?: string;
|
|
36
|
+
focus?: boolean;
|
|
35
37
|
};
|
|
36
38
|
export type AP_alert = {
|
|
37
39
|
rtl?: boolean;
|
package/index.js
CHANGED
|
@@ -284,7 +284,9 @@ const Popup = ({ modal, isLast }) => {
|
|
|
284
284
|
let popup = $(temp.dom.current);
|
|
285
285
|
popup.removeClass('not-mounted');
|
|
286
286
|
$(temp.backdropDom.current).removeClass('not-mounted');
|
|
287
|
-
|
|
287
|
+
if (modal.focus !== false) {
|
|
288
|
+
popup.focus();
|
|
289
|
+
}
|
|
288
290
|
}, 0);
|
|
289
291
|
$(window).unbind('click', handleBackClick);
|
|
290
292
|
$(window).bind('click', handleBackClick);
|
|
@@ -386,8 +388,8 @@ const ModalHeader = () => {
|
|
|
386
388
|
}
|
|
387
389
|
let { setAttrs = () => { return {}; } } = modal;
|
|
388
390
|
let attrs = setAttrs('header') || {};
|
|
389
|
-
if (
|
|
390
|
-
return modal.header({ removeModal: removeModal, state, setState });
|
|
391
|
+
if (modal.header && modal.header.html) {
|
|
392
|
+
return modal.header.html({ removeModal: removeModal, state, setState });
|
|
391
393
|
}
|
|
392
394
|
if (typeof modal.header !== 'object') {
|
|
393
395
|
return null;
|
|
@@ -416,7 +418,7 @@ const ModalClose = () => {
|
|
|
416
418
|
return _jsx("div", { className: `aio-popup-header-close`, onClick: (e) => {
|
|
417
419
|
e.stopPropagation();
|
|
418
420
|
e.preventDefault();
|
|
419
|
-
if (typeof header.onClose === 'function') {
|
|
421
|
+
if (header && typeof header.onClose === 'function') {
|
|
420
422
|
header.onClose({ state, setState });
|
|
421
423
|
}
|
|
422
424
|
else {
|
|
@@ -754,16 +756,16 @@ function getEasing(highlight) {
|
|
|
754
756
|
const { easing } = highlight;
|
|
755
757
|
var easingNames = [
|
|
756
758
|
'linear',
|
|
757
|
-
'easeInQuad',
|
|
758
|
-
'easeInSine',
|
|
759
|
-
'easeInCirc',
|
|
760
|
-
'easeInBack',
|
|
761
|
-
'easeOutQuad',
|
|
762
|
-
'easeOutSine',
|
|
763
|
-
'easeOutCirc',
|
|
764
|
-
'easeInOutQuad',
|
|
765
|
-
'easeInOutSine',
|
|
766
|
-
'easeInOutBack',
|
|
759
|
+
'easeInQuad', //1
|
|
760
|
+
'easeInSine', //5
|
|
761
|
+
'easeInCirc', //7
|
|
762
|
+
'easeInBack', //8
|
|
763
|
+
'easeOutQuad', //9
|
|
764
|
+
'easeOutSine', //13
|
|
765
|
+
'easeOutCirc', //15
|
|
766
|
+
'easeInOutQuad', //18
|
|
767
|
+
'easeInOutSine', //22
|
|
768
|
+
'easeInOutBack', //25
|
|
767
769
|
'easeOutBounce', //27
|
|
768
770
|
];
|
|
769
771
|
if (typeof easing === 'number') {
|