@whitesev/pops 2.0.6 → 2.0.8

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.
Files changed (62) hide show
  1. package/dist/index.amd.js +506 -128
  2. package/dist/index.amd.js.map +1 -1
  3. package/dist/index.cjs.js +506 -128
  4. package/dist/index.cjs.js.map +1 -1
  5. package/dist/index.esm.js +506 -128
  6. package/dist/index.esm.js.map +1 -1
  7. package/dist/index.iife.js +506 -128
  8. package/dist/index.iife.js.map +1 -1
  9. package/dist/index.system.js +506 -128
  10. package/dist/index.system.js.map +1 -1
  11. package/dist/index.umd.js +506 -128
  12. package/dist/index.umd.js.map +1 -1
  13. package/dist/types/src/Pops.d.ts +20761 -15
  14. package/dist/types/src/components/alert/index.d.ts +3 -3
  15. package/dist/types/src/components/confirm/index.d.ts +3 -3
  16. package/dist/types/src/components/drawer/index.d.ts +3 -3
  17. package/dist/types/src/components/drawer/indexType.d.ts +10 -2
  18. package/dist/types/src/components/folder/index.d.ts +3 -3
  19. package/dist/types/src/components/folder/indexType.d.ts +4 -1
  20. package/dist/types/src/components/iframe/index.d.ts +6 -3
  21. package/dist/types/src/components/iframe/indexType.d.ts +2 -0
  22. package/dist/types/src/components/loading/index.d.ts +3 -3
  23. package/dist/types/src/components/loading/indexType.d.ts +3 -1
  24. package/dist/types/src/components/panel/index.d.ts +3 -3
  25. package/dist/types/src/components/panel/indexType.d.ts +1 -0
  26. package/dist/types/src/components/panel/sliderType.d.ts +14 -4
  27. package/dist/types/src/components/prompt/index.d.ts +3 -3
  28. package/dist/types/src/components/prompt/indexType.d.ts +1 -0
  29. package/dist/types/src/components/rightClickMenu/index.d.ts +20661 -3
  30. package/dist/types/src/components/rightClickMenu/indexType.d.ts +6 -2
  31. package/dist/types/src/components/searchSuggestion/index.d.ts +141 -3
  32. package/dist/types/src/components/searchSuggestion/indexType.d.ts +0 -108
  33. package/dist/types/src/components/tooltip/index.d.ts +60 -5
  34. package/dist/types/src/components/tooltip/indexType.d.ts +6 -4
  35. package/dist/types/src/utils/PopsUtils.d.ts +16 -0
  36. package/package.json +6 -5
  37. package/src/Pops.ts +26 -25
  38. package/src/components/alert/index.ts +6 -5
  39. package/src/components/confirm/index.ts +6 -5
  40. package/src/components/drawer/index.ts +8 -7
  41. package/src/components/drawer/indexType.ts +10 -2
  42. package/src/components/folder/index.ts +8 -7
  43. package/src/components/folder/indexType.ts +4 -1
  44. package/src/components/iframe/index.ts +5 -5
  45. package/src/components/iframe/indexType.ts +2 -0
  46. package/src/components/loading/index.ts +6 -5
  47. package/src/components/loading/indexType.ts +3 -1
  48. package/src/components/panel/PanelHandleContentDetails.ts +71 -38
  49. package/src/components/panel/index.ts +6 -5
  50. package/src/components/panel/indexType.ts +1 -0
  51. package/src/components/panel/sliderType.ts +14 -4
  52. package/src/components/prompt/index.ts +6 -5
  53. package/src/components/prompt/indexType.ts +1 -0
  54. package/src/components/rightClickMenu/index.ts +5 -6
  55. package/src/components/rightClickMenu/indexType.ts +6 -7
  56. package/src/components/searchSuggestion/index.ts +6 -6
  57. package/src/components/searchSuggestion/indexType.ts +0 -109
  58. package/src/components/tooltip/index.ts +65 -25
  59. package/src/components/tooltip/indexType.ts +11 -4
  60. package/src/utils/PopsDOMUtils.ts +1 -1
  61. package/src/utils/PopsInstanceUtils.ts +6 -6
  62. package/src/utils/PopsUtils.ts +53 -1
package/dist/index.cjs.js CHANGED
@@ -2,12 +2,6 @@
2
2
 
3
3
  const SymbolEvents = Symbol("events_" + (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1));
4
4
 
