@whitesev/pops 4.0.2 → 4.2.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/dist/index.amd.js +363 -275
- package/dist/index.amd.js.map +1 -1
- package/dist/index.amd.min.js +1 -1
- package/dist/index.amd.min.js.map +1 -1
- package/dist/index.cjs.js +363 -275
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.cjs.min.js +1 -1
- package/dist/index.cjs.min.js.map +1 -1
- package/dist/index.esm.js +363 -275
- package/dist/index.esm.js.map +1 -1
- package/dist/index.esm.min.js +1 -1
- package/dist/index.esm.min.js.map +1 -1
- package/dist/index.iife.js +363 -275
- package/dist/index.iife.js.map +1 -1
- package/dist/index.iife.min.js +1 -1
- package/dist/index.iife.min.js.map +1 -1
- package/dist/index.system.js +363 -275
- package/dist/index.system.js.map +1 -1
- package/dist/index.system.min.js +1 -1
- package/dist/index.system.min.js.map +1 -1
- package/dist/index.umd.js +363 -275
- package/dist/index.umd.js.map +1 -1
- package/dist/index.umd.min.js +1 -1
- package/dist/index.umd.min.js.map +1 -1
- package/dist/types/src/Pops.d.ts +116 -16
- package/dist/types/src/components/loading/types/index.d.ts +1 -1
- package/dist/types/src/components/panel/index.d.ts +3 -2
- package/dist/types/src/components/rightClickMenu/types/index.d.ts +1 -1
- package/dist/types/src/components/searchSuggestion/types/index.d.ts +1 -1
- package/dist/types/src/components/tooltip/index.d.ts +82 -1
- package/dist/types/src/components/tooltip/types/index.d.ts +1 -1
- package/dist/types/src/config/GlobalConfig.d.ts +3 -3
- package/dist/types/src/event/EventEmiter.d.ts +7 -1
- package/dist/types/src/handler/PopsInstHandler.d.ts +4 -4
- package/dist/types/src/types/EventEmitter.d.ts +21 -0
- package/dist/types/src/types/PopsDOMUtilsEventType.d.ts +1 -1
- package/dist/types/src/types/components.d.ts +15 -18
- package/dist/types/src/types/global.d.ts +2 -0
- package/dist/types/src/types/mask.d.ts +6 -6
- package/dist/types/src/utils/PopsDOMUtils.d.ts +2 -2
- package/dist/types/src/utils/PopsInstanceUtils.d.ts +22 -0
- package/dist/types/src/utils/PopsUtils.d.ts +21 -16
- package/package.json +1 -1
- package/src/Pops.ts +11 -11
- package/src/components/alert/defaultConfig.ts +1 -1
- package/src/components/alert/index.ts +1 -1
- package/src/components/confirm/defaultConfig.ts +1 -1
- package/src/components/confirm/index.ts +1 -1
- package/src/components/drawer/defaultConfig.ts +1 -1
- package/src/components/drawer/index.ts +2 -1
- package/src/components/folder/defaultConfig.ts +1 -1
- package/src/components/folder/index.ts +1 -1
- package/src/components/iframe/defaultConfig.ts +1 -1
- package/src/components/iframe/index.ts +10 -6
- package/src/components/loading/defaultConfig.ts +1 -0
- package/src/components/loading/index.ts +10 -10
- package/src/components/loading/types/index.ts +1 -4
- package/src/components/panel/defaultConfig.ts +1 -1
- package/src/components/panel/handlerComponents.ts +4 -4
- package/src/components/panel/index.ts +3 -2
- package/src/components/prompt/defaultConfig.ts +1 -1
- package/src/components/prompt/index.ts +1 -1
- package/src/components/rightClickMenu/defaultConfig.ts +1 -1
- package/src/components/rightClickMenu/index.ts +1 -1
- package/src/components/rightClickMenu/types/index.ts +1 -1
- package/src/components/searchSuggestion/defaultConfig.ts +1 -0
- package/src/components/searchSuggestion/index.ts +1 -1
- package/src/components/searchSuggestion/types/index.ts +1 -1
- package/src/components/tooltip/defaultConfig.ts +1 -1
- package/src/components/tooltip/index.ts +1 -1
- package/src/components/tooltip/types/index.ts +1 -1
- package/src/event/EventEmiter.ts +15 -14
- package/src/handler/PopsHandler.ts +9 -21
- package/src/handler/PopsInstHandler.ts +65 -47
- package/src/types/EventEmitter.d.ts +21 -0
- package/src/types/PopsDOMUtilsEventType.d.ts +1 -1
- package/src/types/components.d.ts +15 -18
- package/src/types/global.d.ts +2 -0
- package/src/types/mask.d.ts +6 -6
- package/src/utils/PopsDOMUtils.ts +6 -3
- package/src/utils/PopsInstanceUtils.ts +50 -0
- package/src/utils/PopsUtils.ts +95 -68
- package/dist/types/src/utils/PopsDOMUtilsEventsConfig.d.ts +0 -4
- package/src/utils/PopsDOMUtilsEventsConfig.ts +0 -4
package/dist/index.system.js
CHANGED
|
@@ -3,7 +3,7 @@ System.register('pops', [], (function (exports) {
|
|
|
3
3
|
return {
|
|
4
4
|
execute: (function () {
|
|
5
5
|
|
|
6
|
-
const version = "4.0
|
|
6
|
+
const version = "4.2.0";
|
|
7
7
|
|
|
8
8
|
const GlobalConfig = {
|
|
9
9
|
config: {},
|
|
@@ -62,15 +62,16 @@ System.register('pops', [], (function (exports) {
|
|
|
62
62
|
};
|
|
63
63
|
|
|
64
64
|
class EventEmiter {
|
|
65
|
-
|
|
66
|
-
|
|
65
|
+
[Symbol.toStringTag] = "EventEmiter";
|
|
66
|
+
type;
|
|
67
|
+
data = new Map();
|
|
67
68
|
constructor(type) {
|
|
68
|
-
this
|
|
69
|
+
this.type = type;
|
|
69
70
|
}
|
|
70
71
|
on(eventName, callback) {
|
|
71
|
-
const eventList = this
|
|
72
|
-
eventList.push({ type: this
|
|
73
|
-
this
|
|
72
|
+
const eventList = this.data.get(eventName) ?? [];
|
|
73
|
+
eventList.push({ type: this.type, time: Date.now(), callback: callback });
|
|
74
|
+
this.data.set(eventName, eventList);
|
|
74
75
|
return {
|
|
75
76
|
off: () => {
|
|
76
77
|
this.off(eventName, callback);
|
|
@@ -81,7 +82,7 @@ System.register('pops', [], (function (exports) {
|
|
|
81
82
|
};
|
|
82
83
|
}
|
|
83
84
|
off(eventName, callback) {
|
|
84
|
-
const eventList = this
|
|
85
|
+
const eventList = this.data.get(eventName) ?? [];
|
|
85
86
|
let isOffSuccess = false;
|
|
86
87
|
for (let index = eventList.length - 1; index >= 0; index--) {
|
|
87
88
|
if (eventList[index].callback === callback) {
|
|
@@ -91,27 +92,27 @@ System.register('pops', [], (function (exports) {
|
|
|
91
92
|
}
|
|
92
93
|
if (eventList.length === 0) {
|
|
93
94
|
// empty
|
|
94
|
-
this
|
|
95
|
+
this.data.delete(eventName);
|
|
95
96
|
}
|
|
96
97
|
else {
|
|
97
98
|
if (isOffSuccess) {
|
|
98
99
|
// update
|
|
99
|
-
this
|
|
100
|
+
this.data.set(eventName, eventList);
|
|
100
101
|
}
|
|
101
102
|
}
|
|
102
103
|
}
|
|
103
104
|
async emit(eventName, ...args) {
|
|
104
|
-
const eventList = this
|
|
105
|
+
const eventList = this.data.get(eventName) ?? [];
|
|
105
106
|
for (const item of eventList) {
|
|
106
107
|
await item.callback(...args);
|
|
107
108
|
}
|
|
108
109
|
}
|
|
109
110
|
offAll(eventName) {
|
|
110
111
|
if (typeof eventName === "string") {
|
|
111
|
-
this
|
|
112
|
+
this.data.delete(eventName);
|
|
112
113
|
}
|
|
113
114
|
else {
|
|
114
|
-
this
|
|
115
|
+
this.data.clear();
|
|
115
116
|
}
|
|
116
117
|
}
|
|
117
118
|
/**
|
|
@@ -119,10 +120,10 @@ System.register('pops', [], (function (exports) {
|
|
|
119
120
|
*/
|
|
120
121
|
getAllEvents(eventName) {
|
|
121
122
|
if (typeof eventName === "string") {
|
|
122
|
-
return this
|
|
123
|
+
return this.data.get(eventName);
|
|
123
124
|
}
|
|
124
125
|
else {
|
|
125
|
-
return Array.from(this
|
|
126
|
+
return Array.from(this.data.values());
|
|
126
127
|
}
|
|
127
128
|
}
|
|
128
129
|
}
|
|
@@ -246,11 +247,6 @@ System.register('pops', [], (function (exports) {
|
|
|
246
247
|
},
|
|
247
248
|
};
|
|
248
249
|
|
|
249
|
-
/**
|
|
250
|
-
* 存储在元素属性上的事件名
|
|
251
|
-
*/
|
|
252
|
-
const SymbolEvents = Symbol("events_" + (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1));
|
|
253
|
-
|
|
254
250
|
const OriginPrototype = {
|
|
255
251
|
Object: {
|
|
256
252
|
defineProperty: Object.defineProperty,
|
|
@@ -300,31 +296,31 @@ System.register('pops', [], (function (exports) {
|
|
|
300
296
|
},
|
|
301
297
|
};
|
|
302
298
|
|
|
303
|
-
|
|
299
|
+
const n$1="clientX",e$2="clientY",t$1=16,c$3="start",o$1="move",s$1="cancel",u$3="end",a$2="left",i$3="right",r$4="up",d$1="down",m$2={4:"start",5:"move",1:"end",3:"cancel"};function v$1(n){return m$2[n]}function b(n,e,t){const c={1:{0:{move:4},4:{move:5,end:1,cancel:3},5:{move:5,end:1,cancel:3}},0:{4:{move:2,end:1,cancel:3},5:{start:2,move:2,end:1,cancel:3}}}[Number(n)][e];return void 0!==c&&c[t]||0}function g$1(n){[1,3,2].includes(n.state)&&(n.state=0);}function h$3(n){return [5,1,3].includes(n)}function j(n){if(n.disabled)return n.state=0,true}function O(n,e){return Object.assign(Object.assign(Object.assign({},n),e),{state:0,disabled:false})}function p$3(n){return Math.round(100*n)/100}
|
|
304
300
|
|
|
305
|
-
|
|
301
|
+
var x=r=>Math.sqrt(r.x*r.x+r.y*r.y),y=(r,a)=>r.x*a.x+r.y*a.y,e$1=(r,a)=>{var t=x(r)*x(a);if(0===t)return 0;var h=y(r,a)/t;return h>1&&(h=1),Math.acos(h)},n=(r,a)=>r.x*a.y-a.x*r.y,o=r=>r/Math.PI*180,s=(r,a)=>{var t=e$1(r,a);return n(r,a)>0&&(t*=-1),o(t)},u$2=(x,y)=>{if(0!==x||0!==y)return Math.abs(x)>=Math.abs(y)?0<x?i$3:a$2:0<y?d$1:r$4};
|
|
306
302
|
|
|
307
|
-
function
|
|
303
|
+
function p$2(){let n=0,e=0;return function(o,r){const{prevVecotr:i,startVecotr:a,activeVecotr:c}=r;return c&&(e=Math.round(s(c,i)),n=Math.round(s(c,a))),{angle:n,deltaAngle:e}}}function d(){return function(t){const{prevInput:e}=t;let o$1=0,r=0,i=0;if(void 0!==e&&(o$1=t.x-e.x,r=t.y-e.y,0!==o$1||0!==r)){const t=Math.sqrt(Math.pow(o$1,2)+Math.pow(r,2));i=Math.round(o(Math.acos(Math.abs(o$1)/t)));}return {deltaX:o$1,deltaY:r,deltaXYAngle:i}}}function h$2(){let t,n=0,u=0,s=0,p=0,d=0;return function(h){const{phase:l,startInput:f}=h;return c$3===l?(n=0,u=0,s=0,p=0,d=0):o$1===l&&(n=Math.round(h.points[0][n$1]-f.points[0][n$1]),u=Math.round(h.points[0][e$2]-f.points[0][e$2]),s=Math.abs(n),p=Math.abs(u),d=Math.round(x({x:s,y:p})),t=u$2(n,u)),{displacementX:n,displacementY:u,distanceX:s,distanceY:p,distance:d,overallDirection:t}}}function l$1(){let t=1;return function(n,o){let r=1;const{prevVecotr:i,startVecotr:a,activeVecotr:c}=o;return c&&(r=p$3(x(c)/x(i)),t=p$3(x(c)/x(a))),{scale:t,deltaScale:r}}}function f(){let t,n,e=0,r=0,i=0,a=0;return function(c){if(void 0!==c){n=n||c.startInput;const u=c.timestamp-n.timestamp;if(t$1<u){const s=c.x-n.x,p=c.y-n.y;i=Math.round(s/u*100)/100,a=Math.round(p/u*100)/100,e=Math.abs(i),r=Math.abs(a),t=u$2(s,p),n=c;}}return {velocityX:e,velocityY:r,speedX:i,speedY:a,direction:t}}}function M(){let t=0;return function(n){const{phase:e}=n;return c$3===e&&(t=n.pointLength),{maxPointLength:t}}}function v(t){return {x:t.points[1][n$1]-t.points[0][n$1],y:t.points[1][e$2]-t.points[0][e$2]}}function m$1(){let t,n,e;return function(o){const{prevInput:r,startMultiInput:i}=o;return void 0!==i&&void 0!==r&&o.id!==i.id&&1<r.pointLength&&1<o.pointLength?(t=v(i),n=v(r),e=v(o)):e=void 0,{startVecotr:t,prevVecotr:n,activeVecotr:e}}}
|
|
308
304
|
|
|
309
|
-
|
|
305
|
+
const m={name:"tap",pointLength:1,tapTimes:1,waitNextTapTime:300,maxDistance:2,maxDistanceFromPrevTap:9,maxPressTime:250};function r$3(r,s){const c=O(m,s);let p,u,x$1,T=0;function f(){T=0,p=void 0,u=void 0;}return r.compute([h$2,M],(t=>{if(j(c))return;const{phase:i,x:o,y:m}=t;u$3===i&&(c.state=0,!function(){const{startInput:e,pointLength:n,timestamp:a}=t,i=a-e.timestamp,{distance:o,maxPointLength:m}=t;return m===c.pointLength&&0===n&&c.maxDistance>=o&&c.maxPressTime>i}()?(f(),c.state=2):(clearTimeout(x$1),function(t,e){if(void 0!==p){const n=x({x:t.x-p.x,y:t.y-p.y});return p=t,e.maxDistanceFromPrevTap>=n}return p=t,true}({x:o,y:m},c)&&function(t){const e=performance.now();if(void 0===u)return u=e,true;{const n=e-u;return u=e,n<t}}(c.waitNextTapTime)?T++:T=1,0==T%c.tapTimes?(c.state=1,r.emit2(c.name,t,c),f()):x$1=setTimeout((()=>{c.state=2,f();}),c.waitNextTapTime)));})),c}
|
|
310
306
|
|
|
311
|
-
function
|
|
307
|
+
function e(e){e.use(r$3,{name:"doubletap",tapTimes:2});const a=e.get("doubletap");let o;return e.beforeEach(((t,e)=>{"tap"===t?(clearTimeout(o),o=setTimeout((()=>{[0,2].includes(a.state)&&e();}),300)):e();})),a}
|
|
312
308
|
|
|
313
|
-
|
|
309
|
+
class t{constructor(){this.__map={};}beforeEach(t){this.__interceptor=t;}on(t,i){const s=Array.isArray(t)?t:[t];for(const t of s){this.__map[t]=this.__map[t]||[];const s=this.__map[t];s&&s.push(i);}return this}emit(t,i,s){ void 0!==this.__interceptor?this.__interceptor(t,(()=>{this.__emit(t,i),s&&s();})):(this.__emit(t,i),s&&s());}__emit(t,i){const s=this.__map[t];if(Array.isArray(s)&&(null==s?void 0:s.length))for(const _ of s)_(i,t);this.event=i;}off(t,i){const s=this.__map[t];if(void 0!==s)if(void 0===i)delete this.__map[t];else {const t=s.findIndex((t=>t===i));s.splice(t,1);}}destroy(){this.__map={};}}
|
|
314
310
|
|
|
315
|
-
const
|
|
311
|
+
function r$2(){let t,o,i,r,a=0;return function(u){if(t=o,void 0!==u){a=Number.MAX_SAFE_INTEGER>a?++a:1;const h=function(t,o){const{phase:i,points:r,changedPoints:a,nativeEvent:u}=t,h=r.length,p=c$3===i,g=u$3===i&&0===h||s$1===i,l=Date.now(),{x:d,y:m}=c$2(r)||c$2(a),{currentTarget:v}=u;return Object.assign(t,{id:o,x:d,y:m,timestamp:l,isStart:p,isEnd:g,pointLength:h,currentTarget:v,getOffset(t=v){const e=t.getBoundingClientRect();return {x:d-Math.round(e.left),y:m-Math.round(e.top)}}})}(u,a);o=h;const{isStart:p,pointLength:g}=h;return p&&(i=h,t=void 0,r=1<g?h:void 0),Object.assign(Object.assign({},h),{prevInput:t,startMultiInput:r,startInput:i})}}}function c$2(t){const{length:e}=t;if(0<e){if(1===e){const{clientX:e,clientY:n}=t[0];return {x:Math.round(e),y:Math.round(n)}}const n=t.reduce(((t,e)=>(t.x+=e[n$1],t.y+=e[e$2],t)),{x:0,y:0});return {x:Math.round(n.x/e),y:Math.round(n.y/e)}}}function a$1(t,e,n,s){const o={};for(const t in n)["target","currentTarget","type"].includes(t)||(o[t]=n[t]);let i;return document.createEvent?(i=document.createEvent("HTMLEvents"),i.initEvent(t,null==s?void 0:s.bubbles,null==s?void 0:s.cancelable)):i=new Event(t,s),Object.assign(i,o,{match:()=>n.targets&&0<n.targets.length&&n.targets.every((t=>i.currentTarget.contains(t)))}),e.dispatchEvent(i)}function u$1(t,e){const{preventDefault:n}=e;return s=n,"[object Function]"===Object.prototype.toString.call(s)?n(t):!!n;var s;}const h$1=["touchstart","touchmove","touchend","touchcancel","mousedown"],p$1=["mousemove","mouseup"];const g={domEvents:{bubbles:true,cancelable:true},preventDefault:t=>{if(t.target&&"tagName"in t.target){const{tagName:e}=t.target;return !/^(?:INPUT|TEXTAREA|BUTTON|SELECT)$/.test(e)}return false}};class l extends t{constructor(t,e){super(),this.v="2.1.3",this.__computeFunctionList=[],this.__computeFunctionCreatorList=[],this.__pluginContexts=[],this.__isIgnoreMouse=false,this.el=t,this.c={},this.__options=Object.assign(Object.assign({},g),e);const n=function(t){const e=r$2();return function(n){const s=[],o=[];Array.from(n.touches).forEach((({clientX:e,clientY:n,target:i})=>{(null==t?void 0:t.contains(i))&&(s.push(i),o.push({clientX:e,clientY:n,target:i}));}));const i=Array.from(n.changedTouches).map((({clientX:t,clientY:e,target:n})=>({clientX:t,clientY:e,target:n})));return e({phase:n.type.replace("touch",""),changedPoints:i,points:o,nativeEvent:n,target:n.target,targets:s})}}(this.el),s=function(){let t,e=false,n=null;const s=r$2();return function(o){const{clientX:i,clientY:r,type:c,button:a,target:u}=o;let h,p=[{clientX:i,clientY:r,target:u}];if("mousedown"===c&&0===a)n=u,e=true,h="start";else {if(!e)return;"mousemove"===c?h="move":"mouseup"===c&&(p=[],h="end",e=false);}const g=t||[{clientX:i,clientY:r,target:u}];if(t=[{clientX:i,clientY:r,target:u}],void 0!==h)return s({phase:h,changedPoints:g,points:p,target:n,targets:[n],nativeEvent:o})}}();if(this.__inputCreatorMap={touchstart:n,touchmove:n,touchend:n,touchcancel:n,mousedown:s,mousemove:s,mouseup:s},this.on("at:after",(t=>{const{target:e,__type:n}=t,{domEvents:s}=this.__options;s&&void 0!==this.el&&e&&(a$1(n,e,t,s),a$1("at:after",e,t,s));})),void 0!==t){t.style.webkitTapHighlightColor="rgba(0,0,0,0)";let e=false;try{const t={};Object.defineProperty(t,"passive",{get(){e=!0;}}),window.addEventListener("_",(()=>{}),t);}catch(t){}this.on("u",function(t,e,n){return h$1.forEach((s=>{t.addEventListener(s,e,n);})),p$1.forEach((t=>{window.addEventListener(t,e,n);})),()=>{h$1.forEach((n=>{t.removeEventListener(n,e);})),p$1.forEach((t=>{window.removeEventListener(t,e);}));}}(t,this.catchEvent.bind(this),false===this.__options.preventDefault&&e?{passive:true}:{passive:false}));}}use(t,e){this.__pluginContexts.push(t(this,e));}catchEvent(t){const e=this.__inputCreatorMap[t.type](t);if(void 0!==e){const n=()=>t.stopPropagation(),s=()=>t.stopImmediatePropagation(),o=()=>t.preventDefault();if(u$1(t,this.__options))o();else if("touchstart"===t.type?this.__isIgnoreMouse=true:"touchmove"===t.type&&(this.__isIgnoreMouse=false),this.__isIgnoreMouse&&t.type.startsWith("mouse"))return void("mouseup"===t.type&&(this.__isIgnoreMouse=false));this.emit("input",e),this.emit2(`at:${e.phase}`,e,{});const i={};this.__computeFunctionList.forEach((t=>{const n=t(e,i);if(void 0!==n)for(const t in n)i[t]=n[t];})),this.emit("computed",Object.assign(Object.assign(Object.assign({},e),i),{stopPropagation:n,stopImmediatePropagation:s,preventDefault:o}));}}compute(t,e){for(const e of t)this.__computeFunctionCreatorList.includes(e)||(this.__computeFunctionCreatorList.push(e),this.__computeFunctionList.push(e()));this.on("computed",e);}beforeEach(t){super.beforeEach(((e,n)=>{var s;(null===(s=this.c)||void 0===s?void 0:s.name)?t(e,n):n();}));}get(t){return this.__pluginContexts.find((e=>t===e.name))}set(t){this.__options=Object.assign(Object.assign({},this.__options),t);}emit2(t,e,n){this.c=n,this.emit(t,Object.assign(Object.assign({},e),{type:t}),(()=>{this.emit("at:after",Object.assign(Object.assign({},e),{name:t,__type:t}));}));}destroy(){this.emit("u"),super.destroy();}}
|
|
316
312
|
|
|
317
|
-
const
|
|
313
|
+
const p={name:"pan",threshold:10,pointLength:1};function u(u,d$1){const f$1=O(p,d$1);return u.compute([f,h$2,d],(t=>{if(g$1(f$1),j(f$1))return;const c=function(){const{pointLength:e,distance:n}=t;return f$1.pointLength===e&&f$1.threshold<=n}();if(f$1.state=b(c,f$1.state,t.phase),c||h$3(f$1.state)){const{name:e}=f$1;u.emit2(e,t,f$1),u.emit2(e+v$1(f$1.state),t,f$1),![u$3,s$1].includes(t.phase)&&t.direction&&u.emit2(e+t.direction,t,f$1);}})),f$1}
|
|
318
314
|
|
|
319
|
-
const
|
|
315
|
+
const c$1={name:"swipe",threshold:10,velocity:.3,pointLength:1};function a(a,r){const s=O(c$1,r);return a.compute([h$2,f,M],(t=>{if(s.state=0,!s.disabled&&function(){if(u$3!==t.phase)return false;const{velocityX:o,velocityY:n,distance:i,maxPointLength:c}=t;return c===s.pointLength&&0===t.points.length&&s.threshold<i&&s.velocity<Math.max(o,n)}()){const{name:e}=s;s.state=1,a.emit2(e,t,s),a.emit2(e+t.direction,t,s);}})),s}
|
|
320
316
|
|
|
321
|
-
const
|
|
317
|
+
const r$1={name:"press",pointLength:1,maxDistance:9,minPressTime:251};function c(c,u){const p=O(r$1,u);let f=0;return c.compute([h$2],(t=>{if(j(p))return;const{phase:o,startInput:r,pointLength:u}=t;if(c$3===o&&p.pointLength===u)g$1(p),clearTimeout(f),f=setTimeout((()=>{p.state=1,c.emit2(p.name,t,p);}),p.minPressTime);else if(u$3===o&&1===p.state)c.emit2(`${p.name}${r$4}`,t,p);else if(1!==p.state){const e=t.timestamp-r.timestamp;(!function(){const{distance:e}=t;return e&&p.maxDistance>e}()||p.minPressTime>e&&[u$3,s$1].includes(o))&&(clearTimeout(f),p.state=2);}})),p}
|
|
322
318
|
|
|
323
|
-
const
|
|
319
|
+
const i$2={name:"pinch",threshold:0,pointLength:2};function r(r,m){const p=O(i$2,m);return r.compute([m$1,l$1],(t=>{if(g$1(p),j(p))return;const c=function(){const{pointLength:e,scale:n,deltaScale:o,phase:a}=t;return p.pointLength===e&&p.threshold<Math.abs(n-1)}();p.state=b(c,p.state,t.phase);const{name:h}=p;if(c||h$3(p.state)){r.emit2(h,t,p);const{deltaScale:e}=t;1!==e&&r.emit2(h+(1<e?"in":"out"),t,p);}const i=v$1(p.state);i&&r.emit2(h+i,t,p);})),p}
|
|
324
320
|
|
|
325
|
-
|
|
321
|
+
const h={name:"rotate",threshold:0,pointLength:2};function i$1(i,m){const u=O(h,m);return i.compute([m$1,p$2],(t=>{if(j(u))return;g$1(u);const r=function(){const{pointLength:e,angle:n}=t;return u.pointLength===e&&u.threshold<Math.abs(n)}();u.state=b(r,u.state,t.phase);const{name:c}=u;(r||h$3(u.state))&&i.emit2(c,t,u);const h=v$1(u.state);h&&i.emit2(c+h,t,u);})),u}
|
|
326
322
|
|
|
327
|
-
class i extends l
|
|
323
|
+
class i extends l{constructor(t,u$1){super(t,u$1),this.use(r$3),this.use(u),this.use(a),this.use(c),this.use(r),this.use(i$1);}}i.STATE_POSSIBLE=0,i.STATE_START=4,i.STATE_MOVE=5,i.STATE_END=1,i.STATE_CANCELLED=3,i.STATE_FAILED=2,i.STATE_RECOGNIZED=1,i.tap=r$3,i.pan=u,i.swipe=a,i.press=c,i.rotate=i$1,i.pinch=r,i.doubletap=e;
|
|
328
324
|
|
|
329
325
|
class PopsUtils {
|
|
330
326
|
/**
|
|
@@ -433,7 +429,8 @@ System.register('pops', [], (function (exports) {
|
|
|
433
429
|
if (typeof sourceValue === "object" &&
|
|
434
430
|
sourceValue != null &&
|
|
435
431
|
keyName in target &&
|
|
436
|
-
!UtilsContext.isDOM(sourceValue)
|
|
432
|
+
!UtilsContext.isDOM(sourceValue) &&
|
|
433
|
+
!(sourceValue instanceof EventEmiter)) {
|
|
437
434
|
// 源端的值是object类型,且不是元素节点
|
|
438
435
|
// 如果是数组,那此数组中有值,清空旧的数组再赋值
|
|
439
436
|
let childObjectValue;
|
|
@@ -449,7 +446,7 @@ System.register('pops', [], (function (exports) {
|
|
|
449
446
|
Reflect.set(target, keyName, childObjectValue);
|
|
450
447
|
}
|
|
451
448
|
else {
|
|
452
|
-
|
|
449
|
+
// 直接赋值
|
|
453
450
|
Reflect.set(target, keyName, sourceValue);
|
|
454
451
|
}
|
|
455
452
|
}
|
|
@@ -639,33 +636,31 @@ System.register('pops', [], (function (exports) {
|
|
|
639
636
|
if (typeof deviation !== "number" || Number.isNaN(deviation)) {
|
|
640
637
|
deviation = 10;
|
|
641
638
|
}
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
const
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
center,
|
|
668
|
-
];
|
|
639
|
+
/** 坐标偏移 */
|
|
640
|
+
const positionDistance = 10;
|
|
641
|
+
const defaultCalcPostion = [];
|
|
642
|
+
const maxPostionX = globalThis.innerWidth;
|
|
643
|
+
const maxPostionY = globalThis.innerHeight;
|
|
644
|
+
const gridXCount = 8;
|
|
645
|
+
const gridYCount = 8;
|
|
646
|
+
for (let i = 0; i < gridXCount; i++) {
|
|
647
|
+
for (let j = 0; j < gridYCount; j++) {
|
|
648
|
+
const positionX = globalThis.innerWidth * (i / gridXCount) + positionDistance;
|
|
649
|
+
const positionY = globalThis.innerHeight * (j / gridYCount) + positionDistance;
|
|
650
|
+
const position = {
|
|
651
|
+
x: positionX,
|
|
652
|
+
y: positionY,
|
|
653
|
+
};
|
|
654
|
+
if (position.x > maxPostionX) {
|
|
655
|
+
position.x = maxPostionX;
|
|
656
|
+
}
|
|
657
|
+
if (position.y > maxPostionY) {
|
|
658
|
+
position.y = maxPostionY;
|
|
659
|
+
}
|
|
660
|
+
defaultCalcPostion.push(position);
|
|
661
|
+
}
|
|
662
|
+
}
|
|
663
|
+
const delayHandlerElementPostionList = defaultCalcPostion;
|
|
669
664
|
if ($el) {
|
|
670
665
|
delayHandlerElementPostionList.length = 0;
|
|
671
666
|
if (Array.isArray($el)) {
|
|
@@ -677,61 +672,79 @@ System.register('pops', [], (function (exports) {
|
|
|
677
672
|
}
|
|
678
673
|
const positionInfoList = delayHandlerElementPostionList
|
|
679
674
|
.map((position) => {
|
|
680
|
-
let
|
|
675
|
+
let $position;
|
|
681
676
|
let positionX;
|
|
682
677
|
let positionY;
|
|
683
678
|
if (position instanceof HTMLElement) {
|
|
684
|
-
|
|
679
|
+
$position = position;
|
|
685
680
|
const nodeRect = position.getBoundingClientRect();
|
|
686
681
|
positionX = nodeRect.x + nodeRect.width / 2;
|
|
687
682
|
positionY = nodeRect.y + nodeRect.height / 2;
|
|
688
683
|
}
|
|
689
684
|
else {
|
|
690
|
-
|
|
685
|
+
$position = document.elementFromPoint(position.x, position.y);
|
|
691
686
|
positionX = position.x;
|
|
692
687
|
positionY = position.y;
|
|
693
688
|
}
|
|
694
|
-
const shadowRoot =
|
|
689
|
+
const shadowRoot = $position?.shadowRoot;
|
|
695
690
|
if (shadowRoot) {
|
|
696
|
-
|
|
691
|
+
// 处理ShadowRoot
|
|
692
|
+
$position = shadowRoot.elementFromPoint(positionX, positionY);
|
|
697
693
|
}
|
|
698
|
-
if (
|
|
699
|
-
return;
|
|
700
|
-
if (positionNode instanceof HTMLScriptElement)
|
|
701
|
-
return;
|
|
702
|
-
if (positionNode instanceof HTMLMetaElement)
|
|
703
|
-
return;
|
|
704
|
-
if (positionNode instanceof HTMLHeadElement)
|
|
705
|
-
return;
|
|
706
|
-
if (!(positionNode instanceof HTMLElement))
|
|
694
|
+
if (!($position instanceof HTMLElement))
|
|
707
695
|
return;
|
|
708
|
-
let parent =
|
|
696
|
+
let $parent = $position;
|
|
709
697
|
let zIndex = 0;
|
|
710
|
-
let maxZIndexNode = null;
|
|
711
|
-
|
|
712
|
-
|
|
698
|
+
let $maxZIndexNode = null;
|
|
699
|
+
let rect = {
|
|
700
|
+
x: 0,
|
|
701
|
+
y: 0,
|
|
702
|
+
width: 0,
|
|
703
|
+
height: 0,
|
|
704
|
+
top: 0,
|
|
705
|
+
right: 0,
|
|
706
|
+
bottom: 0,
|
|
707
|
+
left: 0,
|
|
708
|
+
};
|
|
709
|
+
while ($parent) {
|
|
710
|
+
const nodeStyle = globalThis.getComputedStyle($parent);
|
|
713
711
|
const nodeZIndex = parseInt(nodeStyle.zIndex);
|
|
714
712
|
if (nodeStyle.position !== "static" && !isNaN(nodeZIndex)) {
|
|
715
713
|
if (nodeZIndex > zIndex) {
|
|
716
714
|
zIndex = nodeZIndex;
|
|
717
|
-
maxZIndexNode = parent;
|
|
718
|
-
}
|
|
719
|
-
}
|
|
720
|
-
parent = parent.parentElement;
|
|
715
|
+
$maxZIndexNode = $parent;
|
|
716
|
+
}
|
|
717
|
+
}
|
|
718
|
+
$parent = $parent.parentElement;
|
|
719
|
+
}
|
|
720
|
+
if ($maxZIndexNode) {
|
|
721
|
+
const maxRect = $maxZIndexNode.getBoundingClientRect();
|
|
722
|
+
rect = {
|
|
723
|
+
x: maxRect.x,
|
|
724
|
+
y: maxRect.y,
|
|
725
|
+
width: maxRect.width,
|
|
726
|
+
height: maxRect.height,
|
|
727
|
+
top: maxRect.top,
|
|
728
|
+
right: maxRect.right,
|
|
729
|
+
bottom: maxRect.bottom,
|
|
730
|
+
left: maxRect.left,
|
|
731
|
+
};
|
|
721
732
|
}
|
|
722
733
|
return {
|
|
723
|
-
/**
|
|
734
|
+
/** 计算偏移量后的z-index值 */
|
|
724
735
|
zIndex: zIndex + deviation,
|
|
725
|
-
/**
|
|
736
|
+
/** 获取到的最大的z-index值 */
|
|
726
737
|
originZIndex: zIndex,
|
|
727
738
|
/** 拥有最大z-index的元素 */
|
|
728
|
-
node: maxZIndexNode,
|
|
739
|
+
node: $maxZIndexNode,
|
|
729
740
|
/** 目标坐标元素 */
|
|
730
|
-
positionNode:
|
|
731
|
-
/** x坐标 */
|
|
741
|
+
positionNode: $position,
|
|
742
|
+
/** 目标x坐标 */
|
|
732
743
|
positionX: positionX,
|
|
733
|
-
/** y坐标 */
|
|
744
|
+
/** 目标y坐标 */
|
|
734
745
|
positionY: positionY,
|
|
746
|
+
/** node位置信息 */
|
|
747
|
+
rect,
|
|
735
748
|
};
|
|
736
749
|
})
|
|
737
750
|
.filter((it) => it != null);
|
|
@@ -782,11 +795,22 @@ System.register('pops', [], (function (exports) {
|
|
|
782
795
|
const PopsCommonCSSClassName = {
|
|
783
796
|
flexCenter: "pops-flex-items-center",
|
|
784
797
|
flexYCenter: "pops-flex-y-center",
|
|
798
|
+
flexXCenter: "pops-flex-x-center",
|
|
785
799
|
hide: "pops-hide",
|
|
786
800
|
hideImportant: "pops-hide-important",
|
|
801
|
+
noBorder: "pops-no-border",
|
|
802
|
+
noBorderImportant: "pops-no-border-important",
|
|
787
803
|
userSelectNone: "pops-user-select-none",
|
|
788
|
-
|
|
804
|
+
lineHeightCenter: "pops-line-height-center",
|
|
805
|
+
widthFill: "pops-width-fill",
|
|
806
|
+
textIsDisabled: "pops-text-is-disabled",
|
|
807
|
+
textIsDisabledImportant: "pops-text-is-disabled-important",
|
|
808
|
+
};
|
|
789
809
|
|
|
810
|
+
/**
|
|
811
|
+
* 存储在元素属性上的事件名
|
|
812
|
+
*/
|
|
813
|
+
const SymbolEvents = Symbol("events_" + (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1));
|
|
790
814
|
class PopsDOMUtilsEvent {
|
|
791
815
|
on(element, eventType, selector, callback, option) {
|
|
792
816
|
/**
|
|
@@ -3131,6 +3155,134 @@ System.register('pops', [], (function (exports) {
|
|
|
3131
3155
|
tooltip: [],
|
|
3132
3156
|
};
|
|
3133
3157
|
|
|
3158
|
+
const PopsInstanceUtils = {
|
|
3159
|
+
/**
|
|
3160
|
+
* 获取pops所有弹窗中的最大的z-index
|
|
3161
|
+
* @param deviation
|
|
3162
|
+
*/
|
|
3163
|
+
getPopsMaxZIndex(deviation = 1) {
|
|
3164
|
+
deviation = Number.isNaN(deviation) ? 1 : deviation;
|
|
3165
|
+
// 最大值 2147483647
|
|
3166
|
+
// const browserMaxZIndex = Math.pow(2, 31) - 1;
|
|
3167
|
+
// 比较值 2000000000
|
|
3168
|
+
const maxZIndex = 2 * Math.pow(10, 9);
|
|
3169
|
+
// 当前页面最大的z-index
|
|
3170
|
+
let zIndex = 0;
|
|
3171
|
+
// 当前的最大z-index的元素,调试使用
|
|
3172
|
+
let maxZIndexNode = null;
|
|
3173
|
+
Object.keys(PopsInstData).forEach((instKeyName) => {
|
|
3174
|
+
const instData = PopsInstData[instKeyName];
|
|
3175
|
+
for (let index = 0; index < instData.length; index++) {
|
|
3176
|
+
const inst = instData[index];
|
|
3177
|
+
// 不对position为static和display为none的元素进行获取它们的z-index
|
|
3178
|
+
const $elList = [inst.$anim, inst.$pops, inst.$mask].filter((it) => it instanceof HTMLElement);
|
|
3179
|
+
const nodeZIndexInfoList = popsUtils.getMaxZIndexNodeInfoFromPoint($elList);
|
|
3180
|
+
const maxNodeZIndexInfo = nodeZIndexInfoList[0];
|
|
3181
|
+
if (maxNodeZIndexInfo) {
|
|
3182
|
+
const nodeZIndex = maxNodeZIndexInfo.zIndex;
|
|
3183
|
+
if (nodeZIndex > zIndex) {
|
|
3184
|
+
zIndex = nodeZIndex;
|
|
3185
|
+
maxZIndexNode = maxNodeZIndexInfo.node || maxNodeZIndexInfo.positionNode;
|
|
3186
|
+
}
|
|
3187
|
+
}
|
|
3188
|
+
}
|
|
3189
|
+
});
|
|
3190
|
+
zIndex += deviation;
|
|
3191
|
+
const isOverMaxZIndex = zIndex >= maxZIndex;
|
|
3192
|
+
if (isOverMaxZIndex) {
|
|
3193
|
+
// 超出z-index最大值
|
|
3194
|
+
zIndex = maxZIndex;
|
|
3195
|
+
}
|
|
3196
|
+
return { zIndex: zIndex, animElement: maxZIndexNode, isOverMaxZIndex };
|
|
3197
|
+
},
|
|
3198
|
+
/**
|
|
3199
|
+
* 排序数组
|
|
3200
|
+
* @param getBeforeValueFun
|
|
3201
|
+
* @param getAfterValueFun
|
|
3202
|
+
* @param sortByDesc 排序是否降序,默认降序
|
|
3203
|
+
*/
|
|
3204
|
+
sortElementListByProperty(getBeforeValueFun, getAfterValueFun, sortByDesc = true) {
|
|
3205
|
+
if (typeof sortByDesc !== "boolean") {
|
|
3206
|
+
throw new TypeError("参数 sortByDesc 必须为boolean类型");
|
|
3207
|
+
}
|
|
3208
|
+
if (getBeforeValueFun == null || getAfterValueFun == null) {
|
|
3209
|
+
throw new Error("获取前面的值或后面的值的方法不能为空");
|
|
3210
|
+
}
|
|
3211
|
+
return function (after_obj, before_obj) {
|
|
3212
|
+
const beforeValue = getBeforeValueFun(before_obj); // 前
|
|
3213
|
+
const afterValue = getAfterValueFun(after_obj); // 后
|
|
3214
|
+
if (sortByDesc) {
|
|
3215
|
+
if (afterValue > beforeValue) {
|
|
3216
|
+
return -1;
|
|
3217
|
+
}
|
|
3218
|
+
else if (afterValue < beforeValue) {
|
|
3219
|
+
return 1;
|
|
3220
|
+
}
|
|
3221
|
+
else {
|
|
3222
|
+
return 0;
|
|
3223
|
+
}
|
|
3224
|
+
}
|
|
3225
|
+
else {
|
|
3226
|
+
if (afterValue < beforeValue) {
|
|
3227
|
+
return -1;
|
|
3228
|
+
}
|
|
3229
|
+
else if (afterValue > beforeValue) {
|
|
3230
|
+
return 1;
|
|
3231
|
+
}
|
|
3232
|
+
else {
|
|
3233
|
+
return 0;
|
|
3234
|
+
}
|
|
3235
|
+
}
|
|
3236
|
+
};
|
|
3237
|
+
},
|
|
3238
|
+
/**
|
|
3239
|
+
* 是否是隐藏状态
|
|
3240
|
+
*
|
|
3241
|
+
* 检测以下项:
|
|
3242
|
+
*
|
|
3243
|
+
* + `display`: none
|
|
3244
|
+
* + `visibility`: hidden
|
|
3245
|
+
* + `opacity`: 0
|
|
3246
|
+
* + `使用了pops的自定义的隐藏class类`
|
|
3247
|
+
* @param $el 需要检测的元素
|
|
3248
|
+
*/
|
|
3249
|
+
isHide($el) {
|
|
3250
|
+
let flag = false;
|
|
3251
|
+
if ($el?.classList?.contains(PopsCommonCSSClassName.hide) ||
|
|
3252
|
+
$el?.classList?.contains(PopsCommonCSSClassName.hideImportant)) {
|
|
3253
|
+
flag = true;
|
|
3254
|
+
}
|
|
3255
|
+
else {
|
|
3256
|
+
if ($el instanceof HTMLElement) {
|
|
3257
|
+
const style = $el.style;
|
|
3258
|
+
flag = style.display.includes("none") || style.visibility.includes("hidden") || style.opacity !== "0";
|
|
3259
|
+
}
|
|
3260
|
+
if (!flag) {
|
|
3261
|
+
const style = globalThis.getComputedStyle($el);
|
|
3262
|
+
flag = style.display.includes("none") || style.visibility.includes("hidden") || style.opacity !== "0";
|
|
3263
|
+
}
|
|
3264
|
+
}
|
|
3265
|
+
return flag;
|
|
3266
|
+
},
|
|
3267
|
+
/**
|
|
3268
|
+
* 判断元素是否是在`.pops`内
|
|
3269
|
+
* @param $el 目标元素
|
|
3270
|
+
*/
|
|
3271
|
+
isNodeInPopsNode($el) {
|
|
3272
|
+
return !!($el.closest(".pops") || $el.matches(".pops"));
|
|
3273
|
+
},
|
|
3274
|
+
/**
|
|
3275
|
+
* 判断是否是`.pops-anim`元素
|
|
3276
|
+
* @param $el 目标元素
|
|
3277
|
+
*/
|
|
3278
|
+
isAnimNode($el) {
|
|
3279
|
+
return !!($el?.localName?.toLowerCase() === "div" &&
|
|
3280
|
+
$el.className &&
|
|
3281
|
+
$el.className === "pops-anim" &&
|
|
3282
|
+
$el.hasAttribute("anim"));
|
|
3283
|
+
},
|
|
3284
|
+
};
|
|
3285
|
+
|
|
3134
3286
|
const PopsInstHandler = {
|
|
3135
3287
|
/**
|
|
3136
3288
|
* 删除配置中对应的对象
|
|
@@ -3193,7 +3345,7 @@ System.register('pops', [], (function (exports) {
|
|
|
3193
3345
|
return totalInstConfigList;
|
|
3194
3346
|
},
|
|
3195
3347
|
/**
|
|
3196
|
-
*
|
|
3348
|
+
* 显示
|
|
3197
3349
|
* @param popsType
|
|
3198
3350
|
* @param instConfigList
|
|
3199
3351
|
* @param guid
|
|
@@ -3201,24 +3353,34 @@ System.register('pops', [], (function (exports) {
|
|
|
3201
3353
|
* @param $anim
|
|
3202
3354
|
* @param $mask
|
|
3203
3355
|
*/
|
|
3204
|
-
|
|
3356
|
+
show(config, popsType, instConfigList, guid, $anim, $mask) {
|
|
3205
3357
|
// oxlint-disable-next-line no-async-promise-executor
|
|
3206
3358
|
return new Promise(async (resolve) => {
|
|
3207
3359
|
const $pops = $anim.querySelector(".pops[type-value]");
|
|
3208
3360
|
const fintInst = instConfigList.find((instConfigItem) => instConfigItem.guid === guid);
|
|
3209
3361
|
if (fintInst) {
|
|
3210
|
-
//
|
|
3362
|
+
// 由于是隐蔽状态
|
|
3363
|
+
// 先设置好动画状态
|
|
3364
|
+
// 再显示,会自执行动画
|
|
3365
|
+
const checkVisible = () => {
|
|
3366
|
+
if (!PopsInstanceUtils.isHide($anim)) {
|
|
3367
|
+
return true;
|
|
3368
|
+
}
|
|
3369
|
+
else {
|
|
3370
|
+
return false;
|
|
3371
|
+
}
|
|
3372
|
+
};
|
|
3211
3373
|
const startAnim = async () => {
|
|
3212
3374
|
if (popsType === "drawer") {
|
|
3213
3375
|
// drawer是抽屉
|
|
3214
3376
|
// 单独处理动画
|
|
3215
3377
|
const drawerConfig = config;
|
|
3216
|
-
await popsUtils.sleep(drawerConfig.
|
|
3378
|
+
await popsUtils.sleep(drawerConfig.openDelay ?? 0);
|
|
3217
3379
|
if ($mask) {
|
|
3218
|
-
popsDOMUtils.css($mask, "display", "
|
|
3380
|
+
popsDOMUtils.css($mask, "display", "");
|
|
3219
3381
|
}
|
|
3220
3382
|
const direction = drawerConfig.direction;
|
|
3221
|
-
const size =
|
|
3383
|
+
const size = drawerConfig.size.toString();
|
|
3222
3384
|
if (["top", "bottom"].includes(direction)) {
|
|
3223
3385
|
$pops.style.setProperty("height", size);
|
|
3224
3386
|
}
|
|
@@ -3226,26 +3388,26 @@ System.register('pops', [], (function (exports) {
|
|
|
3226
3388
|
$pops.style.setProperty("width", size);
|
|
3227
3389
|
}
|
|
3228
3390
|
else {
|
|
3229
|
-
console.error("未知direction
|
|
3391
|
+
console.error("未知direction:", direction);
|
|
3230
3392
|
}
|
|
3231
3393
|
}
|
|
3232
3394
|
else {
|
|
3233
|
-
instConfigItem.$anim.style.width = "
|
|
3234
|
-
instConfigItem.$anim.style.height = "
|
|
3235
|
-
Reflect.set(instConfigItem.$anim.style, "animation-name",
|
|
3395
|
+
instConfigItem.$anim.style.width = "";
|
|
3396
|
+
instConfigItem.$anim.style.height = "";
|
|
3397
|
+
Reflect.set(instConfigItem.$anim.style, "animation-name", animName);
|
|
3236
3398
|
}
|
|
3237
|
-
|
|
3238
|
-
const endCallback = () => {
|
|
3239
|
-
instConfigItem.$anim.style.display = "none";
|
|
3399
|
+
instConfigItem.$anim.style.display = "";
|
|
3240
3400
|
if (instConfigItem.$mask) {
|
|
3241
|
-
instConfigItem.$mask.style.display = "
|
|
3401
|
+
instConfigItem.$mask.style.display = "";
|
|
3242
3402
|
}
|
|
3243
|
-
|
|
3403
|
+
};
|
|
3404
|
+
const endCallback = () => {
|
|
3405
|
+
fintInst.emitter.emit("pops:show", instConfigItem);
|
|
3244
3406
|
};
|
|
3245
3407
|
const instConfigItem = fintInst;
|
|
3246
|
-
|
|
3247
|
-
|
|
3248
|
-
if (PopsAnimation.hasAnim(
|
|
3408
|
+
const animName = instConfigItem.$anim.getAttribute("anim").replace("-reverse", "");
|
|
3409
|
+
fintInst.emitter.emit("pops:before-show", instConfigItem);
|
|
3410
|
+
if (checkVisible() && PopsAnimation.hasAnim(animName)) {
|
|
3249
3411
|
/**
|
|
3250
3412
|
* 动画结束的回调
|
|
3251
3413
|
*/
|
|
@@ -3256,22 +3418,23 @@ System.register('pops', [], (function (exports) {
|
|
|
3256
3418
|
};
|
|
3257
3419
|
const listener = popsDOMUtils.on(instConfigItem.$anim, popsDOMUtils.getAnimationEndNameList(), animationendCallBack, {
|
|
3258
3420
|
capture: true,
|
|
3259
|
-
once: true,
|
|
3260
3421
|
});
|
|
3422
|
+
await startAnim();
|
|
3261
3423
|
}
|
|
3262
3424
|
else {
|
|
3425
|
+
await startAnim();
|
|
3263
3426
|
endCallback();
|
|
3264
3427
|
resolve();
|
|
3265
3428
|
}
|
|
3266
3429
|
}
|
|
3267
3430
|
else {
|
|
3268
|
-
console.error("
|
|
3431
|
+
console.error("show-error: 该实例未存储");
|
|
3269
3432
|
resolve();
|
|
3270
3433
|
}
|
|
3271
3434
|
});
|
|
3272
3435
|
},
|
|
3273
3436
|
/**
|
|
3274
|
-
*
|
|
3437
|
+
* 隐藏
|
|
3275
3438
|
* @param popsType
|
|
3276
3439
|
* @param instConfigList
|
|
3277
3440
|
* @param guid
|
|
@@ -3279,23 +3442,35 @@ System.register('pops', [], (function (exports) {
|
|
|
3279
3442
|
* @param $anim
|
|
3280
3443
|
* @param $mask
|
|
3281
3444
|
*/
|
|
3282
|
-
|
|
3445
|
+
hide(config, popsType, instConfigList, guid, $anim, $mask) {
|
|
3283
3446
|
// oxlint-disable-next-line no-async-promise-executor
|
|
3284
3447
|
return new Promise(async (resolve) => {
|
|
3285
3448
|
const $pops = $anim.querySelector(".pops[type-value]");
|
|
3286
3449
|
const fintInst = instConfigList.find((instConfigItem) => instConfigItem.guid === guid);
|
|
3287
3450
|
if (fintInst) {
|
|
3451
|
+
// 由于是已显示状态
|
|
3452
|
+
// 先执行动画
|
|
3453
|
+
// 再隐藏
|
|
3454
|
+
// 存在实例
|
|
3455
|
+
const checkVisible = () => {
|
|
3456
|
+
if (!PopsInstanceUtils.isHide($anim)) {
|
|
3457
|
+
return true;
|
|
3458
|
+
}
|
|
3459
|
+
else {
|
|
3460
|
+
return false;
|
|
3461
|
+
}
|
|
3462
|
+
};
|
|
3288
3463
|
const startAnim = async () => {
|
|
3289
3464
|
if (popsType === "drawer") {
|
|
3290
3465
|
// drawer是抽屉
|
|
3291
3466
|
// 单独处理动画
|
|
3292
3467
|
const drawerConfig = config;
|
|
3293
|
-
await popsUtils.sleep(drawerConfig.
|
|
3468
|
+
await popsUtils.sleep(drawerConfig.closeDelay ?? 0);
|
|
3294
3469
|
if ($mask) {
|
|
3295
|
-
popsDOMUtils.css($mask, "display", "");
|
|
3470
|
+
popsDOMUtils.css($mask, "display", "none");
|
|
3296
3471
|
}
|
|
3297
3472
|
const direction = drawerConfig.direction;
|
|
3298
|
-
const size =
|
|
3473
|
+
const size = "0";
|
|
3299
3474
|
if (["top", "bottom"].includes(direction)) {
|
|
3300
3475
|
$pops.style.setProperty("height", size);
|
|
3301
3476
|
}
|
|
@@ -3303,26 +3478,27 @@ System.register('pops', [], (function (exports) {
|
|
|
3303
3478
|
$pops.style.setProperty("width", size);
|
|
3304
3479
|
}
|
|
3305
3480
|
else {
|
|
3306
|
-
console.error("未知direction
|
|
3481
|
+
console.error("未知direction: ", direction);
|
|
3307
3482
|
}
|
|
3308
3483
|
}
|
|
3309
3484
|
else {
|
|
3310
|
-
instConfigItem.$anim.style.width = "";
|
|
3311
|
-
instConfigItem.$anim.style.height = "";
|
|
3312
|
-
Reflect.set(instConfigItem.$anim.style, "animation-name",
|
|
3485
|
+
instConfigItem.$anim.style.width = "100%";
|
|
3486
|
+
instConfigItem.$anim.style.height = "100%";
|
|
3487
|
+
Reflect.set(instConfigItem.$anim.style, "animation-name", reverseAnimName);
|
|
3313
3488
|
}
|
|
3314
3489
|
};
|
|
3315
3490
|
const endCallback = () => {
|
|
3316
|
-
instConfigItem.$anim.style.display = "";
|
|
3491
|
+
instConfigItem.$anim.style.display = "none";
|
|
3317
3492
|
if (instConfigItem.$mask) {
|
|
3318
|
-
instConfigItem.$mask.style.display = "";
|
|
3493
|
+
instConfigItem.$mask.style.display = "none";
|
|
3319
3494
|
}
|
|
3320
|
-
fintInst.emitter.emit("pops:
|
|
3495
|
+
fintInst.emitter.emit("pops:hide", instConfigItem);
|
|
3321
3496
|
};
|
|
3322
3497
|
const instConfigItem = fintInst;
|
|
3323
|
-
|
|
3324
|
-
|
|
3325
|
-
|
|
3498
|
+
const animName = instConfigItem.$anim.getAttribute("anim").replace("-reverse", "");
|
|
3499
|
+
const reverseAnimName = animName + "-reverse";
|
|
3500
|
+
fintInst.emitter.emit("pops:before-hide", instConfigItem);
|
|
3501
|
+
if (!checkVisible() && PopsAnimation.hasAnim(reverseAnimName)) {
|
|
3326
3502
|
/**
|
|
3327
3503
|
* 动画结束的回调
|
|
3328
3504
|
*/
|
|
@@ -3333,15 +3509,18 @@ System.register('pops', [], (function (exports) {
|
|
|
3333
3509
|
};
|
|
3334
3510
|
const listener = popsDOMUtils.on(instConfigItem.$anim, popsDOMUtils.getAnimationEndNameList(), animationendCallBack, {
|
|
3335
3511
|
capture: true,
|
|
3512
|
+
once: true,
|
|
3336
3513
|
});
|
|
3514
|
+
await startAnim();
|
|
3337
3515
|
}
|
|
3338
3516
|
else {
|
|
3517
|
+
await startAnim();
|
|
3339
3518
|
endCallback();
|
|
3340
3519
|
resolve();
|
|
3341
3520
|
}
|
|
3342
3521
|
}
|
|
3343
3522
|
else {
|
|
3344
|
-
console.error("
|
|
3523
|
+
console.error("hide-error: 该实例未存储");
|
|
3345
3524
|
resolve();
|
|
3346
3525
|
}
|
|
3347
3526
|
});
|
|
@@ -3381,7 +3560,7 @@ System.register('pops', [], (function (exports) {
|
|
|
3381
3560
|
await new Promise(async (resolve) => {
|
|
3382
3561
|
const $pops = $anim.querySelector(".pops[type-value]");
|
|
3383
3562
|
const drawerConfig = config;
|
|
3384
|
-
const
|
|
3563
|
+
const startAnim = () => {
|
|
3385
3564
|
/**
|
|
3386
3565
|
* 弹窗已关闭的回调
|
|
3387
3566
|
*/
|
|
@@ -3422,7 +3601,7 @@ System.register('pops', [], (function (exports) {
|
|
|
3422
3601
|
};
|
|
3423
3602
|
if (popsType === "drawer") {
|
|
3424
3603
|
await popsUtils.sleep(drawerConfig.closeDelay ?? 0);
|
|
3425
|
-
|
|
3604
|
+
startAnim();
|
|
3426
3605
|
}
|
|
3427
3606
|
else {
|
|
3428
3607
|
await PopsInstHandler.removeInstance([instConfigList], guid);
|
|
@@ -3702,11 +3881,11 @@ System.register('pops', [], (function (exports) {
|
|
|
3702
3881
|
* 点击其它区域的事件
|
|
3703
3882
|
* @param event
|
|
3704
3883
|
*/
|
|
3705
|
-
|
|
3884
|
+
const clickEvent = (event) => {
|
|
3706
3885
|
popsDOMUtils.preventEvent(event);
|
|
3707
3886
|
// 获取该类型实例存储列表
|
|
3708
3887
|
const targetInst = PopsInstData[config.type];
|
|
3709
|
-
|
|
3888
|
+
const continueExec = () => {
|
|
3710
3889
|
if (config.config.mask.clickEvent.toClose) {
|
|
3711
3890
|
// 关闭
|
|
3712
3891
|
return PopsInstHandler.close(config.config, config.type, targetInst, config.guid, config.animElement);
|
|
@@ -3715,37 +3894,26 @@ System.register('pops', [], (function (exports) {
|
|
|
3715
3894
|
// 隐藏
|
|
3716
3895
|
return PopsInstHandler.hide(config.config, config.type, targetInst, config.guid, config.animElement, result.maskElement);
|
|
3717
3896
|
}
|
|
3718
|
-
}
|
|
3897
|
+
};
|
|
3719
3898
|
if (typeof config.config.mask.clickCallBack === "function") {
|
|
3720
|
-
config.config.mask.clickCallBack(
|
|
3899
|
+
config.config.mask.clickCallBack(continueExec, config.config);
|
|
3721
3900
|
}
|
|
3722
3901
|
else {
|
|
3723
|
-
|
|
3902
|
+
continueExec();
|
|
3724
3903
|
}
|
|
3725
3904
|
return false;
|
|
3726
|
-
}
|
|
3905
|
+
};
|
|
3727
3906
|
// 判断是否启用了遮罩层点击动作
|
|
3728
3907
|
if (config.config.mask.clickEvent.toClose || config.config.mask.clickEvent.toHide) {
|
|
3729
|
-
/**
|
|
3730
|
-
* 判断点击的元素是否是动画层的元素
|
|
3731
|
-
* @param element
|
|
3732
|
-
* @returns
|
|
3733
|
-
*/
|
|
3734
|
-
function isAnimElement(element) {
|
|
3735
|
-
return Boolean(element?.localName?.toLowerCase() === "div" &&
|
|
3736
|
-
element.className &&
|
|
3737
|
-
element.className === "pops-anim" &&
|
|
3738
|
-
element.hasAttribute("anim"));
|
|
3739
|
-
}
|
|
3740
3908
|
// 判断按下的元素是否是pops-anim
|
|
3741
3909
|
popsDOMUtils.on(config.animElement, "pointerup", (event) => {
|
|
3742
3910
|
const $click = event.composedPath()[0];
|
|
3743
|
-
isMaskClick =
|
|
3911
|
+
isMaskClick = PopsInstanceUtils.isAnimNode($click);
|
|
3744
3912
|
});
|
|
3745
3913
|
// 如果有动画层,在动画层上监听点击事件
|
|
3746
3914
|
popsDOMUtils.on(config.animElement, "click", (event) => {
|
|
3747
3915
|
const $click = event.composedPath()[0];
|
|
3748
|
-
if (isMaskClick &&
|
|
3916
|
+
if (isMaskClick && PopsInstanceUtils.isAnimNode($click)) {
|
|
3749
3917
|
return clickEvent(event);
|
|
3750
3918
|
}
|
|
3751
3919
|
});
|
|
@@ -4173,8 +4341,8 @@ System.register('pops', [], (function (exports) {
|
|
|
4173
4341
|
style: null,
|
|
4174
4342
|
lightStyle: null,
|
|
4175
4343
|
darkStyle: null,
|
|
4176
|
-
beforeAppendToPageCallBack() { },
|
|
4177
4344
|
stopKeyDownEventPropagation: true,
|
|
4345
|
+
emitter: null,
|
|
4178
4346
|
};
|
|
4179
4347
|
};
|
|
4180
4348
|
|
|
@@ -4183,11 +4351,11 @@ System.register('pops', [], (function (exports) {
|
|
|
4183
4351
|
const guid = popsUtils.getRandomGUID();
|
|
4184
4352
|
// 设置当前类型
|
|
4185
4353
|
const popsType = "alert";
|
|
4186
|
-
const emitter = new EventEmiter(popsType);
|
|
4187
4354
|
let config = PopsAlertDefaultConfig();
|
|
4188
4355
|
config = popsUtils.assign(config, GlobalConfig.getGlobalConfig());
|
|
4189
4356
|
config = popsUtils.assign(config, __config__);
|
|
4190
4357
|
config = PopsHandler.handleOnly(popsType, config);
|
|
4358
|
+
const emitter = config.emitter ?? new EventEmiter(popsType);
|
|
4191
4359
|
const { $shadowContainer, $shadowRoot } = PopsHandler.handlerShadow(config);
|
|
4192
4360
|
PopsHandler.handleInit($shadowRoot, [
|
|
4193
4361
|
{
|
|
@@ -4381,8 +4549,8 @@ System.register('pops', [], (function (exports) {
|
|
|
4381
4549
|
style: null,
|
|
4382
4550
|
lightStyle: null,
|
|
4383
4551
|
darkStyle: null,
|
|
4384
|
-
beforeAppendToPageCallBack() { },
|
|
4385
4552
|
stopKeyDownEventPropagation: true,
|
|
4553
|
+
emitter: null,
|
|
4386
4554
|
};
|
|
4387
4555
|
};
|
|
4388
4556
|
|
|
@@ -4391,11 +4559,11 @@ System.register('pops', [], (function (exports) {
|
|
|
4391
4559
|
const guid = popsUtils.getRandomGUID();
|
|
4392
4560
|
// 设置当前类型
|
|
4393
4561
|
const popsType = "confirm";
|
|
4394
|
-
const emitter = new EventEmiter(popsType);
|
|
4395
4562
|
let config = PopsConfirmDefaultConfig();
|
|
4396
4563
|
config = popsUtils.assign(config, GlobalConfig.getGlobalConfig());
|
|
4397
4564
|
config = popsUtils.assign(config, __config__);
|
|
4398
4565
|
config = PopsHandler.handleOnly(popsType, config);
|
|
4566
|
+
const emitter = config.emitter ?? new EventEmiter(popsType);
|
|
4399
4567
|
const { $shadowContainer, $shadowRoot } = PopsHandler.handlerShadow(config);
|
|
4400
4568
|
PopsHandler.handleInit($shadowRoot, [
|
|
4401
4569
|
{
|
|
@@ -4588,9 +4756,9 @@ System.register('pops', [], (function (exports) {
|
|
|
4588
4756
|
style: null,
|
|
4589
4757
|
lightStyle: null,
|
|
4590
4758
|
darkStyle: null,
|
|
4591
|
-
beforeAppendToPageCallBack() { },
|
|
4592
4759
|
forbiddenScroll: false,
|
|
4593
4760
|
stopKeyDownEventPropagation: true,
|
|
4761
|
+
emitter: null,
|
|
4594
4762
|
};
|
|
4595
4763
|
};
|
|
4596
4764
|
|
|
@@ -4599,11 +4767,11 @@ System.register('pops', [], (function (exports) {
|
|
|
4599
4767
|
const guid = popsUtils.getRandomGUID();
|
|
4600
4768
|
// 设置当前类型
|
|
4601
4769
|
const popsType = "drawer";
|
|
4602
|
-
const emitter = new EventEmiter(popsType);
|
|
4603
4770
|
let config = PopsDrawerDefaultConfig();
|
|
4604
4771
|
config = popsUtils.assign(config, GlobalConfig.getGlobalConfig());
|
|
4605
4772
|
config = popsUtils.assign(config, __config__);
|
|
4606
4773
|
config = PopsHandler.handleOnly(popsType, config);
|
|
4774
|
+
const emitter = config.emitter ?? new EventEmiter(popsType);
|
|
4607
4775
|
const { $shadowContainer, $shadowRoot } = PopsHandler.handlerShadow(config);
|
|
4608
4776
|
PopsHandler.handleInit($shadowRoot, [
|
|
4609
4777
|
{
|
|
@@ -4814,6 +4982,7 @@ System.register('pops', [], (function (exports) {
|
|
|
4814
4982
|
darkStyle: null,
|
|
4815
4983
|
addIndexCSS: true,
|
|
4816
4984
|
stopKeyDownEventPropagation: true,
|
|
4985
|
+
emitter: null,
|
|
4817
4986
|
};
|
|
4818
4987
|
};
|
|
4819
4988
|
|
|
@@ -4821,19 +4990,19 @@ System.register('pops', [], (function (exports) {
|
|
|
4821
4990
|
init(__config__) {
|
|
4822
4991
|
const guid = popsUtils.getRandomGUID();
|
|
4823
4992
|
// 设置当前类型
|
|
4824
|
-
const
|
|
4825
|
-
const emitter = new EventEmiter(PopsType);
|
|
4993
|
+
const popsType = "loading";
|
|
4826
4994
|
let config = PopsLoadingDefaultConfig();
|
|
4827
4995
|
config = popsUtils.assign(config, GlobalConfig.getGlobalConfig());
|
|
4828
4996
|
config = popsUtils.assign(config, __config__);
|
|
4829
|
-
config = PopsHandler.handleOnly(
|
|
4997
|
+
config = PopsHandler.handleOnly(popsType, config);
|
|
4998
|
+
const emitter = config.emitter ?? new EventEmiter(popsType);
|
|
4830
4999
|
// 先把z-index提取出来
|
|
4831
5000
|
const zIndex = PopsHandler.getTargerOrFunctionValue(config.zIndex);
|
|
4832
5001
|
const maskHTML = PopsElementHandler.createMask(guid, zIndex);
|
|
4833
5002
|
const { contentPStyle } = PopsElementHandler.createContentStyle("loading", config);
|
|
4834
|
-
const animHTML = PopsElementHandler.createAnim(guid,
|
|
5003
|
+
const animHTML = PopsElementHandler.createAnim(guid, popsType, config,
|
|
4835
5004
|
/*html*/ `
|
|
4836
|
-
<div class="pops-content pops-${
|
|
5005
|
+
<div class="pops-content pops-${popsType}-content">${config.addIndexCSS
|
|
4837
5006
|
? /*html*/ `
|
|
4838
5007
|
<style data-model-name="index">${PopsCSS.index}</style>
|
|
4839
5008
|
<style data-model-name="anim">${PopsCSS.anim}</style>
|
|
@@ -4844,13 +5013,13 @@ System.register('pops', [], (function (exports) {
|
|
|
4844
5013
|
${PopsCSS.loadingCSS}
|
|
4845
5014
|
</style>
|
|
4846
5015
|
${config.style != null ? `<style>${config.style}</style>` : ""}
|
|
4847
|
-
<p pops class="pops-${
|
|
5016
|
+
<p pops class="pops-${popsType}-content-text" style="${contentPStyle}">${config.content.text}</p>
|
|
4848
5017
|
</div>`, "", zIndex);
|
|
4849
5018
|
/**
|
|
4850
5019
|
* 弹窗的主元素,包括动画层
|
|
4851
5020
|
*/
|
|
4852
5021
|
const $anim = PopsElementHandler.parseElement(animHTML);
|
|
4853
|
-
const { $pops: $pops } = PopsHandler.handleQueryElement($anim,
|
|
5022
|
+
const { $pops: $pops } = PopsHandler.handleQueryElement($anim, popsType);
|
|
4854
5023
|
/**
|
|
4855
5024
|
* 遮罩层元素
|
|
4856
5025
|
*/
|
|
@@ -4862,7 +5031,7 @@ System.register('pops', [], (function (exports) {
|
|
|
4862
5031
|
if (config.mask.enable) {
|
|
4863
5032
|
// 创建遮罩层
|
|
4864
5033
|
const handleMask = PopsHandler.handleMask({
|
|
4865
|
-
type:
|
|
5034
|
+
type: popsType,
|
|
4866
5035
|
guid: guid,
|
|
4867
5036
|
config: config,
|
|
4868
5037
|
animElement: $anim,
|
|
@@ -4871,12 +5040,12 @@ System.register('pops', [], (function (exports) {
|
|
|
4871
5040
|
$mask = handleMask.maskElement;
|
|
4872
5041
|
$elList.push($mask);
|
|
4873
5042
|
}
|
|
4874
|
-
const evtConfig = PopsHandler.handleLoadingEventConfig(config, guid,
|
|
5043
|
+
const evtConfig = PopsHandler.handleLoadingEventConfig(config, guid, popsType, $anim, $pops, emitter, $mask);
|
|
4875
5044
|
popsDOMUtils.append(config.$parent, $elList);
|
|
4876
5045
|
if ($mask != null) {
|
|
4877
5046
|
$anim.after($mask);
|
|
4878
5047
|
}
|
|
4879
|
-
PopsHandler.handlePush(
|
|
5048
|
+
PopsHandler.handlePush(popsType, {
|
|
4880
5049
|
$shadowContainer: $pops,
|
|
4881
5050
|
$shadowRoot: $pops,
|
|
4882
5051
|
guid: guid,
|
|
@@ -5045,8 +5214,8 @@ System.register('pops', [], (function (exports) {
|
|
|
5045
5214
|
style: null,
|
|
5046
5215
|
lightStyle: null,
|
|
5047
5216
|
darkStyle: null,
|
|
5048
|
-
beforeAppendToPageCallBack() { },
|
|
5049
5217
|
stopKeyDownEventPropagation: true,
|
|
5218
|
+
emitter: null,
|
|
5050
5219
|
};
|
|
5051
5220
|
};
|
|
5052
5221
|
|
|
@@ -5083,11 +5252,11 @@ System.register('pops', [], (function (exports) {
|
|
|
5083
5252
|
const guid = popsUtils.getRandomGUID();
|
|
5084
5253
|
// 设置当前类型
|
|
5085
5254
|
const popsType = "folder";
|
|
5086
|
-
const emitter = new EventEmiter(popsType);
|
|
5087
5255
|
let config = PopsFolderDefaultConfig();
|
|
5088
5256
|
config = popsUtils.assign(config, GlobalConfig.getGlobalConfig());
|
|
5089
5257
|
config = popsUtils.assign(config, __config__);
|
|
5090
5258
|
config = PopsHandler.handleOnly(popsType, config);
|
|
5259
|
+
const emitter = config.emitter ?? new EventEmiter(popsType);
|
|
5091
5260
|
const { $shadowContainer, $shadowRoot } = PopsHandler.handlerShadow(config);
|
|
5092
5261
|
PopsHandler.handleInit($shadowRoot, [
|
|
5093
5262
|
{
|
|
@@ -6010,8 +6179,8 @@ System.register('pops', [], (function (exports) {
|
|
|
6010
6179
|
style: null,
|
|
6011
6180
|
lightStyle: null,
|
|
6012
6181
|
darkStyle: null,
|
|
6013
|
-
beforeAppendToPageCallBack() { },
|
|
6014
6182
|
stopKeyDownEventPropagation: true,
|
|
6183
|
+
emitter: null,
|
|
6015
6184
|
};
|
|
6016
6185
|
};
|
|
6017
6186
|
|
|
@@ -6020,7 +6189,6 @@ System.register('pops', [], (function (exports) {
|
|
|
6020
6189
|
const guid = popsUtils.getRandomGUID();
|
|
6021
6190
|
// 设置当前类型
|
|
6022
6191
|
const popsType = "iframe";
|
|
6023
|
-
const emitter = new EventEmiter(popsType);
|
|
6024
6192
|
let config = PopsIframeDefaultConfig();
|
|
6025
6193
|
config = popsUtils.assign(config, GlobalConfig.getGlobalConfig());
|
|
6026
6194
|
config = popsUtils.assign(config, __config__);
|
|
@@ -6028,6 +6196,8 @@ System.register('pops', [], (function (exports) {
|
|
|
6028
6196
|
throw new TypeError("config.url must not be null.");
|
|
6029
6197
|
}
|
|
6030
6198
|
config = PopsHandler.handleOnly(popsType, config);
|
|
6199
|
+
const emitter = config.emitter ??
|
|
6200
|
+
new EventEmiter(popsType);
|
|
6031
6201
|
const { $shadowContainer, $shadowRoot } = PopsHandler.handlerShadow(config);
|
|
6032
6202
|
PopsHandler.handleInit($shadowRoot, [
|
|
6033
6203
|
{
|
|
@@ -6055,7 +6225,7 @@ System.register('pops', [], (function (exports) {
|
|
|
6055
6225
|
css: PopsCSS.iframeCSS,
|
|
6056
6226
|
},
|
|
6057
6227
|
]);
|
|
6058
|
-
const maskExtraStyle = config.animation != null && config.animation != "" ? "position:absolute;" : "";
|
|
6228
|
+
const maskExtraStyle = config.animation != null && config.animation != "" && config.animation ? "position:absolute;" : "";
|
|
6059
6229
|
// 先把z-index提取出来
|
|
6060
6230
|
const zIndex = PopsHandler.getTargerOrFunctionValue(config.zIndex);
|
|
6061
6231
|
const maskHTML = PopsElementHandler.createMask(guid, zIndex, maskExtraStyle);
|
|
@@ -7136,9 +7306,9 @@ System.register('pops', [], (function (exports) {
|
|
|
7136
7306
|
style: null,
|
|
7137
7307
|
lightStyle: null,
|
|
7138
7308
|
darkStyle: null,
|
|
7139
|
-
beforeAppendToPageCallBack() { },
|
|
7140
7309
|
stopKeyDownEventPropagation: true,
|
|
7141
7310
|
listenEscapeKeyUpToExitDeepMenu: true,
|
|
7311
|
+
emitter: null,
|
|
7142
7312
|
};
|
|
7143
7313
|
};
|
|
7144
7314
|
|
|
@@ -7250,7 +7420,7 @@ System.register('pops', [], (function (exports) {
|
|
|
7250
7420
|
style: "",
|
|
7251
7421
|
lightStyle: null,
|
|
7252
7422
|
darkStyle: null,
|
|
7253
|
-
|
|
7423
|
+
emitter: null,
|
|
7254
7424
|
};
|
|
7255
7425
|
};
|
|
7256
7426
|
|
|
@@ -7718,7 +7888,6 @@ System.register('pops', [], (function (exports) {
|
|
|
7718
7888
|
const guid = popsUtils.getRandomGUID();
|
|
7719
7889
|
// 设置当前类型
|
|
7720
7890
|
const popsType = "tooltip";
|
|
7721
|
-
const emitter = new EventEmiter(popsType);
|
|
7722
7891
|
let config = PopsTooltipDefaultConfig();
|
|
7723
7892
|
config = popsUtils.assign(config, GlobalConfig.getGlobalConfig());
|
|
7724
7893
|
config = popsUtils.assign(config, __config__);
|
|
@@ -7735,6 +7904,7 @@ System.register('pops', [], (function (exports) {
|
|
|
7735
7904
|
config.onShowEventName += ` ${it}`;
|
|
7736
7905
|
});
|
|
7737
7906
|
}
|
|
7907
|
+
const emitter = config.emitter ?? new EventEmiter(popsType);
|
|
7738
7908
|
const { $shadowContainer, $shadowRoot } = PopsHandler.handlerShadow(config);
|
|
7739
7909
|
PopsHandler.handleInit($shadowRoot, [
|
|
7740
7910
|
{
|
|
@@ -9649,12 +9819,12 @@ System.register('pops', [], (function (exports) {
|
|
|
9649
9819
|
},
|
|
9650
9820
|
mask: {
|
|
9651
9821
|
enable: true,
|
|
9652
|
-
clickCallBack(
|
|
9822
|
+
clickCallBack(continueExec) {
|
|
9653
9823
|
const ret = dialogCloseCallback();
|
|
9654
9824
|
if (typeof ret === "boolean" && !ret) {
|
|
9655
9825
|
return;
|
|
9656
9826
|
}
|
|
9657
|
-
|
|
9827
|
+
continueExec();
|
|
9658
9828
|
},
|
|
9659
9829
|
clickEvent: {
|
|
9660
9830
|
toClose: true,
|
|
@@ -10866,8 +11036,8 @@ System.register('pops', [], (function (exports) {
|
|
|
10866
11036
|
},
|
|
10867
11037
|
mask: {
|
|
10868
11038
|
enable: true,
|
|
10869
|
-
clickCallBack(
|
|
10870
|
-
|
|
11039
|
+
clickCallBack(continueExec) {
|
|
11040
|
+
continueExec();
|
|
10871
11041
|
dialogCloseCallback();
|
|
10872
11042
|
},
|
|
10873
11043
|
clickEvent: {
|
|
@@ -11600,11 +11770,11 @@ System.register('pops', [], (function (exports) {
|
|
|
11600
11770
|
const guid = popsUtils.getRandomGUID();
|
|
11601
11771
|
// 设置当前类型
|
|
11602
11772
|
const popsType = "panel";
|
|
11603
|
-
const emitter = new EventEmiter(popsType);
|
|
11604
11773
|
let config = PopsPanelDefaultConfig();
|
|
11605
11774
|
config = popsUtils.assign(config, GlobalConfig.getGlobalConfig());
|
|
11606
11775
|
config = popsUtils.assign(config, __config__);
|
|
11607
11776
|
config = PopsHandler.handleOnly(popsType, config);
|
|
11777
|
+
const emitter = config.emitter ?? new EventEmiter(popsType);
|
|
11608
11778
|
const { $shadowContainer, $shadowRoot } = PopsHandler.handlerShadow(config);
|
|
11609
11779
|
PopsHandler.handleInit($shadowRoot, [
|
|
11610
11780
|
{
|
|
@@ -11854,8 +12024,8 @@ System.register('pops', [], (function (exports) {
|
|
|
11854
12024
|
style: null,
|
|
11855
12025
|
lightStyle: null,
|
|
11856
12026
|
darkStyle: null,
|
|
11857
|
-
beforeAppendToPageCallBack() { },
|
|
11858
12027
|
stopKeyDownEventPropagation: true,
|
|
12028
|
+
emitter: null,
|
|
11859
12029
|
};
|
|
11860
12030
|
};
|
|
11861
12031
|
|
|
@@ -11864,11 +12034,11 @@ System.register('pops', [], (function (exports) {
|
|
|
11864
12034
|
const guid = popsUtils.getRandomGUID();
|
|
11865
12035
|
// 设置当前类型
|
|
11866
12036
|
const popsType = "prompt";
|
|
11867
|
-
const emitter = new EventEmiter(popsType);
|
|
11868
12037
|
let config = PopsPromptDefaultConfig();
|
|
11869
12038
|
config = popsUtils.assign(config, GlobalConfig.getGlobalConfig());
|
|
11870
12039
|
config = popsUtils.assign(config, __config__);
|
|
11871
12040
|
config = PopsHandler.handleOnly(popsType, config);
|
|
12041
|
+
const emitter = config.emitter ?? new EventEmiter(popsType);
|
|
11872
12042
|
const { $shadowContainer, $shadowRoot } = PopsHandler.handlerShadow(config);
|
|
11873
12043
|
PopsHandler.handleInit($shadowRoot, [
|
|
11874
12044
|
{
|
|
@@ -12089,10 +12259,10 @@ System.register('pops', [], (function (exports) {
|
|
|
12089
12259
|
style: null,
|
|
12090
12260
|
lightStyle: null,
|
|
12091
12261
|
darkStyle: null,
|
|
12092
|
-
beforeAppendToPageCallBack() { },
|
|
12093
12262
|
limitPositionXInView: true,
|
|
12094
12263
|
limitPositionYInView: true,
|
|
12095
12264
|
beforeShowCallBack() { },
|
|
12265
|
+
emitter: null,
|
|
12096
12266
|
};
|
|
12097
12267
|
};
|
|
12098
12268
|
|
|
@@ -12101,11 +12271,11 @@ System.register('pops', [], (function (exports) {
|
|
|
12101
12271
|
const guid = popsUtils.getRandomGUID();
|
|
12102
12272
|
// 设置当前类型
|
|
12103
12273
|
const popsType = "rightClickMenu";
|
|
12104
|
-
const emitter = new EventEmiter(popsType);
|
|
12105
12274
|
let config = PopsRightClickMenuDefaultConfig();
|
|
12106
12275
|
config = popsUtils.assign(config, GlobalConfig.getGlobalConfig());
|
|
12107
12276
|
config = popsUtils.assign(config, __config__);
|
|
12108
12277
|
config = PopsHandler.handleOnly(popsType, config);
|
|
12278
|
+
const emitter = config.emitter ?? new EventEmiter(popsType);
|
|
12109
12279
|
const { $shadowContainer, $shadowRoot } = PopsHandler.handlerShadow(config);
|
|
12110
12280
|
PopsHandler.handleInit($shadowRoot, [
|
|
12111
12281
|
{
|
|
@@ -12727,6 +12897,7 @@ System.register('pops', [], (function (exports) {
|
|
|
12727
12897
|
style: "",
|
|
12728
12898
|
lightStyle: null,
|
|
12729
12899
|
darkStyle: null,
|
|
12900
|
+
emitter: null,
|
|
12730
12901
|
};
|
|
12731
12902
|
};
|
|
12732
12903
|
|
|
@@ -12735,7 +12906,6 @@ System.register('pops', [], (function (exports) {
|
|
|
12735
12906
|
const guid = popsUtils.getRandomGUID();
|
|
12736
12907
|
// 设置当前类型
|
|
12737
12908
|
const popsType = "searchSuggestion";
|
|
12738
|
-
const emitter = new EventEmiter(popsType);
|
|
12739
12909
|
let config = PopsSearchSuggestionDefaultConfig();
|
|
12740
12910
|
config = popsUtils.assign(config, GlobalConfig.getGlobalConfig());
|
|
12741
12911
|
config = popsUtils.assign(config, __config__);
|
|
@@ -12743,6 +12913,7 @@ System.register('pops', [], (function (exports) {
|
|
|
12743
12913
|
if (config.$inputTarget == null) {
|
|
12744
12914
|
config.$inputTarget = config.$target;
|
|
12745
12915
|
}
|
|
12916
|
+
const emitter = config.emitter ?? new EventEmiter(popsType);
|
|
12746
12917
|
const { $shadowContainer, $shadowRoot } = PopsHandler.handlerShadow(config);
|
|
12747
12918
|
PopsHandler.handleInit($shadowRoot, [
|
|
12748
12919
|
{
|
|
@@ -13511,93 +13682,12 @@ System.register('pops', [], (function (exports) {
|
|
|
13511
13682
|
},
|
|
13512
13683
|
};
|
|
13513
13684
|
|
|
13514
|
-
const PopsInstanceUtils = {
|
|
13515
|
-
/**
|
|
13516
|
-
* 获取pops所有弹窗中的最大的z-index
|
|
13517
|
-
* @param deviation
|
|
13518
|
-
*/
|
|
13519
|
-
getPopsMaxZIndex(deviation = 1) {
|
|
13520
|
-
deviation = Number.isNaN(deviation) ? 1 : deviation;
|
|
13521
|
-
// 最大值 2147483647
|
|
13522
|
-
// const browserMaxZIndex = Math.pow(2, 31) - 1;
|
|
13523
|
-
// 比较值 2000000000
|
|
13524
|
-
const maxZIndex = 2 * Math.pow(10, 9);
|
|
13525
|
-
// 当前页面最大的z-index
|
|
13526
|
-
let zIndex = 0;
|
|
13527
|
-
// 当前的最大z-index的元素,调试使用
|
|
13528
|
-
let maxZIndexNode = null;
|
|
13529
|
-
Object.keys(PopsInstData).forEach((instKeyName) => {
|
|
13530
|
-
const instData = PopsInstData[instKeyName];
|
|
13531
|
-
for (let index = 0; index < instData.length; index++) {
|
|
13532
|
-
const inst = instData[index];
|
|
13533
|
-
// 不对position为static和display为none的元素进行获取它们的z-index
|
|
13534
|
-
const $elList = [inst.$anim, inst.$pops, inst.$mask].filter((it) => it instanceof HTMLElement);
|
|
13535
|
-
const nodeZIndexInfoList = popsUtils.getMaxZIndexNodeInfoFromPoint($elList);
|
|
13536
|
-
const maxNodeZIndexInfo = nodeZIndexInfoList[0];
|
|
13537
|
-
if (maxNodeZIndexInfo) {
|
|
13538
|
-
const nodeZIndex = maxNodeZIndexInfo.zIndex;
|
|
13539
|
-
if (nodeZIndex > zIndex) {
|
|
13540
|
-
zIndex = nodeZIndex;
|
|
13541
|
-
maxZIndexNode = maxNodeZIndexInfo.node || maxNodeZIndexInfo.positionNode;
|
|
13542
|
-
}
|
|
13543
|
-
}
|
|
13544
|
-
}
|
|
13545
|
-
});
|
|
13546
|
-
zIndex += deviation;
|
|
13547
|
-
const isOverMaxZIndex = zIndex >= maxZIndex;
|
|
13548
|
-
if (isOverMaxZIndex) {
|
|
13549
|
-
// 超出z-index最大值
|
|
13550
|
-
zIndex = maxZIndex;
|
|
13551
|
-
}
|
|
13552
|
-
return { zIndex: zIndex, animElement: maxZIndexNode, isOverMaxZIndex };
|
|
13553
|
-
},
|
|
13554
|
-
/**
|
|
13555
|
-
* 排序数组
|
|
13556
|
-
* @param getBeforeValueFun
|
|
13557
|
-
* @param getAfterValueFun
|
|
13558
|
-
* @param sortByDesc 排序是否降序,默认降序
|
|
13559
|
-
*/
|
|
13560
|
-
sortElementListByProperty(getBeforeValueFun, getAfterValueFun, sortByDesc = true) {
|
|
13561
|
-
if (typeof sortByDesc !== "boolean") {
|
|
13562
|
-
throw new TypeError("参数 sortByDesc 必须为boolean类型");
|
|
13563
|
-
}
|
|
13564
|
-
if (getBeforeValueFun == null || getAfterValueFun == null) {
|
|
13565
|
-
throw new Error("获取前面的值或后面的值的方法不能为空");
|
|
13566
|
-
}
|
|
13567
|
-
return function (after_obj, before_obj) {
|
|
13568
|
-
const beforeValue = getBeforeValueFun(before_obj); // 前
|
|
13569
|
-
const afterValue = getAfterValueFun(after_obj); // 后
|
|
13570
|
-
if (sortByDesc) {
|
|
13571
|
-
if (afterValue > beforeValue) {
|
|
13572
|
-
return -1;
|
|
13573
|
-
}
|
|
13574
|
-
else if (afterValue < beforeValue) {
|
|
13575
|
-
return 1;
|
|
13576
|
-
}
|
|
13577
|
-
else {
|
|
13578
|
-
return 0;
|
|
13579
|
-
}
|
|
13580
|
-
}
|
|
13581
|
-
else {
|
|
13582
|
-
if (afterValue < beforeValue) {
|
|
13583
|
-
return -1;
|
|
13584
|
-
}
|
|
13585
|
-
else if (afterValue > beforeValue) {
|
|
13586
|
-
return 1;
|
|
13587
|
-
}
|
|
13588
|
-
else {
|
|
13589
|
-
return 0;
|
|
13590
|
-
}
|
|
13591
|
-
}
|
|
13592
|
-
};
|
|
13593
|
-
},
|
|
13594
|
-
};
|
|
13595
|
-
|
|
13596
13685
|
class Pops {
|
|
13597
13686
|
/** 配置 */
|
|
13598
13687
|
config = {
|
|
13599
13688
|
/** 版本号 */
|
|
13600
13689
|
version: version,
|
|
13690
|
+
/** 样式配置 */
|
|
13601
13691
|
cssText: PopsCSS,
|
|
13602
13692
|
/** icon图标的svg代码 */
|
|
13603
13693
|
iconSVG: PopsIcon.$data,
|
|
@@ -13605,12 +13695,9 @@ System.register('pops', [], (function (exports) {
|
|
|
13605
13695
|
animation: PopsAnimation.$data,
|
|
13606
13696
|
/** 存储已创建的元素 */
|
|
13607
13697
|
instData: PopsInstData,
|
|
13608
|
-
|
|
13609
|
-
|
|
13610
|
-
|
|
13611
|
-
return popsDOMUtils.preventEvent(event);
|
|
13612
|
-
},
|
|
13613
|
-
},
|
|
13698
|
+
};
|
|
13699
|
+
/** 导出的函数 */
|
|
13700
|
+
fn = {
|
|
13614
13701
|
/** pops使用的工具类 */
|
|
13615
13702
|
Utils: popsUtils,
|
|
13616
13703
|
/** pops使用的DOM工具类 */
|
|
@@ -13620,15 +13707,16 @@ System.register('pops', [], (function (exports) {
|
|
|
13620
13707
|
/** pops处理float类型使用的工具类 */
|
|
13621
13708
|
MathFloatUtils: PopsMathFloatUtils,
|
|
13622
13709
|
/** 实例处理函数 */
|
|
13623
|
-
PopsInstHandler,
|
|
13710
|
+
InstHandler: PopsInstHandler,
|
|
13624
13711
|
/** pops.panel中用于处理各个类型的工具 */
|
|
13625
|
-
PanelHandlerComponents,
|
|
13712
|
+
PanelHandlerComponents: PanelHandlerComponents,
|
|
13626
13713
|
/** pops.panel中的动画 */
|
|
13627
|
-
PopsAnimation,
|
|
13714
|
+
Animation: PopsAnimation,
|
|
13628
13715
|
/** 事件类 */
|
|
13629
|
-
EventEmiter,
|
|
13716
|
+
EventEmiter: EventEmiter,
|
|
13717
|
+
/** 通用的CSS类名 */
|
|
13718
|
+
CommonCSSClassName: PopsCommonCSSClassName,
|
|
13630
13719
|
};
|
|
13631
|
-
init() { }
|
|
13632
13720
|
/**
|
|
13633
13721
|
* 释放原有的pops控制权
|
|
13634
13722
|
* @example
|