aio-popup 6.5.0 → 6.6.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.d.ts +1 -0
- package/index.js +26 -17
- package/package.json +1 -1
package/index.d.ts
CHANGED
package/index.js
CHANGED
|
@@ -16,9 +16,15 @@ import $ from 'jquery';
|
|
|
16
16
|
import './index.css';
|
|
17
17
|
const CTX = createContext({});
|
|
18
18
|
function Align(p) {
|
|
19
|
-
let { modal, target, fitHorizontal, rtl, limitTo } = p;
|
|
19
|
+
let { modal, target, fitHorizontal, rtl, limitTo, pageSelector } = p;
|
|
20
20
|
const bodyWidth = window.innerWidth, bodyHeight = window.innerHeight;
|
|
21
21
|
let pageLimit = { left: 0, top: 0, bottom: bodyHeight, right: bodyWidth, width: bodyWidth, height: bodyHeight };
|
|
22
|
+
if (pageSelector) {
|
|
23
|
+
let page = modal.parents(pageSelector);
|
|
24
|
+
if (page.length) {
|
|
25
|
+
pageLimit = getBound(page[0]);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
22
28
|
let targetLimit = getBound(target[0]);
|
|
23
29
|
let domLimit = getBound(modal[0]);
|
|
24
30
|
targetLimit = Object.assign({}, targetLimit);
|
|
@@ -149,7 +155,7 @@ const usePopup = (props) => {
|
|
|
149
155
|
if (!item || item.onClose === false) {
|
|
150
156
|
return;
|
|
151
157
|
}
|
|
152
|
-
let newItems = items.filter((o
|
|
158
|
+
let newItems = items.filter((o) => o.id !== id);
|
|
153
159
|
setSnackebarItems(newItems);
|
|
154
160
|
if (typeof item.onClose === 'function') {
|
|
155
161
|
item.onClose();
|
|
@@ -253,9 +259,9 @@ const Prompt = ({ change, placeholder }) => {
|
|
|
253
259
|
return (_jsx("textarea", { placeholder: placeholder, value: text, onChange: (e) => { const value = e.target.value; setText(value); change(value); } }));
|
|
254
260
|
};
|
|
255
261
|
const POPUPCTX = createContext({});
|
|
256
|
-
const Popup = ({ modal, isLast
|
|
262
|
+
const Popup = ({ modal, isLast }) => {
|
|
257
263
|
const mainContext = useContext(CTX);
|
|
258
|
-
let { setAttrs = () => { return {}; },
|
|
264
|
+
let { setAttrs = () => { return {}; }, position = 'fullscreen', getTarget } = modal;
|
|
259
265
|
let [temp] = useState({ dom: createRef(), backdropDom: createRef(), dui: undefined });
|
|
260
266
|
let [popoverStyle, setPopoverStyle] = useState({});
|
|
261
267
|
let modalMouseDown = useRef(false);
|
|
@@ -307,7 +313,7 @@ const Popup = ({ modal, isLast, renderCaller }) => {
|
|
|
307
313
|
if (!target || !target.length) {
|
|
308
314
|
return {};
|
|
309
315
|
}
|
|
310
|
-
let p = { modal: $(temp.dom.current), target, fitHorizontal: modal.fitHorizontal, limitTo: modal.limitTo, attrs, rtl: mainContext.rtl };
|
|
316
|
+
let p = { modal: $(temp.dom.current), target, fitHorizontal: modal.fitHorizontal, limitTo: modal.limitTo, attrs, rtl: mainContext.rtl, pageSelector: modal.pageSelector };
|
|
311
317
|
let style = Align(p);
|
|
312
318
|
let res = Object.assign(Object.assign({}, style), { position: 'absolute' });
|
|
313
319
|
return res;
|
|
@@ -324,7 +330,7 @@ const Popup = ({ modal, isLast, renderCaller }) => {
|
|
|
324
330
|
function mouseUp() {
|
|
325
331
|
setTimeout(() => modalMouseDown.current = false, 0);
|
|
326
332
|
}
|
|
327
|
-
function mouseDown(
|
|
333
|
+
function mouseDown() {
|
|
328
334
|
modalMouseDown.current = true;
|
|
329
335
|
$(window).unbind('mouseup', mouseUp);
|
|
330
336
|
$(window).bind('mouseup', mouseUp);
|
|
@@ -748,16 +754,16 @@ function getEasing(highlight) {
|
|
|
748
754
|
const { easing } = highlight;
|
|
749
755
|
var easingNames = [
|
|
750
756
|
'linear',
|
|
751
|
-
'easeInQuad',
|
|
752
|
-
'easeInSine',
|
|
753
|
-
'easeInCirc',
|
|
754
|
-
'easeInBack',
|
|
755
|
-
'easeOutQuad',
|
|
756
|
-
'easeOutSine',
|
|
757
|
-
'easeOutCirc',
|
|
758
|
-
'easeInOutQuad',
|
|
759
|
-
'easeInOutSine',
|
|
760
|
-
'easeInOutBack',
|
|
757
|
+
'easeInQuad',
|
|
758
|
+
'easeInSine',
|
|
759
|
+
'easeInCirc',
|
|
760
|
+
'easeInBack',
|
|
761
|
+
'easeOutQuad',
|
|
762
|
+
'easeOutSine',
|
|
763
|
+
'easeOutCirc',
|
|
764
|
+
'easeInOutQuad',
|
|
765
|
+
'easeInOutSine',
|
|
766
|
+
'easeInOutBack',
|
|
761
767
|
'easeOutBounce', //27
|
|
762
768
|
];
|
|
763
769
|
if (typeof easing === 'number') {
|
|
@@ -790,7 +796,10 @@ export class Loading {
|
|
|
790
796
|
return (`
|
|
791
797
|
<div class="aio-loading-container-0">
|
|
792
798
|
<div class="aio-loading-0">
|
|
793
|
-
${new Array(5).fill(0).map((o, i) =>
|
|
799
|
+
${new Array(5).fill(0).map((o, i) => {
|
|
800
|
+
if (o) { }
|
|
801
|
+
return this.getLoaderItem_0(`0.${i}`);
|
|
802
|
+
}).join(' ')}
|
|
794
803
|
</div>
|
|
795
804
|
</div>
|
|
796
805
|
`);
|