5
- const PopsCoreDefaultEnv = {
6
- document: document,
7
- window: window,
8
- globalThis: globalThis,
9
- self: self,
10
- };
11
5
  const PopsCoreEnv = {
12
6
  document: document,
13
7
  window: window,
@@ -15,12 +9,6 @@ const PopsCoreEnv = {
15
9
  self: self,
16
10
  };
17
11
  const PopsCore = {
18
- init(option) {
19
- if (!option) {
20
- option = Object.assign({}, PopsCoreDefaultEnv);
21
- }
22
- Object.assign(PopsCoreEnv, option);
23
- },
24
12
  get document() {
25
13
  return PopsCoreEnv.document;
26
14
  },
@@ -40,21 +28,266 @@ const OriginPrototype = {
40
28
  },
41
29
  };
42
30
 
43
- 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={};}};
31
+ const createCache = (lastNumberWeakMap) => {
32
+ return (collection, nextNumber) => {
33
+ lastNumberWeakMap.set(collection, nextNumber);
34
+ return nextNumber;
35
+ };
36
+ };
37
+
38
+ /*
39
+ * The value of the constant Number.MAX_SAFE_INTEGER equals (2 ** 53 - 1) but it
40
+ * is fairly new.
41
+ */
42
+ const MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER === undefined ? 9007199254740991 : Number.MAX_SAFE_INTEGER;
43
+ const TWO_TO_THE_POWER_OF_TWENTY_NINE = 536870912;
44
+ const TWO_TO_THE_POWER_OF_THIRTY = TWO_TO_THE_POWER_OF_TWENTY_NINE * 2;
45
+ const createGenerateUniqueNumber = (cache, lastNumberWeakMap) => {
46
+ return (collection) => {
47
+ const lastNumber = lastNumberWeakMap.get(collection);
48
+ /*
49
+ * Let's try the cheapest algorithm first. It might fail to produce a new
50
+ * number, but it is so cheap that it is okay to take the risk. Just
51
+ * increase the last number by one or reset it to 0 if we reached the upper
52
+ * bound of SMIs (which stands for small integers). When the last number is
53
+ * unknown it is assumed that the collection contains zero based consecutive
54
+ * numbers.
55
+ */
56
+ let nextNumber = lastNumber === undefined ? collection.size : lastNumber < TWO_TO_THE_POWER_OF_THIRTY ? lastNumber + 1 : 0;
57
+ if (!collection.has(nextNumber)) {
58
+ return cache(collection, nextNumber);
59
+ }
60
+ /*
61
+ * If there are less than half of 2 ** 30 numbers stored in the collection,
62
+ * the chance to generate a new random number in the range from 0 to 2 ** 30
63
+ * is at least 50%. It's benifitial to use only SMIs because they perform
64
+ * much better in any environment based on V8.
65
+ */
66
+ if (collection.size < TWO_TO_THE_POWER_OF_TWENTY_NINE) {
67
+ while (collection.has(nextNumber)) {
68
+ nextNumber = Math.floor(Math.random() * TWO_TO_THE_POWER_OF_THIRTY);
69
+ }
70
+ return cache(collection, nextNumber);
71
+ }
72
+ // Quickly check if there is a theoretical chance to generate a new number.
73
+ if (collection.size > MAX_SAFE_INTEGER) {
74
+ throw new Error('Congratulations, you created a collection of unique numbers which uses all available integers!');
75
+ }
76
+ // Otherwise use the full scale of safely usable integers.
77
+ while (collection.has(nextNumber)) {
78
+ nextNumber = Math.floor(Math.random() * MAX_SAFE_INTEGER);
79
+ }
80
+ return cache(collection, nextNumber);
81
+ };
82
+ };
83
+
84
+ const LAST_NUMBER_WEAK_MAP = new WeakMap();
85
+ const cache = createCache(LAST_NUMBER_WEAK_MAP);
86
+ const generateUniqueNumber = createGenerateUniqueNumber(cache, LAST_NUMBER_WEAK_MAP);
87
+
88
+ const isMessagePort = (sender) => {
89
+ return typeof sender.start === 'function';
90
+ };
91
+
92
+ const PORT_MAP = new WeakMap();
93
+
94
+ const extendBrokerImplementation = (partialBrokerImplementation) => ({
95
+ ...partialBrokerImplementation,
96
+ connect: ({ call }) => {
97
+ return async () => {
98
+ const { port1, port2 } = new MessageChannel();
99
+ const portId = await call('connect', { port: port1 }, [port1]);
100
+ PORT_MAP.set(port2, portId);
101
+ return port2;
102
+ };
103
+ },
104
+ disconnect: ({ call }) => {
105
+ return async (port) => {
106
+ const portId = PORT_MAP.get(port);
107
+ if (portId === undefined) {
108
+ throw new Error('The given port is not connected.');
109
+ }
110
+ await call('disconnect', { portId });
111
+ };
112
+ },
113
+ isSupported: ({ call }) => {
114
+ return () => call('isSupported');
115
+ }
116
+ });
117
+
118
+ const ONGOING_REQUESTS = new WeakMap();
119
+ const createOrGetOngoingRequests = (sender) => {
120
+ if (ONGOING_REQUESTS.has(sender)) {
121
+ // @todo TypeScript needs to be convinced that has() works as expected.
122
+ return ONGOING_REQUESTS.get(sender);
123
+ }
124
+ const ongoingRequests = new Map();
125
+ ONGOING_REQUESTS.set(sender, ongoingRequests);
126
+ return ongoingRequests;
127
+ };
128
+ const createBroker = (brokerImplementation) => {
129
+ const fullBrokerImplementation = extendBrokerImplementation(brokerImplementation);
130
+ return (sender) => {
131
+ const ongoingRequests = createOrGetOngoingRequests(sender);
132
+ sender.addEventListener('message', (({ data: message }) => {
133
+ const { id } = message;
134
+ if (id !== null && ongoingRequests.has(id)) {
135
+ const { reject, resolve } = ongoingRequests.get(id);
136
+ ongoingRequests.delete(id);
137
+ if (message.error === undefined) {
138
+ resolve(message.result);
139
+ }
140
+ else {
141
+ reject(new Error(message.error.message));
142
+ }
143
+ }
144
+ }));
145
+ if (isMessagePort(sender)) {
146
+ sender.start();
147
+ }
148
+ const call = (method, params = null, transferables = []) => {
149
+ return new Promise((resolve, reject) => {
150
+ const id = generateUniqueNumber(ongoingRequests);
151
+ ongoingRequests.set(id, { reject, resolve });
152
+ if (params === null) {
153
+ sender.postMessage({ id, method }, transferables);
154
+ }
155
+ else {
156
+ sender.postMessage({ id, method, params }, transferables);
157
+ }
158
+ });
159
+ };
160
+ const notify = (method, params, transferables = []) => {
161
+ sender.postMessage({ id: null, method, params }, transferables);
162
+ };
163
+ let functions = {};
164
+ for (const [key, handler] of Object.entries(fullBrokerImplementation)) {
165
+ functions = { ...functions, [key]: handler({ call, notify }) };
166
+ }
167
+ return { ...functions };
168
+ };
169
+ };
170
+
171
+ // Prefilling the Maps with a function indexed by zero is necessary to be compliant with the specification.
172
+ const scheduledIntervalsState = new Map([[0, null]]); // tslint:disable-line no-empty
173
+ const scheduledTimeoutsState = new Map([[0, null]]); // tslint:disable-line no-empty
174
+ const wrap = createBroker({
175
+ clearInterval: ({ call }) => {
176
+ return (timerId) => {
177
+ if (typeof scheduledIntervalsState.get(timerId) === 'symbol') {
178
+ scheduledIntervalsState.set(timerId, null);
179
+ call('clear', { timerId, timerType: 'interval' }).then(() => {
180
+ scheduledIntervalsState.delete(timerId);
181
+ });
182
+ }
183
+ };
184
+ },
185
+ clearTimeout: ({ call }) => {
186
+ return (timerId) => {
187
+ if (typeof scheduledTimeoutsState.get(timerId) === 'symbol') {
188
+ scheduledTimeoutsState.set(timerId, null);
189
+ call('clear', { timerId, timerType: 'timeout' }).then(() => {
190
+ scheduledTimeoutsState.delete(timerId);
191
+ });
192
+ }
193
+ };
194
+ },
195
+ setInterval: ({ call }) => {
196
+ return (func, delay = 0, ...args) => {
197
+ const symbol = Symbol();
198
+ const timerId = generateUniqueNumber(scheduledIntervalsState);
199
+ scheduledIntervalsState.set(timerId, symbol);
200
+ const schedule = () => call('set', {
201
+ delay,
202
+ now: performance.timeOrigin + performance.now(),
203
+ timerId,
204
+ timerType: 'interval'
205
+ }).then(() => {
206
+ const state = scheduledIntervalsState.get(timerId);
207
+ if (state === undefined) {
208
+ throw new Error('The timer is in an undefined state.');
209
+ }
210
+ if (state === symbol) {
211
+ func(...args);
212
+ // Doublecheck if the interval should still be rescheduled because it could have been cleared inside of func().
213
+ if (scheduledIntervalsState.get(timerId) === symbol) {
214
+ schedule();
215
+ }
216
+ }
217
+ });
218
+ schedule();
219
+ return timerId;
220
+ };
221
+ },
222
+ setTimeout: ({ call }) => {
223
+ return (func, delay = 0, ...args) => {
224
+ const symbol = Symbol();
225
+ const timerId = generateUniqueNumber(scheduledTimeoutsState);
226
+ scheduledTimeoutsState.set(timerId, symbol);
227
+ call('set', {
228
+ delay,
229
+ now: performance.timeOrigin + performance.now(),
230
+ timerId,
231
+ timerType: 'timeout'
232
+ }).then(() => {
233
+ const state = scheduledTimeoutsState.get(timerId);
234
+ if (state === undefined) {
235
+ throw new Error('The timer is in an undefined state.');
236
+ }
237
+ if (state === symbol) {
238
+ // A timeout can be savely deleted because it is only called once.
239
+ scheduledTimeoutsState.delete(timerId);
240
+ func(...args);
241
+ }
242
+ });
243
+ return timerId;
244
+ };
245
+ }
246
+ });
247
+ const load = (url) => {
248
+ const worker = new Worker(url);
249
+ return wrap(worker);
250
+ };
251
+
252
+ const createLoadOrReturnBroker = (loadBroker, worker) => {
253
+ let broker = null;
254
+ return () => {
255
+ if (broker !== null) {
256
+ return broker;
257
+ }
258
+ const blob = new Blob([worker], { type: 'application/javascript; charset=utf-8' });
259
+ const url = URL.createObjectURL(blob);
260
+ broker = loadBroker(url);
261
+ // Bug #1: Edge up until v18 didn't like the URL to be revoked directly.
262
+ setTimeout(() => URL.revokeObjectURL(url));
263
+ return broker;
264
+ };
265
+ };
266
+
267
+ // This is the minified and stringified code of the worker-timers-worker package.
268
+ 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
269
+
270
+ const loadOrReturnBroker = createLoadOrReturnBroker(load, worker);
271
+ const clearInterval = (timerId) => loadOrReturnBroker().clearInterval(timerId);
272
+ const clearTimeout$1 = (timerId) => loadOrReturnBroker().clearTimeout(timerId);
273
+ const setInterval = (...args) => loadOrReturnBroker().setInterval(...args);
274
+ const setTimeout$1 = (...args) => loadOrReturnBroker().setTimeout(...args);
275
+
276
+ 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={};}};
44
277
 
