@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.
- package/dist/index.amd.js +506 -128
- package/dist/index.amd.js.map +1 -1
- package/dist/index.cjs.js +506 -128
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +506 -128
- package/dist/index.esm.js.map +1 -1
- package/dist/index.iife.js +506 -128
- package/dist/index.iife.js.map +1 -1
- package/dist/index.system.js +506 -128
- package/dist/index.system.js.map +1 -1
- package/dist/index.umd.js +506 -128
- package/dist/index.umd.js.map +1 -1
- package/dist/types/src/Pops.d.ts +20761 -15
- package/dist/types/src/components/alert/index.d.ts +3 -3
- package/dist/types/src/components/confirm/index.d.ts +3 -3
- package/dist/types/src/components/drawer/index.d.ts +3 -3
- package/dist/types/src/components/drawer/indexType.d.ts +10 -2
- package/dist/types/src/components/folder/index.d.ts +3 -3
- package/dist/types/src/components/folder/indexType.d.ts +4 -1
- package/dist/types/src/components/iframe/index.d.ts +6 -3
- package/dist/types/src/components/iframe/indexType.d.ts +2 -0
- package/dist/types/src/components/loading/index.d.ts +3 -3
- package/dist/types/src/components/loading/indexType.d.ts +3 -1
- package/dist/types/src/components/panel/index.d.ts +3 -3
- package/dist/types/src/components/panel/indexType.d.ts +1 -0
- package/dist/types/src/components/panel/sliderType.d.ts +14 -4
- package/dist/types/src/components/prompt/index.d.ts +3 -3
- package/dist/types/src/components/prompt/indexType.d.ts +1 -0
- package/dist/types/src/components/rightClickMenu/index.d.ts +20661 -3
- package/dist/types/src/components/rightClickMenu/indexType.d.ts +6 -2
- package/dist/types/src/components/searchSuggestion/index.d.ts +141 -3
- package/dist/types/src/components/searchSuggestion/indexType.d.ts +0 -108
- package/dist/types/src/components/tooltip/index.d.ts +60 -5
- package/dist/types/src/components/tooltip/indexType.d.ts +6 -4
- package/dist/types/src/utils/PopsUtils.d.ts +16 -0
- package/package.json +6 -5
- package/src/Pops.ts +26 -25
- package/src/components/alert/index.ts +6 -5
- package/src/components/confirm/index.ts +6 -5
- package/src/components/drawer/index.ts +8 -7
- package/src/components/drawer/indexType.ts +10 -2
- package/src/components/folder/index.ts +8 -7
- package/src/components/folder/indexType.ts +4 -1
- package/src/components/iframe/index.ts +5 -5
- package/src/components/iframe/indexType.ts +2 -0
- package/src/components/loading/index.ts +6 -5
- package/src/components/loading/indexType.ts +3 -1
- package/src/components/panel/PanelHandleContentDetails.ts +71 -38
- package/src/components/panel/index.ts +6 -5
- package/src/components/panel/indexType.ts +1 -0
- package/src/components/panel/sliderType.ts +14 -4
- package/src/components/prompt/index.ts +6 -5
- package/src/components/prompt/indexType.ts +1 -0
- package/src/components/rightClickMenu/index.ts +5 -6
- package/src/components/rightClickMenu/indexType.ts +6 -7
- package/src/components/searchSuggestion/index.ts +6 -6
- package/src/components/searchSuggestion/indexType.ts +0 -109
- package/src/components/tooltip/index.ts +65 -25
- package/src/components/tooltip/indexType.ts +11 -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.umd.js
CHANGED
|
@@ -6,12 +6,6 @@
|
|
|
6
6
|
|
|
7
7
|
const SymbolEvents = Symbol("events_" + (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1));
|
|
8
8
|
|
|
9
|
-
const PopsCoreDefaultEnv = {
|
|
10
|
-
document: document,
|
|
11
|
-
window: window,
|
|
12
|
-
globalThis: globalThis,
|
|
13
|
-
self: self,
|
|
14
|
-
};
|
|
15
9
|
const PopsCoreEnv = {
|
|
16
10
|
document: document,
|
|
17
11
|
window: window,
|
|
@@ -19,12 +13,6 @@
|
|
|
19
13
|
self: self,
|
|
20
14
|
};
|
|
21
15
|
const PopsCore = {
|
|
22
|
-
init(option) {
|
|
23
|
-
if (!option) {
|
|
24
|
-
option = Object.assign({}, PopsCoreDefaultEnv);
|
|
25
|
-
}
|
|
26
|
-
Object.assign(PopsCoreEnv, option);
|
|
27
|
-
},
|
|
28
16
|
get document() {
|
|
29
17
|
return PopsCoreEnv.document;
|
|
30
18
|
},
|
|
@@ -44,21 +32,266 @@
|
|
|
44
32
|
},
|
|
45
33
|
};
|
|
46
34
|
|
|
47
|
-
|
|
35
|
+
const createCache = (lastNumberWeakMap) => {
|
|
36
|
+
return (collection, nextNumber) => {
|
|
37
|
+
lastNumberWeakMap.set(collection, nextNumber);
|
|
38
|
+
return nextNumber;
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
/*
|
|
43
|
+
* The value of the constant Number.MAX_SAFE_INTEGER equals (2 ** 53 - 1) but it
|
|
44
|
+
* is fairly new.
|
|
45
|
+
*/
|
|
46
|
+
const MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER === undefined ? 9007199254740991 : Number.MAX_SAFE_INTEGER;
|
|
47
|
+
const TWO_TO_THE_POWER_OF_TWENTY_NINE = 536870912;
|
|
48
|
+
const TWO_TO_THE_POWER_OF_THIRTY = TWO_TO_THE_POWER_OF_TWENTY_NINE * 2;
|
|
49
|
+
const createGenerateUniqueNumber = (cache, lastNumberWeakMap) => {
|
|
50
|
+
return (collection) => {
|
|
51
|
+
const lastNumber = lastNumberWeakMap.get(collection);
|
|
52
|
+
/*
|
|
53
|
+
* Let's try the cheapest algorithm first. It might fail to produce a new
|
|
54
|
+
* number, but it is so cheap that it is okay to take the risk. Just
|
|
55
|
+
* increase the last number by one or reset it to 0 if we reached the upper
|
|
56
|
+
* bound of SMIs (which stands for small integers). When the last number is
|
|
57
|
+
* unknown it is assumed that the collection contains zero based consecutive
|
|
58
|
+
* numbers.
|
|
59
|
+
*/
|
|
60
|
+
let nextNumber = lastNumber === undefined ? collection.size : lastNumber < TWO_TO_THE_POWER_OF_THIRTY ? lastNumber + 1 : 0;
|
|
61
|
+
if (!collection.has(nextNumber)) {
|
|
62
|
+
return cache(collection, nextNumber);
|
|
63
|
+
}
|
|
64
|
+
/*
|
|
65
|
+
* If there are less than half of 2 ** 30 numbers stored in the collection,
|
|
66
|
+
* the chance to generate a new random number in the range from 0 to 2 ** 30
|
|
67
|
+
* is at least 50%. It's benifitial to use only SMIs because they perform
|
|
68
|
+
* much better in any environment based on V8.
|
|
69
|
+
*/
|
|
70
|
+
if (collection.size < TWO_TO_THE_POWER_OF_TWENTY_NINE) {
|
|
71
|
+
while (collection.has(nextNumber)) {
|
|
72
|
+
nextNumber = Math.floor(Math.random() * TWO_TO_THE_POWER_OF_THIRTY);
|
|
73
|
+
}
|
|
74
|
+
return cache(collection, nextNumber);
|
|
75
|
+
}
|
|
76
|
+
// Quickly check if there is a theoretical chance to generate a new number.
|
|
77
|
+
if (collection.size > MAX_SAFE_INTEGER) {
|
|
78
|
+
throw new Error('Congratulations, you created a collection of unique numbers which uses all available integers!');
|
|
79
|
+
}
|
|
80
|
+
// Otherwise use the full scale of safely usable integers.
|
|
81
|
+
while (collection.has(nextNumber)) {
|
|
82
|
+
nextNumber = Math.floor(Math.random() * MAX_SAFE_INTEGER);
|
|
83
|
+
}
|
|
84
|
+
return cache(collection, nextNumber);
|
|
85
|
+
};
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
const LAST_NUMBER_WEAK_MAP = new WeakMap();
|
|
89
|
+
const cache = createCache(LAST_NUMBER_WEAK_MAP);
|
|
90
|
+
const generateUniqueNumber = createGenerateUniqueNumber(cache, LAST_NUMBER_WEAK_MAP);
|
|
91
|
+
|
|
92
|
+
const isMessagePort = (sender) => {
|
|
93
|
+
return typeof sender.start === 'function';
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
const PORT_MAP = new WeakMap();
|
|
97
|
+
|
|
98
|
+
const extendBrokerImplementation = (partialBrokerImplementation) => ({
|
|
99
|
+
...partialBrokerImplementation,
|
|
100
|
+
connect: ({ call }) => {
|
|
101
|
+
return async () => {
|
|
102
|
+
const { port1, port2 } = new MessageChannel();
|
|
103
|
+
const portId = await call('connect', { port: port1 }, [port1]);
|
|
104
|
+
PORT_MAP.set(port2, portId);
|
|
105
|
+
return port2;
|
|
106
|
+
};
|
|
107
|
+
},
|
|
108
|
+
disconnect: ({ call }) => {
|
|
109
|
+
return async (port) => {
|
|
110
|
+
const portId = PORT_MAP.get(port);
|
|
111
|
+
if (portId === undefined) {
|
|
112
|
+
throw new Error('The given port is not connected.');
|
|
113
|
+
}
|
|
114
|
+
await call('disconnect', { portId });
|
|
115
|
+
};
|
|
116
|
+
},
|
|
117
|
+
isSupported: ({ call }) => {
|
|
118
|
+
return () => call('isSupported');
|
|
119
|
+
}
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
const ONGOING_REQUESTS = new WeakMap();
|
|
123
|
+
const createOrGetOngoingRequests = (sender) => {
|
|
124
|
+
if (ONGOING_REQUESTS.has(sender)) {
|
|
125
|
+
// @todo TypeScript needs to be convinced that has() works as expected.
|
|
126
|
+
return ONGOING_REQUESTS.get(sender);
|
|
127
|
+
}
|
|
128
|
+
const ongoingRequests = new Map();
|
|
129
|
+
ONGOING_REQUESTS.set(sender, ongoingRequests);
|
|
130
|
+
return ongoingRequests;
|
|
131
|
+
};
|
|
132
|
+
const createBroker = (brokerImplementation) => {
|
|
133
|
+
const fullBrokerImplementation = extendBrokerImplementation(brokerImplementation);
|
|
134
|
+
return (sender) => {
|
|
135
|
+
const ongoingRequests = createOrGetOngoingRequests(sender);
|
|
136
|
+
sender.addEventListener('message', (({ data: message }) => {
|
|
137
|
+
const { id } = message;
|
|
138
|
+
if (id !== null && ongoingRequests.has(id)) {
|
|
139
|
+
const { reject, resolve } = ongoingRequests.get(id);
|
|
140
|
+
ongoingRequests.delete(id);
|
|
141
|
+
if (message.error === undefined) {
|
|
142
|
+
resolve(message.result);
|
|
143
|
+
}
|
|
144
|
+
else {
|
|
145
|
+
reject(new Error(message.error.message));
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
}));
|
|
149
|
+
if (isMessagePort(sender)) {
|
|
150
|
+
sender.start();
|
|
151
|
+
}
|
|
152
|
+
const call = (method, params = null, transferables = []) => {
|
|
153
|
+
return new Promise((resolve, reject) => {
|
|
154
|
+
const id = generateUniqueNumber(ongoingRequests);
|
|
155
|
+
ongoingRequests.set(id, { reject, resolve });
|
|
156
|
+
if (params === null) {
|
|
157
|
+
sender.postMessage({ id, method }, transferables);
|
|
158
|
+
}
|
|
159
|
+
else {
|
|
160
|
+
sender.postMessage({ id, method, params }, transferables);
|
|
161
|
+
}
|
|
162
|
+
});
|
|
163
|
+
};
|
|
164
|
+
const notify = (method, params, transferables = []) => {
|
|
165
|
+
sender.postMessage({ id: null, method, params }, transferables);
|
|
166
|
+
};
|
|
167
|
+
let functions = {};
|
|
168
|
+
for (const [key, handler] of Object.entries(fullBrokerImplementation)) {
|
|
169
|
+
functions = { ...functions, [key]: handler({ call, notify }) };
|
|
170
|
+
}
|
|
171
|
+
return { ...functions };
|
|
172
|
+
};
|
|
173
|
+
};
|
|
174
|
+
|
|
175
|
+
// Prefilling the Maps with a function indexed by zero is necessary to be compliant with the specification.
|
|
176
|
+
const scheduledIntervalsState = new Map([[0, null]]); // tslint:disable-line no-empty
|
|
177
|
+
const scheduledTimeoutsState = new Map([[0, null]]); // tslint:disable-line no-empty
|
|
178
|
+
const wrap = createBroker({
|
|
179
|
+
clearInterval: ({ call }) => {
|
|
180
|
+
return (timerId) => {
|
|
181
|
+
if (typeof scheduledIntervalsState.get(timerId) === 'symbol') {
|
|
182
|
+
scheduledIntervalsState.set(timerId, null);
|
|
183
|
+
call('clear', { timerId, timerType: 'interval' }).then(() => {
|
|
184
|
+
scheduledIntervalsState.delete(timerId);
|
|
185
|
+
});
|
|
186
|
+
}
|
|
187
|
+
};
|
|
188
|
+
},
|
|
189
|
+
clearTimeout: ({ call }) => {
|
|
190
|
+
return (timerId) => {
|
|
191
|
+
if (typeof scheduledTimeoutsState.get(timerId) === 'symbol') {
|
|
192
|
+
scheduledTimeoutsState.set(timerId, null);
|
|
193
|
+
call('clear', { timerId, timerType: 'timeout' }).then(() => {
|
|
194
|
+
scheduledTimeoutsState.delete(timerId);
|
|
195
|
+
});
|
|
196
|
+
}
|
|
197
|
+
};
|
|
198
|
+
},
|
|
199
|
+
setInterval: ({ call }) => {
|
|
200
|
+
return (func, delay = 0, ...args) => {
|
|
201
|
+
const symbol = Symbol();
|
|
202
|
+
const timerId = generateUniqueNumber(scheduledIntervalsState);
|
|
203
|
+
scheduledIntervalsState.set(timerId, symbol);
|
|
204
|
+
const schedule = () => call('set', {
|
|
205
|
+
delay,
|
|
206
|
+
now: performance.timeOrigin + performance.now(),
|
|
207
|
+
timerId,
|
|
208
|
+
timerType: 'interval'
|
|
209
|
+
}).then(() => {
|
|
210
|
+
const state = scheduledIntervalsState.get(timerId);
|
|
211
|
+
if (state === undefined) {
|
|
212
|
+
throw new Error('The timer is in an undefined state.');
|
|
213
|
+
}
|
|
214
|
+
if (state === symbol) {
|
|
215
|
+
func(...args);
|
|
216
|
+
// Doublecheck if the interval should still be rescheduled because it could have been cleared inside of func().
|
|
217
|
+
if (scheduledIntervalsState.get(timerId) === symbol) {
|
|
218
|
+
schedule();
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
});
|
|
222
|
+
schedule();
|
|
223
|
+
return timerId;
|
|
224
|
+
};
|
|
225
|
+
},
|
|
226
|
+
setTimeout: ({ call }) => {
|
|
227
|
+
return (func, delay = 0, ...args) => {
|
|
228
|
+
const symbol = Symbol();
|
|
229
|
+
const timerId = generateUniqueNumber(scheduledTimeoutsState);
|
|
230
|
+
scheduledTimeoutsState.set(timerId, symbol);
|
|
231
|
+
call('set', {
|
|
232
|
+
delay,
|
|
233
|
+
now: performance.timeOrigin + performance.now(),
|
|
234
|
+
timerId,
|
|
235
|
+
timerType: 'timeout'
|
|
236
|
+
}).then(() => {
|
|
237
|
+
const state = scheduledTimeoutsState.get(timerId);
|
|
238
|
+
if (state === undefined) {
|
|
239
|
+
throw new Error('The timer is in an undefined state.');
|
|
240
|
+
}
|
|
241
|
+
if (state === symbol) {
|
|
242
|
+
// A timeout can be savely deleted because it is only called once.
|
|
243
|
+
scheduledTimeoutsState.delete(timerId);
|
|
244
|
+
func(...args);
|
|
245
|
+
}
|
|
246
|
+
});
|
|
247
|
+
return timerId;
|
|
248
|
+
};
|
|
249
|
+
}
|
|
250
|
+
});
|
|
251
|
+
const load = (url) => {
|
|
252
|
+
const worker = new Worker(url);
|
|
253
|
+
return wrap(worker);
|
|
254
|
+
};
|
|
255
|
+
|
|
256
|
+
const createLoadOrReturnBroker = (loadBroker, worker) => {
|
|
257
|
+
let broker = null;
|
|
258
|
+
return () => {
|
|
259
|
+
if (broker !== null) {
|
|
260
|
+
return broker;
|
|
261
|
+
}
|
|
262
|
+
const blob = new Blob([worker], { type: 'application/javascript; charset=utf-8' });
|
|
263
|
+
const url = URL.createObjectURL(blob);
|
|
264
|
+
broker = loadBroker(url);
|
|
265
|
+
// Bug #1: Edge up until v18 didn't like the URL to be revoked directly.
|
|
266
|
+
setTimeout(() => URL.revokeObjectURL(url));
|
|
267
|
+
return broker;
|
|
268
|
+
};
|
|
269
|
+
};
|
|
270
|
+
|
|
271
|
+
// This is the minified and stringified code of the worker-timers-worker package.
|
|
272
|
+
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
|
|
273
|
+
|
|
274
|
+
const loadOrReturnBroker = createLoadOrReturnBroker(load, worker);
|
|
275
|
+
const clearInterval = (timerId) => loadOrReturnBroker().clearInterval(timerId);
|
|
276
|
+
const clearTimeout$1 = (timerId) => loadOrReturnBroker().clearTimeout(timerId);
|
|
277
|
+
const setInterval = (...args) => loadOrReturnBroker().setInterval(...args);
|
|
278
|
+
const setTimeout$1 = (...args) => loadOrReturnBroker().setTimeout(...args);
|
|
279
|
+
|
|
280
|
+
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={};}};
|
|
48
281
|
|
|
49
|
-
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
|
|
282
|
+
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}
|
|
50
283
|
|
|
51
|
-
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
|
|
284
|
+
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();}};
|
|
52
285
|
|
|
53
286
|
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};
|
|
54
287
|
|
|
55
288
|
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}}}
|
|
56
289
|
|
|
57
|
-
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
|
|
290
|
+
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}
|
|
58
291
|
|
|
59
292
|
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}
|
|
60
293
|
|
|
61
|
-
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
|
|
294
|
+
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}
|
|
62
295
|
|
|
63
296
|
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}
|
|
64
297
|
|
|
@@ -280,7 +513,7 @@
|
|
|
280
513
|
formatByteToSize(byteSize, addType = true) {
|
|
281
514
|
byteSize = parseInt(byteSize.toString());
|
|
282
515
|
if (isNaN(byteSize)) {
|
|
283
|
-
throw new
|
|
516
|
+
throw new TypeError("Utils.formatByteToSize 参数 byteSize 格式不正确");
|
|
284
517
|
}
|
|
285
518
|
let result = 0;
|
|
286
519
|
let resultType = "KB";
|
|
@@ -313,6 +546,58 @@
|
|
|
313
546
|
AnyTouch = () => {
|
|
314
547
|
return i;
|
|
315
548
|
};
|
|
549
|
+
/**
|
|
550
|
+
* 自动使用 Worker 执行 setTimeout
|
|
551
|
+
*/
|
|
552
|
+
setTimeout(callback, timeout = 0) {
|
|
553
|
+
try {
|
|
554
|
+
return setTimeout$1(callback, timeout);
|
|
555
|
+
}
|
|
556
|
+
catch (error) {
|
|
557
|
+
return globalThis.setTimeout(callback, timeout);
|
|
558
|
+
}
|
|
559
|
+
}
|
|
560
|
+
/**
|
|
561
|
+
* 配合 .setTimeout 使用
|
|
562
|
+
*/
|
|
563
|
+
clearTimeout(timeId) {
|
|
564
|
+
try {
|
|
565
|
+
if (timeId != null) {
|
|
566
|
+
clearTimeout$1(timeId);
|
|
567
|
+
}
|
|
568
|
+
}
|
|
569
|
+
catch (error) {
|
|
570
|
+
}
|
|
571
|
+
finally {
|
|
572
|
+
globalThis.clearTimeout(timeId);
|
|
573
|
+
}
|
|
574
|
+
}
|
|
575
|
+
/**
|
|
576
|
+
* 自动使用 Worker 执行 setInterval
|
|
577
|
+
*/
|
|
578
|
+
setInterval(callback, timeout = 0) {
|
|
579
|
+
try {
|
|
580
|
+
return setInterval(callback, timeout);
|
|
581
|
+
}
|
|
582
|
+
catch (error) {
|
|
583
|
+
return globalThis.setInterval(callback, timeout);
|
|
584
|
+
}
|
|
585
|
+
}
|
|
586
|
+
/**
|
|
587
|
+
* 配合 .setInterval 使用
|
|
588
|
+
*/
|
|
589
|
+
clearInterval(timeId) {
|
|
590
|
+
try {
|
|
591
|
+
if (timeId != null) {
|
|
592
|
+
clearInterval(timeId);
|
|
593
|
+
}
|
|
594
|
+
}
|
|
595
|
+
catch (error) {
|
|
596
|
+
}
|
|
597
|
+
finally {
|
|
598
|
+
globalThis.clearInterval(timeId);
|
|
599
|
+
}
|
|
600
|
+
}
|
|
316
601
|
}
|
|
317
602
|
const popsUtils = new PopsUtils();
|
|
318
603
|
|
|
@@ -686,7 +971,7 @@
|
|
|
686
971
|
}
|
|
687
972
|
if (checkDOMReadyState()) {
|
|
688
973
|
/* 检查document状态 */
|
|
689
|
-
setTimeout(callback);
|
|
974
|
+
popsUtils.setTimeout(callback, 0);
|
|
690
975
|
}
|
|
691
976
|
else {
|
|
692
977
|
/* 添加监听 */
|
|
@@ -1913,7 +2198,7 @@
|
|
|
1913
2198
|
let popsElement = animElement.querySelector(".pops[type-value]");
|
|
1914
2199
|
if (popsType === "drawer") {
|
|
1915
2200
|
let drawerConfig = config;
|
|
1916
|
-
setTimeout(() => {
|
|
2201
|
+
popsUtils.setTimeout(() => {
|
|
1917
2202
|
maskElement.style.setProperty("display", "none");
|
|
1918
2203
|
if (["top", "bottom"].includes(drawerConfig.direction)) {
|
|
1919
2204
|
popsElement.style.setProperty("height", "0");
|
|
@@ -1979,7 +2264,7 @@
|
|
|
1979
2264
|
let popsElement = animElement.querySelector(".pops[type-value]");
|
|
1980
2265
|
if (popsType === "drawer") {
|
|
1981
2266
|
let drawerConfig = config;
|
|
1982
|
-
setTimeout(() => {
|
|
2267
|
+
popsUtils.setTimeout(() => {
|
|
1983
2268
|
popsDOMUtils.css(maskElement, "display", "");
|
|
1984
2269
|
let direction = drawerConfig.direction;
|
|
1985
2270
|
let size = drawerConfig.size.toString();
|
|
@@ -1993,7 +2278,7 @@
|
|
|
1993
2278
|
console.error("未知direction:", direction);
|
|
1994
2279
|
}
|
|
1995
2280
|
resolve();
|
|
1996
|
-
}, drawerConfig.openDelay);
|
|
2281
|
+
}, drawerConfig.openDelay ?? 0);
|
|
1997
2282
|
}
|
|
1998
2283
|
else {
|
|
1999
2284
|
let findLayerIns = layerConfigList.find((layerConfigItem) => layerConfigItem.guid === guid);
|
|
@@ -2085,7 +2370,7 @@
|
|
|
2085
2370
|
}
|
|
2086
2371
|
}
|
|
2087
2372
|
if (popsType === "drawer") {
|
|
2088
|
-
setTimeout(() => {
|
|
2373
|
+
popsUtils.setTimeout(() => {
|
|
2089
2374
|
transitionendEvent();
|
|
2090
2375
|
}, drawerConfig.closeDelay);
|
|
2091
2376
|
}
|
|
@@ -2302,10 +2587,10 @@
|
|
|
2302
2587
|
*/
|
|
2303
2588
|
sortElementListByProperty(getBeforeValueFun, getAfterValueFun, sortByDesc = true) {
|
|
2304
2589
|
if (typeof sortByDesc !== "boolean") {
|
|
2305
|
-
throw "参数 sortByDesc 必须为boolean类型";
|
|
2590
|
+
throw new TypeError("参数 sortByDesc 必须为boolean类型");
|
|
2306
2591
|
}
|
|
2307
2592
|
if (getBeforeValueFun == null || getAfterValueFun == null) {
|
|
2308
|
-
throw "获取前面的值或后面的值的方法不能为空";
|
|
2593
|
+
throw new Error("获取前面的值或后面的值的方法不能为空");
|
|
2309
2594
|
}
|
|
2310
2595
|
return function (after_obj, before_obj) {
|
|
2311
2596
|
var beforeValue = getBeforeValueFun(before_obj); /* 前 */
|
|
@@ -3250,8 +3535,8 @@
|
|
|
3250
3535
|
};
|
|
3251
3536
|
};
|
|
3252
3537
|
|
|
3253
|
-
|
|
3254
|
-
|
|
3538
|
+
const PopsAlert = {
|
|
3539
|
+
init(details) {
|
|
3255
3540
|
const guid = popsUtils.getRandomGUID();
|
|
3256
3541
|
// 设置当前类型
|
|
3257
3542
|
const PopsType = "alert";
|
|
@@ -3340,9 +3625,10 @@
|
|
|
3340
3625
|
endCallBack: config.dragEndCallBack,
|
|
3341
3626
|
});
|
|
3342
3627
|
}
|
|
3343
|
-
|
|
3344
|
-
|
|
3345
|
-
|
|
3628
|
+
let result = PopsHandler.handleResultDetails(eventDetails);
|
|
3629
|
+
return result;
|
|
3630
|
+
},
|
|
3631
|
+
};
|
|
3346
3632
|
|
|
3347
3633
|
const PopsConfirmConfig = () => {
|
|
3348
3634
|
return {
|
|
@@ -3432,8 +3718,8 @@
|
|
|
3432
3718
|
};
|
|
3433
3719
|
};
|
|
3434
3720
|
|
|
3435
|
-
|
|
3436
|
-
|
|
3721
|
+
const PopsConfirm = {
|
|
3722
|
+
init(details) {
|
|
3437
3723
|
const guid = popsUtils.getRandomGUID();
|
|
3438
3724
|
// 设置当前类型
|
|
3439
3725
|
const PopsType = "confirm";
|
|
@@ -3523,9 +3809,10 @@
|
|
|
3523
3809
|
endCallBack: config.dragEndCallBack,
|
|
3524
3810
|
});
|
|
3525
3811
|
}
|
|
3526
|
-
|
|
3527
|
-
|
|
3528
|
-
|
|
3812
|
+
let result = PopsHandler.handleResultDetails(eventDetails);
|
|
3813
|
+
return result;
|
|
3814
|
+
},
|
|
3815
|
+
};
|
|
3529
3816
|
|
|
3530
3817
|
const PopsPromptConfig = () => {
|
|
3531
3818
|
return {
|
|
@@ -3619,8 +3906,8 @@
|
|
|
3619
3906
|
};
|
|
3620
3907
|
};
|
|
3621
3908
|
|
|
3622
|
-
|
|
3623
|
-
|
|
3909
|
+
const PopsPrompt = {
|
|
3910
|
+
init(details) {
|
|
3624
3911
|
const guid = popsUtils.getRandomGUID();
|
|
3625
3912
|
// 设置当前类型
|
|
3626
3913
|
const PopsType = "prompt";
|
|
@@ -3726,9 +4013,10 @@
|
|
|
3726
4013
|
if (config.content.select) {
|
|
3727
4014
|
$input.select();
|
|
3728
4015
|
}
|
|
3729
|
-
|
|
3730
|
-
|
|
3731
|
-
|
|
4016
|
+
let result = PopsHandler.handleResultDetails(eventDetails);
|
|
4017
|
+
return result;
|
|
4018
|
+
},
|
|
4019
|
+
};
|
|
3732
4020
|
|
|
3733
4021
|
const PopsLoadingConfig = () => {
|
|
3734
4022
|
return {
|
|
@@ -3758,8 +4046,8 @@
|
|
|
3758
4046
|
};
|
|
3759
4047
|
};
|
|
3760
4048
|
|
|
3761
|
-
|
|
3762
|
-
|
|
4049
|
+
const PopsLoading = {
|
|
4050
|
+
init(details) {
|
|
3763
4051
|
let config = PopsLoadingConfig();
|
|
3764
4052
|
config = popsUtils.assign(config, GlobalConfig.getGlobalConfig());
|
|
3765
4053
|
config = popsUtils.assign(config, details);
|
|
@@ -3827,9 +4115,10 @@
|
|
|
3827
4115
|
popsDOMUtils.css($anim, "position", "absolute !important");
|
|
3828
4116
|
$mask && popsDOMUtils.css($mask, "position", "absolute !important");
|
|
3829
4117
|
}
|
|
3830
|
-
|
|
3831
|
-
|
|
3832
|
-
|
|
4118
|
+
let result = PopsHandler.handleResultDetails(eventDetails);
|
|
4119
|
+
return result;
|
|
4120
|
+
},
|
|
4121
|
+
};
|
|
3833
4122
|
|
|
3834
4123
|
const PopsIframeConfig = () => {
|
|
3835
4124
|
return {
|
|
@@ -3889,8 +4178,8 @@
|
|
|
3889
4178
|
};
|
|
3890
4179
|
};
|
|
3891
4180
|
|
|
3892
|
-
|
|
3893
|
-
|
|
4181
|
+
const PopsIframe = {
|
|
4182
|
+
init(details) {
|
|
3894
4183
|
const guid = popsUtils.getRandomGUID();
|
|
3895
4184
|
// 设置当前类型
|
|
3896
4185
|
const PopsType = "iframe";
|
|
@@ -3898,7 +4187,7 @@
|
|
|
3898
4187
|
config = popsUtils.assign(config, GlobalConfig.getGlobalConfig());
|
|
3899
4188
|
config = popsUtils.assign(config, details);
|
|
3900
4189
|
if (config.url == null) {
|
|
3901
|
-
throw "config.url不能为空";
|
|
4190
|
+
throw new Error("config.url不能为空");
|
|
3902
4191
|
}
|
|
3903
4192
|
config = PopsHandler.handleOnly(PopsType, config);
|
|
3904
4193
|
const { $shadowContainer, $shadowRoot } = PopsHandler.handlerShadow(config);
|
|
@@ -4120,8 +4409,8 @@
|
|
|
4120
4409
|
});
|
|
4121
4410
|
let result = PopsHandler.handleResultDetails(eventDetails);
|
|
4122
4411
|
return result;
|
|
4123
|
-
}
|
|
4124
|
-
}
|
|
4412
|
+
},
|
|
4413
|
+
};
|
|
4125
4414
|
|
|
4126
4415
|
const PopsDrawerConfig = () => {
|
|
4127
4416
|
return {
|
|
@@ -4210,8 +4499,8 @@
|
|
|
4210
4499
|
};
|
|
4211
4500
|
};
|
|
4212
4501
|
|
|
4213
|
-
|
|
4214
|
-
|
|
4502
|
+
const PopsDrawer = {
|
|
4503
|
+
init(details) {
|
|
4215
4504
|
const guid = popsUtils.getRandomGUID();
|
|
4216
4505
|
// 设置当前类型
|
|
4217
4506
|
const PopsType = "drawer";
|
|
@@ -4356,8 +4645,8 @@
|
|
|
4356
4645
|
config.beforeAppendToPageCallBack($shadowRoot, $shadowContainer);
|
|
4357
4646
|
}
|
|
4358
4647
|
popsDOMUtils.appendBody($shadowContainer);
|
|
4359
|
-
setTimeout(() => {
|
|
4360
|
-
setTimeout(() => {
|
|
4648
|
+
popsUtils.setTimeout(() => {
|
|
4649
|
+
popsUtils.setTimeout(() => {
|
|
4361
4650
|
$pops.style.setProperty("transform", "");
|
|
4362
4651
|
}, config.openDelay);
|
|
4363
4652
|
}, 50);
|
|
@@ -4372,9 +4661,10 @@
|
|
|
4372
4661
|
$shadowContainer: $shadowContainer,
|
|
4373
4662
|
$shadowRoot: $shadowRoot,
|
|
4374
4663
|
});
|
|
4375
|
-
|
|
4376
|
-
|
|
4377
|
-
|
|
4664
|
+
let result = PopsHandler.handleResultDetails(eventDetails);
|
|
4665
|
+
return result;
|
|
4666
|
+
},
|
|
4667
|
+
};
|
|
4378
4668
|
|
|
4379
4669
|
const PopsFolderConfig = () => {
|
|
4380
4670
|
return {
|
|
@@ -4536,8 +4826,8 @@
|
|
|
4536
4826
|
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=",
|
|
4537
4827
|
};
|
|
4538
4828
|
|
|
4539
|
-
|
|
4540
|
-
|
|
4829
|
+
const PopsFolder = {
|
|
4830
|
+
init(details) {
|
|
4541
4831
|
const guid = popsUtils.getRandomGUID();
|
|
4542
4832
|
// 设置当前类型
|
|
4543
4833
|
const PopsType = "folder";
|
|
@@ -5077,12 +5367,12 @@
|
|
|
5077
5367
|
let downloadIframeLinkElement = document.createElement("iframe");
|
|
5078
5368
|
downloadIframeLinkElement.src = downloadInfo.url;
|
|
5079
5369
|
downloadIframeLinkElement.onload = function () {
|
|
5080
|
-
setTimeout(() => {
|
|
5370
|
+
popsUtils.setTimeout(() => {
|
|
5081
5371
|
downloadIframeLinkElement.remove();
|
|
5082
5372
|
}, 1000);
|
|
5083
5373
|
};
|
|
5084
5374
|
$shadowRoot.appendChild(downloadIframeLinkElement);
|
|
5085
|
-
setTimeout(() => {
|
|
5375
|
+
popsUtils.setTimeout(() => {
|
|
5086
5376
|
downloadIframeLinkElement.remove();
|
|
5087
5377
|
}, 3 * 60 * 1000);
|
|
5088
5378
|
}
|
|
@@ -5319,9 +5609,10 @@
|
|
|
5319
5609
|
$shadowContainer: $shadowContainer,
|
|
5320
5610
|
$shadowRoot: $shadowRoot,
|
|
5321
5611
|
});
|
|
5322
|
-
|
|
5323
|
-
|
|
5324
|
-
|
|
5612
|
+
let result = PopsHandler.handleResultDetails(eventDetails);
|
|
5613
|
+
return result;
|
|
5614
|
+
},
|
|
5615
|
+
};
|
|
5325
5616
|
|
|
5326
5617
|
const PopsPanelConfig = () => {
|
|
5327
5618
|
return {
|
|
@@ -6204,6 +6495,7 @@
|
|
|
6204
6495
|
*/
|
|
6205
6496
|
createSectionContainerItem_slider_new(formConfig) {
|
|
6206
6497
|
let liElement = document.createElement("li");
|
|
6498
|
+
// @ts-ignore
|
|
6207
6499
|
liElement["__formConfig__"] = formConfig;
|
|
6208
6500
|
this.setElementClassName(liElement, formConfig.className);
|
|
6209
6501
|
this.setElementAttributes(liElement, formConfig.attributes);
|
|
@@ -6304,15 +6596,15 @@
|
|
|
6304
6596
|
this.setPanEvent();
|
|
6305
6597
|
this.setRunAwayClickEvent();
|
|
6306
6598
|
this.intervalInit();
|
|
6307
|
-
if (
|
|
6599
|
+
if (this.isFormConfigDisabledDrag()) {
|
|
6308
6600
|
this.disableDrag();
|
|
6309
6601
|
}
|
|
6310
6602
|
},
|
|
6311
6603
|
/**
|
|
6312
6604
|
* 10s内循环获取slider的宽度等信息
|
|
6313
6605
|
* 获取到了就可以初始化left的值
|
|
6314
|
-
* @param
|
|
6315
|
-
* @param
|
|
6606
|
+
* @param [checkStepTime=200] 每次检测的间隔时间
|
|
6607
|
+
* @param [maxTime=10000] 最大的检测时间
|
|
6316
6608
|
*/
|
|
6317
6609
|
intervalInit(checkStepTime = 200, maxTime = 10000) {
|
|
6318
6610
|
if (this.$interval.isCheck) {
|
|
@@ -6322,11 +6614,11 @@
|
|
|
6322
6614
|
let isSuccess = false;
|
|
6323
6615
|
let oldTotalWidth = this.$data.totalWidth;
|
|
6324
6616
|
let timer = void 0;
|
|
6325
|
-
let interval = setInterval(() => {
|
|
6617
|
+
let interval = popsUtils.setInterval(() => {
|
|
6326
6618
|
if (isSuccess) {
|
|
6327
6619
|
this.$interval.isCheck = false;
|
|
6328
|
-
clearTimeout(timer);
|
|
6329
|
-
clearInterval(interval);
|
|
6620
|
+
popsUtils.clearTimeout(timer);
|
|
6621
|
+
popsUtils.clearInterval(interval);
|
|
6330
6622
|
}
|
|
6331
6623
|
else {
|
|
6332
6624
|
this.initTotalWidth();
|
|
@@ -6346,8 +6638,8 @@
|
|
|
6346
6638
|
}
|
|
6347
6639
|
}, checkStepTime);
|
|
6348
6640
|
/* 最长检测时间是10s */
|
|
6349
|
-
timer = setTimeout(() => {
|
|
6350
|
-
clearInterval(interval);
|
|
6641
|
+
timer = popsUtils.setTimeout(() => {
|
|
6642
|
+
popsUtils.clearInterval(interval);
|
|
6351
6643
|
}, maxTime);
|
|
6352
6644
|
},
|
|
6353
6645
|
/**
|
|
@@ -6358,9 +6650,13 @@
|
|
|
6358
6650
|
this.$ele.slider.setAttribute("data-max", this.max.toString());
|
|
6359
6651
|
this.$ele.slider.setAttribute("data-value", this.value.toString());
|
|
6360
6652
|
this.$ele.slider.setAttribute("data-step", this.step.toString());
|
|
6653
|
+
// @ts-ignore
|
|
6361
6654
|
this.$ele.slider["data-min"] = this.min;
|
|
6655
|
+
// @ts-ignore
|
|
6362
6656
|
this.$ele.slider["data-max"] = this.max;
|
|
6657
|
+
// @ts-ignore
|
|
6363
6658
|
this.$ele.slider["data-value"] = this.value;
|
|
6659
|
+
// @ts-ignore
|
|
6364
6660
|
this.$ele.slider["data-step"] = this.step;
|
|
6365
6661
|
},
|
|
6366
6662
|
/**
|
|
@@ -6475,7 +6771,6 @@
|
|
|
6475
6771
|
/**
|
|
6476
6772
|
* 判断数字是否是浮点数
|
|
6477
6773
|
* @param num
|
|
6478
|
-
* @returns
|
|
6479
6774
|
*/
|
|
6480
6775
|
isFloat(num) {
|
|
6481
6776
|
return Number(num) === num && num % 1 !== 0;
|
|
@@ -6492,6 +6787,7 @@
|
|
|
6492
6787
|
},
|
|
6493
6788
|
/**
|
|
6494
6789
|
* 根据拖拽距离获取滑块应该在的区间和值
|
|
6790
|
+
* @param dragX
|
|
6495
6791
|
*/
|
|
6496
6792
|
getDragInfo(dragX) {
|
|
6497
6793
|
let result = this.$data.stepBlockMap.get(0);
|
|
@@ -6506,7 +6802,7 @@
|
|
|
6506
6802
|
},
|
|
6507
6803
|
/**
|
|
6508
6804
|
* 获取滑块的当前脱拖拽占据的百分比
|
|
6509
|
-
* @param
|
|
6805
|
+
* @param dragWidth
|
|
6510
6806
|
*/
|
|
6511
6807
|
getSliderPositonPercent(dragWidth) {
|
|
6512
6808
|
return dragWidth / this.$data.totalWidth;
|
|
@@ -6558,6 +6854,21 @@
|
|
|
6558
6854
|
isDisabledDrag() {
|
|
6559
6855
|
return this.$ele.runAway.classList.contains("pops-slider-is-disabled");
|
|
6560
6856
|
},
|
|
6857
|
+
/**
|
|
6858
|
+
* 判断当前滑块是否被禁用(配置中判断)
|
|
6859
|
+
*/
|
|
6860
|
+
isFormConfigDisabledDrag() {
|
|
6861
|
+
if (typeof formConfig.disabled === "function" ||
|
|
6862
|
+
typeof formConfig.disabled === "boolean") {
|
|
6863
|
+
let isDisabled = typeof formConfig.disabled === "function"
|
|
6864
|
+
? formConfig.disabled()
|
|
6865
|
+
: formConfig.disabled;
|
|
6866
|
+
return isDisabled;
|
|
6867
|
+
}
|
|
6868
|
+
else {
|
|
6869
|
+
return false;
|
|
6870
|
+
}
|
|
6871
|
+
},
|
|
6561
6872
|
/**
|
|
6562
6873
|
* 设置进度条点击定位的事件
|
|
6563
6874
|
*/
|
|
@@ -6580,9 +6891,17 @@
|
|
|
6580
6891
|
*/
|
|
6581
6892
|
dragStartCallBack() {
|
|
6582
6893
|
if (!this.$data.isMove) {
|
|
6583
|
-
if (this.
|
|
6894
|
+
if (this.isFormConfigDisabledDrag()) {
|
|
6895
|
+
// 禁止
|
|
6896
|
+
this.disableDrag();
|
|
6584
6897
|
return false;
|
|
6585
6898
|
}
|
|
6899
|
+
else {
|
|
6900
|
+
// 允许
|
|
6901
|
+
if (this.isDisabledDrag()) {
|
|
6902
|
+
this.allowDrag();
|
|
6903
|
+
}
|
|
6904
|
+
}
|
|
6586
6905
|
this.$data.isMove = true;
|
|
6587
6906
|
}
|
|
6588
6907
|
return true;
|
|
@@ -6688,16 +7007,16 @@
|
|
|
6688
7007
|
return;
|
|
6689
7008
|
}
|
|
6690
7009
|
this.$data.isCheckingStopDragMove = true;
|
|
6691
|
-
let interval = setInterval(() => {
|
|
7010
|
+
let interval = popsUtils.setInterval(() => {
|
|
6692
7011
|
if (!this.$data.isMove) {
|
|
6693
7012
|
this.$data.isCheckingStopDragMove = false;
|
|
6694
7013
|
this.closeToolTip();
|
|
6695
|
-
clearInterval(interval);
|
|
7014
|
+
popsUtils.clearInterval(interval);
|
|
6696
7015
|
}
|
|
6697
7016
|
}, 200);
|
|
6698
|
-
setTimeout(() => {
|
|
7017
|
+
popsUtils.setTimeout(() => {
|
|
6699
7018
|
this.$data.isCheckingStopDragMove = false;
|
|
6700
|
-
clearInterval(interval);
|
|
7019
|
+
popsUtils.clearInterval(interval);
|
|
6701
7020
|
}, 2000);
|
|
6702
7021
|
},
|
|
6703
7022
|
/**
|
|
@@ -6729,6 +7048,14 @@
|
|
|
6729
7048
|
passive: true,
|
|
6730
7049
|
},
|
|
6731
7050
|
showBeforeCallBack: () => {
|
|
7051
|
+
let isShowHoverTip = typeof formConfig.isShowHoverTip === "function"
|
|
7052
|
+
? formConfig.isShowHoverTip()
|
|
7053
|
+
: typeof formConfig.isShowHoverTip === "boolean"
|
|
7054
|
+
? formConfig.isShowHoverTip
|
|
7055
|
+
: true;
|
|
7056
|
+
if (!isShowHoverTip) {
|
|
7057
|
+
return false;
|
|
7058
|
+
}
|
|
6732
7059
|
this.intervalInit();
|
|
6733
7060
|
},
|
|
6734
7061
|
showAfterCallBack: (toolTipNode) => {
|
|
@@ -8313,8 +8640,8 @@
|
|
|
8313
8640
|
};
|
|
8314
8641
|
};
|
|
8315
8642
|
|
|
8316
|
-
|
|
8317
|
-
|
|
8643
|
+
const PopsPanel = {
|
|
8644
|
+
init(details) {
|
|
8318
8645
|
const guid = popsUtils.getRandomGUID();
|
|
8319
8646
|
// 设置当前类型
|
|
8320
8647
|
const PopsType = "panel";
|
|
@@ -8427,9 +8754,10 @@
|
|
|
8427
8754
|
endCallBack: config.dragEndCallBack,
|
|
8428
8755
|
});
|
|
8429
8756
|
}
|
|
8430
|
-
|
|
8431
|
-
|
|
8432
|
-
|
|
8757
|
+
let result = PopsHandler.handleResultDetails(eventDetails);
|
|
8758
|
+
return result;
|
|
8759
|
+
},
|
|
8760
|
+
};
|
|
8433
8761
|
|
|
8434
8762
|
const rightClickMenuConfig = () => {
|
|
8435
8763
|
return {
|
|
@@ -8556,8 +8884,8 @@
|
|
|
8556
8884
|
};
|
|
8557
8885
|
};
|
|
8558
8886
|
|
|
8559
|
-
|
|
8560
|
-
|
|
8887
|
+
const PopsRightClickMenu = {
|
|
8888
|
+
init(details) {
|
|
8561
8889
|
const guid = popsUtils.getRandomGUID();
|
|
8562
8890
|
// 设置当前类型
|
|
8563
8891
|
const PopsType = "rightClickMenu";
|
|
@@ -8566,7 +8894,7 @@
|
|
|
8566
8894
|
config = popsUtils.assign(config, details);
|
|
8567
8895
|
config = PopsHandler.handleOnly(PopsType, config);
|
|
8568
8896
|
if (config.target == null) {
|
|
8569
|
-
throw "config.target 不能为空";
|
|
8897
|
+
throw new Error("config.target 不能为空");
|
|
8570
8898
|
}
|
|
8571
8899
|
if (details.data) {
|
|
8572
8900
|
// @ts-ignore
|
|
@@ -8983,8 +9311,8 @@
|
|
|
8983
9311
|
removeContextMenuEvent: PopsContextMenu.removeContextMenuEvent,
|
|
8984
9312
|
addContextMenuEvent: PopsContextMenu.addContextMenuEvent,
|
|
8985
9313
|
};
|
|
8986
|
-
}
|
|
8987
|
-
}
|
|
9314
|
+
},
|
|
9315
|
+
};
|
|
8988
9316
|
|
|
8989
9317
|
const searchSuggestionConfig = () => {
|
|
8990
9318
|
return {
|
|
@@ -9043,8 +9371,8 @@
|
|
|
9043
9371
|
};
|
|
9044
9372
|
};
|
|
9045
9373
|
|
|
9046
|
-
|
|
9047
|
-
|
|
9374
|
+
const PopsSearchSuggestion = {
|
|
9375
|
+
init(details) {
|
|
9048
9376
|
const guid = popsUtils.getRandomGUID();
|
|
9049
9377
|
// 设置当前类型
|
|
9050
9378
|
const PopsType = "searchSuggestion";
|
|
@@ -9052,7 +9380,7 @@
|
|
|
9052
9380
|
config = popsUtils.assign(config, GlobalConfig.getGlobalConfig());
|
|
9053
9381
|
config = popsUtils.assign(config, details);
|
|
9054
9382
|
if (config.target == null) {
|
|
9055
|
-
throw new
|
|
9383
|
+
throw new Error("config.target 不能为空");
|
|
9056
9384
|
}
|
|
9057
9385
|
/* 做下兼容处理 */
|
|
9058
9386
|
if (config.inputTarget == null) {
|
|
@@ -9323,7 +9651,7 @@
|
|
|
9323
9651
|
popsDOMUtils.on([config.inputTarget], ["focus", "click", "input"], void 0, SearchSuggestion.showEvent, option);
|
|
9324
9652
|
}
|
|
9325
9653
|
else {
|
|
9326
|
-
throw new
|
|
9654
|
+
throw new Error("未知followPosition:" + config.followPosition);
|
|
9327
9655
|
}
|
|
9328
9656
|
},
|
|
9329
9657
|
/**
|
|
@@ -9582,8 +9910,8 @@
|
|
|
9582
9910
|
},
|
|
9583
9911
|
};
|
|
9584
9912
|
return SearchSuggestion;
|
|
9585
|
-
}
|
|
9586
|
-
}
|
|
9913
|
+
},
|
|
9914
|
+
};
|
|
9587
9915
|
|
|
9588
9916
|
const PopsTooltipConfig = () => {
|
|
9589
9917
|
// @ts-ignore
|
|
@@ -9734,11 +10062,12 @@
|
|
|
9734
10062
|
}
|
|
9735
10063
|
/**
|
|
9736
10064
|
* 计算 提示框的位置
|
|
10065
|
+
* @param event 触发的事件
|
|
9737
10066
|
* @param targetElement 目标元素
|
|
9738
10067
|
* @param arrowDistance 箭头和目标元素的距离
|
|
9739
10068
|
* @param otherDistance 其它位置的偏移
|
|
9740
10069
|
*/
|
|
9741
|
-
calcToolTipPosition(targetElement, arrowDistance, otherDistance) {
|
|
10070
|
+
calcToolTipPosition(targetElement, arrowDistance, otherDistance, event) {
|
|
9742
10071
|
let offsetInfo = popsDOMUtils.offset(targetElement, !this.$data.config.isFixed);
|
|
9743
10072
|
// 目标 宽
|
|
9744
10073
|
let targetElement_width = offsetInfo.width;
|
|
@@ -9756,6 +10085,31 @@
|
|
|
9756
10085
|
let targetElement_X_center_pos = targetElement_left + targetElement_width / 2 - toolTipElement_width / 2;
|
|
9757
10086
|
/* 目标元素的Y轴的中间位置 */
|
|
9758
10087
|
let targetElement_Y_center_pos = targetElement_top + targetElement_height / 2 - toolTipElement_height / 2;
|
|
10088
|
+
let mouseX = 0;
|
|
10089
|
+
let mouseY = 0;
|
|
10090
|
+
if (event != null) {
|
|
10091
|
+
if (event instanceof MouseEvent || event instanceof PointerEvent) {
|
|
10092
|
+
mouseX = event.pageX;
|
|
10093
|
+
mouseY = event.y;
|
|
10094
|
+
}
|
|
10095
|
+
else if (event instanceof TouchEvent) {
|
|
10096
|
+
let touchEvent = event.touches[0];
|
|
10097
|
+
mouseX = touchEvent.pageX;
|
|
10098
|
+
mouseY = touchEvent.pageY;
|
|
10099
|
+
}
|
|
10100
|
+
else {
|
|
10101
|
+
// @ts-ignore
|
|
10102
|
+
if (typeof event.clientX === "number") {
|
|
10103
|
+
// @ts-ignore
|
|
10104
|
+
mouseX = event.clientX;
|
|
10105
|
+
}
|
|
10106
|
+
// @ts-ignore
|
|
10107
|
+
if (typeof event.clientY === "number") {
|
|
10108
|
+
// @ts-ignore
|
|
10109
|
+
mouseY = event.clientY;
|
|
10110
|
+
}
|
|
10111
|
+
}
|
|
10112
|
+
}
|
|
9759
10113
|
return {
|
|
9760
10114
|
TOP: {
|
|
9761
10115
|
left: targetElement_X_center_pos - otherDistance,
|
|
@@ -9781,13 +10135,19 @@
|
|
|
9781
10135
|
arrow: "right",
|
|
9782
10136
|
motion: "fadeInLeft",
|
|
9783
10137
|
},
|
|
10138
|
+
FOLLOW: {
|
|
10139
|
+
left: mouseX + otherDistance,
|
|
10140
|
+
top: mouseY + otherDistance,
|
|
10141
|
+
arrow: "follow",
|
|
10142
|
+
motion: "",
|
|
10143
|
+
},
|
|
9784
10144
|
};
|
|
9785
10145
|
}
|
|
9786
10146
|
/**
|
|
9787
10147
|
* 动态修改tooltip的位置
|
|
9788
10148
|
*/
|
|
9789
|
-
changePosition() {
|
|
9790
|
-
let positionInfo = this.calcToolTipPosition(this.$data.config.target, this.$data.config.arrowDistance, this.$data.config.otherDistance);
|
|
10149
|
+
changePosition(event) {
|
|
10150
|
+
let positionInfo = this.calcToolTipPosition(this.$data.config.target, this.$data.config.arrowDistance, this.$data.config.otherDistance, event);
|
|
9791
10151
|
let positionKey = this.$data.config.position.toUpperCase();
|
|
9792
10152
|
let positionDetail = positionInfo[positionKey];
|
|
9793
10153
|
if (positionDetail) {
|
|
@@ -9847,13 +10207,13 @@
|
|
|
9847
10207
|
if (typeof timeId === "number") {
|
|
9848
10208
|
// 只清除一个
|
|
9849
10209
|
if (timeId == currentTimeId) {
|
|
9850
|
-
clearTimeout(timeId);
|
|
10210
|
+
popsUtils.clearTimeout(timeId);
|
|
9851
10211
|
timeIdList.splice(index, 1);
|
|
9852
10212
|
break;
|
|
9853
10213
|
}
|
|
9854
10214
|
}
|
|
9855
10215
|
else {
|
|
9856
|
-
clearTimeout(currentTimeId);
|
|
10216
|
+
popsUtils.clearTimeout(currentTimeId);
|
|
9857
10217
|
timeIdList.splice(index, 1);
|
|
9858
10218
|
index--;
|
|
9859
10219
|
}
|
|
@@ -9887,7 +10247,7 @@
|
|
|
9887
10247
|
// 更新内容
|
|
9888
10248
|
this.changeContent();
|
|
9889
10249
|
// 更新tip的位置
|
|
9890
|
-
this.changePosition();
|
|
10250
|
+
this.changePosition(event);
|
|
9891
10251
|
if (typeof this.$data.config.showAfterCallBack === "function") {
|
|
9892
10252
|
this.$data.config.showAfterCallBack(this.$el.$toolTip);
|
|
9893
10253
|
}
|
|
@@ -9932,16 +10292,24 @@
|
|
|
9932
10292
|
this.$data.config.delayCloseTime <= 0)) {
|
|
9933
10293
|
this.$data.config.delayCloseTime = 100;
|
|
9934
10294
|
}
|
|
9935
|
-
let timeId = setTimeout(() => {
|
|
10295
|
+
let timeId = popsUtils.setTimeout(() => {
|
|
9936
10296
|
// 设置属性触发关闭动画
|
|
9937
10297
|
this.clearCloseTimeoutId(eventType, timeId);
|
|
9938
10298
|
if (this.$el.$toolTip == null) {
|
|
9939
10299
|
// 已清除了
|
|
9940
10300
|
return;
|
|
9941
10301
|
}
|
|
9942
|
-
this.$el.$toolTip.
|
|
9943
|
-
|
|
9944
|
-
|
|
10302
|
+
let motion = this.$el.$toolTip.getAttribute("data-motion");
|
|
10303
|
+
if (motion == null || motion.trim() === "") {
|
|
10304
|
+
// 没有动画
|
|
10305
|
+
this.toolTipAnimationFinishEvent();
|
|
10306
|
+
}
|
|
10307
|
+
else {
|
|
10308
|
+
// 修改data-motion触发动画关闭
|
|
10309
|
+
this.$el.$toolTip.setAttribute("data-motion", this.$el.$toolTip
|
|
10310
|
+
.getAttribute("data-motion")
|
|
10311
|
+
.replace("fadeIn", "fadeOut"));
|
|
10312
|
+
}
|
|
9945
10313
|
}, this.$data.config.delayCloseTime);
|
|
9946
10314
|
this.addCloseTimeoutId(eventType, timeId);
|
|
9947
10315
|
if (typeof this.$data.config.closeAfterCallBack === "function") {
|
|
@@ -10046,8 +10414,8 @@
|
|
|
10046
10414
|
popsDOMUtils.off(this.$el.$toolTip, "mouseleave touchend", this.toolTipMouseLeaveEvent, this.$data.config.eventOption);
|
|
10047
10415
|
}
|
|
10048
10416
|
}
|
|
10049
|
-
|
|
10050
|
-
|
|
10417
|
+
const PopsTooltip = {
|
|
10418
|
+
init(details) {
|
|
10051
10419
|
const guid = popsUtils.getRandomGUID();
|
|
10052
10420
|
// 设置当前类型
|
|
10053
10421
|
const PopsType = "tooltip";
|
|
@@ -10055,7 +10423,7 @@
|
|
|
10055
10423
|
config = popsUtils.assign(config, GlobalConfig.getGlobalConfig());
|
|
10056
10424
|
config = popsUtils.assign(config, details);
|
|
10057
10425
|
if (!(config.target instanceof HTMLElement)) {
|
|
10058
|
-
throw "config.target 必须是HTMLElement类型";
|
|
10426
|
+
throw new TypeError("config.target 必须是HTMLElement类型");
|
|
10059
10427
|
}
|
|
10060
10428
|
config = PopsHandler.handleOnly(PopsType, config);
|
|
10061
10429
|
const { $shadowContainer, $shadowRoot } = PopsHandler.handlerShadow(config);
|
|
@@ -10075,20 +10443,20 @@
|
|
|
10075
10443
|
toolTip.show();
|
|
10076
10444
|
}
|
|
10077
10445
|
return {
|
|
10078
|
-
guid
|
|
10079
|
-
config
|
|
10080
|
-
$shadowContainer
|
|
10081
|
-
$shadowRoot
|
|
10082
|
-
toolTip
|
|
10446
|
+
guid,
|
|
10447
|
+
config,
|
|
10448
|
+
$shadowContainer,
|
|
10449
|
+
$shadowRoot,
|
|
10450
|
+
toolTip,
|
|
10083
10451
|
};
|
|
10084
|
-
}
|
|
10085
|
-
}
|
|
10452
|
+
},
|
|
10453
|
+
};
|
|
10086
10454
|
|
|
10087
10455
|
class Pops {
|
|
10088
10456
|
/** 配置 */
|
|
10089
10457
|
config = {
|
|
10090
10458
|
/** 版本号 */
|
|
10091
|
-
version: "2025.5.
|
|
10459
|
+
version: "2025.5.26",
|
|
10092
10460
|
cssText: {
|
|
10093
10461
|
/** 主CSS */
|
|
10094
10462
|
index: indexCSS,
|
|
@@ -10197,7 +10565,7 @@
|
|
|
10197
10565
|
popsDOMUtils.appendHead(animationStyle);
|
|
10198
10566
|
this.config.animation = null;
|
|
10199
10567
|
this.config.animation = PopsInstanceUtils.getKeyFrames(animationStyle.sheet);
|
|
10200
|
-
setTimeout(() => {
|
|
10568
|
+
popsUtils.setTimeout(() => {
|
|
10201
10569
|
animationStyle.remove();
|
|
10202
10570
|
}, 50);
|
|
10203
10571
|
}
|
|
@@ -10234,42 +10602,47 @@
|
|
|
10234
10602
|
* @param details 配置
|
|
10235
10603
|
*/
|
|
10236
10604
|
alert = (details) => {
|
|
10237
|
-
|
|
10605
|
+
let dialog = PopsAlert.init(details);
|
|
10606
|
+
return dialog;
|
|
10238
10607
|
};
|
|
10239
10608
|
/**
|
|
10240
10609
|
* 询问框
|
|
10241
10610
|
* @param details 配置
|
|
10242
10611
|
*/
|
|
10243
10612
|
confirm = (details) => {
|
|
10244
|
-
|
|
10613
|
+
let dialog = PopsConfirm.init(details);
|
|
10614
|
+
return dialog;
|
|
10245
10615
|
};
|
|
10246
10616
|
/**
|
|
10247
10617
|
* 输入框
|
|
10248
10618
|
* @param details 配置
|
|
10249
10619
|
*/
|
|
10250
10620
|
prompt = (details) => {
|
|
10251
|
-
|
|
10621
|
+
let dialog = PopsPrompt.init(details);
|
|
10622
|
+
return dialog;
|
|
10252
10623
|
};
|
|
10253
10624
|
/**
|
|
10254
10625
|
* 加载层
|
|
10255
10626
|
* @param details 配置
|
|
10256
10627
|
*/
|
|
10257
10628
|
loading = (details) => {
|
|
10258
|
-
|
|
10629
|
+
let popsLoading = PopsLoading.init(details);
|
|
10630
|
+
return popsLoading;
|
|
10259
10631
|
};
|
|
10260
10632
|
/**
|
|
10261
10633
|
* iframe层
|
|
10262
10634
|
* @param details 配置
|
|
10263
10635
|
*/
|
|
10264
10636
|
iframe = (details) => {
|
|
10265
|
-
|
|
10637
|
+
let dialog = PopsIframe.init(details);
|
|
10638
|
+
return dialog;
|
|
10266
10639
|
};
|
|
10267
10640
|
/**
|
|
10268
10641
|
* 提示框
|
|
10269
10642
|
* @param details 配置
|
|
10270
10643
|
*/
|
|
10271
10644
|
tooltip = (details) => {
|
|
10272
|
-
let popsTooltip =
|
|
10645
|
+
let popsTooltip = PopsTooltip.init(details);
|
|
10273
10646
|
return popsTooltip;
|
|
10274
10647
|
};
|
|
10275
10648
|
/**
|
|
@@ -10277,35 +10650,40 @@
|
|
|
10277
10650
|
* @param details 配置
|
|
10278
10651
|
*/
|
|
10279
10652
|
drawer = (details) => {
|
|
10280
|
-
|
|
10653
|
+
let dialog = PopsDrawer.init(details);
|
|
10654
|
+
return dialog;
|
|
10281
10655
|
};
|
|
10282
10656
|
/**
|
|
10283
10657
|
* 文件夹
|
|
10284
10658
|
* @param details 配置
|
|
10285
10659
|
*/
|
|
10286
10660
|
folder = (details) => {
|
|
10287
|
-
|
|
10661
|
+
let dialog = PopsFolder.init(details);
|
|
10662
|
+
return dialog;
|
|
10288
10663
|
};
|
|
10289
10664
|
/**
|
|
10290
10665
|
* 配置面板
|
|
10291
10666
|
* @param details 配置
|
|
10292
10667
|
*/
|
|
10293
10668
|
panel = (details) => {
|
|
10294
|
-
|
|
10669
|
+
let dialog = PopsPanel.init(details);
|
|
10670
|
+
return dialog;
|
|
10295
10671
|
};
|
|
10296
10672
|
/**
|
|
10297
10673
|
* 右键菜单
|
|
10298
10674
|
* @param details 配置
|
|
10299
10675
|
*/
|
|
10300
10676
|
rightClickMenu = (details) => {
|
|
10301
|
-
|
|
10677
|
+
let popsRightClickMenu = PopsRightClickMenu.init(details);
|
|
10678
|
+
return popsRightClickMenu;
|
|
10302
10679
|
};
|
|
10303
10680
|
/**
|
|
10304
10681
|
* 搜索建议
|
|
10305
10682
|
* @param details 配置
|
|
10306
10683
|
*/
|
|
10307
10684
|
searchSuggestion = (details) => {
|
|
10308
|
-
|
|
10685
|
+
let popsSearchSuggestion = PopsSearchSuggestion.init(details);
|
|
10686
|
+
return popsSearchSuggestion;
|
|
10309
10687
|
};
|
|
10310
10688
|
}
|
|
10311
10689
|
const pops = new Pops();
|