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