45
- 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,!0}function O(n,e){return Object.assign(Object.assign(Object.assign({},n),e),{state:0,disabled:!1})}function p$3(n){return Math.round(100*n)/100}
278
+ 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}
46
279
 
47
- 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:!0,cancelable:!0},preventDefault:t=>{if(t.target&&"tagName"in t.target){const{tagName:e}=t.target;return !/^(?:INPUT|TEXTAREA|BUTTON|SELECT)$/.test(e)}return !1}};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=!1,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=!1,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=!0,h="start";else {if(!e)return;"mousemove"===c?h="move":"mouseup"===c&&(p=[],h="end",e=!1);}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=!1;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),!1===this.__options.preventDefault&&e?{passive:!0}:{passive:!1}));}}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=!0:"touchmove"===t.type&&(this.__isIgnoreMouse=!1),this.__isIgnoreMouse&&t.type.startsWith("mouse"))return void("mouseup"===t.type&&(this.__isIgnoreMouse=!1));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();}};
280
+ 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();}};
48
281
 
49
282
  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};
50
283
 
51
284
  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}}}
52
285
 
53
- 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,!0}({x:o,y:m},c)&&function(t){const e=performance.now();if(void 0===u)return u=e,!0;{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}
286
+ 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}
54
287
 
55
288
  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}
56
289
 
57
- 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 !1;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}
290
+ 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}
58
291
 
59
292
  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}
60
293
 
