@whitesev/pops 2.0.7 → 2.0.9
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 +394 -55
- package/dist/index.amd.js.map +1 -1
- package/dist/index.cjs.js +394 -55
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +394 -55
- package/dist/index.esm.js.map +1 -1
- package/dist/index.iife.js +394 -55
- package/dist/index.iife.js.map +1 -1
- package/dist/index.system.js +394 -55
- package/dist/index.system.js.map +1 -1
- package/dist/index.umd.js +394 -55
- package/dist/index.umd.js.map +1 -1
- package/dist/types/src/Pops.d.ts +550 -199
- package/dist/types/src/components/rightClickMenu/index.d.ts +545 -199
- package/dist/types/src/components/tooltip/index.d.ts +10 -2
- package/dist/types/src/components/tooltip/indexType.d.ts +13 -4
- package/dist/types/src/utils/PopsUtils.d.ts +16 -0
- package/package.json +6 -5
- package/src/Pops.ts +2 -2
- package/src/components/drawer/index.ts +2 -2
- package/src/components/folder/index.ts +2 -2
- package/src/components/iframe/index.ts +1 -1
- package/src/components/panel/PanelHandleContentDetails.ts +9 -9
- package/src/components/rightClickMenu/index.ts +1 -1
- package/src/components/searchSuggestion/index.ts +2 -2
- package/src/components/tooltip/config.ts +1 -0
- package/src/components/tooltip/index.ts +69 -16
- package/src/components/tooltip/indexType.ts +18 -4
- package/src/utils/PopsDOMUtils.ts +1 -1
- package/src/utils/PopsInstanceUtils.ts +6 -6
- package/src/utils/PopsUtils.ts +53 -1
package/dist/index.iife.js
CHANGED
|
@@ -3,12 +3,6 @@ var pops = (function () {
|
|
|
3
3
|
|
|
4
4
|
const SymbolEvents = Symbol("events_" + (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1));
|
|
5
5
|
|
|
6
|
-
const PopsCoreDefaultEnv = {
|
|
7
|
-
document: document,
|
|
8
|
-
window: window,
|
|
9
|
-
globalThis: globalThis,
|
|
10
|
-
self: self,
|
|
11
|
-
};
|
|
12
6
|
const PopsCoreEnv = {
|
|
13
7
|
document: document,
|
|
14
8
|
window: window,
|
|
@@ -16,12 +10,6 @@ var pops = (function () {
|
|
|
16
10
|
self: self,
|
|
17
11
|
};
|
|
18
12
|
const PopsCore = {
|
|
19
|
-
init(option) {
|
|
20
|
-
if (!option) {
|
|
21
|
-
option = Object.assign({}, PopsCoreDefaultEnv);
|
|
22
|
-
}
|
|
23
|
-
Object.assign(PopsCoreEnv, option);
|
|
24
|
-
},
|
|
25
13
|
get document() {
|
|
26
14
|
return PopsCoreEnv.document;
|
|
27
15
|
},
|
|
@@ -41,21 +29,266 @@ var pops = (function () {
|
|
|
41
29
|
},
|
|
42
30
|
};
|
|
43
31
|
|
|
44
|
-
|
|
32
|
+
const createCache = (lastNumberWeakMap) => {
|
|
33
|
+
return (collection, nextNumber) => {
|
|
34
|
+
lastNumberWeakMap.set(collection, nextNumber);
|
|
35
|
+
return nextNumber;
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
/*
|
|
40
|
+
* The value of the constant Number.MAX_SAFE_INTEGER equals (2 ** 53 - 1) but it
|
|
41
|
+
* is fairly new.
|
|
42
|
+
*/
|
|
43
|
+
const MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER === undefined ? 9007199254740991 : Number.MAX_SAFE_INTEGER;
|
|
44
|
+
const TWO_TO_THE_POWER_OF_TWENTY_NINE = 536870912;
|
|
45
|
+
const TWO_TO_THE_POWER_OF_THIRTY = TWO_TO_THE_POWER_OF_TWENTY_NINE * 2;
|
|
46
|
+
const createGenerateUniqueNumber = (cache, lastNumberWeakMap) => {
|
|
47
|
+
return (collection) => {
|
|
48
|
+
const lastNumber = lastNumberWeakMap.get(collection);
|
|
49
|
+
/*
|
|
50
|
+
* Let's try the cheapest algorithm first. It might fail to produce a new
|
|
51
|
+
* number, but it is so cheap that it is okay to take the risk. Just
|
|
52
|
+
* increase the last number by one or reset it to 0 if we reached the upper
|
|
53
|
+
* bound of SMIs (which stands for small integers). When the last number is
|
|
54
|
+
* unknown it is assumed that the collection contains zero based consecutive
|
|
55
|
+
* numbers.
|
|
56
|
+
*/
|
|
57
|
+
let nextNumber = lastNumber === undefined ? collection.size : lastNumber < TWO_TO_THE_POWER_OF_THIRTY ? lastNumber + 1 : 0;
|
|
58
|
+
if (!collection.has(nextNumber)) {
|
|
59
|
+
return cache(collection, nextNumber);
|
|
60
|
+
}
|
|
61
|
+
/*
|
|
62
|
+
* If there are less than half of 2 ** 30 numbers stored in the collection,
|
|
63
|
+
* the chance to generate a new random number in the range from 0 to 2 ** 30
|
|
64
|
+
* is at least 50%. It's benifitial to use only SMIs because they perform
|
|
65
|
+
* much better in any environment based on V8.
|
|
66
|
+
*/
|
|
67
|
+
if (collection.size < TWO_TO_THE_POWER_OF_TWENTY_NINE) {
|
|
68
|
+
while (collection.has(nextNumber)) {
|
|
69
|
+
nextNumber = Math.floor(Math.random() * TWO_TO_THE_POWER_OF_THIRTY);
|
|
70
|
+
}
|
|
71
|
+
return cache(collection, nextNumber);
|
|
72
|
+
}
|
|
73
|
+
// Quickly check if there is a theoretical chance to generate a new number.
|
|
74
|
+
if (collection.size > MAX_SAFE_INTEGER) {
|
|
75
|
+
throw new Error('Congratulations, you created a collection of unique numbers which uses all available integers!');
|
|
76
|
+
}
|
|
77
|
+
// Otherwise use the full scale of safely usable integers.
|
|
78
|
+
while (collection.has(nextNumber)) {
|
|
79
|
+
nextNumber = Math.floor(Math.random() * MAX_SAFE_INTEGER);
|
|
80
|
+
}
|
|
81
|
+
return cache(collection, nextNumber);
|
|
82
|
+
};
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
const LAST_NUMBER_WEAK_MAP = new WeakMap();
|
|
86
|
+
const cache = createCache(LAST_NUMBER_WEAK_MAP);
|
|
87
|
+
const generateUniqueNumber = createGenerateUniqueNumber(cache, LAST_NUMBER_WEAK_MAP);
|
|
45
88
|
|
|
46
|
-
const
|
|
89
|
+
const isMessagePort = (sender) => {
|
|
90
|
+
return typeof sender.start === 'function';
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
const PORT_MAP = new WeakMap();
|
|
47
94
|
|
|
48
|
-
|
|
95
|
+
const extendBrokerImplementation = (partialBrokerImplementation) => ({
|
|
96
|
+
...partialBrokerImplementation,
|
|
97
|
+
connect: ({ call }) => {
|
|
98
|
+
return async () => {
|
|
99
|
+
const { port1, port2 } = new MessageChannel();
|
|
100
|
+
const portId = await call('connect', { port: port1 }, [port1]);
|
|
101
|
+
PORT_MAP.set(port2, portId);
|
|
102
|
+
return port2;
|
|
103
|
+
};
|
|
104
|
+
},
|
|
105
|
+
disconnect: ({ call }) => {
|
|
106
|
+
return async (port) => {
|
|
107
|
+
const portId = PORT_MAP.get(port);
|
|
108
|
+
if (portId === undefined) {
|
|
109
|
+
throw new Error('The given port is not connected.');
|
|
110
|
+
}
|
|
111
|
+
await call('disconnect', { portId });
|
|
112
|
+
};
|
|
113
|
+
},
|
|
114
|
+
isSupported: ({ call }) => {
|
|
115
|
+
return () => call('isSupported');
|
|
116
|
+
}
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
const ONGOING_REQUESTS = new WeakMap();
|
|
120
|
+
const createOrGetOngoingRequests = (sender) => {
|
|
121
|
+
if (ONGOING_REQUESTS.has(sender)) {
|
|
122
|
+
// @todo TypeScript needs to be convinced that has() works as expected.
|
|
123
|
+
return ONGOING_REQUESTS.get(sender);
|
|
124
|
+
}
|
|
125
|
+
const ongoingRequests = new Map();
|
|
126
|
+
ONGOING_REQUESTS.set(sender, ongoingRequests);
|
|
127
|
+
return ongoingRequests;
|
|
128
|
+
};
|
|
129
|
+
const createBroker = (brokerImplementation) => {
|
|
130
|
+
const fullBrokerImplementation = extendBrokerImplementation(brokerImplementation);
|
|
131
|
+
return (sender) => {
|
|
132
|
+
const ongoingRequests = createOrGetOngoingRequests(sender);
|
|
133
|
+
sender.addEventListener('message', (({ data: message }) => {
|
|
134
|
+
const { id } = message;
|
|
135
|
+
if (id !== null && ongoingRequests.has(id)) {
|
|
136
|
+
const { reject, resolve } = ongoingRequests.get(id);
|
|
137
|
+
ongoingRequests.delete(id);
|
|
138
|
+
if (message.error === undefined) {
|
|
139
|
+
resolve(message.result);
|
|
140
|
+
}
|
|
141
|
+
else {
|
|
142
|
+
reject(new Error(message.error.message));
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
}));
|
|
146
|
+
if (isMessagePort(sender)) {
|
|
147
|
+
sender.start();
|
|
148
|
+
}
|
|
149
|
+
const call = (method, params = null, transferables = []) => {
|
|
150
|
+
return new Promise((resolve, reject) => {
|
|
151
|
+
const id = generateUniqueNumber(ongoingRequests);
|
|
152
|
+
ongoingRequests.set(id, { reject, resolve });
|
|
153
|
+
if (params === null) {
|
|
154
|
+
sender.postMessage({ id, method }, transferables);
|
|
155
|
+
}
|
|
156
|
+
else {
|
|
157
|
+
sender.postMessage({ id, method, params }, transferables);
|
|
158
|
+
}
|
|
159
|
+
});
|
|
160
|
+
};
|
|
161
|
+
const notify = (method, params, transferables = []) => {
|
|
162
|
+
sender.postMessage({ id: null, method, params }, transferables);
|
|
163
|
+
};
|
|
164
|
+
let functions = {};
|
|
165
|
+
for (const [key, handler] of Object.entries(fullBrokerImplementation)) {
|
|
166
|
+
functions = { ...functions, [key]: handler({ call, notify }) };
|
|
167
|
+
}
|
|
168
|
+
return { ...functions };
|
|
169
|
+
};
|
|
170
|
+
};
|
|
171
|
+
|
|
172
|
+
// Prefilling the Maps with a function indexed by zero is necessary to be compliant with the specification.
|
|
173
|
+
const scheduledIntervalsState = new Map([[0, null]]); // tslint:disable-line no-empty
|
|
174
|
+
const scheduledTimeoutsState = new Map([[0, null]]); // tslint:disable-line no-empty
|
|
175
|
+
const wrap = createBroker({
|
|
176
|
+
clearInterval: ({ call }) => {
|
|
177
|
+
return (timerId) => {
|
|
178
|
+
if (typeof scheduledIntervalsState.get(timerId) === 'symbol') {
|
|
179
|
+
scheduledIntervalsState.set(timerId, null);
|
|
180
|
+
call('clear', { timerId, timerType: 'interval' }).then(() => {
|
|
181
|
+
scheduledIntervalsState.delete(timerId);
|
|
182
|
+
});
|
|
183
|
+
}
|
|
184
|
+
};
|
|
185
|
+
},
|
|
186
|
+
clearTimeout: ({ call }) => {
|
|
187
|
+
return (timerId) => {
|
|
188
|
+
if (typeof scheduledTimeoutsState.get(timerId) === 'symbol') {
|
|
189
|
+
scheduledTimeoutsState.set(timerId, null);
|
|
190
|
+
call('clear', { timerId, timerType: 'timeout' }).then(() => {
|
|
191
|
+
scheduledTimeoutsState.delete(timerId);
|
|
192
|
+
});
|
|
193
|
+
}
|
|
194
|
+
};
|
|
195
|
+
},
|
|
196
|
+
setInterval: ({ call }) => {
|
|
197
|
+
return (func, delay = 0, ...args) => {
|
|
198
|
+
const symbol = Symbol();
|
|
199
|
+
const timerId = generateUniqueNumber(scheduledIntervalsState);
|
|
200
|
+
scheduledIntervalsState.set(timerId, symbol);
|
|
201
|
+
const schedule = () => call('set', {
|
|
202
|
+
delay,
|
|
203
|
+
now: performance.timeOrigin + performance.now(),
|
|
204
|
+
timerId,
|
|
205
|
+
timerType: 'interval'
|
|
206
|
+
}).then(() => {
|
|
207
|
+
const state = scheduledIntervalsState.get(timerId);
|
|
208
|
+
if (state === undefined) {
|
|
209
|
+
throw new Error('The timer is in an undefined state.');
|
|
210
|
+
}
|
|
211
|
+
if (state === symbol) {
|
|
212
|
+
func(...args);
|
|
213
|
+
// Doublecheck if the interval should still be rescheduled because it could have been cleared inside of func().
|
|
214
|
+
if (scheduledIntervalsState.get(timerId) === symbol) {
|
|
215
|
+
schedule();
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
});
|
|
219
|
+
schedule();
|
|
220
|
+
return timerId;
|
|
221
|
+
};
|
|
222
|
+
},
|
|
223
|
+
setTimeout: ({ call }) => {
|
|
224
|
+
return (func, delay = 0, ...args) => {
|
|
225
|
+
const symbol = Symbol();
|
|
226
|
+
const timerId = generateUniqueNumber(scheduledTimeoutsState);
|
|
227
|
+
scheduledTimeoutsState.set(timerId, symbol);
|
|
228
|
+
call('set', {
|
|
229
|
+
delay,
|
|
230
|
+
now: performance.timeOrigin + performance.now(),
|
|
231
|
+
timerId,
|
|
232
|
+
timerType: 'timeout'
|
|
233
|
+
}).then(() => {
|
|
234
|
+
const state = scheduledTimeoutsState.get(timerId);
|
|
235
|
+
if (state === undefined) {
|
|
236
|
+
throw new Error('The timer is in an undefined state.');
|
|
237
|
+
}
|
|
238
|
+
if (state === symbol) {
|
|
239
|
+
// A timeout can be savely deleted because it is only called once.
|
|
240
|
+
scheduledTimeoutsState.delete(timerId);
|
|
241
|
+
func(...args);
|
|
242
|
+
}
|
|
243
|
+
});
|
|
244
|
+
return timerId;
|
|
245
|
+
};
|
|
246
|
+
}
|
|
247
|
+
});
|
|
248
|
+
const load = (url) => {
|
|
249
|
+
const worker = new Worker(url);
|
|
250
|
+
return wrap(worker);
|
|
251
|
+
};
|
|
252
|
+
|
|
253
|
+
const createLoadOrReturnBroker = (loadBroker, worker) => {
|
|
254
|
+
let broker = null;
|
|
255
|
+
return () => {
|
|
256
|
+
if (broker !== null) {
|
|
257
|
+
return broker;
|
|
258
|
+
}
|
|
259
|
+
const blob = new Blob([worker], { type: 'application/javascript; charset=utf-8' });
|
|
260
|
+
const url = URL.createObjectURL(blob);
|
|
261
|
+
broker = loadBroker(url);
|
|
262
|
+
// Bug #1: Edge up until v18 didn't like the URL to be revoked directly.
|
|
263
|
+
setTimeout(() => URL.revokeObjectURL(url));
|
|
264
|
+
return broker;
|
|
265
|
+
};
|
|
266
|
+
};
|
|
267
|
+
|
|
268
|
+
// This is the minified and stringified code of the worker-timers-worker package.
|
|
269
|
+
const worker = `(()=>{var e={455:function(e,t){!function(e){"use strict";var t=function(e){return function(t){var r=e(t);return t.add(r),r}},r=function(e){return function(t,r){return e.set(t,r),r}},n=void 0===Number.MAX_SAFE_INTEGER?9007199254740991:Number.MAX_SAFE_INTEGER,o=536870912,s=2*o,a=function(e,t){return function(r){var a=t.get(r),i=void 0===a?r.size:a<s?a+1:0;if(!r.has(i))return e(r,i);if(r.size<o){for(;r.has(i);)i=Math.floor(Math.random()*s);return e(r,i)}if(r.size>n)throw new Error("Congratulations, you created a collection of unique numbers which uses all available integers!");for(;r.has(i);)i=Math.floor(Math.random()*n);return e(r,i)}},i=new WeakMap,u=r(i),c=a(u,i),d=t(c);e.addUniqueNumber=d,e.generateUniqueNumber=c}(t)}},t={};function r(n){var o=t[n];if(void 0!==o)return o.exports;var s=t[n]={exports:{}};return e[n].call(s.exports,s,s.exports,r),s.exports}(()=>{"use strict";const e=-32603,t=-32602,n=-32601,o=(e,t)=>Object.assign(new Error(e),{status:t}),s=t=>o('The handler of the method called "'.concat(t,'" returned an unexpected result.'),e),a=(t,r)=>async({data:{id:a,method:i,params:u}})=>{const c=r[i];try{if(void 0===c)throw(e=>o('The requested method called "'.concat(e,'" is not supported.'),n))(i);const r=void 0===u?c():c(u);if(void 0===r)throw(t=>o('The handler of the method called "'.concat(t,'" returned no required result.'),e))(i);const d=r instanceof Promise?await r:r;if(null===a){if(void 0!==d.result)throw s(i)}else{if(void 0===d.result)throw s(i);const{result:e,transferables:r=[]}=d;t.postMessage({id:a,result:e},r)}}catch(e){const{message:r,status:n=-32603}=e;t.postMessage({error:{code:n,message:r},id:a})}};var i=r(455);const u=new Map,c=(e,r,n)=>({...r,connect:({port:t})=>{t.start();const n=e(t,r),o=(0,i.generateUniqueNumber)(u);return u.set(o,(()=>{n(),t.close(),u.delete(o)})),{result:o}},disconnect:({portId:e})=>{const r=u.get(e);if(void 0===r)throw(e=>o('The specified parameter called "portId" with the given value "'.concat(e,'" does not identify a port connected to this worker.'),t))(e);return r(),{result:null}},isSupported:async()=>{if(await new Promise((e=>{const t=new ArrayBuffer(0),{port1:r,port2:n}=new MessageChannel;r.onmessage=({data:t})=>e(null!==t),n.postMessage(t,[t])}))){const e=n();return{result:e instanceof Promise?await e:e}}return{result:!1}}}),d=(e,t,r=()=>!0)=>{const n=c(d,t,r),o=a(e,n);return e.addEventListener("message",o),()=>e.removeEventListener("message",o)},l=e=>t=>{const r=e.get(t);if(void 0===r)return Promise.resolve(!1);const[n,o]=r;return clearTimeout(n),e.delete(t),o(!1),Promise.resolve(!0)},f=(e,t,r)=>(n,o,s)=>{const{expected:a,remainingDelay:i}=e(n,o);return new Promise((e=>{t.set(s,[setTimeout(r,i,a,t,e,s),e])}))},m=(e,t)=>{const r=performance.now(),n=e+t-r-performance.timeOrigin;return{expected:r+n,remainingDelay:n}},p=(e,t,r,n)=>{const o=e-performance.now();o>0?t.set(n,[setTimeout(p,o,e,t,r,n),r]):(t.delete(n),r(!0))},h=new Map,v=l(h),w=new Map,g=l(w),M=f(m,h,p),y=f(m,w,p);d(self,{clear:async({timerId:e,timerType:t})=>({result:await("interval"===t?v(e):g(e))}),set:async({delay:e,now:t,timerId:r,timerType:n})=>({result:await("interval"===n?M:y)(e,t,r)})})})()})();`; // tslint:disable-line:max-line-length
|
|
270
|
+
|
|
271
|
+
const loadOrReturnBroker = createLoadOrReturnBroker(load, worker);
|
|
272
|
+
const clearInterval = (timerId) => loadOrReturnBroker().clearInterval(timerId);
|
|
273
|
+
const clearTimeout$1 = (timerId) => loadOrReturnBroker().clearTimeout(timerId);
|
|
274
|
+
const setInterval = (...args) => loadOrReturnBroker().setInterval(...args);
|
|
275
|
+
const setTimeout$1 = (...args) => loadOrReturnBroker().setTimeout(...args);
|
|
276
|
+
|
|
277
|
+
let t$1 = 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={};}};
|
|
278
|
+
|
|
279
|
+
const n$1="clientX",e$2="clientY",t=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}
|
|
280
|
+
|
|
281
|
+
function r$3(){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$2(t,e){const{preventDefault:n}=e;return s=n,"[object Function]"===Object.prototype.toString.call(s)?n(t):!!n;var s;}const h$2=["touchstart","touchmove","touchend","touchcancel","mousedown"],p$2=["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}};let l$1 = class l extends t$1{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$3();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$3();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$2.forEach((s=>{t.addEventListener(s,e,n);})),p$2.forEach((t=>{window.addEventListener(t,e,n);})),()=>{h$2.forEach((n=>{t.removeEventListener(n,e);})),p$2.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$2(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();}};
|
|
49
282
|
|
|
50
283
|
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$1=(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};
|
|
51
284
|
|
|
52
285
|
function p$1(){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$1(){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$1(n,u)),{displacementX:n,displacementY:u,distanceX:s,distanceY:p,distance:d,overallDirection:t}}}function l(){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$1,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<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$1=u$1(s,p),n=c;}}return {velocityX:e,velocityY:r,speedX:i,speedY:a,direction:t$1}}}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}}}
|
|
53
286
|
|
|
54
|
-
const m={name:"tap",pointLength:1,tapTimes:1,waitNextTapTime:300,maxDistance:2,maxDistanceFromPrevTap:9,maxPressTime:250};function r$2(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$1,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
|
|
287
|
+
const m={name:"tap",pointLength:1,tapTimes:1,waitNextTapTime:300,maxDistance:2,maxDistanceFromPrevTap:9,maxPressTime:250};function r$2(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$1,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}
|
|
55
288
|
|
|
56
289
|
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$1,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}
|
|
57
290
|
|
|
58
|
-
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$1,f,M],(t=>{if(s.state=0,!s.disabled&&function(){if(u$3!==t.phase)return
|
|
291
|
+
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$1,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}
|
|
59
292
|
|
|
60
293
|
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$1],(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}
|
|
61
294
|
|
|
@@ -277,7 +510,7 @@ var pops = (function () {
|
|
|
277
510
|
formatByteToSize(byteSize, addType = true) {
|
|
278
511
|
byteSize = parseInt(byteSize.toString());
|
|
279
512
|
if (isNaN(byteSize)) {
|
|
280
|
-
throw new
|
|
513
|
+
throw new TypeError("Utils.formatByteToSize 参数 byteSize 格式不正确");
|
|
281
514
|
}
|
|
282
515
|
let result = 0;
|
|
283
516
|
let resultType = "KB";
|
|
@@ -310,6 +543,58 @@ var pops = (function () {
|
|
|
310
543
|
AnyTouch = () => {
|
|
311
544
|
return i;
|
|
312
545
|
};
|
|
546
|
+
/**
|
|
547
|
+
* 自动使用 Worker 执行 setTimeout
|
|
548
|
+
*/
|
|
549
|
+
setTimeout(callback, timeout = 0) {
|
|
550
|
+
try {
|
|
551
|
+
return setTimeout$1(callback, timeout);
|
|
552
|
+
}
|
|
553
|
+
catch (error) {
|
|
554
|
+
return globalThis.setTimeout(callback, timeout);
|
|
555
|
+
}
|
|
556
|
+
}
|
|
557
|
+
/**
|
|
558
|
+
* 配合 .setTimeout 使用
|
|
559
|
+
*/
|
|
560
|
+
clearTimeout(timeId) {
|
|
561
|
+
try {
|
|
562
|
+
if (timeId != null) {
|
|
563
|
+
clearTimeout$1(timeId);
|
|
564
|
+
}
|
|
565
|
+
}
|
|
566
|
+
catch (error) {
|
|
567
|
+
}
|
|
568
|
+
finally {
|
|
569
|
+
globalThis.clearTimeout(timeId);
|
|
570
|
+
}
|
|
571
|
+
}
|
|
572
|
+
/**
|
|
573
|
+
* 自动使用 Worker 执行 setInterval
|
|
574
|
+
*/
|
|
575
|
+
setInterval(callback, timeout = 0) {
|
|
576
|
+
try {
|
|
577
|
+
return setInterval(callback, timeout);
|
|
578
|
+
}
|
|
579
|
+
catch (error) {
|
|
580
|
+
return globalThis.setInterval(callback, timeout);
|
|
581
|
+
}
|
|
582
|
+
}
|
|
583
|
+
/**
|
|
584
|
+
* 配合 .setInterval 使用
|
|
585
|
+
*/
|
|
586
|
+
clearInterval(timeId) {
|
|
587
|
+
try {
|
|
588
|
+
if (timeId != null) {
|
|
589
|
+
clearInterval(timeId);
|
|
590
|
+
}
|
|
591
|
+
}
|
|
592
|
+
catch (error) {
|
|
593
|
+
}
|
|
594
|
+
finally {
|
|
595
|
+
globalThis.clearInterval(timeId);
|
|
596
|
+
}
|
|
597
|
+
}
|
|
313
598
|
}
|
|
314
599
|
const popsUtils = new PopsUtils();
|
|
315
600
|
|
|
@@ -683,7 +968,7 @@ var pops = (function () {
|
|
|
683
968
|
}
|
|
684
969
|
if (checkDOMReadyState()) {
|
|
685
970
|
/* 检查document状态 */
|
|
686
|
-
setTimeout(callback);
|
|
971
|
+
popsUtils.setTimeout(callback, 0);
|
|
687
972
|
}
|
|
688
973
|
else {
|
|
689
974
|
/* 添加监听 */
|
|
@@ -1910,7 +2195,7 @@ var pops = (function () {
|
|
|
1910
2195
|
let popsElement = animElement.querySelector(".pops[type-value]");
|
|
1911
2196
|
if (popsType === "drawer") {
|
|
1912
2197
|
let drawerConfig = config;
|
|
1913
|
-
setTimeout(() => {
|
|
2198
|
+
popsUtils.setTimeout(() => {
|
|
1914
2199
|
maskElement.style.setProperty("display", "none");
|
|
1915
2200
|
if (["top", "bottom"].includes(drawerConfig.direction)) {
|
|
1916
2201
|
popsElement.style.setProperty("height", "0");
|
|
@@ -1976,7 +2261,7 @@ var pops = (function () {
|
|
|
1976
2261
|
let popsElement = animElement.querySelector(".pops[type-value]");
|
|
1977
2262
|
if (popsType === "drawer") {
|
|
1978
2263
|
let drawerConfig = config;
|
|
1979
|
-
setTimeout(() => {
|
|
2264
|
+
popsUtils.setTimeout(() => {
|
|
1980
2265
|
popsDOMUtils.css(maskElement, "display", "");
|
|
1981
2266
|
let direction = drawerConfig.direction;
|
|
1982
2267
|
let size = drawerConfig.size.toString();
|
|
@@ -1990,7 +2275,7 @@ var pops = (function () {
|
|
|
1990
2275
|
console.error("未知direction:", direction);
|
|
1991
2276
|
}
|
|
1992
2277
|
resolve();
|
|
1993
|
-
}, drawerConfig.openDelay);
|
|
2278
|
+
}, drawerConfig.openDelay ?? 0);
|
|
1994
2279
|
}
|
|
1995
2280
|
else {
|
|
1996
2281
|
let findLayerIns = layerConfigList.find((layerConfigItem) => layerConfigItem.guid === guid);
|
|
@@ -2082,7 +2367,7 @@ var pops = (function () {
|
|
|
2082
2367
|
}
|
|
2083
2368
|
}
|
|
2084
2369
|
if (popsType === "drawer") {
|
|
2085
|
-
setTimeout(() => {
|
|
2370
|
+
popsUtils.setTimeout(() => {
|
|
2086
2371
|
transitionendEvent();
|
|
2087
2372
|
}, drawerConfig.closeDelay);
|
|
2088
2373
|
}
|
|
@@ -2299,10 +2584,10 @@ var pops = (function () {
|
|
|
2299
2584
|
*/
|
|
2300
2585
|
sortElementListByProperty(getBeforeValueFun, getAfterValueFun, sortByDesc = true) {
|
|
2301
2586
|
if (typeof sortByDesc !== "boolean") {
|
|
2302
|
-
throw "参数 sortByDesc 必须为boolean类型";
|
|
2587
|
+
throw new TypeError("参数 sortByDesc 必须为boolean类型");
|
|
2303
2588
|
}
|
|
2304
2589
|
if (getBeforeValueFun == null || getAfterValueFun == null) {
|
|
2305
|
-
throw "获取前面的值或后面的值的方法不能为空";
|
|
2590
|
+
throw new Error("获取前面的值或后面的值的方法不能为空");
|
|
2306
2591
|
}
|
|
2307
2592
|
return function (after_obj, before_obj) {
|
|
2308
2593
|
var beforeValue = getBeforeValueFun(before_obj); /* 前 */
|
|
@@ -3899,7 +4184,7 @@ var pops = (function () {
|
|
|
3899
4184
|
config = popsUtils.assign(config, GlobalConfig.getGlobalConfig());
|
|
3900
4185
|
config = popsUtils.assign(config, details);
|
|
3901
4186
|
if (config.url == null) {
|
|
3902
|
-
throw "config.url不能为空";
|
|
4187
|
+
throw new Error("config.url不能为空");
|
|
3903
4188
|
}
|
|
3904
4189
|
config = PopsHandler.handleOnly(PopsType, config);
|
|
3905
4190
|
const { $shadowContainer, $shadowRoot } = PopsHandler.handlerShadow(config);
|
|
@@ -4357,8 +4642,8 @@ var pops = (function () {
|
|
|
4357
4642
|
config.beforeAppendToPageCallBack($shadowRoot, $shadowContainer);
|
|
4358
4643
|
}
|
|
4359
4644
|
popsDOMUtils.appendBody($shadowContainer);
|
|
4360
|
-
setTimeout(() => {
|
|
4361
|
-
setTimeout(() => {
|
|
4645
|
+
popsUtils.setTimeout(() => {
|
|
4646
|
+
popsUtils.setTimeout(() => {
|
|
4362
4647
|
$pops.style.setProperty("transform", "");
|
|
4363
4648
|
}, config.openDelay);
|
|
4364
4649
|
}, 50);
|
|
@@ -5079,12 +5364,12 @@ var pops = (function () {
|
|
|
5079
5364
|
let downloadIframeLinkElement = document.createElement("iframe");
|
|
5080
5365
|
downloadIframeLinkElement.src = downloadInfo.url;
|
|
5081
5366
|
downloadIframeLinkElement.onload = function () {
|
|
5082
|
-
setTimeout(() => {
|
|
5367
|
+
popsUtils.setTimeout(() => {
|
|
5083
5368
|
downloadIframeLinkElement.remove();
|
|
5084
5369
|
}, 1000);
|
|
5085
5370
|
};
|
|
5086
5371
|
$shadowRoot.appendChild(downloadIframeLinkElement);
|
|
5087
|
-
setTimeout(() => {
|
|
5372
|
+
popsUtils.setTimeout(() => {
|
|
5088
5373
|
downloadIframeLinkElement.remove();
|
|
5089
5374
|
}, 3 * 60 * 1000);
|
|
5090
5375
|
}
|
|
@@ -6326,11 +6611,11 @@ var pops = (function () {
|
|
|
6326
6611
|
let isSuccess = false;
|
|
6327
6612
|
let oldTotalWidth = this.$data.totalWidth;
|
|
6328
6613
|
let timer = void 0;
|
|
6329
|
-
let interval = setInterval(() => {
|
|
6614
|
+
let interval = popsUtils.setInterval(() => {
|
|
6330
6615
|
if (isSuccess) {
|
|
6331
6616
|
this.$interval.isCheck = false;
|
|
6332
|
-
clearTimeout(timer);
|
|
6333
|
-
clearInterval(interval);
|
|
6617
|
+
popsUtils.clearTimeout(timer);
|
|
6618
|
+
popsUtils.clearInterval(interval);
|
|
6334
6619
|
}
|
|
6335
6620
|
else {
|
|
6336
6621
|
this.initTotalWidth();
|
|
@@ -6350,8 +6635,8 @@ var pops = (function () {
|
|
|
6350
6635
|
}
|
|
6351
6636
|
}, checkStepTime);
|
|
6352
6637
|
/* 最长检测时间是10s */
|
|
6353
|
-
timer = setTimeout(() => {
|
|
6354
|
-
clearInterval(interval);
|
|
6638
|
+
timer = popsUtils.setTimeout(() => {
|
|
6639
|
+
popsUtils.clearInterval(interval);
|
|
6355
6640
|
}, maxTime);
|
|
6356
6641
|
},
|
|
6357
6642
|
/**
|
|
@@ -6719,16 +7004,16 @@ var pops = (function () {
|
|
|
6719
7004
|
return;
|
|
6720
7005
|
}
|
|
6721
7006
|
this.$data.isCheckingStopDragMove = true;
|
|
6722
|
-
let interval = setInterval(() => {
|
|
7007
|
+
let interval = popsUtils.setInterval(() => {
|
|
6723
7008
|
if (!this.$data.isMove) {
|
|
6724
7009
|
this.$data.isCheckingStopDragMove = false;
|
|
6725
7010
|
this.closeToolTip();
|
|
6726
|
-
clearInterval(interval);
|
|
7011
|
+
popsUtils.clearInterval(interval);
|
|
6727
7012
|
}
|
|
6728
7013
|
}, 200);
|
|
6729
|
-
setTimeout(() => {
|
|
7014
|
+
popsUtils.setTimeout(() => {
|
|
6730
7015
|
this.$data.isCheckingStopDragMove = false;
|
|
6731
|
-
clearInterval(interval);
|
|
7016
|
+
popsUtils.clearInterval(interval);
|
|
6732
7017
|
}, 2000);
|
|
6733
7018
|
},
|
|
6734
7019
|
/**
|
|
@@ -8606,7 +8891,7 @@ var pops = (function () {
|
|
|
8606
8891
|
config = popsUtils.assign(config, details);
|
|
8607
8892
|
config = PopsHandler.handleOnly(PopsType, config);
|
|
8608
8893
|
if (config.target == null) {
|
|
8609
|
-
throw "config.target 不能为空";
|
|
8894
|
+
throw new Error("config.target 不能为空");
|
|
8610
8895
|
}
|
|
8611
8896
|
if (details.data) {
|
|
8612
8897
|
// @ts-ignore
|
|
@@ -9092,7 +9377,7 @@ var pops = (function () {
|
|
|
9092
9377
|
config = popsUtils.assign(config, GlobalConfig.getGlobalConfig());
|
|
9093
9378
|
config = popsUtils.assign(config, details);
|
|
9094
9379
|
if (config.target == null) {
|
|
9095
|
-
throw new
|
|
9380
|
+
throw new Error("config.target 不能为空");
|
|
9096
9381
|
}
|
|
9097
9382
|
/* 做下兼容处理 */
|
|
9098
9383
|
if (config.inputTarget == null) {
|
|
@@ -9363,7 +9648,7 @@ var pops = (function () {
|
|
|
9363
9648
|
popsDOMUtils.on([config.inputTarget], ["focus", "click", "input"], void 0, SearchSuggestion.showEvent, option);
|
|
9364
9649
|
}
|
|
9365
9650
|
else {
|
|
9366
|
-
throw new
|
|
9651
|
+
throw new Error("未知followPosition:" + config.followPosition);
|
|
9367
9652
|
}
|
|
9368
9653
|
},
|
|
9369
9654
|
/**
|
|
@@ -9631,6 +9916,7 @@ var pops = (function () {
|
|
|
9631
9916
|
useShadowRoot: true,
|
|
9632
9917
|
target: null,
|
|
9633
9918
|
content: "默认文字",
|
|
9919
|
+
isDiffContent: false,
|
|
9634
9920
|
position: "top",
|
|
9635
9921
|
className: "",
|
|
9636
9922
|
isFixed: false,
|
|
@@ -9756,6 +10042,19 @@ var pops = (function () {
|
|
|
9756
10042
|
if (text == null) {
|
|
9757
10043
|
text = this.getContent();
|
|
9758
10044
|
}
|
|
10045
|
+
if (this.$data.config.isDiffContent) {
|
|
10046
|
+
let contentPropKey = "data-content";
|
|
10047
|
+
// @ts-ignore
|
|
10048
|
+
let originContentText = this.$el.$content[contentPropKey];
|
|
10049
|
+
if (typeof originContentText === "string") {
|
|
10050
|
+
if (originContentText === text) {
|
|
10051
|
+
// 内容未改变,不修改避免渲染
|
|
10052
|
+
return;
|
|
10053
|
+
}
|
|
10054
|
+
}
|
|
10055
|
+
// @ts-ignore
|
|
10056
|
+
this.$el.$content[contentPropKey] = text;
|
|
10057
|
+
}
|
|
9759
10058
|
PopsSafeUtils.setSafeHTML(this.$el.$content, text);
|
|
9760
10059
|
}
|
|
9761
10060
|
/**
|
|
@@ -9774,11 +10073,12 @@ var pops = (function () {
|
|
|
9774
10073
|
}
|
|
9775
10074
|
/**
|
|
9776
10075
|
* 计算 提示框的位置
|
|
10076
|
+
* @param event 触发的事件
|
|
9777
10077
|
* @param targetElement 目标元素
|
|
9778
10078
|
* @param arrowDistance 箭头和目标元素的距离
|
|
9779
10079
|
* @param otherDistance 其它位置的偏移
|
|
9780
10080
|
*/
|
|
9781
|
-
calcToolTipPosition(targetElement, arrowDistance, otherDistance) {
|
|
10081
|
+
calcToolTipPosition(targetElement, arrowDistance, otherDistance, event) {
|
|
9782
10082
|
let offsetInfo = popsDOMUtils.offset(targetElement, !this.$data.config.isFixed);
|
|
9783
10083
|
// 目标 宽
|
|
9784
10084
|
let targetElement_width = offsetInfo.width;
|
|
@@ -9796,6 +10096,31 @@ var pops = (function () {
|
|
|
9796
10096
|
let targetElement_X_center_pos = targetElement_left + targetElement_width / 2 - toolTipElement_width / 2;
|
|
9797
10097
|
/* 目标元素的Y轴的中间位置 */
|
|
9798
10098
|
let targetElement_Y_center_pos = targetElement_top + targetElement_height / 2 - toolTipElement_height / 2;
|
|
10099
|
+
let mouseX = 0;
|
|
10100
|
+
let mouseY = 0;
|
|
10101
|
+
if (event != null) {
|
|
10102
|
+
if (event instanceof MouseEvent || event instanceof PointerEvent) {
|
|
10103
|
+
mouseX = event.pageX;
|
|
10104
|
+
mouseY = event.y;
|
|
10105
|
+
}
|
|
10106
|
+
else if (event instanceof TouchEvent) {
|
|
10107
|
+
let touchEvent = event.touches[0];
|
|
10108
|
+
mouseX = touchEvent.pageX;
|
|
10109
|
+
mouseY = touchEvent.pageY;
|
|
10110
|
+
}
|
|
10111
|
+
else {
|
|
10112
|
+
// @ts-ignore
|
|
10113
|
+
if (typeof event.clientX === "number") {
|
|
10114
|
+
// @ts-ignore
|
|
10115
|
+
mouseX = event.clientX;
|
|
10116
|
+
}
|
|
10117
|
+
// @ts-ignore
|
|
10118
|
+
if (typeof event.clientY === "number") {
|
|
10119
|
+
// @ts-ignore
|
|
10120
|
+
mouseY = event.clientY;
|
|
10121
|
+
}
|
|
10122
|
+
}
|
|
10123
|
+
}
|
|
9799
10124
|
return {
|
|
9800
10125
|
TOP: {
|
|
9801
10126
|
left: targetElement_X_center_pos - otherDistance,
|
|
@@ -9821,13 +10146,19 @@ var pops = (function () {
|
|
|
9821
10146
|
arrow: "right",
|
|
9822
10147
|
motion: "fadeInLeft",
|
|
9823
10148
|
},
|
|
10149
|
+
FOLLOW: {
|
|
10150
|
+
left: mouseX + otherDistance,
|
|
10151
|
+
top: mouseY + otherDistance,
|
|
10152
|
+
arrow: "follow",
|
|
10153
|
+
motion: "",
|
|
10154
|
+
},
|
|
9824
10155
|
};
|
|
9825
10156
|
}
|
|
9826
10157
|
/**
|
|
9827
10158
|
* 动态修改tooltip的位置
|
|
9828
10159
|
*/
|
|
9829
|
-
changePosition() {
|
|
9830
|
-
let positionInfo = this.calcToolTipPosition(this.$data.config.target, this.$data.config.arrowDistance, this.$data.config.otherDistance);
|
|
10160
|
+
changePosition(event) {
|
|
10161
|
+
let positionInfo = this.calcToolTipPosition(this.$data.config.target, this.$data.config.arrowDistance, this.$data.config.otherDistance, event);
|
|
9831
10162
|
let positionKey = this.$data.config.position.toUpperCase();
|
|
9832
10163
|
let positionDetail = positionInfo[positionKey];
|
|
9833
10164
|
if (positionDetail) {
|
|
@@ -9887,13 +10218,13 @@ var pops = (function () {
|
|
|
9887
10218
|
if (typeof timeId === "number") {
|
|
9888
10219
|
// 只清除一个
|
|
9889
10220
|
if (timeId == currentTimeId) {
|
|
9890
|
-
clearTimeout(timeId);
|
|
10221
|
+
popsUtils.clearTimeout(timeId);
|
|
9891
10222
|
timeIdList.splice(index, 1);
|
|
9892
10223
|
break;
|
|
9893
10224
|
}
|
|
9894
10225
|
}
|
|
9895
10226
|
else {
|
|
9896
|
-
clearTimeout(currentTimeId);
|
|
10227
|
+
popsUtils.clearTimeout(currentTimeId);
|
|
9897
10228
|
timeIdList.splice(index, 1);
|
|
9898
10229
|
index--;
|
|
9899
10230
|
}
|
|
@@ -9927,7 +10258,7 @@ var pops = (function () {
|
|
|
9927
10258
|
// 更新内容
|
|
9928
10259
|
this.changeContent();
|
|
9929
10260
|
// 更新tip的位置
|
|
9930
|
-
this.changePosition();
|
|
10261
|
+
this.changePosition(event);
|
|
9931
10262
|
if (typeof this.$data.config.showAfterCallBack === "function") {
|
|
9932
10263
|
this.$data.config.showAfterCallBack(this.$el.$toolTip);
|
|
9933
10264
|
}
|
|
@@ -9972,16 +10303,24 @@ var pops = (function () {
|
|
|
9972
10303
|
this.$data.config.delayCloseTime <= 0)) {
|
|
9973
10304
|
this.$data.config.delayCloseTime = 100;
|
|
9974
10305
|
}
|
|
9975
|
-
let timeId = setTimeout(() => {
|
|
10306
|
+
let timeId = popsUtils.setTimeout(() => {
|
|
9976
10307
|
// 设置属性触发关闭动画
|
|
9977
10308
|
this.clearCloseTimeoutId(eventType, timeId);
|
|
9978
10309
|
if (this.$el.$toolTip == null) {
|
|
9979
10310
|
// 已清除了
|
|
9980
10311
|
return;
|
|
9981
10312
|
}
|
|
9982
|
-
this.$el.$toolTip.
|
|
9983
|
-
|
|
9984
|
-
|
|
10313
|
+
let motion = this.$el.$toolTip.getAttribute("data-motion");
|
|
10314
|
+
if (motion == null || motion.trim() === "") {
|
|
10315
|
+
// 没有动画
|
|
10316
|
+
this.toolTipAnimationFinishEvent();
|
|
10317
|
+
}
|
|
10318
|
+
else {
|
|
10319
|
+
// 修改data-motion触发动画关闭
|
|
10320
|
+
this.$el.$toolTip.setAttribute("data-motion", this.$el.$toolTip
|
|
10321
|
+
.getAttribute("data-motion")
|
|
10322
|
+
.replace("fadeIn", "fadeOut"));
|
|
10323
|
+
}
|
|
9985
10324
|
}, this.$data.config.delayCloseTime);
|
|
9986
10325
|
this.addCloseTimeoutId(eventType, timeId);
|
|
9987
10326
|
if (typeof this.$data.config.closeAfterCallBack === "function") {
|
|
@@ -10095,7 +10434,7 @@ var pops = (function () {
|
|
|
10095
10434
|
config = popsUtils.assign(config, GlobalConfig.getGlobalConfig());
|
|
10096
10435
|
config = popsUtils.assign(config, details);
|
|
10097
10436
|
if (!(config.target instanceof HTMLElement)) {
|
|
10098
|
-
throw "config.target 必须是HTMLElement类型";
|
|
10437
|
+
throw new TypeError("config.target 必须是HTMLElement类型");
|
|
10099
10438
|
}
|
|
10100
10439
|
config = PopsHandler.handleOnly(PopsType, config);
|
|
10101
10440
|
const { $shadowContainer, $shadowRoot } = PopsHandler.handlerShadow(config);
|
|
@@ -10128,7 +10467,7 @@ var pops = (function () {
|
|
|
10128
10467
|
/** 配置 */
|
|
10129
10468
|
config = {
|
|
10130
10469
|
/** 版本号 */
|
|
10131
|
-
version: "2025.5.
|
|
10470
|
+
version: "2025.5.26",
|
|
10132
10471
|
cssText: {
|
|
10133
10472
|
/** 主CSS */
|
|
10134
10473
|
index: indexCSS,
|
|
@@ -10237,7 +10576,7 @@ var pops = (function () {
|
|
|
10237
10576
|
popsDOMUtils.appendHead(animationStyle);
|
|
10238
10577
|
this.config.animation = null;
|
|
10239
10578
|
this.config.animation = PopsInstanceUtils.getKeyFrames(animationStyle.sheet);
|
|
10240
|
-
setTimeout(() => {
|
|
10579
|
+
popsUtils.setTimeout(() => {
|
|
10241
10580
|
animationStyle.remove();
|
|
10242
10581
|
}, 50);
|
|
10243
10582
|
}
|