@whitesev/pops 3.1.2 → 3.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.amd.js +337 -250
- package/dist/index.amd.js.map +1 -1
- package/dist/index.amd.min.js +1 -1
- package/dist/index.amd.min.js.map +1 -1
- package/dist/index.cjs.js +337 -250
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.cjs.min.js +1 -1
- package/dist/index.cjs.min.js.map +1 -1
- package/dist/index.esm.js +337 -250
- package/dist/index.esm.js.map +1 -1
- package/dist/index.esm.min.js +1 -1
- package/dist/index.esm.min.js.map +1 -1
- package/dist/index.iife.js +337 -250
- package/dist/index.iife.js.map +1 -1
- package/dist/index.iife.min.js +1 -1
- package/dist/index.iife.min.js.map +1 -1
- package/dist/index.system.js +337 -250
- package/dist/index.system.js.map +1 -1
- package/dist/index.system.min.js +1 -1
- package/dist/index.system.min.js.map +1 -1
- package/dist/index.umd.js +337 -250
- package/dist/index.umd.js.map +1 -1
- package/dist/index.umd.min.js +1 -1
- package/dist/index.umd.min.js.map +1 -1
- package/dist/types/src/Pops.d.ts +10 -10
- package/dist/types/src/components/panel/index.d.ts +2 -2
- package/dist/types/src/components/rightClickMenu/index.d.ts +1 -1
- package/dist/types/src/components/rightClickMenu/types/index.d.ts +8 -1
- package/dist/types/src/components/tooltip/index.d.ts +5 -5
- package/dist/types/src/components/tooltip/types/index.d.ts +15 -14
- package/dist/types/src/handler/PopsHandler.d.ts +4 -4
- package/dist/types/src/types/PopsDOMUtilsEventType.d.ts +39 -0
- package/dist/types/src/types/components.d.ts +2 -1
- package/dist/types/src/types/event.d.ts +13 -3
- package/dist/types/src/types/inst.d.ts +4 -0
- package/dist/types/src/utils/PopsDOMUtils.d.ts +10 -12
- package/dist/types/src/utils/PopsInstanceUtils.d.ts +2 -2
- package/package.json +9 -9
- package/src/components/alert/index.ts +3 -1
- package/src/components/confirm/index.ts +3 -1
- package/src/components/drawer/index.ts +3 -1
- package/src/components/folder/index.ts +3 -1
- package/src/components/iframe/index.ts +6 -4
- package/src/components/panel/handlerComponents.ts +26 -26
- package/src/components/panel/index.ts +3 -1
- package/src/components/prompt/index.ts +3 -1
- package/src/components/rightClickMenu/defaultConfig.ts +1 -0
- package/src/components/rightClickMenu/index.ts +18 -7
- package/src/components/rightClickMenu/types/index.ts +8 -1
- package/src/components/searchSuggestion/index.ts +7 -19
- package/src/components/tooltip/defaultConfig.ts +1 -1
- package/src/components/tooltip/index.ts +38 -23
- package/src/components/tooltip/types/index.ts +15 -14
- package/src/handler/PopsHandler.ts +22 -19
- package/src/types/PopsDOMUtilsEventType.d.ts +39 -0
- package/src/types/components.d.ts +2 -1
- package/src/types/event.d.ts +13 -3
- package/src/types/inst.d.ts +4 -0
- package/src/utils/PopsDOMUtils.ts +71 -40
- package/src/utils/PopsInstanceUtils.ts +62 -30
- package/src/utils/PopsUtils.ts +1 -1
package/dist/index.system.js
CHANGED
|
@@ -264,47 +264,7 @@ System.register('pops', [], (function (exports) {
|
|
|
264
264
|
const cache = createCache(LAST_NUMBER_WEAK_MAP);
|
|
265
265
|
const generateUniqueNumber = createGenerateUniqueNumber(cache, LAST_NUMBER_WEAK_MAP);
|
|
266
266
|
|
|
267
|
-
const
|
|
268
|
-
return typeof sender.start === 'function';
|
|
269
|
-
};
|
|
270
|
-
|
|
271
|
-
const PORT_MAP = new WeakMap();
|
|
272
|
-
|
|
273
|
-
const extendBrokerImplementation = (partialBrokerImplementation) => ({
|
|
274
|
-
...partialBrokerImplementation,
|
|
275
|
-
connect: ({ call }) => {
|
|
276
|
-
return async () => {
|
|
277
|
-
const { port1, port2 } = new MessageChannel();
|
|
278
|
-
const portId = await call('connect', { port: port1 }, [port1]);
|
|
279
|
-
PORT_MAP.set(port2, portId);
|
|
280
|
-
return port2;
|
|
281
|
-
};
|
|
282
|
-
},
|
|
283
|
-
disconnect: ({ call }) => {
|
|
284
|
-
return async (port) => {
|
|
285
|
-
const portId = PORT_MAP.get(port);
|
|
286
|
-
if (portId === undefined) {
|
|
287
|
-
throw new Error('The given port is not connected.');
|
|
288
|
-
}
|
|
289
|
-
await call('disconnect', { portId });
|
|
290
|
-
};
|
|
291
|
-
},
|
|
292
|
-
isSupported: ({ call }) => {
|
|
293
|
-
return () => call('isSupported');
|
|
294
|
-
}
|
|
295
|
-
});
|
|
296
|
-
|
|
297
|
-
const ONGOING_REQUESTS = new WeakMap();
|
|
298
|
-
const createOrGetOngoingRequests = (sender) => {
|
|
299
|
-
if (ONGOING_REQUESTS.has(sender)) {
|
|
300
|
-
// @todo TypeScript needs to be convinced that has() works as expected.
|
|
301
|
-
return ONGOING_REQUESTS.get(sender);
|
|
302
|
-
}
|
|
303
|
-
const ongoingRequests = new Map();
|
|
304
|
-
ONGOING_REQUESTS.set(sender, ongoingRequests);
|
|
305
|
-
return ongoingRequests;
|
|
306
|
-
};
|
|
307
|
-
const createBroker = (brokerImplementation) => {
|
|
267
|
+
const createBrokerFactory = (createOrGetOngoingRequests, extendBrokerImplementation, generateUniqueNumber, isMessagePort) => (brokerImplementation) => {
|
|
308
268
|
const fullBrokerImplementation = extendBrokerImplementation(brokerImplementation);
|
|
309
269
|
return (sender) => {
|
|
310
270
|
const ongoingRequests = createOrGetOngoingRequests(sender);
|
|
@@ -347,81 +307,115 @@ System.register('pops', [], (function (exports) {
|
|
|
347
307
|
};
|
|
348
308
|
};
|
|
349
309
|
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
310
|
+
const createCreateOrGetOngoingRequests = (ongoingRequestsMap) => (sender) => {
|
|
311
|
+
if (ongoingRequestsMap.has(sender)) {
|
|
312
|
+
// @todo TypeScript needs to be convinced that has() works as expected.
|
|
313
|
+
return ongoingRequestsMap.get(sender);
|
|
314
|
+
}
|
|
315
|
+
const ongoingRequests = new Map();
|
|
316
|
+
ongoingRequestsMap.set(sender, ongoingRequests);
|
|
317
|
+
return ongoingRequests;
|
|
318
|
+
};
|
|
319
|
+
|
|
320
|
+
const createExtendBrokerImplementation = (portMap) => (partialBrokerImplementation) => ({
|
|
321
|
+
...partialBrokerImplementation,
|
|
322
|
+
connect: ({ call }) => {
|
|
323
|
+
return async () => {
|
|
324
|
+
const { port1, port2 } = new MessageChannel();
|
|
325
|
+
const portId = await call('connect', { port: port1 }, [port1]);
|
|
326
|
+
portMap.set(port2, portId);
|
|
327
|
+
return port2;
|
|
362
328
|
};
|
|
363
329
|
},
|
|
364
|
-
|
|
365
|
-
return (
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
scheduledTimeoutsState.delete(timerId);
|
|
370
|
-
});
|
|
330
|
+
disconnect: ({ call }) => {
|
|
331
|
+
return async (port) => {
|
|
332
|
+
const portId = portMap.get(port);
|
|
333
|
+
if (portId === undefined) {
|
|
334
|
+
throw new Error('The given port is not connected.');
|
|
371
335
|
}
|
|
336
|
+
await call('disconnect', { portId });
|
|
372
337
|
};
|
|
373
338
|
},
|
|
374
|
-
|
|
375
|
-
return (
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
};
|
|
400
|
-
},
|
|
401
|
-
setTimeout: ({ call }) => {
|
|
402
|
-
return (func, delay = 0, ...args) => {
|
|
403
|
-
const symbol = Symbol();
|
|
404
|
-
const timerId = generateUniqueNumber(scheduledTimeoutsState);
|
|
405
|
-
scheduledTimeoutsState.set(timerId, symbol);
|
|
406
|
-
call('set', {
|
|
407
|
-
delay,
|
|
408
|
-
now: performance.timeOrigin + performance.now(),
|
|
409
|
-
timerId,
|
|
410
|
-
timerType: 'timeout'
|
|
411
|
-
}).then(() => {
|
|
412
|
-
const state = scheduledTimeoutsState.get(timerId);
|
|
413
|
-
if (state === undefined) {
|
|
414
|
-
throw new Error('The timer is in an undefined state.');
|
|
415
|
-
}
|
|
416
|
-
if (state === symbol) {
|
|
417
|
-
// A timeout can be savely deleted because it is only called once.
|
|
418
|
-
scheduledTimeoutsState.delete(timerId);
|
|
419
|
-
func(...args);
|
|
420
|
-
}
|
|
421
|
-
});
|
|
422
|
-
return timerId;
|
|
423
|
-
};
|
|
339
|
+
isSupported: ({ call }) => {
|
|
340
|
+
return () => call('isSupported');
|
|
341
|
+
}
|
|
342
|
+
});
|
|
343
|
+
|
|
344
|
+
const isMessagePort = (sender) => {
|
|
345
|
+
return typeof sender.start === 'function';
|
|
346
|
+
};
|
|
347
|
+
|
|
348
|
+
const createBroker = createBrokerFactory(createCreateOrGetOngoingRequests(new WeakMap()), createExtendBrokerImplementation(new WeakMap()), generateUniqueNumber, isMessagePort);
|
|
349
|
+
|
|
350
|
+
const createClearIntervalFactory = (scheduledIntervalsState) => (clear) => (timerId) => {
|
|
351
|
+
if (typeof scheduledIntervalsState.get(timerId) === 'symbol') {
|
|
352
|
+
scheduledIntervalsState.set(timerId, null);
|
|
353
|
+
clear(timerId).then(() => {
|
|
354
|
+
scheduledIntervalsState.delete(timerId);
|
|
355
|
+
});
|
|
356
|
+
}
|
|
357
|
+
};
|
|
358
|
+
|
|
359
|
+
const createClearTimeoutFactory = (scheduledTimeoutsState) => (clear) => (timerId) => {
|
|
360
|
+
if (typeof scheduledTimeoutsState.get(timerId) === 'symbol') {
|
|
361
|
+
scheduledTimeoutsState.set(timerId, null);
|
|
362
|
+
clear(timerId).then(() => {
|
|
363
|
+
scheduledTimeoutsState.delete(timerId);
|
|
364
|
+
});
|
|
424
365
|
}
|
|
366
|
+
};
|
|
367
|
+
|
|
368
|
+
const createSetIntervalFactory = (generateUniqueNumber, scheduledIntervalsState) => (set) => (func, delay = 0, ...args) => {
|
|
369
|
+
const symbol = Symbol();
|
|
370
|
+
const timerId = generateUniqueNumber(scheduledIntervalsState);
|
|
371
|
+
scheduledIntervalsState.set(timerId, symbol);
|
|
372
|
+
const schedule = () => set(delay, timerId).then(() => {
|
|
373
|
+
const state = scheduledIntervalsState.get(timerId);
|
|
374
|
+
if (state === undefined) {
|
|
375
|
+
throw new Error('The timer is in an undefined state.');
|
|
376
|
+
}
|
|
377
|
+
if (state === symbol) {
|
|
378
|
+
func(...args);
|
|
379
|
+
// Doublecheck if the interval should still be rescheduled because it could have been cleared inside of func().
|
|
380
|
+
if (scheduledIntervalsState.get(timerId) === symbol) {
|
|
381
|
+
schedule();
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
});
|
|
385
|
+
schedule();
|
|
386
|
+
return timerId;
|
|
387
|
+
};
|
|
388
|
+
|
|
389
|
+
const createSetTimeoutFactory = (generateUniqueNumber, scheduledTimeoutsState) => (set) => (func, delay = 0, ...args) => {
|
|
390
|
+
const symbol = Symbol();
|
|
391
|
+
const timerId = generateUniqueNumber(scheduledTimeoutsState);
|
|
392
|
+
scheduledTimeoutsState.set(timerId, symbol);
|
|
393
|
+
set(delay, timerId).then(() => {
|
|
394
|
+
const state = scheduledTimeoutsState.get(timerId);
|
|
395
|
+
if (state === undefined) {
|
|
396
|
+
throw new Error('The timer is in an undefined state.');
|
|
397
|
+
}
|
|
398
|
+
if (state === symbol) {
|
|
399
|
+
// A timeout can be savely deleted because it is only called once.
|
|
400
|
+
scheduledTimeoutsState.delete(timerId);
|
|
401
|
+
func(...args);
|
|
402
|
+
}
|
|
403
|
+
});
|
|
404
|
+
return timerId;
|
|
405
|
+
};
|
|
406
|
+
|
|
407
|
+
// Prefilling the Maps with a function indexed by zero is necessary to be compliant with the specification.
|
|
408
|
+
const scheduledIntervalsState = new Map([[0, null]]); // tslint:disable-line no-empty
|
|
409
|
+
const scheduledTimeoutsState = new Map([[0, null]]); // tslint:disable-line no-empty
|
|
410
|
+
const createClearInterval = createClearIntervalFactory(scheduledIntervalsState);
|
|
411
|
+
const createClearTimeout = createClearTimeoutFactory(scheduledTimeoutsState);
|
|
412
|
+
const createSetInterval = createSetIntervalFactory(generateUniqueNumber, scheduledIntervalsState);
|
|
413
|
+
const createSetTimeout = createSetTimeoutFactory(generateUniqueNumber, scheduledTimeoutsState);
|
|
414
|
+
const wrap = createBroker({
|
|
415
|
+
clearInterval: ({ call }) => createClearInterval((timerId) => call('clear', { timerId, timerType: 'interval' })),
|
|
416
|
+
clearTimeout: ({ call }) => createClearTimeout((timerId) => call('clear', { timerId, timerType: 'timeout' })),
|
|
417
|
+
setInterval: ({ call }) => createSetInterval((delay, timerId) => call('set', { delay, now: performance.timeOrigin + performance.now(), timerId, timerType: 'interval' })),
|
|
418
|
+
setTimeout: ({ call }) => createSetTimeout((delay, timerId) => call('set', { delay, now: performance.timeOrigin + performance.now(), timerId, timerType: 'timeout' }))
|
|
425
419
|
});
|
|
426
420
|
const load = (url) => {
|
|
427
421
|
const worker = new Worker(url);
|
|
@@ -444,7 +438,7 @@ System.register('pops', [], (function (exports) {
|
|
|
444
438
|
};
|
|
445
439
|
|
|
446
440
|
// This is the minified and stringified code of the worker-timers-worker package.
|
|
447
|
-
const worker = `(()=>{var e={455
|
|
441
|
+
const worker = `(()=>{var e={455(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),l=t(c);e.addUniqueNumber=l,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 l=r instanceof Promise?await r:r;if(null===a){if(void 0!==l.result)throw s(i)}else{if(void 0===l.result)throw s(i);const{result:e,transferables:r=[]}=l;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}}}),l=(e,t,r=()=>!0)=>{const n=c(l,t,r),o=a(e,n);return e.addEventListener("message",o),()=>e.removeEventListener("message",o)},d=(e,t)=>r=>{const n=t.get(r);if(void 0===n)return Promise.resolve(!1);const[o,s]=n;return e(o),t.delete(r),s(!1),Promise.resolve(!0)},m=(e,t,r,n)=>(o,s,a)=>{const i=o+s-t.timeOrigin,u=i-t.now();return new Promise(t=>{e.set(a,[r(n,u,i,e,t,a),t])})},f=new Map,h=d(globalThis.clearTimeout,f),p=new Map,v=d(globalThis.clearTimeout,p),w=((e,t)=>{const r=(n,o,s,a)=>{const i=n-e.now();i>0?o.set(a,[t(r,i,n,o,s,a),s]):(o.delete(a),s(!0))};return r})(performance,globalThis.setTimeout),g=m(f,performance,globalThis.setTimeout,w),T=m(p,performance,globalThis.setTimeout,w);l(self,{clear:async({timerId:e,timerType:t})=>({result:await("interval"===t?h(e):v(e))}),set:async({delay:e,now:t,timerId:r,timerType:n})=>({result:await("interval"===n?g:T)(e,t,r)})})})()})();`; // tslint:disable-line:max-line-length
|
|
448
442
|
|
|
449
443
|
const loadOrReturnBroker = createLoadOrReturnBroker(load, worker);
|
|
450
444
|
const clearInterval$1 = (timerId) => loadOrReturnBroker().clearInterval(timerId);
|
|
@@ -525,7 +519,7 @@ System.register('pops', [], (function (exports) {
|
|
|
525
519
|
* @param propName
|
|
526
520
|
*/
|
|
527
521
|
delete(target, propName) {
|
|
528
|
-
if (typeof Reflect === "object" && Reflect.deleteProperty) {
|
|
522
|
+
if (typeof Reflect === "object" && typeof Reflect.deleteProperty === "function") {
|
|
529
523
|
Reflect.deleteProperty(target, propName);
|
|
530
524
|
}
|
|
531
525
|
else {
|
|
@@ -1031,13 +1025,13 @@ System.register('pops', [], (function (exports) {
|
|
|
1031
1025
|
if (element == null) {
|
|
1032
1026
|
return;
|
|
1033
1027
|
}
|
|
1034
|
-
let
|
|
1028
|
+
let $elList = [];
|
|
1035
1029
|
if (element instanceof NodeList || Array.isArray(element)) {
|
|
1036
1030
|
element = element;
|
|
1037
|
-
|
|
1031
|
+
$elList = $elList.concat(element);
|
|
1038
1032
|
}
|
|
1039
1033
|
else {
|
|
1040
|
-
|
|
1034
|
+
$elList.push(element);
|
|
1041
1035
|
}
|
|
1042
1036
|
let eventTypeList = [];
|
|
1043
1037
|
if (Array.isArray(eventType)) {
|
|
@@ -1088,7 +1082,7 @@ System.register('pops', [], (function (exports) {
|
|
|
1088
1082
|
// 目标函数、事件名、回调函数、事件配置、过滤函数
|
|
1089
1083
|
filter = option;
|
|
1090
1084
|
}
|
|
1091
|
-
|
|
1085
|
+
$elList.forEach((elementItem) => {
|
|
1092
1086
|
// 获取对象上的事件
|
|
1093
1087
|
const elementEvents = Reflect.get(elementItem, SymbolEvents) || {};
|
|
1094
1088
|
eventTypeList.forEach((eventName) => {
|
|
@@ -1135,18 +1129,19 @@ System.register('pops', [], (function (exports) {
|
|
|
1135
1129
|
* @param eventType (可选)需要取消监听的事件
|
|
1136
1130
|
*/
|
|
1137
1131
|
offAll(element, eventType) {
|
|
1132
|
+
const that = this;
|
|
1138
1133
|
if (typeof element === "string") {
|
|
1139
|
-
element =
|
|
1134
|
+
element = that.selectorAll(element);
|
|
1140
1135
|
}
|
|
1141
1136
|
if (element == null) {
|
|
1142
1137
|
return;
|
|
1143
1138
|
}
|
|
1144
|
-
let
|
|
1139
|
+
let $elList = [];
|
|
1145
1140
|
if (element instanceof NodeList || Array.isArray(element)) {
|
|
1146
|
-
|
|
1141
|
+
$elList = $elList.concat(Array.from(element));
|
|
1147
1142
|
}
|
|
1148
1143
|
else {
|
|
1149
|
-
|
|
1144
|
+
$elList.push(element);
|
|
1150
1145
|
}
|
|
1151
1146
|
let eventTypeList = [];
|
|
1152
1147
|
if (Array.isArray(eventType)) {
|
|
@@ -1155,12 +1150,13 @@ System.register('pops', [], (function (exports) {
|
|
|
1155
1150
|
else if (typeof eventType === "string") {
|
|
1156
1151
|
eventTypeList = eventTypeList.concat(eventType.split(" "));
|
|
1157
1152
|
}
|
|
1158
|
-
|
|
1159
|
-
Object.getOwnPropertySymbols(
|
|
1160
|
-
|
|
1153
|
+
$elList.forEach(($elItem) => {
|
|
1154
|
+
const symbolList = [...new Set([...Object.getOwnPropertySymbols($elItem), SymbolEvents])];
|
|
1155
|
+
symbolList.forEach((symbolItem) => {
|
|
1156
|
+
if (!symbolItem.toString().startsWith("Symbol(events_")) {
|
|
1161
1157
|
return;
|
|
1162
1158
|
}
|
|
1163
|
-
const elementEvents =
|
|
1159
|
+
const elementEvents = Reflect.get($elItem, symbolItem) || {};
|
|
1164
1160
|
const iterEventNameList = eventTypeList.length ? eventTypeList : Object.keys(elementEvents);
|
|
1165
1161
|
iterEventNameList.forEach((eventName) => {
|
|
1166
1162
|
const handlers = elementEvents[eventName];
|
|
@@ -1168,11 +1164,12 @@ System.register('pops', [], (function (exports) {
|
|
|
1168
1164
|
return;
|
|
1169
1165
|
}
|
|
1170
1166
|
for (const handler of handlers) {
|
|
1171
|
-
|
|
1167
|
+
$elItem.removeEventListener(eventName, handler.callback, {
|
|
1172
1168
|
capture: handler["option"]["capture"],
|
|
1173
1169
|
});
|
|
1174
1170
|
}
|
|
1175
|
-
|
|
1171
|
+
const events = Reflect.get($elItem, symbolItem);
|
|
1172
|
+
popsUtils.delete(events, eventName);
|
|
1176
1173
|
});
|
|
1177
1174
|
});
|
|
1178
1175
|
});
|
|
@@ -1915,7 +1912,8 @@ System.register('pops', [], (function (exports) {
|
|
|
1915
1912
|
}
|
|
1916
1913
|
return $el.classList.contains(className);
|
|
1917
1914
|
}
|
|
1918
|
-
css(
|
|
1915
|
+
css($el, property, value) {
|
|
1916
|
+
const that = this;
|
|
1919
1917
|
/**
|
|
1920
1918
|
* 把纯数字没有px的加上
|
|
1921
1919
|
*/
|
|
@@ -1929,10 +1927,33 @@ System.register('pops', [], (function (exports) {
|
|
|
1929
1927
|
}
|
|
1930
1928
|
return propertyValue;
|
|
1931
1929
|
}
|
|
1932
|
-
if (typeof
|
|
1933
|
-
|
|
1930
|
+
if (typeof $el === "string") {
|
|
1931
|
+
$el = that.selectorAll($el);
|
|
1934
1932
|
}
|
|
1935
|
-
if (
|
|
1933
|
+
if ($el == null) {
|
|
1934
|
+
return;
|
|
1935
|
+
}
|
|
1936
|
+
if (Array.isArray($el) || $el instanceof NodeList) {
|
|
1937
|
+
if (typeof property === "string") {
|
|
1938
|
+
if (value == null) {
|
|
1939
|
+
// 获取属性
|
|
1940
|
+
return that.css($el[0], property);
|
|
1941
|
+
}
|
|
1942
|
+
else {
|
|
1943
|
+
// 设置属性
|
|
1944
|
+
$el.forEach(($elItem) => {
|
|
1945
|
+
that.css($elItem, property);
|
|
1946
|
+
});
|
|
1947
|
+
return;
|
|
1948
|
+
}
|
|
1949
|
+
}
|
|
1950
|
+
else if (typeof property === "object") {
|
|
1951
|
+
// 设置属性
|
|
1952
|
+
$el.forEach(($elItem) => {
|
|
1953
|
+
that.css($elItem, property);
|
|
1954
|
+
});
|
|
1955
|
+
return;
|
|
1956
|
+
}
|
|
1936
1957
|
return;
|
|
1937
1958
|
}
|
|
1938
1959
|
const setStyleProperty = (propertyName, propertyValue) => {
|
|
@@ -1941,16 +1962,16 @@ System.register('pops', [], (function (exports) {
|
|
|
1941
1962
|
.trim()
|
|
1942
1963
|
.replace(/!important$/gi, "")
|
|
1943
1964
|
.trim();
|
|
1944
|
-
|
|
1965
|
+
$el.style.setProperty(propertyName, propertyValue, "important");
|
|
1945
1966
|
}
|
|
1946
1967
|
else {
|
|
1947
1968
|
propertyValue = handlePixe(propertyName, propertyValue);
|
|
1948
|
-
|
|
1969
|
+
$el.style.setProperty(propertyName, propertyValue);
|
|
1949
1970
|
}
|
|
1950
1971
|
};
|
|
1951
1972
|
if (typeof property === "string") {
|
|
1952
1973
|
if (value == null) {
|
|
1953
|
-
return getComputedStyle(
|
|
1974
|
+
return PopsCore.globalThis.getComputedStyle($el).getPropertyValue(property);
|
|
1954
1975
|
}
|
|
1955
1976
|
else {
|
|
1956
1977
|
setStyleProperty(property, value);
|
|
@@ -1962,6 +1983,10 @@ System.register('pops', [], (function (exports) {
|
|
|
1962
1983
|
setStyleProperty(prop, value);
|
|
1963
1984
|
}
|
|
1964
1985
|
}
|
|
1986
|
+
else {
|
|
1987
|
+
// 其他情况
|
|
1988
|
+
throw new TypeError("property must be string or object");
|
|
1989
|
+
}
|
|
1965
1990
|
}
|
|
1966
1991
|
/**
|
|
1967
1992
|
* 创建元素
|
|
@@ -3096,16 +3121,16 @@ System.register('pops', [], (function (exports) {
|
|
|
3096
3121
|
},
|
|
3097
3122
|
/**
|
|
3098
3123
|
* 删除配置中对应的对象
|
|
3099
|
-
* @param
|
|
3124
|
+
* @param totalInstConfigList 配置实例列表
|
|
3100
3125
|
* @param guid 唯一标识
|
|
3101
3126
|
* @param isAll 是否全部删除
|
|
3102
3127
|
*/
|
|
3103
|
-
removeInstance(
|
|
3128
|
+
async removeInstance(totalInstConfigList, guid, isAll = false) {
|
|
3104
3129
|
/**
|
|
3105
3130
|
* 移除元素实例
|
|
3106
3131
|
* @param instCommonConfig
|
|
3107
3132
|
*/
|
|
3108
|
-
function
|
|
3133
|
+
const removeInst = function (instCommonConfig) {
|
|
3109
3134
|
if (typeof instCommonConfig.beforeRemoveCallBack === "function") {
|
|
3110
3135
|
// 调用移除签的回调
|
|
3111
3136
|
instCommonConfig.beforeRemoveCallBack(instCommonConfig);
|
|
@@ -3114,39 +3139,44 @@ System.register('pops', [], (function (exports) {
|
|
|
3114
3139
|
instCommonConfig?.$pops?.remove();
|
|
3115
3140
|
instCommonConfig?.$mask?.remove();
|
|
3116
3141
|
instCommonConfig?.$shadowContainer?.remove();
|
|
3117
|
-
}
|
|
3142
|
+
};
|
|
3143
|
+
const asyncInstTask = [];
|
|
3118
3144
|
// [ inst[], inst[],...]
|
|
3119
|
-
|
|
3145
|
+
totalInstConfigList.forEach((instConfigList) => {
|
|
3120
3146
|
// inst[]
|
|
3121
|
-
instConfigList.forEach((instConfigItem, index) => {
|
|
3147
|
+
instConfigList.forEach(async (instConfigItem, index) => {
|
|
3122
3148
|
// 移除全部或者guid相同
|
|
3123
|
-
if (isAll ||
|
|
3149
|
+
if (isAll || (typeof guid === "string" && instConfigItem.guid === guid)) {
|
|
3124
3150
|
// 判断是否有动画
|
|
3125
3151
|
const animName = instConfigItem.$anim.getAttribute("anim");
|
|
3126
3152
|
if (PopsAnimation.hasAnim(animName)) {
|
|
3127
3153
|
const reverseAnimName = animName + "-reverse";
|
|
3128
|
-
instConfigItem.$anim
|
|
3129
|
-
instConfigItem.$anim
|
|
3130
|
-
instConfigItem.$anim
|
|
3131
|
-
if (PopsAnimation.hasAnim(instConfigItem.$anim
|
|
3132
|
-
|
|
3133
|
-
|
|
3134
|
-
|
|
3135
|
-
|
|
3136
|
-
|
|
3154
|
+
popsDOMUtils.css(instConfigItem.$anim, "width", "100%");
|
|
3155
|
+
popsDOMUtils.css(instConfigItem.$anim, "height", "100%");
|
|
3156
|
+
popsDOMUtils.css(instConfigItem.$anim, "animation-name", reverseAnimName);
|
|
3157
|
+
if (PopsAnimation.hasAnim(popsDOMUtils.css(instConfigItem.$anim, "animation-name"))) {
|
|
3158
|
+
asyncInstTask.push(new Promise((resolve) => {
|
|
3159
|
+
popsDOMUtils.on(instConfigItem.$anim, popsDOMUtils.getAnimationEndNameList(), function () {
|
|
3160
|
+
removeInst(instConfigItem);
|
|
3161
|
+
resolve();
|
|
3162
|
+
}, {
|
|
3163
|
+
capture: true,
|
|
3164
|
+
});
|
|
3165
|
+
}));
|
|
3137
3166
|
}
|
|
3138
3167
|
else {
|
|
3139
|
-
|
|
3168
|
+
removeInst(instConfigItem);
|
|
3140
3169
|
}
|
|
3141
3170
|
}
|
|
3142
3171
|
else {
|
|
3143
|
-
|
|
3172
|
+
removeInst(instConfigItem);
|
|
3144
3173
|
}
|
|
3145
3174
|
instConfigList.splice(index, 1);
|
|
3146
3175
|
}
|
|
3147
3176
|
});
|
|
3148
3177
|
});
|
|
3149
|
-
|
|
3178
|
+
await Promise.all(asyncInstTask);
|
|
3179
|
+
return totalInstConfigList;
|
|
3150
3180
|
},
|
|
3151
3181
|
/**
|
|
3152
3182
|
* 隐藏
|
|
@@ -3291,8 +3321,9 @@ System.register('pops', [], (function (exports) {
|
|
|
3291
3321
|
* @param config
|
|
3292
3322
|
* @param $anim
|
|
3293
3323
|
*/
|
|
3294
|
-
close(config, popsType, instConfigList, guid, $anim) {
|
|
3295
|
-
|
|
3324
|
+
async close(config, popsType, instConfigList, guid, $anim) {
|
|
3325
|
+
// eslint-disable-next-line no-async-promise-executor
|
|
3326
|
+
await new Promise(async (resolve) => {
|
|
3296
3327
|
const $pops = $anim.querySelector(".pops[type-value]");
|
|
3297
3328
|
const drawerConfig = config;
|
|
3298
3329
|
/**
|
|
@@ -3302,12 +3333,12 @@ System.register('pops', [], (function (exports) {
|
|
|
3302
3333
|
/**
|
|
3303
3334
|
* 弹窗已关闭的回调
|
|
3304
3335
|
*/
|
|
3305
|
-
function closeCallBack(event) {
|
|
3336
|
+
async function closeCallBack(event) {
|
|
3306
3337
|
if (event.propertyName !== "transform") {
|
|
3307
3338
|
return;
|
|
3308
3339
|
}
|
|
3309
|
-
popsDOMUtils.off($pops, popsDOMUtils.getTransitionEndNameList(),
|
|
3310
|
-
PopsInstanceUtils.removeInstance([instConfigList], guid);
|
|
3340
|
+
popsDOMUtils.off($pops, popsDOMUtils.getTransitionEndNameList(), closeCallBack);
|
|
3341
|
+
await PopsInstanceUtils.removeInstance([instConfigList], guid);
|
|
3311
3342
|
resolve();
|
|
3312
3343
|
}
|
|
3313
3344
|
// 监听过渡结束
|
|
@@ -3339,10 +3370,32 @@ System.register('pops', [], (function (exports) {
|
|
|
3339
3370
|
}, drawerConfig.closeDelay);
|
|
3340
3371
|
}
|
|
3341
3372
|
else {
|
|
3342
|
-
PopsInstanceUtils.removeInstance([instConfigList], guid);
|
|
3373
|
+
await PopsInstanceUtils.removeInstance([instConfigList], guid);
|
|
3343
3374
|
resolve();
|
|
3344
3375
|
}
|
|
3345
3376
|
});
|
|
3377
|
+
// 判断组件内是否有rightClickMenu、tooltip、searchSuggestion组件
|
|
3378
|
+
// 有的话也需要关闭
|
|
3379
|
+
PopsInstData.rightClickMenu.forEach((itemConfig) => {
|
|
3380
|
+
const config = itemConfig.config;
|
|
3381
|
+
if (config.$target instanceof HTMLElement) {
|
|
3382
|
+
const $root = config.$target.getRootNode();
|
|
3383
|
+
if ($root instanceof HTMLElement && $root.parentElement == null) {
|
|
3384
|
+
// 触发销毁元素
|
|
3385
|
+
itemConfig.destory();
|
|
3386
|
+
}
|
|
3387
|
+
}
|
|
3388
|
+
});
|
|
3389
|
+
PopsInstData.tooltip.forEach((itemConfig) => {
|
|
3390
|
+
const config = itemConfig.config;
|
|
3391
|
+
if (config.$target instanceof HTMLElement) {
|
|
3392
|
+
const $root = config.$target.getRootNode();
|
|
3393
|
+
if ($root instanceof HTMLElement && $root.parentElement == null) {
|
|
3394
|
+
// 触发销毁元素
|
|
3395
|
+
itemConfig.destory();
|
|
3396
|
+
}
|
|
3397
|
+
}
|
|
3398
|
+
});
|
|
3346
3399
|
},
|
|
3347
3400
|
/**
|
|
3348
3401
|
* 拖拽元素
|
|
@@ -3681,12 +3734,12 @@ System.register('pops', [], (function (exports) {
|
|
|
3681
3734
|
element.hasAttribute("anim"));
|
|
3682
3735
|
}
|
|
3683
3736
|
// 判断按下的元素是否是pops-anim
|
|
3684
|
-
popsDOMUtils.on(config.animElement, ["touchstart", "mousedown"],
|
|
3737
|
+
popsDOMUtils.on(config.animElement, ["touchstart", "mousedown"], (event) => {
|
|
3685
3738
|
const $click = event.composedPath()[0];
|
|
3686
3739
|
isMaskClick = isAnimElement($click);
|
|
3687
3740
|
});
|
|
3688
3741
|
// 如果有动画层,在动画层上监听点击事件
|
|
3689
|
-
popsDOMUtils.on(config.animElement, "click",
|
|
3742
|
+
popsDOMUtils.on(config.animElement, "click", (event) => {
|
|
3690
3743
|
const $click = event.composedPath()[0];
|
|
3691
3744
|
if (isAnimElement($click) && isMaskClick) {
|
|
3692
3745
|
return clickEvent(event);
|
|
@@ -3694,7 +3747,7 @@ System.register('pops', [], (function (exports) {
|
|
|
3694
3747
|
});
|
|
3695
3748
|
// 在遮罩层监听点击事件
|
|
3696
3749
|
// 如果有动画层,那么该点击事件触发不了
|
|
3697
|
-
popsDOMUtils.on(result.maskElement, "click",
|
|
3750
|
+
popsDOMUtils.on(result.maskElement, "click", (event) => {
|
|
3698
3751
|
isMaskClick = true;
|
|
3699
3752
|
clickEvent(event);
|
|
3700
3753
|
});
|
|
@@ -3837,13 +3890,13 @@ System.register('pops', [], (function (exports) {
|
|
|
3837
3890
|
* @param guid
|
|
3838
3891
|
* @param $shadowContainer
|
|
3839
3892
|
* @param $shadowRoot
|
|
3840
|
-
* @param
|
|
3893
|
+
* @param type 当前弹窗类型
|
|
3841
3894
|
* @param $anim 动画层
|
|
3842
3895
|
* @param $pops 主元素
|
|
3843
3896
|
* @param $mask 遮罩层
|
|
3844
3897
|
* @param config 当前配置
|
|
3845
3898
|
*/
|
|
3846
|
-
handleEventConfig(config, guid, $shadowContainer, $shadowRoot,
|
|
3899
|
+
handleEventConfig(config, guid, $shadowContainer, $shadowRoot, type, $anim, $pops, $mask) {
|
|
3847
3900
|
return {
|
|
3848
3901
|
$shadowContainer: $shadowContainer,
|
|
3849
3902
|
$shadowRoot: $shadowRoot,
|
|
@@ -3851,44 +3904,47 @@ System.register('pops', [], (function (exports) {
|
|
|
3851
3904
|
$anim: $anim,
|
|
3852
3905
|
$pops: $pops,
|
|
3853
3906
|
$mask: $mask,
|
|
3854
|
-
mode:
|
|
3907
|
+
mode: type,
|
|
3855
3908
|
guid: guid,
|
|
3856
3909
|
close() {
|
|
3857
|
-
return PopsInstanceUtils.close(config,
|
|
3910
|
+
return PopsInstanceUtils.close(config, type, PopsInstData[type], guid, $anim);
|
|
3858
3911
|
},
|
|
3859
3912
|
hide() {
|
|
3860
|
-
return PopsInstanceUtils.hide(config,
|
|
3913
|
+
return PopsInstanceUtils.hide(config, type, PopsInstData[type], guid, $anim, $mask);
|
|
3861
3914
|
},
|
|
3862
|
-
show() {
|
|
3863
|
-
|
|
3915
|
+
show($parent) {
|
|
3916
|
+
if ($parent) {
|
|
3917
|
+
$parent.appendChild(PopsInstData[type][0].$shadowRoot);
|
|
3918
|
+
}
|
|
3919
|
+
return PopsInstanceUtils.show(config, type, PopsInstData[type], guid, $anim, $mask);
|
|
3864
3920
|
},
|
|
3865
3921
|
};
|
|
3866
3922
|
},
|
|
3867
3923
|
/**
|
|
3868
3924
|
* 获取loading的事件配置
|
|
3869
3925
|
* @param guid
|
|
3870
|
-
* @param
|
|
3926
|
+
* @param type 当前弹窗类型
|
|
3871
3927
|
* @param $anim 动画层
|
|
3872
3928
|
* @param $pops 主元素
|
|
3873
3929
|
* @param $mask 遮罩层
|
|
3874
3930
|
* @param config 当前配置
|
|
3875
3931
|
*/
|
|
3876
|
-
handleLoadingEventConfig(config, guid,
|
|
3932
|
+
handleLoadingEventConfig(config, guid, type, $anim, $pops, $mask) {
|
|
3877
3933
|
return {
|
|
3878
3934
|
$el: $anim,
|
|
3879
3935
|
$anim: $anim,
|
|
3880
3936
|
$pops: $pops,
|
|
3881
3937
|
$mask: $mask,
|
|
3882
|
-
mode:
|
|
3938
|
+
mode: type,
|
|
3883
3939
|
guid: guid,
|
|
3884
3940
|
close() {
|
|
3885
|
-
return PopsInstanceUtils.close(config,
|
|
3941
|
+
return PopsInstanceUtils.close(config, type, PopsInstData[type], guid, $anim);
|
|
3886
3942
|
},
|
|
3887
3943
|
hide() {
|
|
3888
|
-
return PopsInstanceUtils.hide(config,
|
|
3944
|
+
return PopsInstanceUtils.hide(config, type, PopsInstData[type], guid, $anim, $mask);
|
|
3889
3945
|
},
|
|
3890
3946
|
show() {
|
|
3891
|
-
return PopsInstanceUtils.show(config,
|
|
3947
|
+
return PopsInstanceUtils.show(config, type, PopsInstData[type], guid, $anim, $mask);
|
|
3892
3948
|
},
|
|
3893
3949
|
};
|
|
3894
3950
|
},
|
|
@@ -4001,8 +4057,8 @@ System.register('pops', [], (function (exports) {
|
|
|
4001
4057
|
handleOnly(type, config) {
|
|
4002
4058
|
if (config.only) {
|
|
4003
4059
|
// .loading
|
|
4004
|
-
// .tooltip
|
|
4005
4060
|
// .rightClickMenu
|
|
4061
|
+
// .tooltip
|
|
4006
4062
|
// 单独处理
|
|
4007
4063
|
if (type === "loading" || type === "tooltip" || type === "rightClickMenu") {
|
|
4008
4064
|
const inst = PopsInstData[type];
|
|
@@ -4014,11 +4070,11 @@ System.register('pops', [], (function (exports) {
|
|
|
4014
4070
|
PopsInstanceUtils.removeInstance([
|
|
4015
4071
|
PopsInstData.alert,
|
|
4016
4072
|
PopsInstData.confirm,
|
|
4017
|
-
PopsInstData.prompt,
|
|
4018
|
-
PopsInstData.iframe,
|
|
4019
4073
|
PopsInstData.drawer,
|
|
4020
4074
|
PopsInstData.folder,
|
|
4075
|
+
PopsInstData.iframe,
|
|
4021
4076
|
PopsInstData.panel,
|
|
4077
|
+
PopsInstData.prompt,
|
|
4022
4078
|
], "", true);
|
|
4023
4079
|
}
|
|
4024
4080
|
}
|
|
@@ -4182,6 +4238,7 @@ System.register('pops', [], (function (exports) {
|
|
|
4182
4238
|
}
|
|
4183
4239
|
// 处理返回的配置
|
|
4184
4240
|
const evtConfig = PopsHandler.handleEventConfig(config, guid, $shadowContainer, $shadowRoot, popsType, $anim, $pops, $mask);
|
|
4241
|
+
const result = PopsHandler.handleResultConfig(evtConfig);
|
|
4185
4242
|
// 为顶部右边的关闭按钮添加点击事件
|
|
4186
4243
|
PopsHandler.handleClickEvent("close", $headerCloseBtn, evtConfig, config.btn.close?.callback);
|
|
4187
4244
|
// 为底部ok按钮添加点击事件
|
|
@@ -4204,6 +4261,8 @@ System.register('pops', [], (function (exports) {
|
|
|
4204
4261
|
$mask: $mask,
|
|
4205
4262
|
$shadowContainer: $shadowContainer,
|
|
4206
4263
|
$shadowRoot: $shadowRoot,
|
|
4264
|
+
config: config,
|
|
4265
|
+
destory: result.close,
|
|
4207
4266
|
});
|
|
4208
4267
|
// 拖拽
|
|
4209
4268
|
if (config.drag) {
|
|
@@ -4215,7 +4274,6 @@ System.register('pops', [], (function (exports) {
|
|
|
4215
4274
|
endCallBack: config.dragEndCallBack,
|
|
4216
4275
|
});
|
|
4217
4276
|
}
|
|
4218
|
-
const result = PopsHandler.handleResultConfig(evtConfig);
|
|
4219
4277
|
return result;
|
|
4220
4278
|
},
|
|
4221
4279
|
};
|
|
@@ -4389,6 +4447,7 @@ System.register('pops', [], (function (exports) {
|
|
|
4389
4447
|
$elList.push($mask);
|
|
4390
4448
|
}
|
|
4391
4449
|
const evtConfig = PopsHandler.handleEventConfig(config, guid, $shadowContainer, $shadowRoot, popsType, $anim, $pops, $mask);
|
|
4450
|
+
const result = PopsHandler.handleResultConfig(evtConfig);
|
|
4392
4451
|
PopsHandler.handleClickEvent("close", $btnClose, evtConfig, config.btn.close.callback);
|
|
4393
4452
|
PopsHandler.handleClickEvent("ok", $btnOk, evtConfig, config.btn.ok.callback);
|
|
4394
4453
|
PopsHandler.handleClickEvent("cancel", $btnCancel, evtConfig, config.btn.cancel.callback);
|
|
@@ -4409,6 +4468,8 @@ System.register('pops', [], (function (exports) {
|
|
|
4409
4468
|
$mask: $mask,
|
|
4410
4469
|
$shadowContainer: $shadowContainer,
|
|
4411
4470
|
$shadowRoot: $shadowRoot,
|
|
4471
|
+
config: config,
|
|
4472
|
+
destory: result.close,
|
|
4412
4473
|
});
|
|
4413
4474
|
// 拖拽
|
|
4414
4475
|
if (config.drag) {
|
|
@@ -4420,7 +4481,6 @@ System.register('pops', [], (function (exports) {
|
|
|
4420
4481
|
endCallBack: config.dragEndCallBack,
|
|
4421
4482
|
});
|
|
4422
4483
|
}
|
|
4423
|
-
const result = PopsHandler.handleResultConfig(evtConfig);
|
|
4424
4484
|
return result;
|
|
4425
4485
|
},
|
|
4426
4486
|
};
|
|
@@ -4599,6 +4659,7 @@ System.register('pops', [], (function (exports) {
|
|
|
4599
4659
|
$elList.push($mask);
|
|
4600
4660
|
}
|
|
4601
4661
|
const evtConfig = PopsHandler.handleEventConfig(config, guid, $shadowContainer, $shadowRoot, popsType, $anim, $pops, $mask);
|
|
4662
|
+
const result = PopsHandler.handleResultConfig(evtConfig);
|
|
4602
4663
|
// 处理方向
|
|
4603
4664
|
$pops.setAttribute("direction", config.direction);
|
|
4604
4665
|
// 处理border-radius
|
|
@@ -4694,8 +4755,9 @@ System.register('pops', [], (function (exports) {
|
|
|
4694
4755
|
$mask: $mask,
|
|
4695
4756
|
$shadowContainer: $shadowContainer,
|
|
4696
4757
|
$shadowRoot: $shadowRoot,
|
|
4758
|
+
config: config,
|
|
4759
|
+
destory: result.close,
|
|
4697
4760
|
});
|
|
4698
|
-
const result = PopsHandler.handleResultConfig(evtConfig);
|
|
4699
4761
|
return result;
|
|
4700
4762
|
},
|
|
4701
4763
|
};
|
|
@@ -5204,6 +5266,7 @@ System.register('pops', [], (function (exports) {
|
|
|
5204
5266
|
}
|
|
5205
5267
|
// 事件
|
|
5206
5268
|
const evtConfig = PopsHandler.handleEventConfig(config, guid, $shadowContainer, $shadowRoot, popsType, $anim, $pops, $mask);
|
|
5269
|
+
const result = PopsHandler.handleResultConfig(evtConfig);
|
|
5207
5270
|
PopsHandler.handleClickEvent("close", $btnCloseBtn, evtConfig, config.btn.close.callback);
|
|
5208
5271
|
PopsHandler.handleClickEvent("ok", btnOkElement, evtConfig, config.btn.ok.callback);
|
|
5209
5272
|
PopsHandler.handleClickEvent("cancel", btnCancelElement, evtConfig, config.btn.cancel.callback);
|
|
@@ -5783,8 +5846,9 @@ System.register('pops', [], (function (exports) {
|
|
|
5783
5846
|
$mask: $mask,
|
|
5784
5847
|
$shadowContainer: $shadowContainer,
|
|
5785
5848
|
$shadowRoot: $shadowRoot,
|
|
5849
|
+
config: config,
|
|
5850
|
+
destory: result.close,
|
|
5786
5851
|
});
|
|
5787
|
-
const result = PopsHandler.handleResultConfig(evtConfig);
|
|
5788
5852
|
return result;
|
|
5789
5853
|
},
|
|
5790
5854
|
};
|
|
@@ -5940,6 +6004,7 @@ System.register('pops', [], (function (exports) {
|
|
|
5940
6004
|
const evtConfig = PopsHandler.handleEventConfig(config, guid, $shadowContainer, $shadowRoot, popsType, $anim, $pops, $mask);
|
|
5941
6005
|
// 赋值额外的$iframe参数
|
|
5942
6006
|
evtConfig.$iframe = $iframe;
|
|
6007
|
+
const result = PopsHandler.handleResultConfig(evtConfig);
|
|
5943
6008
|
popsDOMUtils.on($anim, popsDOMUtils.getAnimationEndNameList(), function () {
|
|
5944
6009
|
// 动画加载完毕
|
|
5945
6010
|
$anim.style.width = "0%";
|
|
@@ -6071,10 +6136,10 @@ System.register('pops', [], (function (exports) {
|
|
|
6071
6136
|
capture: true,
|
|
6072
6137
|
});
|
|
6073
6138
|
// 关闭按钮点击事件
|
|
6074
|
-
popsDOMUtils.on(headerCloseBtnElement, "click", (event) => {
|
|
6139
|
+
popsDOMUtils.on(headerCloseBtnElement, "click", async (event) => {
|
|
6075
6140
|
event.preventDefault();
|
|
6076
6141
|
event.stopPropagation();
|
|
6077
|
-
PopsInstanceUtils.removeInstance([PopsInstData.iframe], guid, false);
|
|
6142
|
+
await PopsInstanceUtils.removeInstance([PopsInstData.iframe], guid, false);
|
|
6078
6143
|
if (typeof config?.btn?.close?.callback === "function") {
|
|
6079
6144
|
config.btn.close.callback(evtConfig, event);
|
|
6080
6145
|
}
|
|
@@ -6088,8 +6153,9 @@ System.register('pops', [], (function (exports) {
|
|
|
6088
6153
|
$mask: $mask,
|
|
6089
6154
|
$shadowContainer: $shadowContainer,
|
|
6090
6155
|
$shadowRoot: $shadowRoot,
|
|
6156
|
+
config: config,
|
|
6157
|
+
destory: result.close,
|
|
6091
6158
|
});
|
|
6092
|
-
const result = PopsHandler.handleResultConfig(evtConfig);
|
|
6093
6159
|
return result;
|
|
6094
6160
|
},
|
|
6095
6161
|
};
|
|
@@ -7055,7 +7121,7 @@ System.register('pops', [], (function (exports) {
|
|
|
7055
7121
|
isFixed: false,
|
|
7056
7122
|
alwaysShow: false,
|
|
7057
7123
|
onShowEventName: "mouseenter touchstart",
|
|
7058
|
-
onCloseEventName: "mouseleave touchend",
|
|
7124
|
+
onCloseEventName: "mouseleave touchend touchcancel",
|
|
7059
7125
|
zIndex: 10000,
|
|
7060
7126
|
only: false,
|
|
7061
7127
|
eventOption: {
|
|
@@ -7281,12 +7347,12 @@ System.register('pops', [], (function (exports) {
|
|
|
7281
7347
|
changePosition(event) {
|
|
7282
7348
|
const positionInfo = this.calcToolTipPosition(this.$data.config.$target, this.$data.config.arrowDistance, this.$data.config.otherDistance, event);
|
|
7283
7349
|
const positionKey = this.$data.config.position.toUpperCase();
|
|
7284
|
-
const
|
|
7285
|
-
if (
|
|
7286
|
-
this.$el.$toolTip.style.left =
|
|
7287
|
-
this.$el.$toolTip.style.top =
|
|
7288
|
-
this.$el.$toolTip.setAttribute("data-motion",
|
|
7289
|
-
this.$el.$arrow.setAttribute("data-position",
|
|
7350
|
+
const position = positionInfo[positionKey];
|
|
7351
|
+
if (position) {
|
|
7352
|
+
this.$el.$toolTip.style.left = position.left + "px";
|
|
7353
|
+
this.$el.$toolTip.style.top = position.top + "px";
|
|
7354
|
+
this.$el.$toolTip.setAttribute("data-motion", position.motion);
|
|
7355
|
+
this.$el.$arrow.setAttribute("data-position", position.arrow);
|
|
7290
7356
|
}
|
|
7291
7357
|
else {
|
|
7292
7358
|
console.error("不存在该位置", this.$data.config.position);
|
|
@@ -7392,9 +7458,7 @@ System.register('pops', [], (function (exports) {
|
|
|
7392
7458
|
* 取消绑定 显示事件
|
|
7393
7459
|
*/
|
|
7394
7460
|
offShowEvent() {
|
|
7395
|
-
popsDOMUtils.off(this.$data.config.$target, this.$data.config.onShowEventName, this.show,
|
|
7396
|
-
capture: true,
|
|
7397
|
-
});
|
|
7461
|
+
popsDOMUtils.off(this.$data.config.$target, this.$data.config.onShowEventName, this.show, this.$data.config.eventOption);
|
|
7398
7462
|
}
|
|
7399
7463
|
/**
|
|
7400
7464
|
* 关闭提示框
|
|
@@ -7453,22 +7517,20 @@ System.register('pops', [], (function (exports) {
|
|
|
7453
7517
|
* 取消绑定 关闭事件
|
|
7454
7518
|
*/
|
|
7455
7519
|
offCloseEvent() {
|
|
7456
|
-
popsDOMUtils.off(this.$data.config.$target, this.$data.config.onCloseEventName, this.close,
|
|
7457
|
-
capture: true,
|
|
7458
|
-
});
|
|
7520
|
+
popsDOMUtils.off(this.$data.config.$target, this.$data.config.onCloseEventName, this.close, this.$data.config.eventOption);
|
|
7459
7521
|
}
|
|
7460
7522
|
/**
|
|
7461
7523
|
* 销毁元素
|
|
7462
7524
|
*/
|
|
7463
7525
|
destory() {
|
|
7464
7526
|
if (this.$el.$toolTip) {
|
|
7465
|
-
this.$el.$
|
|
7527
|
+
this.$el.$toolTip.remove();
|
|
7466
7528
|
}
|
|
7467
|
-
// @ts-
|
|
7529
|
+
// @ts-expect-error
|
|
7468
7530
|
this.$el.$toolTip = null;
|
|
7469
|
-
// @ts-
|
|
7531
|
+
// @ts-expect-error
|
|
7470
7532
|
this.$el.$arrow = null;
|
|
7471
|
-
// @ts-
|
|
7533
|
+
// @ts-expect-error
|
|
7472
7534
|
this.$el.$content = null;
|
|
7473
7535
|
}
|
|
7474
7536
|
/**
|
|
@@ -7516,29 +7578,29 @@ System.register('pops', [], (function (exports) {
|
|
|
7516
7578
|
popsDOMUtils.on(this.$el.$toolTip, "mouseenter touchstart", this.toolTipMouseEnterEvent, this.$data.config.eventOption);
|
|
7517
7579
|
}
|
|
7518
7580
|
/**
|
|
7519
|
-
*
|
|
7581
|
+
* 取消监听事件 - 鼠标|触摸
|
|
7520
7582
|
*/
|
|
7521
7583
|
offToolTipMouseEnterEvent() {
|
|
7522
7584
|
popsDOMUtils.off(this.$el.$toolTip, "mouseenter touchstart", this.toolTipMouseEnterEvent, this.$data.config.eventOption);
|
|
7523
7585
|
}
|
|
7524
7586
|
/**
|
|
7525
|
-
*
|
|
7587
|
+
* 离开事件 - 鼠标|触摸
|
|
7526
7588
|
*/
|
|
7527
7589
|
toolTipMouseLeaveEvent(event) {
|
|
7528
7590
|
this.close(event);
|
|
7529
7591
|
// this.$el.$toolTip.style.animationPlayState = "running";
|
|
7530
7592
|
}
|
|
7531
7593
|
/**
|
|
7532
|
-
*
|
|
7594
|
+
* 监听离开事件 - 鼠标|触摸
|
|
7533
7595
|
*/
|
|
7534
7596
|
onToolTipMouseLeaveEvent() {
|
|
7535
|
-
popsDOMUtils.on(this.$el.$toolTip, "mouseleave touchend", this.toolTipMouseLeaveEvent, this.$data.config.eventOption);
|
|
7597
|
+
popsDOMUtils.on(this.$el.$toolTip, "mouseleave touchend touchcancel", this.toolTipMouseLeaveEvent, this.$data.config.eventOption);
|
|
7536
7598
|
}
|
|
7537
7599
|
/**
|
|
7538
|
-
*
|
|
7600
|
+
* 取消监听离开事件 - 鼠标|触摸
|
|
7539
7601
|
*/
|
|
7540
7602
|
offToolTipMouseLeaveEvent() {
|
|
7541
|
-
popsDOMUtils.off(this.$el.$toolTip, "mouseleave touchend", this.toolTipMouseLeaveEvent, this.$data.config.eventOption);
|
|
7603
|
+
popsDOMUtils.off(this.$el.$toolTip, "mouseleave touchend touchcancel", this.toolTipMouseLeaveEvent, this.$data.config.eventOption);
|
|
7542
7604
|
}
|
|
7543
7605
|
}
|
|
7544
7606
|
const PopsTooltip = {
|
|
@@ -7553,6 +7615,15 @@ System.register('pops', [], (function (exports) {
|
|
|
7553
7615
|
throw new TypeError("config.target 必须是HTMLElement类型");
|
|
7554
7616
|
}
|
|
7555
7617
|
config = PopsHandler.handleOnly(popsType, config);
|
|
7618
|
+
if (config.position === "follow") {
|
|
7619
|
+
config.onShowEventName = config.onShowEventName.trim();
|
|
7620
|
+
const showEventNameSplit = config.onShowEventName.split(" ");
|
|
7621
|
+
["mousemove", "touchmove"].forEach((it) => {
|
|
7622
|
+
if (showEventNameSplit.includes(it))
|
|
7623
|
+
return;
|
|
7624
|
+
config.onShowEventName += ` ${it}`;
|
|
7625
|
+
});
|
|
7626
|
+
}
|
|
7556
7627
|
const { $shadowContainer, $shadowRoot } = PopsHandler.handlerShadow(config);
|
|
7557
7628
|
PopsHandler.handleInit($shadowRoot, [
|
|
7558
7629
|
{
|
|
@@ -8817,7 +8888,7 @@ System.register('pops', [], (function (exports) {
|
|
|
8817
8888
|
* 监听输入框内容改变
|
|
8818
8889
|
*/
|
|
8819
8890
|
onValueChange() {
|
|
8820
|
-
popsDOMUtils.on(this.$el.input, ["input", "propertychange"],
|
|
8891
|
+
popsDOMUtils.on(this.$el.input, ["input", "propertychange"], (event) => {
|
|
8821
8892
|
this.$data.value = this.$el.input.value;
|
|
8822
8893
|
if (inputType !== "password") {
|
|
8823
8894
|
// 不是密码框
|
|
@@ -9190,7 +9261,7 @@ System.register('pops', [], (function (exports) {
|
|
|
9190
9261
|
* 监听点击事件
|
|
9191
9262
|
*/
|
|
9192
9263
|
onClick() {
|
|
9193
|
-
popsDOMUtils.on(this.$el.$select, "click",
|
|
9264
|
+
popsDOMUtils.on(this.$el.$select, "click", (event) => {
|
|
9194
9265
|
this.setSelectOptionsDisableStatus();
|
|
9195
9266
|
if (typeof viewConfig.clickCallBack === "function") {
|
|
9196
9267
|
const $isSelectedElement = this.$el.$select[this.$el.$select.selectedIndex];
|
|
@@ -10957,7 +11028,7 @@ System.register('pops', [], (function (exports) {
|
|
|
10957
11028
|
* 设置按钮的点击事件
|
|
10958
11029
|
*/
|
|
10959
11030
|
onButtonClick() {
|
|
10960
|
-
popsDOMUtils.on(this.$ele.button, "click",
|
|
11031
|
+
popsDOMUtils.on(this.$ele.button, "click", (event) => {
|
|
10961
11032
|
if (typeof viewConfig.callback === "function") {
|
|
10962
11033
|
viewConfig.callback(event);
|
|
10963
11034
|
}
|
|
@@ -11026,13 +11097,13 @@ System.register('pops', [], (function (exports) {
|
|
|
11026
11097
|
initContainerItem($container, formItemConfig) {
|
|
11027
11098
|
const containerViewConfig = formItemConfig;
|
|
11028
11099
|
if (containerViewConfig.type === "container") {
|
|
11029
|
-
const
|
|
11100
|
+
const childViewConfig = containerViewConfig["views"];
|
|
11030
11101
|
// 每一项<li>元素
|
|
11031
|
-
const
|
|
11102
|
+
const $itemLi = popsDOMUtils.createElement("li");
|
|
11032
11103
|
// 每一项<li>内的子<ul>元素
|
|
11033
|
-
const
|
|
11034
|
-
|
|
11035
|
-
|
|
11104
|
+
const $itemUL = popsDOMUtils.createElement("ul");
|
|
11105
|
+
$itemUL.classList.add("pops-panel-forms-container-item-formlist");
|
|
11106
|
+
$itemLi.classList.add("pops-panel-forms-container-item");
|
|
11036
11107
|
// 区域头部的文字
|
|
11037
11108
|
const formHeaderDivElement = popsDOMUtils.createElement("div", {
|
|
11038
11109
|
className: "pops-panel-forms-container-item-header-text",
|
|
@@ -11052,42 +11123,42 @@ System.register('pops', [], (function (exports) {
|
|
|
11052
11123
|
`);
|
|
11053
11124
|
// 添加点击事件
|
|
11054
11125
|
popsDOMUtils.on(formHeaderDivElement, "click", () => {
|
|
11055
|
-
if (
|
|
11056
|
-
|
|
11126
|
+
if ($itemLi.hasAttribute("data-fold-enable")) {
|
|
11127
|
+
$itemLi.removeAttribute("data-fold-enable");
|
|
11057
11128
|
}
|
|
11058
11129
|
else {
|
|
11059
|
-
|
|
11130
|
+
$itemLi.setAttribute("data-fold-enable", "");
|
|
11060
11131
|
}
|
|
11061
11132
|
});
|
|
11062
11133
|
popsDOMUtils.addClassName(formHeaderDivElement, "pops-panel-forms-fold-container");
|
|
11063
11134
|
popsDOMUtils.addClassName(formHeaderDivElement, PopsCommonCSSClassName.userSelectNone);
|
|
11064
|
-
|
|
11135
|
+
$itemLi.setAttribute("data-fold-enable", "");
|
|
11065
11136
|
popsDOMUtils.addClassName(formHeaderDivElement, "pops-panel-forms-fold");
|
|
11066
|
-
|
|
11137
|
+
$itemLi.appendChild(formHeaderDivElement);
|
|
11067
11138
|
}
|
|
11068
11139
|
else {
|
|
11069
11140
|
// 加进容器内
|
|
11070
|
-
|
|
11141
|
+
$itemLi.appendChild(formHeaderDivElement);
|
|
11071
11142
|
}
|
|
11072
|
-
that.setElementClassName(
|
|
11073
|
-
that.setElementAttributes(
|
|
11074
|
-
that.setElementProps(
|
|
11075
|
-
|
|
11143
|
+
that.setElementClassName($itemLi, formItemConfig.className);
|
|
11144
|
+
that.setElementAttributes($itemLi, formItemConfig.attributes);
|
|
11145
|
+
that.setElementProps($itemLi, formItemConfig.props);
|
|
11146
|
+
$itemLi.appendChild($itemUL);
|
|
11147
|
+
$container.appendChild($itemLi);
|
|
11148
|
+
childViewConfig.forEach((childViewConfig) => {
|
|
11076
11149
|
that.uListContainerAddItem(childViewConfig, {
|
|
11077
|
-
ulElement:
|
|
11150
|
+
ulElement: $itemUL,
|
|
11078
11151
|
sectionContainerULElement: that.sectionContainerULElement,
|
|
11079
|
-
formContainerListElement:
|
|
11152
|
+
formContainerListElement: $itemLi,
|
|
11080
11153
|
formHeaderDivElement: formHeaderDivElement,
|
|
11081
11154
|
});
|
|
11082
11155
|
});
|
|
11083
|
-
formContainerListElement.appendChild(formContainerULElement);
|
|
11084
|
-
$container.appendChild(formContainerListElement);
|
|
11085
11156
|
if (typeof containerViewConfig.afterAddToUListCallBack === "function") {
|
|
11086
11157
|
containerViewConfig.afterAddToUListCallBack(viewConfig, {
|
|
11087
|
-
target:
|
|
11088
|
-
ulElement:
|
|
11158
|
+
target: $itemLi,
|
|
11159
|
+
ulElement: $itemUL,
|
|
11089
11160
|
sectionContainerULElement: that.sectionContainerULElement,
|
|
11090
|
-
formContainerListElement:
|
|
11161
|
+
formContainerListElement: $itemLi,
|
|
11091
11162
|
formHeaderDivElement: formHeaderDivElement,
|
|
11092
11163
|
});
|
|
11093
11164
|
}
|
|
@@ -11226,7 +11297,7 @@ System.register('pops', [], (function (exports) {
|
|
|
11226
11297
|
},
|
|
11227
11298
|
/** 设置项的点击事件 */
|
|
11228
11299
|
onLiClick() {
|
|
11229
|
-
popsDOMUtils.on($li, "click",
|
|
11300
|
+
popsDOMUtils.on($li, "click", async (event) => {
|
|
11230
11301
|
if (typeof viewConfig.clickCallBack === "function") {
|
|
11231
11302
|
const result = await viewConfig.clickCallBack(event, viewConfig);
|
|
11232
11303
|
if (result) {
|
|
@@ -11554,6 +11625,7 @@ System.register('pops', [], (function (exports) {
|
|
|
11554
11625
|
}
|
|
11555
11626
|
// 处理返回的配置
|
|
11556
11627
|
const evtConfig = PopsHandler.handleEventConfig(config, guid, $shadowContainer, $shadowRoot, popsType, $anim, $pops, $mask);
|
|
11628
|
+
const result = PopsHandler.handleResultConfig(evtConfig);
|
|
11557
11629
|
// 为顶部右边的关闭按钮添加点击事件
|
|
11558
11630
|
PopsHandler.handleClickEvent("close", $headerBtnClose, evtConfig, config.btn?.close?.callback);
|
|
11559
11631
|
// 创建到页面中
|
|
@@ -11591,6 +11663,8 @@ System.register('pops', [], (function (exports) {
|
|
|
11591
11663
|
$mask: $mask,
|
|
11592
11664
|
$shadowContainer: $shadowContainer,
|
|
11593
11665
|
$shadowRoot: $shadowRoot,
|
|
11666
|
+
config: config,
|
|
11667
|
+
destory: result.close,
|
|
11594
11668
|
});
|
|
11595
11669
|
// 拖拽
|
|
11596
11670
|
if (config.drag) {
|
|
@@ -11602,7 +11676,6 @@ System.register('pops', [], (function (exports) {
|
|
|
11602
11676
|
endCallBack: config.dragEndCallBack,
|
|
11603
11677
|
});
|
|
11604
11678
|
}
|
|
11605
|
-
const result = PopsHandler.handleResultConfig(evtConfig);
|
|
11606
11679
|
return {
|
|
11607
11680
|
...result,
|
|
11608
11681
|
addEventListener: (event, listener, options) => {
|
|
@@ -11794,6 +11867,7 @@ System.register('pops', [], (function (exports) {
|
|
|
11794
11867
|
$elList.push($mask);
|
|
11795
11868
|
}
|
|
11796
11869
|
const evtConfig = PopsHandler.handleEventConfig(config, guid, $shadowContainer, $shadowRoot, popsType, $anim, $pops, $mask);
|
|
11870
|
+
const result = PopsHandler.handleResultConfig(evtConfig);
|
|
11797
11871
|
// 输入框赋值初始值
|
|
11798
11872
|
$input.value = config.content.text;
|
|
11799
11873
|
PopsHandler.handlePromptClickEvent("close", $input, $btnClose, evtConfig, config.btn.close.callback);
|
|
@@ -11816,6 +11890,8 @@ System.register('pops', [], (function (exports) {
|
|
|
11816
11890
|
$mask: $mask,
|
|
11817
11891
|
$shadowContainer: $shadowContainer,
|
|
11818
11892
|
$shadowRoot: $shadowRoot,
|
|
11893
|
+
config: config,
|
|
11894
|
+
destory: result.close,
|
|
11819
11895
|
});
|
|
11820
11896
|
// 拖拽
|
|
11821
11897
|
if (config.drag) {
|
|
@@ -11835,7 +11911,6 @@ System.register('pops', [], (function (exports) {
|
|
|
11835
11911
|
if (config.content.select) {
|
|
11836
11912
|
$input.select();
|
|
11837
11913
|
}
|
|
11838
|
-
const result = PopsHandler.handleResultConfig(evtConfig);
|
|
11839
11914
|
return result;
|
|
11840
11915
|
},
|
|
11841
11916
|
};
|
|
@@ -11937,6 +12012,7 @@ System.register('pops', [], (function (exports) {
|
|
|
11937
12012
|
beforeAppendToPageCallBack() { },
|
|
11938
12013
|
limitPositionXInView: true,
|
|
11939
12014
|
limitPositionYInView: true,
|
|
12015
|
+
beforeShowCallBack() { },
|
|
11940
12016
|
};
|
|
11941
12017
|
};
|
|
11942
12018
|
|
|
@@ -11996,6 +12072,8 @@ System.register('pops', [], (function (exports) {
|
|
|
11996
12072
|
return;
|
|
11997
12073
|
}
|
|
11998
12074
|
if ($click.className && $click.className === "pops-shadow-container" && $click.shadowRoot != null) {
|
|
12075
|
+
// pops的shadow-container
|
|
12076
|
+
PopsContextMenu.shadowRootCheckClickEvent(event);
|
|
11999
12077
|
return;
|
|
12000
12078
|
}
|
|
12001
12079
|
PopsContextMenu.closeAllMenu(PopsContextMenu.$el.$root);
|
|
@@ -12008,7 +12086,7 @@ System.register('pops', [], (function (exports) {
|
|
|
12008
12086
|
if (!PopsContextMenu.$el.$root) {
|
|
12009
12087
|
return;
|
|
12010
12088
|
}
|
|
12011
|
-
const $click = event.
|
|
12089
|
+
const $click = event.composedPath()[0];
|
|
12012
12090
|
if ($click.closest(`.pops-${popsType}`)) {
|
|
12013
12091
|
return;
|
|
12014
12092
|
}
|
|
@@ -12018,13 +12096,13 @@ System.register('pops', [], (function (exports) {
|
|
|
12018
12096
|
* 添加全局点击检测事件
|
|
12019
12097
|
*/
|
|
12020
12098
|
addWindowCheckClickListener() {
|
|
12021
|
-
popsDOMUtils.on(globalThis, "click touchstart",
|
|
12099
|
+
popsDOMUtils.on(globalThis, "click touchstart", PopsContextMenu.windowCheckClickEvent, {
|
|
12022
12100
|
capture: true,
|
|
12023
12101
|
});
|
|
12024
12102
|
if (config.$target instanceof Node) {
|
|
12025
12103
|
const $shadowRoot = config.$target.getRootNode();
|
|
12026
12104
|
if ($shadowRoot instanceof ShadowRoot) {
|
|
12027
|
-
popsDOMUtils.on($shadowRoot, "click touchstart",
|
|
12105
|
+
popsDOMUtils.on($shadowRoot, "click touchstart", PopsContextMenu.shadowRootCheckClickEvent, {
|
|
12028
12106
|
capture: true,
|
|
12029
12107
|
});
|
|
12030
12108
|
}
|
|
@@ -12034,13 +12112,13 @@ System.register('pops', [], (function (exports) {
|
|
|
12034
12112
|
* 移除全局点击检测事件
|
|
12035
12113
|
*/
|
|
12036
12114
|
removeWindowCheckClickListener() {
|
|
12037
|
-
popsDOMUtils.off(globalThis, "click touchstart",
|
|
12115
|
+
popsDOMUtils.off(globalThis, "click touchstart", PopsContextMenu.windowCheckClickEvent, {
|
|
12038
12116
|
capture: true,
|
|
12039
12117
|
});
|
|
12040
12118
|
if (config.$target instanceof Node) {
|
|
12041
12119
|
const $shadowRoot = config.$target.getRootNode();
|
|
12042
12120
|
if ($shadowRoot instanceof ShadowRoot) {
|
|
12043
|
-
popsDOMUtils.off($shadowRoot, "click touchstart",
|
|
12121
|
+
popsDOMUtils.off($shadowRoot, "click touchstart", PopsContextMenu.windowCheckClickEvent, {
|
|
12044
12122
|
capture: true,
|
|
12045
12123
|
});
|
|
12046
12124
|
}
|
|
@@ -12051,7 +12129,7 @@ System.register('pops', [], (function (exports) {
|
|
|
12051
12129
|
* @param event
|
|
12052
12130
|
* @param selectorTarget
|
|
12053
12131
|
*/
|
|
12054
|
-
contextMenuEvent(event, selectorTarget) {
|
|
12132
|
+
async contextMenuEvent(event, selectorTarget) {
|
|
12055
12133
|
if (config.preventDefault) {
|
|
12056
12134
|
popsDOMUtils.preventEvent(event);
|
|
12057
12135
|
}
|
|
@@ -12060,6 +12138,10 @@ System.register('pops', [], (function (exports) {
|
|
|
12060
12138
|
PopsContextMenu.closeAllMenu(PopsContextMenu.$el.$root);
|
|
12061
12139
|
}
|
|
12062
12140
|
selectorTarget = selectorTarget ?? config.$target;
|
|
12141
|
+
const beforeShowCallBackResult = await config?.beforeShowCallBack(event);
|
|
12142
|
+
if (typeof beforeShowCallBackResult === "boolean" && !beforeShowCallBackResult) {
|
|
12143
|
+
return;
|
|
12144
|
+
}
|
|
12063
12145
|
const rootElement = PopsContextMenu.showMenu(event, config.data, selectorTarget);
|
|
12064
12146
|
PopsContextMenu.$el.$root = rootElement;
|
|
12065
12147
|
if (config.only) {
|
|
@@ -12072,6 +12154,10 @@ System.register('pops', [], (function (exports) {
|
|
|
12072
12154
|
beforeRemoveCallBack(instCommonConfig) {
|
|
12073
12155
|
PopsContextMenu.closeAllMenu(instCommonConfig.$pops);
|
|
12074
12156
|
},
|
|
12157
|
+
config: config,
|
|
12158
|
+
destory: () => {
|
|
12159
|
+
PopsContextMenu.closeAllMenu(rootElement);
|
|
12160
|
+
},
|
|
12075
12161
|
});
|
|
12076
12162
|
}
|
|
12077
12163
|
},
|
|
@@ -12375,7 +12461,8 @@ System.register('pops', [], (function (exports) {
|
|
|
12375
12461
|
menuLiElement.appendChild(iconElement);
|
|
12376
12462
|
}
|
|
12377
12463
|
// 插入文字
|
|
12378
|
-
|
|
12464
|
+
const text = typeof item.text === "function" ? item.text() : item.text;
|
|
12465
|
+
menuLiElement.insertAdjacentHTML("beforeend", PopsSafeUtils.getSafeHTML(`<span>${text}</span>`));
|
|
12379
12466
|
// 如果存在子数据,显示
|
|
12380
12467
|
if (item.item && Array.isArray(item.item)) {
|
|
12381
12468
|
popsDOMUtils.addClassName(menuLiElement, `pops-${popsType}-item`);
|
|
@@ -13014,10 +13101,10 @@ System.register('pops', [], (function (exports) {
|
|
|
13014
13101
|
setShowEvent(option = defaultListenerOption) {
|
|
13015
13102
|
/* 焦点|点击事件*/
|
|
13016
13103
|
if (config.followPosition === "target") {
|
|
13017
|
-
popsDOMUtils.on([config.$target], ["focus", "click"],
|
|
13104
|
+
popsDOMUtils.on([config.$target], ["focus", "click"], SearchSuggestion.showEvent, option);
|
|
13018
13105
|
}
|
|
13019
13106
|
else if (config.followPosition === "input") {
|
|
13020
|
-
popsDOMUtils.on([config.$inputTarget], ["focus", "click"],
|
|
13107
|
+
popsDOMUtils.on([config.$inputTarget], ["focus", "click"], SearchSuggestion.showEvent, option);
|
|
13021
13108
|
}
|
|
13022
13109
|
else if (config.followPosition === "inputCursor") {
|
|
13023
13110
|
popsDOMUtils.on([config.$inputTarget], ["focus", "click", "input"], SearchSuggestion.showEvent, option);
|
|
@@ -13031,9 +13118,9 @@ System.register('pops', [], (function (exports) {
|
|
|
13031
13118
|
*/
|
|
13032
13119
|
removeShowEvent(option = defaultListenerOption) {
|
|
13033
13120
|
/* 焦点|点击事件*/
|
|
13034
|
-
popsDOMUtils.off([config.$target, config.$inputTarget], ["focus", "click"],
|
|
13121
|
+
popsDOMUtils.off([config.$target, config.$inputTarget], ["focus", "click"], SearchSuggestion.showEvent, option);
|
|
13035
13122
|
// 内容改变事件
|
|
13036
|
-
popsDOMUtils.off([config.$inputTarget], ["input"],
|
|
13123
|
+
popsDOMUtils.off([config.$inputTarget], ["input"], SearchSuggestion.showEvent, option);
|
|
13037
13124
|
},
|
|
13038
13125
|
/**
|
|
13039
13126
|
* 隐藏搜索建议框的事件
|
|
@@ -13064,7 +13151,7 @@ System.register('pops', [], (function (exports) {
|
|
|
13064
13151
|
// 全局触摸屏点击事件
|
|
13065
13152
|
if (Array.isArray(SearchSuggestion.selfDocument)) {
|
|
13066
13153
|
SearchSuggestion.selfDocument.forEach(($checkParent) => {
|
|
13067
|
-
popsDOMUtils.on($checkParent, ["click", "touchstart"],
|
|
13154
|
+
popsDOMUtils.on($checkParent, ["click", "touchstart"], SearchSuggestion.hideEvent, option);
|
|
13068
13155
|
});
|
|
13069
13156
|
}
|
|
13070
13157
|
else {
|
|
@@ -13077,11 +13164,11 @@ System.register('pops', [], (function (exports) {
|
|
|
13077
13164
|
removeHideEvent(option = defaultListenerOption) {
|
|
13078
13165
|
if (Array.isArray(SearchSuggestion.selfDocument)) {
|
|
13079
13166
|
SearchSuggestion.selfDocument.forEach(($checkParent) => {
|
|
13080
|
-
popsDOMUtils.off($checkParent, ["click", "touchstart"],
|
|
13167
|
+
popsDOMUtils.off($checkParent, ["click", "touchstart"], SearchSuggestion.hideEvent, option);
|
|
13081
13168
|
});
|
|
13082
13169
|
}
|
|
13083
13170
|
else {
|
|
13084
|
-
popsDOMUtils.off(SearchSuggestion.selfDocument, ["click", "touchstart"],
|
|
13171
|
+
popsDOMUtils.off(SearchSuggestion.selfDocument, ["click", "touchstart"], SearchSuggestion.hideEvent, option);
|
|
13085
13172
|
}
|
|
13086
13173
|
},
|
|
13087
13174
|
/**
|
|
@@ -13342,7 +13429,7 @@ System.register('pops', [], (function (exports) {
|
|
|
13342
13429
|
},
|
|
13343
13430
|
};
|
|
13344
13431
|
|
|
13345
|
-
const version = "3.
|
|
13432
|
+
const version = "3.2.0";
|
|
13346
13433
|
|
|
13347
13434
|
class Pops {
|
|
13348
13435
|
/** 配置 */
|