@@ -276,7 +509,7 @@ class PopsUtils {
276
509
  formatByteToSize(byteSize, addType = true) {
277
510
  byteSize = parseInt(byteSize.toString());
278
511
  if (isNaN(byteSize)) {
279
- throw new Error("Utils.formatByteToSize 参数 byteSize 格式不正确");
512
+ throw new TypeError("Utils.formatByteToSize 参数 byteSize 格式不正确");
280
513
  }
281
514
  let result = 0;
282
515
  let resultType = "KB";
@@ -309,6 +542,58 @@ class PopsUtils {
309
542
  AnyTouch = () => {
310
543
  return i;
311
544
  };
545
+ /**
546
+ * 自动使用 Worker 执行 setTimeout
547
+ */
548
+ setTimeout(callback, timeout = 0) {
549
+ try {
550
+ return setTimeout$1(callback, timeout);
551
+ }
552
+ catch (error) {
553
+ return globalThis.setTimeout(callback, timeout);
554
+ }
555
+ }
556
+ /**
557
+ * 配合 .setTimeout 使用
558
+ */
559
+ clearTimeout(timeId) {
560
+ try {
561
+ if (timeId != null) {
562
+ clearTimeout$1(timeId);
563
+ }
564
+ }
565
+ catch (error) {
566
+ }
567
+ finally {
568
+ globalThis.clearTimeout(timeId);
569
+ }
570
+ }
571
+ /**
572
+ * 自动使用 Worker 执行 setInterval
573
+ */
574
+ setInterval(callback, timeout = 0) {
575
+ try {
576
+ return setInterval(callback, timeout);
577
+ }
578
+ catch (error) {
579
+ return globalThis.setInterval(callback, timeout);
580
+ }
581
+ }
582
+ /**
583
+ * 配合 .setInterval 使用
584
+ */
585
+ clearInterval(timeId) {
586
+ try {
587
+ if (timeId != null) {
588
+ clearInterval(timeId);
589
+ }
590
+ }
591
+ catch (error) {
592
+ }
593
+ finally {
594
+ globalThis.clearInterval(timeId);
595
+ }
596
+ }
312
597
  }
313
598
  const popsUtils = new PopsUtils();
314
599
 
@@ -682,7 +967,7 @@ class PopsDOMUtilsEvent {
682
967
  }
683
968
  if (checkDOMReadyState()) {
684
969
  /* 检查document状态 */
685
- setTimeout(callback);
970
+ popsUtils.setTimeout(callback, 0);
686
971
  }
687
972
  else {
688
973
  /* 添加监听 */
@@ -1909,7 +2194,7 @@ const PopsInstanceUtils = {
1909
2194
  let popsElement = animElement.querySelector(".pops[type-value]");
1910
2195
  if (popsType === "drawer") {
1911
2196
  let drawerConfig = config;
1912
- setTimeout(() => {
2197
+ popsUtils.setTimeout(() => {
1913
2198
  maskElement.style.setProperty("display", "none");
1914
2199
  if (["top", "bottom"].includes(drawerConfig.direction)) {
1915
2200
  popsElement.style.setProperty("height", "0");
@@ -1975,7 +2260,7 @@ const PopsInstanceUtils = {
1975
2260
  let popsElement = animElement.querySelector(".pops[type-value]");
1976
2261
  if (popsType === "drawer") {
1977
2262
  let drawerConfig = config;
1978
- setTimeout(() => {
2263
+ popsUtils.setTimeout(() => {
1979
2264
  popsDOMUtils.css(maskElement, "display", "");
1980
2265
  let direction = drawerConfig.direction;
1981
2266
  let size = drawerConfig.size.toString();
@@ -1989,7 +2274,7 @@ const PopsInstanceUtils = {
1989
2274
  console.error("未知direction:", direction);
1990
2275
  }
1991
2276
  resolve();
1992
- }, drawerConfig.openDelay);
2277
+ }, drawerConfig.openDelay ?? 0);
1993
2278
  }
1994
2279
  else {
1995
2280
  let findLayerIns = layerConfigList.find((layerConfigItem) => layerConfigItem.guid === guid);
@@ -2081,7 +2366,7 @@ const PopsInstanceUtils = {
2081
2366
  }
2082
2367
  }
2083
2368
  if (popsType === "drawer") {
2084
- setTimeout(() => {
2369
+ popsUtils.setTimeout(() => {
2085
2370
  transitionendEvent();
2086
2371
  }, drawerConfig.closeDelay);
2087
2372
  }
@@ -2298,10 +2583,10 @@ const PopsInstanceUtils = {
2298
2583
  */
2299
2584
  sortElementListByProperty(getBeforeValueFun, getAfterValueFun, sortByDesc = true) {
2300
2585
  if (typeof sortByDesc !== "boolean") {
2301
- throw "参数 sortByDesc 必须为boolean类型";
2586
+ throw new TypeError("参数 sortByDesc 必须为boolean类型");
2302
2587
  }
2303
2588
  if (getBeforeValueFun == null || getAfterValueFun == null) {
2304
- throw "获取前面的值或后面的值的方法不能为空";
2589
+ throw new Error("获取前面的值或后面的值的方法不能为空");
2305
2590
  }
2306
2591
  return function (after_obj, before_obj) {
2307
2592
  var beforeValue = getBeforeValueFun(before_obj); /* 前 */
@@ -3246,8 +3531,8 @@ const PopsAlertConfig = () => {
3246
3531
  };
3247
3532
  };
3248
3533
 
3249
- class PopsAlert {
3250
- constructor(details) {
3534
+ const PopsAlert = {
3535
+ init(details) {
3251
3536
  const guid = popsUtils.getRandomGUID();
3252
3537
  // 设置当前类型
3253
3538
  const PopsType = "alert";
@@ -3336,9 +3621,10 @@ class PopsAlert {
3336
3621
  endCallBack: config.dragEndCallBack,
3337
3622
  });
3338
3623
  }
3339
- return PopsHandler.handleResultDetails(eventDetails);
3340
- }
3341
- }
3624
+ let result = PopsHandler.handleResultDetails(eventDetails);
3625
+ return result;
3626
+ },
3627
+ };
3342
3628
 
3343
3629
  const PopsConfirmConfig = () => {
3344
3630
  return {
@@ -3428,8 +3714,8 @@ const PopsConfirmConfig = () => {
3428
3714
  };
3429
3715
  };
3430
3716
 
3431
- class PopsConfirm {
3432
- constructor(details) {
3717
+ const PopsConfirm = {
3718
+ init(details) {
3433
3719
  const guid = popsUtils.getRandomGUID();
3434
3720
  // 设置当前类型
3435
3721
  const PopsType = "confirm";
@@ -3519,9 +3805,10 @@ class PopsConfirm {
3519
3805
  endCallBack: config.dragEndCallBack,
3520
3806
  });
3521
3807
  }
3522
- return PopsHandler.handleResultDetails(eventDetails);
3523
- }
3524
- }
3808
+ let result = PopsHandler.handleResultDetails(eventDetails);
3809
+ return result;
3810
+ },
3811
+ };
3525
3812
 
3526
3813
  const PopsPromptConfig = () => {
3527
3814
  return {
@@ -3615,8 +3902,8 @@ const PopsPromptConfig = () => {
3615
3902
  };
3616
3903
  };
3617
3904
 
3618
- class PopsPrompt {
3619
- constructor(details) {
3905
+ const PopsPrompt = {
3906
+ init(details) {
3620
3907
  const guid = popsUtils.getRandomGUID();
3621
3908
  // 设置当前类型
3622
3909
  const PopsType = "prompt";
@@ -3722,9 +4009,10 @@ class PopsPrompt {
3722
4009
  if (config.content.select) {
3723
4010
  $input.select();
3724
4011
  }
3725
- return PopsHandler.handleResultDetails(eventDetails);
3726
- }
3727
- }
4012
+ let result = PopsHandler.handleResultDetails(eventDetails);
4013
+ return result;
4014
+ },
4015
+ };
3728
4016
 
3729
4017
  const PopsLoadingConfig = () => {
3730
4018
  return {
@@ -3754,8 +4042,8 @@ const PopsLoadingConfig = () => {
3754
4042
  };
3755
4043
  };
3756
4044
 
3757
- class PopsLoading {
3758
- constructor(details) {
4045
+ const PopsLoading = {
4046
+ init(details) {
3759
4047
  let config = PopsLoadingConfig();
3760
4048
  config = popsUtils.assign(config, GlobalConfig.getGlobalConfig());
3761
4049
  config = popsUtils.assign(config, details);
@@ -3823,9 +4111,10 @@ class PopsLoading {
3823
4111
  popsDOMUtils.css($anim, "position", "absolute !important");
3824
4112
  $mask && popsDOMUtils.css($mask, "position", "absolute !important");
3825
4113
  }
3826
- return PopsHandler.handleResultDetails(eventDetails);
3827
- }
3828
- }
4114
+ let result = PopsHandler.handleResultDetails(eventDetails);
4115
+ return result;
4116
+ },
4117
+ };
3829
4118
 
3830
4119
  const PopsIframeConfig = () => {
3831
4120
  return {
@@ -3885,8 +4174,8 @@ const PopsIframeConfig = () => {
3885
4174
  };
3886
4175
  };
3887
4176
 
3888
- class PopsIframe {
3889
- constructor(details) {
4177
+ const PopsIframe = {
4178
+ init(details) {
3890
4179
  const guid = popsUtils.getRandomGUID();
3891
4180
  // 设置当前类型
3892
4181
  const PopsType = "iframe";
@@ -3894,7 +4183,7 @@ class PopsIframe {
3894
4183
  config = popsUtils.assign(config, GlobalConfig.getGlobalConfig());
3895
4184
  config = popsUtils.assign(config, details);
3896
4185
  if (config.url == null) {
3897
- throw "config.url不能为空";
4186
+ throw new Error("config.url不能为空");
3898
4187
  }
3899
4188
  config = PopsHandler.handleOnly(PopsType, config);
3900
4189
  const { $shadowContainer, $shadowRoot } = PopsHandler.handlerShadow(config);
@@ -4116,8 +4405,8 @@ class PopsIframe {
4116
4405
  });
4117
4406
  let result = PopsHandler.handleResultDetails(eventDetails);
4118
4407
  return result;
4119
- }
4120
- }
4408
+ },
4409
+ };
4121
4410
 
4122
4411
  const PopsDrawerConfig = () => {
4123
4412
  return {
@@ -4206,8 +4495,8 @@ const PopsDrawerConfig = () => {
4206
4495
  };
4207
4496
  };
4208
4497
 
4209
- class PopsDrawer {
4210
- constructor(details) {
4498
+ const PopsDrawer = {
4499
+ init(details) {
4211
4500
  const guid = popsUtils.getRandomGUID();
4212
4501
  // 设置当前类型
4213
4502
  const PopsType = "drawer";
@@ -4352,8 +4641,8 @@ class PopsDrawer {
4352
4641
  config.beforeAppendToPageCallBack($shadowRoot, $shadowContainer);
4353
4642
  }
4354
4643
  popsDOMUtils.appendBody($shadowContainer);
4355
- setTimeout(() => {
4356
- setTimeout(() => {
4644
+ popsUtils.setTimeout(() => {
4645
+ popsUtils.setTimeout(() => {
4357
4646
  $pops.style.setProperty("transform", "");
4358
4647
  }, config.openDelay);
4359
4648
  }, 50);
@@ -4368,9 +4657,10 @@ class PopsDrawer {
4368
4657
  $shadowContainer: $shadowContainer,
4369
4658
  $shadowRoot: $shadowRoot,
4370
4659
  });
4371
- return PopsHandler.handleResultDetails(eventDetails);
4372
- }
4373
- }
4660
+ let result = PopsHandler.handleResultDetails(eventDetails);
4661
+ return result;
4662
+ },
4663
+ };
4374
4664
 
4375
4665
  const PopsFolderConfig = () => {
4376
4666
  return {
@@ -4532,8 +4822,8 @@ const Folder_ICON = {
4532
4822
  dwg: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFAAAABQCAMAAAC5zwKfAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAABaUExURUxpcXvGVIbNYXvHVHzJWYbNYXbDTWu9QHrGU4jOZHLBSW+/RYDJWmy+QoXMYHzHVYjOZHfET2m7P4LLXf3/+/T+7u3+5MXrsaXbiVyuMZjUeNb2xOP81bPjmuZ7vy0AAAAKdFJOUwA9z1wc33ign591Bg7OAAACdUlEQVRYw+2Yi3KjIBRAm51UI4gKxMei+f/f3PsQNU3SXtzOdGfWo0W4wBGFau3b28HBwYGYU1a85JSuOxfNZ/w6p/rem895TzQWTfOtxjP1qWCDtJoLK1WyMcM+VUUu1pJ3ls6nSDEW1UpTvSLBWFRf0iQZXwn93jFuhd7fK/2SJhgL9Hh0ecp5P4tn3xzwYmPhX0En2SL7nXkirEIPNA/xspAIL9Cw9CUmsV85dG3bBcjNgSUjeVJcykeG9nrtAmX9/MNJtk9Yk7B5cqbLvymsdwjr2LOmBIVtU3OMQ9xGJIQOQHSFGzBegR5zoV4Qj7DeQiumbVGIx26gEXICpAvr4bqlHe5r04WWhB1BQvsdwo5uX4/GvxCGgejBMv4mJpwZjoY0IY7C9nSZNB+jI1DY8tXfsJGVCi3Rt8tUjBoDelrn5mbBJxVi29qqG60XXDLtqFjYXudQd1N8VqEQUUNPTNA/jhCyE0cHRUNMEiq+cbiwV2E3cFTvGKHjqQ34bB0Jespy1NlkIQwR0aG7I2iOJwmVje1BG6atbwpQxbUqZYRq3ej9NIJ1GjGHwk21SKgiFndL7xQU0jvFLlWERJhHE3ehuQnTNI2WZmOxUQuhcDsK44xzJCx5vdyRJFzRYQShf6xQ+U8J9VOh3inU4NMAaTULccWUmopUrRQ3kAkfqQJgn1TsFBpaO+77hHp+xOwXmo9DhNVoOLipMlKh0dibd8waLq7HWDBGJDQJ/IgwM3zHIm5JlpQ33CV/wZ6wj1t7UT4KaLY5R4noMyB3EXN32BRiRHLF8H2rnRAt/JY65zJfLv8iPWf5l2Q7/ptxcHDw//IHYWiLelDcDu8AAAAASUVORK5CYII=",
4533
4823
  };
4534
4824
 
4535
- class PopsFolder {
4536
- constructor(details) {
4825
+ const PopsFolder = {
4826
+ init(details) {
4537
4827
  const guid = popsUtils.getRandomGUID();
4538
4828
  // 设置当前类型
4539
4829
  const PopsType = "folder";
@@ -5073,12 +5363,12 @@ class PopsFolder {
5073
5363
  let downloadIframeLinkElement = document.createElement("iframe");
5074
5364
  downloadIframeLinkElement.src = downloadInfo.url;
5075
5365
  downloadIframeLinkElement.onload = function () {
5076
- setTimeout(() => {
5366
+ popsUtils.setTimeout(() => {
5077
5367
  downloadIframeLinkElement.remove();
5078
5368
  }, 1000);
5079
5369
  };
5080
5370
  $shadowRoot.appendChild(downloadIframeLinkElement);
5081
- setTimeout(() => {
5371
+ popsUtils.setTimeout(() => {
5082
5372
  downloadIframeLinkElement.remove();
5083
5373
  }, 3 * 60 * 1000);
5084
5374
  }
@@ -5315,9 +5605,10 @@ class PopsFolder {
5315
5605
  $shadowContainer: $shadowContainer,
5316
5606
  $shadowRoot: $shadowRoot,
5317
5607
  });
5318
- return PopsHandler.handleResultDetails(eventDetails);
5319
- }
5320
- }
5608
+ let result = PopsHandler.handleResultDetails(eventDetails);
5609
+ return result;
5610
+ },
5611
+ };
5321
5612
 
5322
5613
  const PopsPanelConfig = () => {
5323
5614
  return {
@@ -6200,6 +6491,7 @@ const PanelHandleContentDetails = () => {
6200
6491
  */
6201
6492
  createSectionContainerItem_slider_new(formConfig) {
6202
6493
  let liElement = document.createElement("li");
6494
+ // @ts-ignore
6203
6495
  liElement["__formConfig__"] = formConfig;
6204
6496
  this.setElementClassName(liElement, formConfig.className);
6205
6497
  this.setElementAttributes(liElement, formConfig.attributes);
@@ -6300,15 +6592,15 @@ const PanelHandleContentDetails = () => {
6300
6592
  this.setPanEvent();
6301
6593
  this.setRunAwayClickEvent();
6302
6594
  this.intervalInit();
6303
- if (formConfig.disabled) {
6595
+ if (this.isFormConfigDisabledDrag()) {
6304
6596
  this.disableDrag();
6305
6597
  }
6306
6598
  },
6307
6599
  /**
6308
6600
  * 10s内循环获取slider的宽度等信息
6309
6601
  * 获取到了就可以初始化left的值
6310
- * @param {number} [checkStepTime=200] 每次检测的间隔时间
6311
- * @param {number} [maxTime=10000] 最大的检测时间
6602
+ * @param [checkStepTime=200] 每次检测的间隔时间
6603
+ * @param [maxTime=10000] 最大的检测时间
6312
6604
  */
6313
6605
  intervalInit(checkStepTime = 200, maxTime = 10000) {
6314
6606
  if (this.$interval.isCheck) {
@@ -6318,11 +6610,11 @@ const PanelHandleContentDetails = () => {
6318
6610
  let isSuccess = false;
6319
6611
  let oldTotalWidth = this.$data.totalWidth;
6320
6612
  let timer = void 0;
6321
- let interval = setInterval(() => {
6613
+ let interval = popsUtils.setInterval(() => {
6322
6614
  if (isSuccess) {
6323
6615
  this.$interval.isCheck = false;
6324
- clearTimeout(timer);
6325
- clearInterval(interval);
6616
+ popsUtils.clearTimeout(timer);
6617
+ popsUtils.clearInterval(interval);
6326
6618
  }
6327
6619
  else {
6328
6620
  this.initTotalWidth();
@@ -6342,8 +6634,8 @@ const PanelHandleContentDetails = () => {
6342
6634
  }
6343
6635
  }, checkStepTime);
6344
6636
  /* 最长检测时间是10s */
6345
- timer = setTimeout(() => {
6346
- clearInterval(interval);
6637
+ timer = popsUtils.setTimeout(() => {
6638
+ popsUtils.clearInterval(interval);
6347
6639
  }, maxTime);
6348
6640
  },
6349
6641
  /**
@@ -6354,9 +6646,13 @@ const PanelHandleContentDetails = () => {
6354
6646
  this.$ele.slider.setAttribute("data-max", this.max.toString());
6355
6647
  this.$ele.slider.setAttribute("data-value", this.value.toString());
6356
6648
  this.$ele.slider.setAttribute("data-step", this.step.toString());
6649
+ // @ts-ignore
6357
6650
  this.$ele.slider["data-min"] = this.min;
6651
+ // @ts-ignore
6358
6652
  this.$ele.slider["data-max"] = this.max;
6653
+ // @ts-ignore
6359
6654
  this.$ele.slider["data-value"] = this.value;
6655
+ // @ts-ignore
6360
6656
  this.$ele.slider["data-step"] = this.step;
6361
6657
  },
6362
6658
  /**
@@ -6471,7 +6767,6 @@ const PanelHandleContentDetails = () => {
6471
6767
  /**
6472
6768
  * 判断数字是否是浮点数
6473
6769
  * @param num
6474
- * @returns
6475
6770
  */
6476
6771
  isFloat(num) {
6477
6772
  return Number(num) === num && num % 1 !== 0;
@@ -6488,6 +6783,7 @@ const PanelHandleContentDetails = () => {
6488
6783
  },
6489
6784
  /**
6490
6785
  * 根据拖拽距离获取滑块应该在的区间和值
6786
+ * @param dragX
6491
6787
  */
6492
6788
  getDragInfo(dragX) {
6493
6789
  let result = this.$data.stepBlockMap.get(0);
@@ -6502,7 +6798,7 @@ const PanelHandleContentDetails = () => {
6502
6798
  },
6503
6799
  /**
6504
6800
  * 获取滑块的当前脱拖拽占据的百分比
6505
- * @param {number} dragWidth
6801
+ * @param dragWidth
6506
6802
  */
6507
6803
  getSliderPositonPercent(dragWidth) {
6508
6804
  return dragWidth / this.$data.totalWidth;
@@ -6554,6 +6850,21 @@ const PanelHandleContentDetails = () => {
6554
6850
  isDisabledDrag() {
6555
6851
  return this.$ele.runAway.classList.contains("pops-slider-is-disabled");
6556
6852
  },
6853
+ /**
6854
+ * 判断当前滑块是否被禁用(配置中判断)
6855
+ */
6856
+ isFormConfigDisabledDrag() {
6857
+ if (typeof formConfig.disabled === "function" ||
6858
+ typeof formConfig.disabled === "boolean") {
6859
+ let isDisabled = typeof formConfig.disabled === "function"
6860
+ ? formConfig.disabled()
6861
+ : formConfig.disabled;
6862
+ return isDisabled;
6863
+ }
6864
+ else {
6865
+ return false;
6866
+ }
6867
+ },
6557
6868
  /**
6558
6869
  * 设置进度条点击定位的事件
6559
6870
  */
@@ -6576,9 +6887,17 @@ const PanelHandleContentDetails = () => {
6576
6887
  */
6577
6888
  dragStartCallBack() {
6578
6889
  if (!this.$data.isMove) {
6579
- if (this.isDisabledDrag()) {
6890
+ if (this.isFormConfigDisabledDrag()) {
6891
+ // 禁止
6892
+ this.disableDrag();
6580
6893
  return false;
6581
6894
  }
6895
+ else {
6896
+ // 允许
6897
+ if (this.isDisabledDrag()) {
6898
+ this.allowDrag();
6899
+ }
6900
+ }
6582
6901
  this.$data.isMove = true;
6583
6902
  }
6584
6903
  return true;
@@ -6684,16 +7003,16 @@ const PanelHandleContentDetails = () => {
6684
7003
  return;
6685
7004
  }
6686
7005
  this.$data.isCheckingStopDragMove = true;
6687
- let interval = setInterval(() => {
7006
+ let interval = popsUtils.setInterval(() => {
6688
7007
  if (!this.$data.isMove) {
6689
7008
  this.$data.isCheckingStopDragMove = false;
6690
7009
  this.closeToolTip();
6691
- clearInterval(interval);
7010
+ popsUtils.clearInterval(interval);
6692
7011
  }
6693
7012
  }, 200);
6694
- setTimeout(() => {
7013
+ popsUtils.setTimeout(() => {
6695
7014
  this.$data.isCheckingStopDragMove = false;
6696
- clearInterval(interval);
7015
+ popsUtils.clearInterval(interval);
6697
7016
  }, 2000);
6698
7017
  },
6699
7018
  /**
@@ -6725,6 +7044,14 @@ const PanelHandleContentDetails = () => {
6725
7044
  passive: true,
6726
7045
  },
6727
7046
  showBeforeCallBack: () => {
7047
+ let isShowHoverTip = typeof formConfig.isShowHoverTip === "function"
7048
+ ? formConfig.isShowHoverTip()
7049
+ : typeof formConfig.isShowHoverTip === "boolean"
7050
+ ? formConfig.isShowHoverTip
7051
+ : true;
7052
+ if (!isShowHoverTip) {
7053
+ return false;
7054
+ }
6728
7055
  this.intervalInit();
6729
7056
  },
6730
7057
  showAfterCallBack: (toolTipNode) => {
@@ -8309,8 +8636,8 @@ const PanelHandleContentDetails = () => {
8309
8636
  };
8310
8637
  };
8311
8638
 
8312
- class PopsPanel {
8313
- constructor(details) {
8639
+ const PopsPanel = {
8640
+ init(details) {
8314
8641
  const guid = popsUtils.getRandomGUID();
8315
8642
  // 设置当前类型
8316
8643
  const PopsType = "panel";
@@ -8423,9 +8750,10 @@ class PopsPanel {
8423
8750
  endCallBack: config.dragEndCallBack,
8424
8751
  });
8425
8752
  }
8426
- return PopsHandler.handleResultDetails(eventDetails);
8427
- }
8428
- }
8753
+ let result = PopsHandler.handleResultDetails(eventDetails);
8754
+ return result;
8755
+ },
8756
+ };
8429
8757
 
8430
8758
  const rightClickMenuConfig = () => {
8431
8759
  return {
@@ -8552,8 +8880,8 @@ const rightClickMenuConfig = () => {
8552
8880
  };
8553
8881
  };
8554
8882
 
8555
- class PopsRightClickMenu {
8556
- constructor(details) {
8883
+ const PopsRightClickMenu = {
8884
+ init(details) {
8557
8885
  const guid = popsUtils.getRandomGUID();
8558
8886
  // 设置当前类型
8559
8887
  const PopsType = "rightClickMenu";
@@ -8562,7 +8890,7 @@ class PopsRightClickMenu {
8562
8890
  config = popsUtils.assign(config, details);
8563
8891
  config = PopsHandler.handleOnly(PopsType, config);
8564
8892
  if (config.target == null) {
8565
- throw "config.target 不能为空";
8893
+ throw new Error("config.target 不能为空");
8566
8894
  }
8567
8895
  if (details.data) {
8568
8896
  // @ts-ignore
@@ -8979,8 +9307,8 @@ class PopsRightClickMenu {
8979
9307
  removeContextMenuEvent: PopsContextMenu.removeContextMenuEvent,
8980
9308
  addContextMenuEvent: PopsContextMenu.addContextMenuEvent,
8981
9309
  };
8982
- }
8983
- }
9310
+ },
9311
+ };
8984
9312
 
8985
9313
  const searchSuggestionConfig = () => {
8986
9314
  return {
@@ -9039,8 +9367,8 @@ const searchSuggestionConfig = () => {
9039
9367
  };
9040
9368
  };
9041
9369
 
9042
- class PopsSearchSuggestion {
9043
- constructor(details) {
9370
+ const PopsSearchSuggestion = {
9371
+ init(details) {
9044
9372
  const guid = popsUtils.getRandomGUID();
9045
9373
  // 设置当前类型
9046
9374
  const PopsType = "searchSuggestion";
@@ -9048,7 +9376,7 @@ class PopsSearchSuggestion {
9048
9376
  config = popsUtils.assign(config, GlobalConfig.getGlobalConfig());
9049
9377
  config = popsUtils.assign(config, details);
9050
9378
  if (config.target == null) {
9051
- throw new TypeError("config.target 不能为空");
9379
+ throw new Error("config.target 不能为空");
9052
9380
  }
9053
9381
  /* 做下兼容处理 */
9054
9382
  if (config.inputTarget == null) {
@@ -9319,7 +9647,7 @@ class PopsSearchSuggestion {
9319
9647
  popsDOMUtils.on([config.inputTarget], ["focus", "click", "input"], void 0, SearchSuggestion.showEvent, option);
9320
9648
  }
9321
9649
  else {
9322
- throw new TypeError("未知followPosition:" + config.followPosition);
9650
+ throw new Error("未知followPosition:" + config.followPosition);
9323
9651
  }
9324
9652
  },
9325
9653
  /**
@@ -9578,8 +9906,8 @@ class PopsSearchSuggestion {
9578
9906
  },
9579
9907
  };
9580
9908
  return SearchSuggestion;
9581
- }
9582
- }
9909
+ },
9910
+ };
9583
9911
 
9584
9912
  const PopsTooltipConfig = () => {
9585
9913
  // @ts-ignore
@@ -9730,11 +10058,12 @@ class ToolTip {
9730
10058
  }
9731
10059
  /**
9732
10060
  * 计算 提示框的位置
10061
+ * @param event 触发的事件
9733
10062
  * @param targetElement 目标元素
9734
10063
  * @param arrowDistance 箭头和目标元素的距离
9735
10064
  * @param otherDistance 其它位置的偏移
9736
10065
  */
9737
- calcToolTipPosition(targetElement, arrowDistance, otherDistance) {
10066
+ calcToolTipPosition(targetElement, arrowDistance, otherDistance, event) {
9738
10067
  let offsetInfo = popsDOMUtils.offset(targetElement, !this.$data.config.isFixed);
9739
10068
  // 目标 宽
9740
10069
  let targetElement_width = offsetInfo.width;
@@ -9752,6 +10081,31 @@ class ToolTip {
9752
10081
  let targetElement_X_center_pos = targetElement_left + targetElement_width / 2 - toolTipElement_width / 2;
9753
10082
  /* 目标元素的Y轴的中间位置 */
9754
10083
  let targetElement_Y_center_pos = targetElement_top + targetElement_height / 2 - toolTipElement_height / 2;
10084
+ let mouseX = 0;
10085
+ let mouseY = 0;
10086
+ if (event != null) {
10087
+ if (event instanceof MouseEvent || event instanceof PointerEvent) {
10088
+ mouseX = event.pageX;
10089
+ mouseY = event.y;
10090
+ }
10091
+ else if (event instanceof TouchEvent) {
10092
+ let touchEvent = event.touches[0];
10093
+ mouseX = touchEvent.pageX;
10094
+ mouseY = touchEvent.pageY;
10095
+ }
10096
+ else {
10097
+ // @ts-ignore
10098
+ if (typeof event.clientX === "number") {
10099
+ // @ts-ignore
10100
+ mouseX = event.clientX;
10101
+ }
10102
+ // @ts-ignore
10103
+ if (typeof event.clientY === "number") {
10104
+ // @ts-ignore
10105
+ mouseY = event.clientY;
10106
+ }
10107
+ }
10108
+ }
9755
10109
  return {
9756
10110
  TOP: {
9757
10111
  left: targetElement_X_center_pos - otherDistance,
@@ -9777,13 +10131,19 @@ class ToolTip {
9777
10131
  arrow: "right",
9778
10132
  motion: "fadeInLeft",
9779
10133
  },
10134
+ FOLLOW: {
10135
+ left: mouseX + otherDistance,
10136
+ top: mouseY + otherDistance,
10137
+ arrow: "follow",
10138
+ motion: "",
10139
+ },
9780
10140
  };
9781
10141
  }
9782
10142
  /**
9783
10143
  * 动态修改tooltip的位置
9784
10144
  */
9785
- changePosition() {
9786
- let positionInfo = this.calcToolTipPosition(this.$data.config.target, this.$data.config.arrowDistance, this.$data.config.otherDistance);
10145
+ changePosition(event) {
10146
+ let positionInfo = this.calcToolTipPosition(this.$data.config.target, this.$data.config.arrowDistance, this.$data.config.otherDistance, event);
9787
10147
  let positionKey = this.$data.config.position.toUpperCase();
9788
10148
  let positionDetail = positionInfo[positionKey];
9789
10149
  if (positionDetail) {
@@ -9843,13 +10203,13 @@ class ToolTip {
9843
10203
  if (typeof timeId === "number") {
9844
10204
  // 只清除一个
9845
10205
  if (timeId == currentTimeId) {
9846
- clearTimeout(timeId);
10206
+ popsUtils.clearTimeout(timeId);
9847
10207
  timeIdList.splice(index, 1);
9848
10208
  break;
9849
10209
  }
9850
10210
  }
9851
10211
  else {
9852
- clearTimeout(currentTimeId);
10212
+ popsUtils.clearTimeout(currentTimeId);
9853
10213
  timeIdList.splice(index, 1);
9854
10214
  index--;
9855
10215
  }
@@ -9883,7 +10243,7 @@ class ToolTip {
9883
10243
  // 更新内容
9884
10244
  this.changeContent();
9885
10245
  // 更新tip的位置
9886
- this.changePosition();
10246
+ this.changePosition(event);
9887
10247
  if (typeof this.$data.config.showAfterCallBack === "function") {
9888
10248
  this.$data.config.showAfterCallBack(this.$el.$toolTip);
9889
10249
  }
@@ -9928,16 +10288,24 @@ class ToolTip {
9928
10288
  this.$data.config.delayCloseTime <= 0)) {
9929
10289
  this.$data.config.delayCloseTime = 100;
9930
10290
  }
9931
- let timeId = setTimeout(() => {
10291
+ let timeId = popsUtils.setTimeout(() => {
9932
10292
  // 设置属性触发关闭动画
9933
10293
  this.clearCloseTimeoutId(eventType, timeId);
9934
10294
  if (this.$el.$toolTip == null) {
9935
10295
  // 已清除了
9936
10296
  return;
9937
10297
  }
9938
- this.$el.$toolTip.setAttribute("data-motion", this.$el.$toolTip
9939
- .getAttribute("data-motion")
9940
- .replace("fadeIn", "fadeOut"));
10298
+ let motion = this.$el.$toolTip.getAttribute("data-motion");
10299
+ if (motion == null || motion.trim() === "") {
10300
+ // 没有动画
10301
+ this.toolTipAnimationFinishEvent();
10302
+ }
10303
+ else {
10304
+ // 修改data-motion触发动画关闭
10305
+ this.$el.$toolTip.setAttribute("data-motion", this.$el.$toolTip
10306
+ .getAttribute("data-motion")
10307
+ .replace("fadeIn", "fadeOut"));
10308
+ }
9941
10309
  }, this.$data.config.delayCloseTime);
9942
10310
  this.addCloseTimeoutId(eventType, timeId);
9943
10311
  if (typeof this.$data.config.closeAfterCallBack === "function") {
@@ -10042,8 +10410,8 @@ class ToolTip {
10042
10410
  popsDOMUtils.off(this.$el.$toolTip, "mouseleave touchend", this.toolTipMouseLeaveEvent, this.$data.config.eventOption);
10043
10411
  }
10044
10412
  }
10045
- class PopsTooltip {
10046
- constructor(details) {
10413
+ const PopsTooltip = {
10414
+ init(details) {
10047
10415
  const guid = popsUtils.getRandomGUID();
10048
10416
  // 设置当前类型
10049
10417
  const PopsType = "tooltip";
@@ -10051,7 +10419,7 @@ class PopsTooltip {
10051
10419
  config = popsUtils.assign(config, GlobalConfig.getGlobalConfig());
10052
10420
  config = popsUtils.assign(config, details);
10053
10421
  if (!(config.target instanceof HTMLElement)) {
10054
- throw "config.target 必须是HTMLElement类型";
10422
+ throw new TypeError("config.target 必须是HTMLElement类型");
10055
10423
  }
10056
10424
  config = PopsHandler.handleOnly(PopsType, config);
10057
10425
  const { $shadowContainer, $shadowRoot } = PopsHandler.handlerShadow(config);
@@ -10071,20 +10439,20 @@ class PopsTooltip {
10071
10439
  toolTip.show();
10072
10440
  }
10073
10441
  return {
10074
- guid: guid,
10075
- config: config,
10076
- $shadowContainer: $shadowContainer,
10077
- $shadowRoot: $shadowRoot,
10078
- toolTip: toolTip,
10442
+ guid,
10443
+ config,
10444
+ $shadowContainer,
10445
+ $shadowRoot,
10446
+ toolTip,
10079
10447
  };
10080
- }
10081
- }
10448
+ },
10449
+ };
10082
10450
 
10083
10451
  class Pops {
10084
10452
  /** 配置 */
10085
10453
  config = {
10086
10454
  /** 版本号 */
10087
- version: "2025.5.12",
10455
+ version: "2025.5.26",
10088
10456
  cssText: {
10089
10457
  /** 主CSS */
10090
10458
  index: indexCSS,
@@ -10193,7 +10561,7 @@ class Pops {
10193
10561
  popsDOMUtils.appendHead(animationStyle);
10194
10562
  this.config.animation = null;
10195
10563
  this.config.animation = PopsInstanceUtils.getKeyFrames(animationStyle.sheet);
10196
- setTimeout(() => {
10564
+ popsUtils.setTimeout(() => {
10197
10565
  animationStyle.remove();
10198
10566
  }, 50);
10199
10567
  }
@@ -10230,42 +10598,47 @@ class Pops {
10230
10598
  * @param details 配置
10231
10599
  */
10232
10600
  alert = (details) => {
10233
- return new PopsAlert(details);
10601
+ let dialog = PopsAlert.init(details);
10602
+ return dialog;
10234
10603
  };
10235
10604
  /**
10236
10605
  * 询问框
10237
10606
  * @param details 配置
10238
10607
  */
10239
10608
  confirm = (details) => {
10240
- return new PopsConfirm(details);
10609
+ let dialog = PopsConfirm.init(details);
10610
+ return dialog;
10241
10611
  };
10242
10612
  /**
10243
10613
  * 输入框
10244
10614
  * @param details 配置
10245
10615
  */
10246
10616
  prompt = (details) => {
10247
- return new PopsPrompt(details);
10617
+ let dialog = PopsPrompt.init(details);
10618
+ return dialog;
10248
10619
  };
10249
10620
  /**
10250
10621
  * 加载层
10251
10622
  * @param details 配置
10252
10623
  */
10253
10624
  loading = (details) => {
10254
- return new PopsLoading(details);
10625
+ let popsLoading = PopsLoading.init(details);
10626
+ return popsLoading;
10255
10627
  };
10256
10628
  /**
10257
10629
  * iframe层
10258
10630
  * @param details 配置
10259
10631
  */
10260
10632
  iframe = (details) => {
10261
- return new PopsIframe(details);
10633
+ let dialog = PopsIframe.init(details);
10634
+ return dialog;
10262
10635
  };
10263
10636
  /**
10264
10637
  * 提示框
10265
10638
  * @param details 配置
10266
10639
  */
10267
10640
  tooltip = (details) => {
10268
- let popsTooltip = new PopsTooltip(details);
10641
+ let popsTooltip = PopsTooltip.init(details);
10269
10642
  return popsTooltip;
10270
10643
  };
10271
10644
  /**
@@ -10273,35 +10646,40 @@ class Pops {
10273
10646
  * @param details 配置
10274
10647
  */
10275
10648
  drawer = (details) => {
10276
- return new PopsDrawer(details);
10649
+ let dialog = PopsDrawer.init(details);
10650
+ return dialog;
10277
10651
  };
10278
10652
  /**
10279
10653
  * 文件夹
10280
10654
  * @param details 配置
10281
10655
  */
10282
10656
  folder = (details) => {
10283
- return new PopsFolder(details);
10657
+ let dialog = PopsFolder.init(details);
10658
+ return dialog;
10284
10659
  };
10285
10660
  /**
10286
10661
  * 配置面板
10287
10662
  * @param details 配置
10288
10663
  */
10289
10664
  panel = (details) => {
10290
- return new PopsPanel(details);
10665
+ let dialog = PopsPanel.init(details);
10666
+ return dialog;
10291
10667
  };
10292
10668
  /**
10293
10669
  * 右键菜单
10294
10670
  * @param details 配置
10295
10671
  */
10296
10672
  rightClickMenu = (details) => {
10297
- return new PopsRightClickMenu(details);
10673
+ let popsRightClickMenu = PopsRightClickMenu.init(details);
10674
+ return popsRightClickMenu;
10298
10675
  };
10299
10676
  /**
10300
10677
  * 搜索建议
10301
10678
  * @param details 配置
10302
10679
  */
10303
10680
  searchSuggestion = (details) => {
10304
- return new PopsSearchSuggestion(details);
10681
+ let popsSearchSuggestion = PopsSearchSuggestion.init(details);
10682
+ return popsSearchSuggestion;
10305
10683
  };
10306
10684
  }
10307
10685
  const pops = new Pops();