@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.amd.js
CHANGED
|
@@ -261,47 +261,7 @@ define((function () { 'use strict';
|
|
|
261
261
|
const cache = createCache(LAST_NUMBER_WEAK_MAP);
|
|
262
262
|
const generateUniqueNumber = createGenerateUniqueNumber(cache, LAST_NUMBER_WEAK_MAP);
|
|
263
263
|
|
|
264
|
-
const
|
|
265
|
-
return typeof sender.start === 'function';
|
|
266
|
-
};
|
|
267
|
-
|
|
268
|
-
const PORT_MAP = new WeakMap();
|
|
269
|
-
|
|
270
|
-
const extendBrokerImplementation = (partialBrokerImplementation) => ({
|
|
271
|
-
...partialBrokerImplementation,
|
|
272
|
-
connect: ({ call }) => {
|
|
273
|
-
return async () => {
|
|
274
|
-
const { port1, port2 } = new MessageChannel();
|
|
275
|
-
const portId = await call('connect', { port: port1 }, [port1]);
|
|
276
|
-
PORT_MAP.set(port2, portId);
|
|
277
|
-
return port2;
|
|
278
|
-
};
|
|
279
|
-
},
|
|
280
|
-
disconnect: ({ call }) => {
|
|
281
|
-
return async (port) => {
|
|
282
|
-
const portId = PORT_MAP.get(port);
|
|
283
|
-
if (portId === undefined) {
|
|
284
|
-
throw new Error('The given port is not connected.');
|
|
285
|
-
}
|
|
286
|
-
await call('disconnect', { portId });
|
|
287
|
-
};
|
|
288
|
-
},
|
|
289
|
-
isSupported: ({ call }) => {
|
|
290
|
-
return () => call('isSupported');
|
|
291
|
-
}
|
|
292
|
-
});
|
|
293
|
-
|
|
294
|
-
const ONGOING_REQUESTS = new WeakMap();
|
|
295
|
-
const createOrGetOngoingRequests = (sender) => {
|
|
296
|
-
if (ONGOING_REQUESTS.has(sender)) {
|
|
297
|
-
// @todo TypeScript needs to be convinced that has() works as expected.
|
|
298
|
-
return ONGOING_REQUESTS.get(sender);
|
|
299
|
-
}
|
|
300
|
-
const ongoingRequests = new Map();
|
|
301
|
-
ONGOING_REQUESTS.set(sender, ongoingRequests);
|
|
302
|
-
return ongoingRequests;
|
|
303
|
-
};
|
|
304
|
-
const createBroker = (brokerImplementation) => {
|
|
264
|
+
const createBrokerFactory = (createOrGetOngoingRequests, extendBrokerImplementation, generateUniqueNumber, isMessagePort) => (brokerImplementation) => {
|
|
305
265
|
const fullBrokerImplementation = extendBrokerImplementation(brokerImplementation);
|
|
306
266
|
return (sender) => {
|
|
307
267
|
const ongoingRequests = createOrGetOngoingRequests(sender);
|
|
@@ -344,81 +304,115 @@ define((function () { 'use strict';
|
|
|
344
304
|
};
|
|
345
305
|
};
|
|
346
306
|
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
307
|
+
const createCreateOrGetOngoingRequests = (ongoingRequestsMap) => (sender) => {
|
|
308
|
+
if (ongoingRequestsMap.has(sender)) {
|
|
309
|
+
// @todo TypeScript needs to be convinced that has() works as expected.
|
|
310
|
+
return ongoingRequestsMap.get(sender);
|
|
311
|
+
}
|
|
312
|
+
const ongoingRequests = new Map();
|
|
313
|
+
ongoingRequestsMap.set(sender, ongoingRequests);
|
|
314
|
+
return ongoingRequests;
|
|
315
|
+
};
|
|
316
|
+
|
|
317
|
+
const createExtendBrokerImplementation = (portMap) => (partialBrokerImplementation) => ({
|
|
318
|
+
...partialBrokerImplementation,
|
|
319
|
+
connect: ({ call }) => {
|
|
320
|
+
return async () => {
|
|
321
|
+
const { port1, port2 } = new MessageChannel();
|
|
322
|
+
const portId = await call('connect', { port: port1 }, [port1]);
|
|
323
|
+
portMap.set(port2, portId);
|
|
324
|
+
return port2;
|
|
359
325
|
};
|
|
360
326
|
},
|
|
361
|
-
|
|
362
|
-
return (
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
scheduledTimeoutsState.delete(timerId);
|
|
367
|
-
});
|
|
327
|
+
disconnect: ({ call }) => {
|
|
328
|
+
return async (port) => {
|
|
329
|
+
const portId = portMap.get(port);
|
|
330
|
+
if (portId === undefined) {
|
|
331
|
+
throw new Error('The given port is not connected.');
|
|
368
332
|
}
|
|
333
|
+
await call('disconnect', { portId });
|
|
369
334
|
};
|
|
370
335
|
},
|
|
371
|
-
|
|
372
|
-
return (
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
};
|
|
397
|
-
},
|
|
398
|
-
setTimeout: ({ call }) => {
|
|
399
|
-
return (func, delay = 0, ...args) => {
|
|
400
|
-
const symbol = Symbol();
|
|
401
|
-
const timerId = generateUniqueNumber(scheduledTimeoutsState);
|
|
402
|
-
scheduledTimeoutsState.set(timerId, symbol);
|
|
403
|
-
call('set', {
|
|
404
|
-
delay,
|
|
405
|
-
now: performance.timeOrigin + performance.now(),
|
|
406
|
-
timerId,
|
|
407
|
-
timerType: 'timeout'
|
|
408
|
-
}).then(() => {
|
|
409
|
-
const state = scheduledTimeoutsState.get(timerId);
|
|
410
|
-
if (state === undefined) {
|
|
411
|
-
throw new Error('The timer is in an undefined state.');
|
|
412
|
-
}
|
|
413
|
-
if (state === symbol) {
|
|
414
|
-
// A timeout can be savely deleted because it is only called once.
|
|
415
|
-
scheduledTimeoutsState.delete(timerId);
|
|
416
|
-
func(...args);
|
|
417
|
-
}
|
|
418
|
-
});
|
|
419
|
-
return timerId;
|
|
420
|
-
};
|
|
336
|
+
isSupported: ({ call }) => {
|
|
337
|
+
return () => call('isSupported');
|
|
338
|
+
}
|
|
339
|
+
});
|
|
340
|
+
|
|
341
|
+
const isMessagePort = (sender) => {
|
|
342
|
+
return typeof sender.start === 'function';
|
|
343
|
+
};
|
|
344
|
+
|
|
345
|
+
const createBroker = createBrokerFactory(createCreateOrGetOngoingRequests(new WeakMap()), createExtendBrokerImplementation(new WeakMap()), generateUniqueNumber, isMessagePort);
|
|
346
|
+
|
|
347
|
+
const createClearIntervalFactory = (scheduledIntervalsState) => (clear) => (timerId) => {
|
|
348
|
+
if (typeof scheduledIntervalsState.get(timerId) === 'symbol') {
|
|
349
|
+
scheduledIntervalsState.set(timerId, null);
|
|
350
|
+
clear(timerId).then(() => {
|
|
351
|
+
scheduledIntervalsState.delete(timerId);
|
|
352
|
+
});
|
|
353
|
+
}
|
|
354
|
+
};
|
|
355
|
+
|
|
356
|
+
const createClearTimeoutFactory = (scheduledTimeoutsState) => (clear) => (timerId) => {
|
|
357
|
+
if (typeof scheduledTimeoutsState.get(timerId) === 'symbol') {
|
|
358
|
+
scheduledTimeoutsState.set(timerId, null);
|
|
359
|
+
clear(timerId).then(() => {
|
|
360
|
+
scheduledTimeoutsState.delete(timerId);
|
|
361
|
+
});
|
|
421
362
|
}
|
|
363
|
+
};
|
|
364
|
+
|
|
365
|
+
const createSetIntervalFactory = (generateUniqueNumber, scheduledIntervalsState) => (set) => (func, delay = 0, ...args) => {
|
|
366
|
+
const symbol = Symbol();
|
|
367
|
+
const timerId = generateUniqueNumber(scheduledIntervalsState);
|
|
368
|
+
scheduledIntervalsState.set(timerId, symbol);
|
|
369
|
+
const schedule = () => set(delay, timerId).then(() => {
|
|
370
|
+
const state = scheduledIntervalsState.get(timerId);
|
|
371
|
+
if (state === undefined) {
|
|
372
|
+
throw new Error('The timer is in an undefined state.');
|
|
373
|
+
}
|
|
374
|
+
if (state === symbol) {
|
|
375
|
+
func(...args);
|
|
376
|
+
// Doublecheck if the interval should still be rescheduled because it could have been cleared inside of func().
|
|
377
|
+
if (scheduledIntervalsState.get(timerId) === symbol) {
|
|
378
|
+
schedule();
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
});
|
|
382
|
+
schedule();
|
|
383
|
+
return timerId;
|
|
384
|
+
};
|
|
385
|
+
|
|
386
|
+
const createSetTimeoutFactory = (generateUniqueNumber, scheduledTimeoutsState) => (set) => (func, delay = 0, ...args) => {
|
|
387
|
+
const symbol = Symbol();
|
|
388
|
+
const timerId = generateUniqueNumber(scheduledTimeoutsState);
|
|
389
|
+
scheduledTimeoutsState.set(timerId, symbol);
|
|
390
|
+
set(delay, timerId).then(() => {
|
|
391
|
+
const state = scheduledTimeoutsState.get(timerId);
|
|
392
|
+
if (state === undefined) {
|
|
393
|
+
throw new Error('The timer is in an undefined state.');
|
|
394
|
+
}
|
|
395
|
+
if (state === symbol) {
|
|
396
|
+
// A timeout can be savely deleted because it is only called once.
|
|
397
|
+
scheduledTimeoutsState.delete(timerId);
|
|
398
|
+
func(...args);
|
|
399
|
+
}
|
|
400
|
+
});
|
|
401
|
+
return timerId;
|
|
402
|
+
};
|
|
403
|
+
|
|
404
|
+
// Prefilling the Maps with a function indexed by zero is necessary to be compliant with the specification.
|
|
405
|
+
const scheduledIntervalsState = new Map([[0, null]]); // tslint:disable-line no-empty
|
|
406
|
+
const scheduledTimeoutsState = new Map([[0, null]]); // tslint:disable-line no-empty
|
|
407
|
+
const createClearInterval = createClearIntervalFactory(scheduledIntervalsState);
|
|
408
|
+
const createClearTimeout = createClearTimeoutFactory(scheduledTimeoutsState);
|
|
409
|
+
const createSetInterval = createSetIntervalFactory(generateUniqueNumber, scheduledIntervalsState);
|
|
410
|
+
const createSetTimeout = createSetTimeoutFactory(generateUniqueNumber, scheduledTimeoutsState);
|
|
411
|
+
const wrap = createBroker({
|
|
412
|
+
clearInterval: ({ call }) => createClearInterval((timerId) => call('clear', { timerId, timerType: 'interval' })),
|
|
413
|
+
clearTimeout: ({ call }) => createClearTimeout((timerId) => call('clear', { timerId, timerType: 'timeout' })),
|
|
414
|
+
setInterval: ({ call }) => createSetInterval((delay, timerId) => call('set', { delay, now: performance.timeOrigin + performance.now(), timerId, timerType: 'interval' })),
|
|
415
|
+
setTimeout: ({ call }) => createSetTimeout((delay, timerId) => call('set', { delay, now: performance.timeOrigin + performance.now(), timerId, timerType: 'timeout' }))
|
|
422
416
|
});
|
|
423
417
|
const load = (url) => {
|
|
424
418
|
const worker = new Worker(url);
|
|
@@ -441,7 +435,7 @@ define((function () { 'use strict';
|
|
|
441
435
|
};
|
|
442
436
|
|
|
443
437
|
// This is the minified and stringified code of the worker-timers-worker package.
|
|
444
|
-
const worker = `(()=>{var e={455
|
|
438
|
+
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
|
|
445
439
|
|
|
446
440
|
const loadOrReturnBroker = createLoadOrReturnBroker(load, worker);
|
|
447
441
|
const clearInterval$1 = (timerId) => loadOrReturnBroker().clearInterval(timerId);
|
|
@@ -522,7 +516,7 @@ define((function () { 'use strict';
|
|
|
522
516
|
* @param propName
|
|
523
517
|
*/
|
|
524
518
|
delete(target, propName) {
|
|
525
|
-
if (typeof Reflect === "object" && Reflect.deleteProperty) {
|
|
519
|
+
if (typeof Reflect === "object" && typeof Reflect.deleteProperty === "function") {
|
|
526
520
|
Reflect.deleteProperty(target, propName);
|
|
527
521
|
}
|
|
528
522
|
else {
|
|
@@ -1028,13 +1022,13 @@ define((function () { 'use strict';
|
|
|
1028
1022
|
if (element == null) {
|
|
1029
1023
|
return;
|
|
1030
1024
|
}
|
|
1031
|
-
let
|
|
1025
|
+
let $elList = [];
|
|
1032
1026
|
if (element instanceof NodeList || Array.isArray(element)) {
|
|
1033
1027
|
element = element;
|
|
1034
|
-
|
|
1028
|
+
$elList = $elList.concat(element);
|
|
1035
1029
|
}
|
|
1036
1030
|
else {
|
|
1037
|
-
|
|
1031
|
+
$elList.push(element);
|
|
1038
1032
|
}
|
|
1039
1033
|
let eventTypeList = [];
|
|
1040
1034
|
if (Array.isArray(eventType)) {
|
|
@@ -1085,7 +1079,7 @@ define((function () { 'use strict';
|
|
|
1085
1079
|
// 目标函数、事件名、回调函数、事件配置、过滤函数
|
|
1086
1080
|
filter = option;
|
|
1087
1081
|
}
|
|
1088
|
-
|
|
1082
|
+
$elList.forEach((elementItem) => {
|
|
1089
1083
|
// 获取对象上的事件
|
|
1090
1084
|
const elementEvents = Reflect.get(elementItem, SymbolEvents) || {};
|
|
1091
1085
|
eventTypeList.forEach((eventName) => {
|
|
@@ -1132,18 +1126,19 @@ define((function () { 'use strict';
|
|
|
1132
1126
|
* @param eventType (可选)需要取消监听的事件
|
|
1133
1127
|
*/
|
|
1134
1128
|
offAll(element, eventType) {
|
|
1129
|
+
const that = this;
|
|
1135
1130
|
if (typeof element === "string") {
|
|
1136
|
-
element =
|
|
1131
|
+
element = that.selectorAll(element);
|
|
1137
1132
|
}
|
|
1138
1133
|
if (element == null) {
|
|
1139
1134
|
return;
|
|
1140
1135
|
}
|
|
1141
|
-
let
|
|
1136
|
+
let $elList = [];
|
|
1142
1137
|
if (element instanceof NodeList || Array.isArray(element)) {
|
|
1143
|
-
|
|
1138
|
+
$elList = $elList.concat(Array.from(element));
|
|
1144
1139
|
}
|
|
1145
1140
|
else {
|
|
1146
|
-
|
|
1141
|
+
$elList.push(element);
|
|
1147
1142
|
}
|
|
1148
1143
|
let eventTypeList = [];
|
|
1149
1144
|
if (Array.isArray(eventType)) {
|
|
@@ -1152,12 +1147,13 @@ define((function () { 'use strict';
|
|
|
1152
1147
|
else if (typeof eventType === "string") {
|
|
1153
1148
|
eventTypeList = eventTypeList.concat(eventType.split(" "));
|
|
1154
1149
|
}
|
|
1155
|
-
|
|
1156
|
-
Object.getOwnPropertySymbols(
|
|
1157
|
-
|
|
1150
|
+
$elList.forEach(($elItem) => {
|
|
1151
|
+
const symbolList = [...new Set([...Object.getOwnPropertySymbols($elItem), SymbolEvents])];
|
|
1152
|
+
symbolList.forEach((symbolItem) => {
|
|
1153
|
+
if (!symbolItem.toString().startsWith("Symbol(events_")) {
|
|
1158
1154
|
return;
|
|
1159
1155
|
}
|
|
1160
|
-
const elementEvents =
|
|
1156
|
+
const elementEvents = Reflect.get($elItem, symbolItem) || {};
|
|
1161
1157
|
const iterEventNameList = eventTypeList.length ? eventTypeList : Object.keys(elementEvents);
|
|
1162
1158
|
iterEventNameList.forEach((eventName) => {
|
|
1163
1159
|
const handlers = elementEvents[eventName];
|
|
@@ -1165,11 +1161,12 @@ define((function () { 'use strict';
|
|
|
1165
1161
|
return;
|
|
1166
1162
|
}
|
|
1167
1163
|
for (const handler of handlers) {
|
|
1168
|
-
|
|
1164
|
+
$elItem.removeEventListener(eventName, handler.callback, {
|
|
1169
1165
|
capture: handler["option"]["capture"],
|
|
1170
1166
|
});
|
|
1171
1167
|
}
|
|
1172
|
-
|
|
1168
|
+
const events = Reflect.get($elItem, symbolItem);
|
|
1169
|
+
popsUtils.delete(events, eventName);
|
|
1173
1170
|
});
|
|
1174
1171
|
});
|
|
1175
1172
|
});
|
|
@@ -1912,7 +1909,8 @@ define((function () { 'use strict';
|
|
|
1912
1909
|
}
|
|
1913
1910
|
return $el.classList.contains(className);
|
|
1914
1911
|
}
|
|
1915
|
-
css(
|
|
1912
|
+
css($el, property, value) {
|
|
1913
|
+
const that = this;
|
|
1916
1914
|
/**
|
|
1917
1915
|
* 把纯数字没有px的加上
|
|
1918
1916
|
*/
|
|
@@ -1926,10 +1924,33 @@ define((function () { 'use strict';
|
|
|
1926
1924
|
}
|
|
1927
1925
|
return propertyValue;
|
|
1928
1926
|
}
|
|
1929
|
-
if (typeof
|
|
1930
|
-
|
|
1927
|
+
if (typeof $el === "string") {
|
|
1928
|
+
$el = that.selectorAll($el);
|
|
1931
1929
|
}
|
|
1932
|
-
if (
|
|
1930
|
+
if ($el == null) {
|
|
1931
|
+
return;
|
|
1932
|
+
}
|
|
1933
|
+
if (Array.isArray($el) || $el instanceof NodeList) {
|
|
1934
|
+
if (typeof property === "string") {
|
|
1935
|
+
if (value == null) {
|
|
1936
|
+
// 获取属性
|
|
1937
|
+
return that.css($el[0], property);
|
|
1938
|
+
}
|
|
1939
|
+
else {
|
|
1940
|
+
// 设置属性
|
|
1941
|
+
$el.forEach(($elItem) => {
|
|
1942
|
+
that.css($elItem, property);
|
|
1943
|
+
});
|
|
1944
|
+
return;
|
|
1945
|
+
}
|
|
1946
|
+
}
|
|
1947
|
+
else if (typeof property === "object") {
|
|
1948
|
+
// 设置属性
|
|
1949
|
+
$el.forEach(($elItem) => {
|
|
1950
|
+
that.css($elItem, property);
|
|
1951
|
+
});
|
|
1952
|
+
return;
|
|
1953
|
+
}
|
|
1933
1954
|
return;
|
|
1934
1955
|
}
|
|
1935
1956
|
const setStyleProperty = (propertyName, propertyValue) => {
|
|
@@ -1938,16 +1959,16 @@ define((function () { 'use strict';
|
|
|
1938
1959
|
.trim()
|
|
1939
1960
|
.replace(/!important$/gi, "")
|
|
1940
1961
|
.trim();
|
|
1941
|
-
|
|
1962
|
+
$el.style.setProperty(propertyName, propertyValue, "important");
|
|
1942
1963
|
}
|
|
1943
1964
|
else {
|
|
1944
1965
|
propertyValue = handlePixe(propertyName, propertyValue);
|
|
1945
|
-
|
|
1966
|
+
$el.style.setProperty(propertyName, propertyValue);
|
|
1946
1967
|
}
|
|
1947
1968
|
};
|
|
1948
1969
|
if (typeof property === "string") {
|
|
1949
1970
|
if (value == null) {
|
|
1950
|
-
return getComputedStyle(
|
|
1971
|
+
return PopsCore.globalThis.getComputedStyle($el).getPropertyValue(property);
|
|
1951
1972
|
}
|
|
1952
1973
|
else {
|
|
1953
1974
|
setStyleProperty(property, value);
|
|
@@ -1959,6 +1980,10 @@ define((function () { 'use strict';
|
|
|
1959
1980
|
setStyleProperty(prop, value);
|
|
1960
1981
|
}
|
|
1961
1982
|
}
|
|
1983
|
+
else {
|
|
1984
|
+
// 其他情况
|
|
1985
|
+
throw new TypeError("property must be string or object");
|
|
1986
|
+
}
|
|
1962
1987
|
}
|
|
1963
1988
|
/**
|
|
1964
1989
|
* 创建元素
|
|
@@ -3093,16 +3118,16 @@ define((function () { 'use strict';
|
|
|
3093
3118
|
},
|
|
3094
3119
|
/**
|
|
3095
3120
|
* 删除配置中对应的对象
|
|
3096
|
-
* @param
|
|
3121
|
+
* @param totalInstConfigList 配置实例列表
|
|
3097
3122
|
* @param guid 唯一标识
|
|
3098
3123
|
* @param isAll 是否全部删除
|
|
3099
3124
|
*/
|
|
3100
|
-
removeInstance(
|
|
3125
|
+
async removeInstance(totalInstConfigList, guid, isAll = false) {
|
|
3101
3126
|
/**
|
|
3102
3127
|
* 移除元素实例
|
|
3103
3128
|
* @param instCommonConfig
|
|
3104
3129
|
*/
|
|
3105
|
-
function
|
|
3130
|
+
const removeInst = function (instCommonConfig) {
|
|
3106
3131
|
if (typeof instCommonConfig.beforeRemoveCallBack === "function") {
|
|
3107
3132
|
// 调用移除签的回调
|
|
3108
3133
|
instCommonConfig.beforeRemoveCallBack(instCommonConfig);
|
|
@@ -3111,39 +3136,44 @@ define((function () { 'use strict';
|
|
|
3111
3136
|
instCommonConfig?.$pops?.remove();
|
|
3112
3137
|
instCommonConfig?.$mask?.remove();
|
|
3113
3138
|
instCommonConfig?.$shadowContainer?.remove();
|
|
3114
|
-
}
|
|
3139
|
+
};
|
|
3140
|
+
const asyncInstTask = [];
|
|
3115
3141
|
// [ inst[], inst[],...]
|
|
3116
|
-
|
|
3142
|
+
totalInstConfigList.forEach((instConfigList) => {
|
|
3117
3143
|
// inst[]
|
|
3118
|
-
instConfigList.forEach((instConfigItem, index) => {
|
|
3144
|
+
instConfigList.forEach(async (instConfigItem, index) => {
|
|
3119
3145
|
// 移除全部或者guid相同
|
|
3120
|
-
if (isAll ||
|
|
3146
|
+
if (isAll || (typeof guid === "string" && instConfigItem.guid === guid)) {
|
|
3121
3147
|
// 判断是否有动画
|
|
3122
3148
|
const animName = instConfigItem.$anim.getAttribute("anim");
|
|
3123
3149
|
if (PopsAnimation.hasAnim(animName)) {
|
|
3124
3150
|
const reverseAnimName = animName + "-reverse";
|
|
3125
|
-
instConfigItem.$anim
|
|
3126
|
-
instConfigItem.$anim
|
|
3127
|
-
instConfigItem.$anim
|
|
3128
|
-
if (PopsAnimation.hasAnim(instConfigItem.$anim
|
|
3129
|
-
|
|
3130
|
-
|
|
3131
|
-
|
|
3132
|
-
|
|
3133
|
-
|
|
3151
|
+
popsDOMUtils.css(instConfigItem.$anim, "width", "100%");
|
|
3152
|
+
popsDOMUtils.css(instConfigItem.$anim, "height", "100%");
|
|
3153
|
+
popsDOMUtils.css(instConfigItem.$anim, "animation-name", reverseAnimName);
|
|
3154
|
+
if (PopsAnimation.hasAnim(popsDOMUtils.css(instConfigItem.$anim, "animation-name"))) {
|
|
3155
|
+
asyncInstTask.push(new Promise((resolve) => {
|
|
3156
|
+
popsDOMUtils.on(instConfigItem.$anim, popsDOMUtils.getAnimationEndNameList(), function () {
|
|
3157
|
+
removeInst(instConfigItem);
|
|
3158
|
+
resolve();
|
|
3159
|
+
}, {
|
|
3160
|
+
capture: true,
|
|
3161
|
+
});
|
|
3162
|
+
}));
|
|
3134
3163
|
}
|
|
3135
3164
|
else {
|
|
3136
|
-
|
|
3165
|
+
removeInst(instConfigItem);
|
|
3137
3166
|
}
|
|
3138
3167
|
}
|
|
3139
3168
|
else {
|
|
3140
|
-
|
|
3169
|
+
removeInst(instConfigItem);
|
|
3141
3170
|
}
|
|
3142
3171
|
instConfigList.splice(index, 1);
|
|
3143
3172
|
}
|
|
3144
3173
|
});
|
|
3145
3174
|
});
|
|
3146
|
-
|
|
3175
|
+
await Promise.all(asyncInstTask);
|
|
3176
|
+
return totalInstConfigList;
|
|
3147
3177
|
},
|
|
3148
3178
|
/**
|
|
3149
3179
|
* 隐藏
|
|
@@ -3288,8 +3318,9 @@ define((function () { 'use strict';
|
|
|
3288
3318
|
* @param config
|
|
3289
3319
|
* @param $anim
|
|
3290
3320
|
*/
|
|
3291
|
-
close(config, popsType, instConfigList, guid, $anim) {
|
|
3292
|
-
|
|
3321
|
+
async close(config, popsType, instConfigList, guid, $anim) {
|
|
3322
|
+
// eslint-disable-next-line no-async-promise-executor
|
|
3323
|
+
await new Promise(async (resolve) => {
|
|
3293
3324
|
const $pops = $anim.querySelector(".pops[type-value]");
|
|
3294
3325
|
const drawerConfig = config;
|
|
3295
3326
|
/**
|
|
@@ -3299,12 +3330,12 @@ define((function () { 'use strict';
|
|
|
3299
3330
|
/**
|
|
3300
3331
|
* 弹窗已关闭的回调
|
|
3301
3332
|
*/
|
|
3302
|
-
function closeCallBack(event) {
|
|
3333
|
+
async function closeCallBack(event) {
|
|
3303
3334
|
if (event.propertyName !== "transform") {
|
|
3304
3335
|
return;
|
|
3305
3336
|
}
|
|
3306
|
-
popsDOMUtils.off($pops, popsDOMUtils.getTransitionEndNameList(),
|
|
3307
|
-
PopsInstanceUtils.removeInstance([instConfigList], guid);
|
|
3337
|
+
popsDOMUtils.off($pops, popsDOMUtils.getTransitionEndNameList(), closeCallBack);
|
|
3338
|
+
await PopsInstanceUtils.removeInstance([instConfigList], guid);
|
|
3308
3339
|
resolve();
|
|
3309
3340
|
}
|
|
3310
3341
|
// 监听过渡结束
|
|
@@ -3336,10 +3367,32 @@ define((function () { 'use strict';
|
|
|
3336
3367
|
}, drawerConfig.closeDelay);
|
|
3337
3368
|
}
|
|
3338
3369
|
else {
|
|
3339
|
-
PopsInstanceUtils.removeInstance([instConfigList], guid);
|
|
3370
|
+
await PopsInstanceUtils.removeInstance([instConfigList], guid);
|
|
3340
3371
|
resolve();
|
|
3341
3372
|
}
|
|
3342
3373
|
});
|
|
3374
|
+
// 判断组件内是否有rightClickMenu、tooltip、searchSuggestion组件
|
|
3375
|
+
// 有的话也需要关闭
|
|
3376
|
+
PopsInstData.rightClickMenu.forEach((itemConfig) => {
|
|
3377
|
+
const config = itemConfig.config;
|
|
3378
|
+
if (config.$target instanceof HTMLElement) {
|
|
3379
|
+
const $root = config.$target.getRootNode();
|
|
3380
|
+
if ($root instanceof HTMLElement && $root.parentElement == null) {
|
|
3381
|
+
// 触发销毁元素
|
|
3382
|
+
itemConfig.destory();
|
|
3383
|
+
}
|
|
3384
|
+
}
|
|
3385
|
+
});
|
|
3386
|
+
PopsInstData.tooltip.forEach((itemConfig) => {
|
|
3387
|
+
const config = itemConfig.config;
|
|
3388
|
+
if (config.$target instanceof HTMLElement) {
|
|
3389
|
+
const $root = config.$target.getRootNode();
|
|
3390
|
+
if ($root instanceof HTMLElement && $root.parentElement == null) {
|
|
3391
|
+
// 触发销毁元素
|
|
3392
|
+
itemConfig.destory();
|
|
3393
|
+
}
|
|
3394
|
+
}
|
|
3395
|
+
});
|
|
3343
3396
|
},
|
|
3344
3397
|
/**
|
|
3345
3398
|
* 拖拽元素
|
|
@@ -3678,12 +3731,12 @@ define((function () { 'use strict';
|
|
|
3678
3731
|
element.hasAttribute("anim"));
|
|
3679
3732
|
}
|
|
3680
3733
|
// 判断按下的元素是否是pops-anim
|
|
3681
|
-
popsDOMUtils.on(config.animElement, ["touchstart", "mousedown"],
|
|
3734
|
+
popsDOMUtils.on(config.animElement, ["touchstart", "mousedown"], (event) => {
|
|
3682
3735
|
const $click = event.composedPath()[0];
|
|
3683
3736
|
isMaskClick = isAnimElement($click);
|
|
3684
3737
|
});
|
|
3685
3738
|
// 如果有动画层,在动画层上监听点击事件
|
|
3686
|
-
popsDOMUtils.on(config.animElement, "click",
|
|
3739
|
+
popsDOMUtils.on(config.animElement, "click", (event) => {
|
|
3687
3740
|
const $click = event.composedPath()[0];
|
|
3688
3741
|
if (isAnimElement($click) && isMaskClick) {
|
|
3689
3742
|
return clickEvent(event);
|
|
@@ -3691,7 +3744,7 @@ define((function () { 'use strict';
|
|
|
3691
3744
|
});
|
|
3692
3745
|
// 在遮罩层监听点击事件
|
|
3693
3746
|
// 如果有动画层,那么该点击事件触发不了
|
|
3694
|
-
popsDOMUtils.on(result.maskElement, "click",
|
|
3747
|
+
popsDOMUtils.on(result.maskElement, "click", (event) => {
|
|
3695
3748
|
isMaskClick = true;
|
|
3696
3749
|
clickEvent(event);
|
|
3697
3750
|
});
|
|
@@ -3834,13 +3887,13 @@ define((function () { 'use strict';
|
|
|
3834
3887
|
* @param guid
|
|
3835
3888
|
* @param $shadowContainer
|
|
3836
3889
|
* @param $shadowRoot
|
|
3837
|
-
* @param
|
|
3890
|
+
* @param type 当前弹窗类型
|
|
3838
3891
|
* @param $anim 动画层
|
|
3839
3892
|
* @param $pops 主元素
|
|
3840
3893
|
* @param $mask 遮罩层
|
|
3841
3894
|
* @param config 当前配置
|
|
3842
3895
|
*/
|
|
3843
|
-
handleEventConfig(config, guid, $shadowContainer, $shadowRoot,
|
|
3896
|
+
handleEventConfig(config, guid, $shadowContainer, $shadowRoot, type, $anim, $pops, $mask) {
|
|
3844
3897
|
return {
|
|
3845
3898
|
$shadowContainer: $shadowContainer,
|
|
3846
3899
|
$shadowRoot: $shadowRoot,
|
|
@@ -3848,44 +3901,47 @@ define((function () { 'use strict';
|
|
|
3848
3901
|
$anim: $anim,
|
|
3849
3902
|
$pops: $pops,
|
|
3850
3903
|
$mask: $mask,
|
|
3851
|
-
mode:
|
|
3904
|
+
mode: type,
|
|
3852
3905
|
guid: guid,
|
|
3853
3906
|
close() {
|
|
3854
|
-
return PopsInstanceUtils.close(config,
|
|
3907
|
+
return PopsInstanceUtils.close(config, type, PopsInstData[type], guid, $anim);
|
|
3855
3908
|
},
|
|
3856
3909
|
hide() {
|
|
3857
|
-
return PopsInstanceUtils.hide(config,
|
|
3910
|
+
return PopsInstanceUtils.hide(config, type, PopsInstData[type], guid, $anim, $mask);
|
|
3858
3911
|
},
|
|
3859
|
-
show() {
|
|
3860
|
-
|
|
3912
|
+
show($parent) {
|
|
3913
|
+
if ($parent) {
|
|
3914
|
+
$parent.appendChild(PopsInstData[type][0].$shadowRoot);
|
|
3915
|
+
}
|
|
3916
|
+
return PopsInstanceUtils.show(config, type, PopsInstData[type], guid, $anim, $mask);
|
|
3861
3917
|
},
|
|
3862
3918
|
};
|
|
3863
3919
|
},
|
|
3864
3920
|
/**
|
|
3865
3921
|
* 获取loading的事件配置
|
|
3866
3922
|
* @param guid
|
|
3867
|
-
* @param
|
|
3923
|
+
* @param type 当前弹窗类型
|
|
3868
3924
|
* @param $anim 动画层
|
|
3869
3925
|
* @param $pops 主元素
|
|
3870
3926
|
* @param $mask 遮罩层
|
|
3871
3927
|
* @param config 当前配置
|
|
3872
3928
|
*/
|
|
3873
|
-
handleLoadingEventConfig(config, guid,
|
|
3929
|
+
handleLoadingEventConfig(config, guid, type, $anim, $pops, $mask) {
|
|
3874
3930
|
return {
|
|
3875
3931
|
$el: $anim,
|
|
3876
3932
|
$anim: $anim,
|
|
3877
3933
|
$pops: $pops,
|
|
3878
3934
|
$mask: $mask,
|
|
3879
|
-
mode:
|
|
3935
|
+
mode: type,
|
|
3880
3936
|
guid: guid,
|
|
3881
3937
|
close() {
|
|
3882
|
-
return PopsInstanceUtils.close(config,
|
|
3938
|
+
return PopsInstanceUtils.close(config, type, PopsInstData[type], guid, $anim);
|
|
3883
3939
|
},
|
|
3884
3940
|
hide() {
|
|
3885
|
-
return PopsInstanceUtils.hide(config,
|
|
3941
|
+
return PopsInstanceUtils.hide(config, type, PopsInstData[type], guid, $anim, $mask);
|
|
3886
3942
|
},
|
|
3887
3943
|
show() {
|
|
3888
|
-
return PopsInstanceUtils.show(config,
|
|
3944
|
+
return PopsInstanceUtils.show(config, type, PopsInstData[type], guid, $anim, $mask);
|
|
3889
3945
|
},
|
|
3890
3946
|
};
|
|
3891
3947
|
},
|
|
@@ -3998,8 +4054,8 @@ define((function () { 'use strict';
|
|
|
3998
4054
|
handleOnly(type, config) {
|
|
3999
4055
|
if (config.only) {
|
|
4000
4056
|
// .loading
|
|
4001
|
-
// .tooltip
|
|
4002
4057
|
// .rightClickMenu
|
|
4058
|
+
// .tooltip
|
|
4003
4059
|
// 单独处理
|
|
4004
4060
|
if (type === "loading" || type === "tooltip" || type === "rightClickMenu") {
|
|
4005
4061
|
const inst = PopsInstData[type];
|
|
@@ -4011,11 +4067,11 @@ define((function () { 'use strict';
|
|
|
4011
4067
|
PopsInstanceUtils.removeInstance([
|
|
4012
4068
|
PopsInstData.alert,
|
|
4013
4069
|
PopsInstData.confirm,
|
|
4014
|
-
PopsInstData.prompt,
|
|
4015
|
-
PopsInstData.iframe,
|
|
4016
4070
|
PopsInstData.drawer,
|
|
4017
4071
|
PopsInstData.folder,
|
|
4072
|
+
PopsInstData.iframe,
|
|
4018
4073
|
PopsInstData.panel,
|
|
4074
|
+
PopsInstData.prompt,
|
|
4019
4075
|
], "", true);
|
|
4020
4076
|
}
|
|
4021
4077
|
}
|
|
@@ -4179,6 +4235,7 @@ define((function () { 'use strict';
|
|
|
4179
4235
|
}
|
|
4180
4236
|
// 处理返回的配置
|
|
4181
4237
|
const evtConfig = PopsHandler.handleEventConfig(config, guid, $shadowContainer, $shadowRoot, popsType, $anim, $pops, $mask);
|
|
4238
|
+
const result = PopsHandler.handleResultConfig(evtConfig);
|
|
4182
4239
|
// 为顶部右边的关闭按钮添加点击事件
|
|
4183
4240
|
PopsHandler.handleClickEvent("close", $headerCloseBtn, evtConfig, config.btn.close?.callback);
|
|
4184
4241
|
// 为底部ok按钮添加点击事件
|
|
@@ -4201,6 +4258,8 @@ define((function () { 'use strict';
|
|
|
4201
4258
|
$mask: $mask,
|
|
4202
4259
|
$shadowContainer: $shadowContainer,
|
|
4203
4260
|
$shadowRoot: $shadowRoot,
|
|
4261
|
+
config: config,
|
|
4262
|
+
destory: result.close,
|
|
4204
4263
|
});
|
|
4205
4264
|
// 拖拽
|
|
4206
4265
|
if (config.drag) {
|
|
@@ -4212,7 +4271,6 @@ define((function () { 'use strict';
|
|
|
4212
4271
|
endCallBack: config.dragEndCallBack,
|
|
4213
4272
|
});
|
|
4214
4273
|
}
|
|
4215
|
-
const result = PopsHandler.handleResultConfig(evtConfig);
|
|
4216
4274
|
return result;
|
|
4217
4275
|
},
|
|
4218
4276
|
};
|
|
@@ -4386,6 +4444,7 @@ define((function () { 'use strict';
|
|
|
4386
4444
|
$elList.push($mask);
|
|
4387
4445
|
}
|
|
4388
4446
|
const evtConfig = PopsHandler.handleEventConfig(config, guid, $shadowContainer, $shadowRoot, popsType, $anim, $pops, $mask);
|
|
4447
|
+
const result = PopsHandler.handleResultConfig(evtConfig);
|
|
4389
4448
|
PopsHandler.handleClickEvent("close", $btnClose, evtConfig, config.btn.close.callback);
|
|
4390
4449
|
PopsHandler.handleClickEvent("ok", $btnOk, evtConfig, config.btn.ok.callback);
|
|
4391
4450
|
PopsHandler.handleClickEvent("cancel", $btnCancel, evtConfig, config.btn.cancel.callback);
|
|
@@ -4406,6 +4465,8 @@ define((function () { 'use strict';
|
|
|
4406
4465
|
$mask: $mask,
|
|
4407
4466
|
$shadowContainer: $shadowContainer,
|
|
4408
4467
|
$shadowRoot: $shadowRoot,
|
|
4468
|
+
config: config,
|
|
4469
|
+
destory: result.close,
|
|
4409
4470
|
});
|
|
4410
4471
|
// 拖拽
|
|
4411
4472
|
if (config.drag) {
|
|
@@ -4417,7 +4478,6 @@ define((function () { 'use strict';
|
|
|
4417
4478
|
endCallBack: config.dragEndCallBack,
|
|
4418
4479
|
});
|
|
4419
4480
|
}
|
|
4420
|
-
const result = PopsHandler.handleResultConfig(evtConfig);
|
|
4421
4481
|
return result;
|
|
4422
4482
|
},
|
|
4423
4483
|
};
|
|
@@ -4596,6 +4656,7 @@ define((function () { 'use strict';
|
|
|
4596
4656
|
$elList.push($mask);
|
|
4597
4657
|
}
|
|
4598
4658
|
const evtConfig = PopsHandler.handleEventConfig(config, guid, $shadowContainer, $shadowRoot, popsType, $anim, $pops, $mask);
|
|
4659
|
+
const result = PopsHandler.handleResultConfig(evtConfig);
|
|
4599
4660
|
// 处理方向
|
|
4600
4661
|
$pops.setAttribute("direction", config.direction);
|
|
4601
4662
|
// 处理border-radius
|
|
@@ -4691,8 +4752,9 @@ define((function () { 'use strict';
|
|
|
4691
4752
|
$mask: $mask,
|
|
4692
4753
|
$shadowContainer: $shadowContainer,
|
|
4693
4754
|
$shadowRoot: $shadowRoot,
|
|
4755
|
+
config: config,
|
|
4756
|
+
destory: result.close,
|
|
4694
4757
|
});
|
|
4695
|
-
const result = PopsHandler.handleResultConfig(evtConfig);
|
|
4696
4758
|
return result;
|
|
4697
4759
|
},
|
|
4698
4760
|
};
|
|
@@ -5201,6 +5263,7 @@ define((function () { 'use strict';
|
|
|
5201
5263
|
}
|
|
5202
5264
|
// 事件
|
|
5203
5265
|
const evtConfig = PopsHandler.handleEventConfig(config, guid, $shadowContainer, $shadowRoot, popsType, $anim, $pops, $mask);
|
|
5266
|
+
const result = PopsHandler.handleResultConfig(evtConfig);
|
|
5204
5267
|
PopsHandler.handleClickEvent("close", $btnCloseBtn, evtConfig, config.btn.close.callback);
|
|
5205
5268
|
PopsHandler.handleClickEvent("ok", btnOkElement, evtConfig, config.btn.ok.callback);
|
|
5206
5269
|
PopsHandler.handleClickEvent("cancel", btnCancelElement, evtConfig, config.btn.cancel.callback);
|
|
@@ -5780,8 +5843,9 @@ define((function () { 'use strict';
|
|
|
5780
5843
|
$mask: $mask,
|
|
5781
5844
|
$shadowContainer: $shadowContainer,
|
|
5782
5845
|
$shadowRoot: $shadowRoot,
|
|
5846
|
+
config: config,
|
|
5847
|
+
destory: result.close,
|
|
5783
5848
|
});
|
|
5784
|
-
const result = PopsHandler.handleResultConfig(evtConfig);
|
|
5785
5849
|
return result;
|
|
5786
5850
|
},
|
|
5787
5851
|
};
|
|
@@ -5937,6 +6001,7 @@ define((function () { 'use strict';
|
|
|
5937
6001
|
const evtConfig = PopsHandler.handleEventConfig(config, guid, $shadowContainer, $shadowRoot, popsType, $anim, $pops, $mask);
|
|
5938
6002
|
// 赋值额外的$iframe参数
|
|
5939
6003
|
evtConfig.$iframe = $iframe;
|
|
6004
|
+
const result = PopsHandler.handleResultConfig(evtConfig);
|
|
5940
6005
|
popsDOMUtils.on($anim, popsDOMUtils.getAnimationEndNameList(), function () {
|
|
5941
6006
|
// 动画加载完毕
|
|
5942
6007
|
$anim.style.width = "0%";
|
|
@@ -6068,10 +6133,10 @@ define((function () { 'use strict';
|
|
|
6068
6133
|
capture: true,
|
|
6069
6134
|
});
|
|
6070
6135
|
// 关闭按钮点击事件
|
|
6071
|
-
popsDOMUtils.on(headerCloseBtnElement, "click", (event) => {
|
|
6136
|
+
popsDOMUtils.on(headerCloseBtnElement, "click", async (event) => {
|
|
6072
6137
|
event.preventDefault();
|
|
6073
6138
|
event.stopPropagation();
|
|
6074
|
-
PopsInstanceUtils.removeInstance([PopsInstData.iframe], guid, false);
|
|
6139
|
+
await PopsInstanceUtils.removeInstance([PopsInstData.iframe], guid, false);
|
|
6075
6140
|
if (typeof config?.btn?.close?.callback === "function") {
|
|
6076
6141
|
config.btn.close.callback(evtConfig, event);
|
|
6077
6142
|
}
|
|
@@ -6085,8 +6150,9 @@ define((function () { 'use strict';
|
|
|
6085
6150
|
$mask: $mask,
|
|
6086
6151
|
$shadowContainer: $shadowContainer,
|
|
6087
6152
|
$shadowRoot: $shadowRoot,
|
|
6153
|
+
config: config,
|
|
6154
|
+
destory: result.close,
|
|
6088
6155
|
});
|
|
6089
|
-
const result = PopsHandler.handleResultConfig(evtConfig);
|
|
6090
6156
|
return result;
|
|
6091
6157
|
},
|
|
6092
6158
|
};
|
|
@@ -7052,7 +7118,7 @@ define((function () { 'use strict';
|
|
|
7052
7118
|
isFixed: false,
|
|
7053
7119
|
alwaysShow: false,
|
|
7054
7120
|
onShowEventName: "mouseenter touchstart",
|
|
7055
|
-
onCloseEventName: "mouseleave touchend",
|
|
7121
|
+
onCloseEventName: "mouseleave touchend touchcancel",
|
|
7056
7122
|
zIndex: 10000,
|
|
7057
7123
|
only: false,
|
|
7058
7124
|
eventOption: {
|
|
@@ -7278,12 +7344,12 @@ define((function () { 'use strict';
|
|
|
7278
7344
|
changePosition(event) {
|
|
7279
7345
|
const positionInfo = this.calcToolTipPosition(this.$data.config.$target, this.$data.config.arrowDistance, this.$data.config.otherDistance, event);
|
|
7280
7346
|
const positionKey = this.$data.config.position.toUpperCase();
|
|
7281
|
-
const
|
|
7282
|
-
if (
|
|
7283
|
-
this.$el.$toolTip.style.left =
|
|
7284
|
-
this.$el.$toolTip.style.top =
|
|
7285
|
-
this.$el.$toolTip.setAttribute("data-motion",
|
|
7286
|
-
this.$el.$arrow.setAttribute("data-position",
|
|
7347
|
+
const position = positionInfo[positionKey];
|
|
7348
|
+
if (position) {
|
|
7349
|
+
this.$el.$toolTip.style.left = position.left + "px";
|
|
7350
|
+
this.$el.$toolTip.style.top = position.top + "px";
|
|
7351
|
+
this.$el.$toolTip.setAttribute("data-motion", position.motion);
|
|
7352
|
+
this.$el.$arrow.setAttribute("data-position", position.arrow);
|
|
7287
7353
|
}
|
|
7288
7354
|
else {
|
|
7289
7355
|
console.error("不存在该位置", this.$data.config.position);
|
|
@@ -7389,9 +7455,7 @@ define((function () { 'use strict';
|
|
|
7389
7455
|
* 取消绑定 显示事件
|
|
7390
7456
|
*/
|
|
7391
7457
|
offShowEvent() {
|
|
7392
|
-
popsDOMUtils.off(this.$data.config.$target, this.$data.config.onShowEventName, this.show,
|
|
7393
|
-
capture: true,
|
|
7394
|
-
});
|
|
7458
|
+
popsDOMUtils.off(this.$data.config.$target, this.$data.config.onShowEventName, this.show, this.$data.config.eventOption);
|
|
7395
7459
|
}
|
|
7396
7460
|
/**
|
|
7397
7461
|
* 关闭提示框
|
|
@@ -7450,22 +7514,20 @@ define((function () { 'use strict';
|
|
|
7450
7514
|
* 取消绑定 关闭事件
|
|
7451
7515
|
*/
|
|
7452
7516
|
offCloseEvent() {
|
|
7453
|
-
popsDOMUtils.off(this.$data.config.$target, this.$data.config.onCloseEventName, this.close,
|
|
7454
|
-
capture: true,
|
|
7455
|
-
});
|
|
7517
|
+
popsDOMUtils.off(this.$data.config.$target, this.$data.config.onCloseEventName, this.close, this.$data.config.eventOption);
|
|
7456
7518
|
}
|
|
7457
7519
|
/**
|
|
7458
7520
|
* 销毁元素
|
|
7459
7521
|
*/
|
|
7460
7522
|
destory() {
|
|
7461
7523
|
if (this.$el.$toolTip) {
|
|
7462
|
-
this.$el.$
|
|
7524
|
+
this.$el.$toolTip.remove();
|
|
7463
7525
|
}
|
|
7464
|
-
// @ts-
|
|
7526
|
+
// @ts-expect-error
|
|
7465
7527
|
this.$el.$toolTip = null;
|
|
7466
|
-
// @ts-
|
|
7528
|
+
// @ts-expect-error
|
|
7467
7529
|
this.$el.$arrow = null;
|
|
7468
|
-
// @ts-
|
|
7530
|
+
// @ts-expect-error
|
|
7469
7531
|
this.$el.$content = null;
|
|
7470
7532
|
}
|
|
7471
7533
|
/**
|
|
@@ -7513,29 +7575,29 @@ define((function () { 'use strict';
|
|
|
7513
7575
|
popsDOMUtils.on(this.$el.$toolTip, "mouseenter touchstart", this.toolTipMouseEnterEvent, this.$data.config.eventOption);
|
|
7514
7576
|
}
|
|
7515
7577
|
/**
|
|
7516
|
-
*
|
|
7578
|
+
* 取消监听事件 - 鼠标|触摸
|
|
7517
7579
|
*/
|
|
7518
7580
|
offToolTipMouseEnterEvent() {
|
|
7519
7581
|
popsDOMUtils.off(this.$el.$toolTip, "mouseenter touchstart", this.toolTipMouseEnterEvent, this.$data.config.eventOption);
|
|
7520
7582
|
}
|
|
7521
7583
|
/**
|
|
7522
|
-
*
|
|
7584
|
+
* 离开事件 - 鼠标|触摸
|
|
7523
7585
|
*/
|
|
7524
7586
|
toolTipMouseLeaveEvent(event) {
|
|
7525
7587
|
this.close(event);
|
|
7526
7588
|
// this.$el.$toolTip.style.animationPlayState = "running";
|
|
7527
7589
|
}
|
|
7528
7590
|
/**
|
|
7529
|
-
*
|
|
7591
|
+
* 监听离开事件 - 鼠标|触摸
|
|
7530
7592
|
*/
|
|
7531
7593
|
onToolTipMouseLeaveEvent() {
|
|
7532
|
-
popsDOMUtils.on(this.$el.$toolTip, "mouseleave touchend", this.toolTipMouseLeaveEvent, this.$data.config.eventOption);
|
|
7594
|
+
popsDOMUtils.on(this.$el.$toolTip, "mouseleave touchend touchcancel", this.toolTipMouseLeaveEvent, this.$data.config.eventOption);
|
|
7533
7595
|
}
|
|
7534
7596
|
/**
|
|
7535
|
-
*
|
|
7597
|
+
* 取消监听离开事件 - 鼠标|触摸
|
|
7536
7598
|
*/
|
|
7537
7599
|
offToolTipMouseLeaveEvent() {
|
|
7538
|
-
popsDOMUtils.off(this.$el.$toolTip, "mouseleave touchend", this.toolTipMouseLeaveEvent, this.$data.config.eventOption);
|
|
7600
|
+
popsDOMUtils.off(this.$el.$toolTip, "mouseleave touchend touchcancel", this.toolTipMouseLeaveEvent, this.$data.config.eventOption);
|
|
7539
7601
|
}
|
|
7540
7602
|
}
|
|
7541
7603
|
const PopsTooltip = {
|
|
@@ -7550,6 +7612,15 @@ define((function () { 'use strict';
|
|
|
7550
7612
|
throw new TypeError("config.target 必须是HTMLElement类型");
|
|
7551
7613
|
}
|
|
7552
7614
|
config = PopsHandler.handleOnly(popsType, config);
|
|
7615
|
+
if (config.position === "follow") {
|
|
7616
|
+
config.onShowEventName = config.onShowEventName.trim();
|
|
7617
|
+
const showEventNameSplit = config.onShowEventName.split(" ");
|
|
7618
|
+
["mousemove", "touchmove"].forEach((it) => {
|
|
7619
|
+
if (showEventNameSplit.includes(it))
|
|
7620
|
+
return;
|
|
7621
|
+
config.onShowEventName += ` ${it}`;
|
|
7622
|
+
});
|
|
7623
|
+
}
|
|
7553
7624
|
const { $shadowContainer, $shadowRoot } = PopsHandler.handlerShadow(config);
|
|
7554
7625
|
PopsHandler.handleInit($shadowRoot, [
|
|
7555
7626
|
{
|
|
@@ -8814,7 +8885,7 @@ define((function () { 'use strict';
|
|
|
8814
8885
|
* 监听输入框内容改变
|
|
8815
8886
|
*/
|
|
8816
8887
|
onValueChange() {
|
|
8817
|
-
popsDOMUtils.on(this.$el.input, ["input", "propertychange"],
|
|
8888
|
+
popsDOMUtils.on(this.$el.input, ["input", "propertychange"], (event) => {
|
|
8818
8889
|
this.$data.value = this.$el.input.value;
|
|
8819
8890
|
if (inputType !== "password") {
|
|
8820
8891
|
// 不是密码框
|
|
@@ -9187,7 +9258,7 @@ define((function () { 'use strict';
|
|
|
9187
9258
|
* 监听点击事件
|
|
9188
9259
|
*/
|
|
9189
9260
|
onClick() {
|
|
9190
|
-
popsDOMUtils.on(this.$el.$select, "click",
|
|
9261
|
+
popsDOMUtils.on(this.$el.$select, "click", (event) => {
|
|
9191
9262
|
this.setSelectOptionsDisableStatus();
|
|
9192
9263
|
if (typeof viewConfig.clickCallBack === "function") {
|
|
9193
9264
|
const $isSelectedElement = this.$el.$select[this.$el.$select.selectedIndex];
|
|
@@ -10954,7 +11025,7 @@ define((function () { 'use strict';
|
|
|
10954
11025
|
* 设置按钮的点击事件
|
|
10955
11026
|
*/
|
|
10956
11027
|
onButtonClick() {
|
|
10957
|
-
popsDOMUtils.on(this.$ele.button, "click",
|
|
11028
|
+
popsDOMUtils.on(this.$ele.button, "click", (event) => {
|
|
10958
11029
|
if (typeof viewConfig.callback === "function") {
|
|
10959
11030
|
viewConfig.callback(event);
|
|
10960
11031
|
}
|
|
@@ -11023,13 +11094,13 @@ define((function () { 'use strict';
|
|
|
11023
11094
|
initContainerItem($container, formItemConfig) {
|
|
11024
11095
|
const containerViewConfig = formItemConfig;
|
|
11025
11096
|
if (containerViewConfig.type === "container") {
|
|
11026
|
-
const
|
|
11097
|
+
const childViewConfig = containerViewConfig["views"];
|
|
11027
11098
|
// 每一项<li>元素
|
|
11028
|
-
const
|
|
11099
|
+
const $itemLi = popsDOMUtils.createElement("li");
|
|
11029
11100
|
// 每一项<li>内的子<ul>元素
|
|
11030
|
-
const
|
|
11031
|
-
|
|
11032
|
-
|
|
11101
|
+
const $itemUL = popsDOMUtils.createElement("ul");
|
|
11102
|
+
$itemUL.classList.add("pops-panel-forms-container-item-formlist");
|
|
11103
|
+
$itemLi.classList.add("pops-panel-forms-container-item");
|
|
11033
11104
|
// 区域头部的文字
|
|
11034
11105
|
const formHeaderDivElement = popsDOMUtils.createElement("div", {
|
|
11035
11106
|
className: "pops-panel-forms-container-item-header-text",
|
|
@@ -11049,42 +11120,42 @@ define((function () { 'use strict';
|
|
|
11049
11120
|
`);
|
|
11050
11121
|
// 添加点击事件
|
|
11051
11122
|
popsDOMUtils.on(formHeaderDivElement, "click", () => {
|
|
11052
|
-
if (
|
|
11053
|
-
|
|
11123
|
+
if ($itemLi.hasAttribute("data-fold-enable")) {
|
|
11124
|
+
$itemLi.removeAttribute("data-fold-enable");
|
|
11054
11125
|
}
|
|
11055
11126
|
else {
|
|
11056
|
-
|
|
11127
|
+
$itemLi.setAttribute("data-fold-enable", "");
|
|
11057
11128
|
}
|
|
11058
11129
|
});
|
|
11059
11130
|
popsDOMUtils.addClassName(formHeaderDivElement, "pops-panel-forms-fold-container");
|
|
11060
11131
|
popsDOMUtils.addClassName(formHeaderDivElement, PopsCommonCSSClassName.userSelectNone);
|
|
11061
|
-
|
|
11132
|
+
$itemLi.setAttribute("data-fold-enable", "");
|
|
11062
11133
|
popsDOMUtils.addClassName(formHeaderDivElement, "pops-panel-forms-fold");
|
|
11063
|
-
|
|
11134
|
+
$itemLi.appendChild(formHeaderDivElement);
|
|
11064
11135
|
}
|
|
11065
11136
|
else {
|
|
11066
11137
|
// 加进容器内
|
|
11067
|
-
|
|
11138
|
+
$itemLi.appendChild(formHeaderDivElement);
|
|
11068
11139
|
}
|
|
11069
|
-
that.setElementClassName(
|
|
11070
|
-
that.setElementAttributes(
|
|
11071
|
-
that.setElementProps(
|
|
11072
|
-
|
|
11140
|
+
that.setElementClassName($itemLi, formItemConfig.className);
|
|
11141
|
+
that.setElementAttributes($itemLi, formItemConfig.attributes);
|
|
11142
|
+
that.setElementProps($itemLi, formItemConfig.props);
|
|
11143
|
+
$itemLi.appendChild($itemUL);
|
|
11144
|
+
$container.appendChild($itemLi);
|
|
11145
|
+
childViewConfig.forEach((childViewConfig) => {
|
|
11073
11146
|
that.uListContainerAddItem(childViewConfig, {
|
|
11074
|
-
ulElement:
|
|
11147
|
+
ulElement: $itemUL,
|
|
11075
11148
|
sectionContainerULElement: that.sectionContainerULElement,
|
|
11076
|
-
formContainerListElement:
|
|
11149
|
+
formContainerListElement: $itemLi,
|
|
11077
11150
|
formHeaderDivElement: formHeaderDivElement,
|
|
11078
11151
|
});
|
|
11079
11152
|
});
|
|
11080
|
-
formContainerListElement.appendChild(formContainerULElement);
|
|
11081
|
-
$container.appendChild(formContainerListElement);
|
|
11082
11153
|
if (typeof containerViewConfig.afterAddToUListCallBack === "function") {
|
|
11083
11154
|
containerViewConfig.afterAddToUListCallBack(viewConfig, {
|
|
11084
|
-
target:
|
|
11085
|
-
ulElement:
|
|
11155
|
+
target: $itemLi,
|
|
11156
|
+
ulElement: $itemUL,
|
|
11086
11157
|
sectionContainerULElement: that.sectionContainerULElement,
|
|
11087
|
-
formContainerListElement:
|
|
11158
|
+
formContainerListElement: $itemLi,
|
|
11088
11159
|
formHeaderDivElement: formHeaderDivElement,
|
|
11089
11160
|
});
|
|
11090
11161
|
}
|
|
@@ -11223,7 +11294,7 @@ define((function () { 'use strict';
|
|
|
11223
11294
|
},
|
|
11224
11295
|
/** 设置项的点击事件 */
|
|
11225
11296
|
onLiClick() {
|
|
11226
|
-
popsDOMUtils.on($li, "click",
|
|
11297
|
+
popsDOMUtils.on($li, "click", async (event) => {
|
|
11227
11298
|
if (typeof viewConfig.clickCallBack === "function") {
|
|
11228
11299
|
const result = await viewConfig.clickCallBack(event, viewConfig);
|
|
11229
11300
|
if (result) {
|
|
@@ -11551,6 +11622,7 @@ define((function () { 'use strict';
|
|
|
11551
11622
|
}
|
|
11552
11623
|
// 处理返回的配置
|
|
11553
11624
|
const evtConfig = PopsHandler.handleEventConfig(config, guid, $shadowContainer, $shadowRoot, popsType, $anim, $pops, $mask);
|
|
11625
|
+
const result = PopsHandler.handleResultConfig(evtConfig);
|
|
11554
11626
|
// 为顶部右边的关闭按钮添加点击事件
|
|
11555
11627
|
PopsHandler.handleClickEvent("close", $headerBtnClose, evtConfig, config.btn?.close?.callback);
|
|
11556
11628
|
// 创建到页面中
|
|
@@ -11588,6 +11660,8 @@ define((function () { 'use strict';
|
|
|
11588
11660
|
$mask: $mask,
|
|
11589
11661
|
$shadowContainer: $shadowContainer,
|
|
11590
11662
|
$shadowRoot: $shadowRoot,
|
|
11663
|
+
config: config,
|
|
11664
|
+
destory: result.close,
|
|
11591
11665
|
});
|
|
11592
11666
|
// 拖拽
|
|
11593
11667
|
if (config.drag) {
|
|
@@ -11599,7 +11673,6 @@ define((function () { 'use strict';
|
|
|
11599
11673
|
endCallBack: config.dragEndCallBack,
|
|
11600
11674
|
});
|
|
11601
11675
|
}
|
|
11602
|
-
const result = PopsHandler.handleResultConfig(evtConfig);
|
|
11603
11676
|
return {
|
|
11604
11677
|
...result,
|
|
11605
11678
|
addEventListener: (event, listener, options) => {
|
|
@@ -11791,6 +11864,7 @@ define((function () { 'use strict';
|
|
|
11791
11864
|
$elList.push($mask);
|
|
11792
11865
|
}
|
|
11793
11866
|
const evtConfig = PopsHandler.handleEventConfig(config, guid, $shadowContainer, $shadowRoot, popsType, $anim, $pops, $mask);
|
|
11867
|
+
const result = PopsHandler.handleResultConfig(evtConfig);
|
|
11794
11868
|
// 输入框赋值初始值
|
|
11795
11869
|
$input.value = config.content.text;
|
|
11796
11870
|
PopsHandler.handlePromptClickEvent("close", $input, $btnClose, evtConfig, config.btn.close.callback);
|
|
@@ -11813,6 +11887,8 @@ define((function () { 'use strict';
|
|
|
11813
11887
|
$mask: $mask,
|
|
11814
11888
|
$shadowContainer: $shadowContainer,
|
|
11815
11889
|
$shadowRoot: $shadowRoot,
|
|
11890
|
+
config: config,
|
|
11891
|
+
destory: result.close,
|
|
11816
11892
|
});
|
|
11817
11893
|
// 拖拽
|
|
11818
11894
|
if (config.drag) {
|
|
@@ -11832,7 +11908,6 @@ define((function () { 'use strict';
|
|
|
11832
11908
|
if (config.content.select) {
|
|
11833
11909
|
$input.select();
|
|
11834
11910
|
}
|
|
11835
|
-
const result = PopsHandler.handleResultConfig(evtConfig);
|
|
11836
11911
|
return result;
|
|
11837
11912
|
},
|
|
11838
11913
|
};
|
|
@@ -11934,6 +12009,7 @@ define((function () { 'use strict';
|
|
|
11934
12009
|
beforeAppendToPageCallBack() { },
|
|
11935
12010
|
limitPositionXInView: true,
|
|
11936
12011
|
limitPositionYInView: true,
|
|
12012
|
+
beforeShowCallBack() { },
|
|
11937
12013
|
};
|
|
11938
12014
|
};
|
|
11939
12015
|
|
|
@@ -11993,6 +12069,8 @@ define((function () { 'use strict';
|
|
|
11993
12069
|
return;
|
|
11994
12070
|
}
|
|
11995
12071
|
if ($click.className && $click.className === "pops-shadow-container" && $click.shadowRoot != null) {
|
|
12072
|
+
// pops的shadow-container
|
|
12073
|
+
PopsContextMenu.shadowRootCheckClickEvent(event);
|
|
11996
12074
|
return;
|
|
11997
12075
|
}
|
|
11998
12076
|
PopsContextMenu.closeAllMenu(PopsContextMenu.$el.$root);
|
|
@@ -12005,7 +12083,7 @@ define((function () { 'use strict';
|
|
|
12005
12083
|
if (!PopsContextMenu.$el.$root) {
|
|
12006
12084
|
return;
|
|
12007
12085
|
}
|
|
12008
|
-
const $click = event.
|
|
12086
|
+
const $click = event.composedPath()[0];
|
|
12009
12087
|
if ($click.closest(`.pops-${popsType}`)) {
|
|
12010
12088
|
return;
|
|
12011
12089
|
}
|
|
@@ -12015,13 +12093,13 @@ define((function () { 'use strict';
|
|
|
12015
12093
|
* 添加全局点击检测事件
|
|
12016
12094
|
*/
|
|
12017
12095
|
addWindowCheckClickListener() {
|
|
12018
|
-
popsDOMUtils.on(globalThis, "click touchstart",
|
|
12096
|
+
popsDOMUtils.on(globalThis, "click touchstart", PopsContextMenu.windowCheckClickEvent, {
|
|
12019
12097
|
capture: true,
|
|
12020
12098
|
});
|
|
12021
12099
|
if (config.$target instanceof Node) {
|
|
12022
12100
|
const $shadowRoot = config.$target.getRootNode();
|
|
12023
12101
|
if ($shadowRoot instanceof ShadowRoot) {
|
|
12024
|
-
popsDOMUtils.on($shadowRoot, "click touchstart",
|
|
12102
|
+
popsDOMUtils.on($shadowRoot, "click touchstart", PopsContextMenu.shadowRootCheckClickEvent, {
|
|
12025
12103
|
capture: true,
|
|
12026
12104
|
});
|
|
12027
12105
|
}
|
|
@@ -12031,13 +12109,13 @@ define((function () { 'use strict';
|
|
|
12031
12109
|
* 移除全局点击检测事件
|
|
12032
12110
|
*/
|
|
12033
12111
|
removeWindowCheckClickListener() {
|
|
12034
|
-
popsDOMUtils.off(globalThis, "click touchstart",
|
|
12112
|
+
popsDOMUtils.off(globalThis, "click touchstart", PopsContextMenu.windowCheckClickEvent, {
|
|
12035
12113
|
capture: true,
|
|
12036
12114
|
});
|
|
12037
12115
|
if (config.$target instanceof Node) {
|
|
12038
12116
|
const $shadowRoot = config.$target.getRootNode();
|
|
12039
12117
|
if ($shadowRoot instanceof ShadowRoot) {
|
|
12040
|
-
popsDOMUtils.off($shadowRoot, "click touchstart",
|
|
12118
|
+
popsDOMUtils.off($shadowRoot, "click touchstart", PopsContextMenu.windowCheckClickEvent, {
|
|
12041
12119
|
capture: true,
|
|
12042
12120
|
});
|
|
12043
12121
|
}
|
|
@@ -12048,7 +12126,7 @@ define((function () { 'use strict';
|
|
|
12048
12126
|
* @param event
|
|
12049
12127
|
* @param selectorTarget
|
|
12050
12128
|
*/
|
|
12051
|
-
contextMenuEvent(event, selectorTarget) {
|
|
12129
|
+
async contextMenuEvent(event, selectorTarget) {
|
|
12052
12130
|
if (config.preventDefault) {
|
|
12053
12131
|
popsDOMUtils.preventEvent(event);
|
|
12054
12132
|
}
|
|
@@ -12057,6 +12135,10 @@ define((function () { 'use strict';
|
|
|
12057
12135
|
PopsContextMenu.closeAllMenu(PopsContextMenu.$el.$root);
|
|
12058
12136
|
}
|
|
12059
12137
|
selectorTarget = selectorTarget ?? config.$target;
|
|
12138
|
+
const beforeShowCallBackResult = await config?.beforeShowCallBack(event);
|
|
12139
|
+
if (typeof beforeShowCallBackResult === "boolean" && !beforeShowCallBackResult) {
|
|
12140
|
+
return;
|
|
12141
|
+
}
|
|
12060
12142
|
const rootElement = PopsContextMenu.showMenu(event, config.data, selectorTarget);
|
|
12061
12143
|
PopsContextMenu.$el.$root = rootElement;
|
|
12062
12144
|
if (config.only) {
|
|
@@ -12069,6 +12151,10 @@ define((function () { 'use strict';
|
|
|
12069
12151
|
beforeRemoveCallBack(instCommonConfig) {
|
|
12070
12152
|
PopsContextMenu.closeAllMenu(instCommonConfig.$pops);
|
|
12071
12153
|
},
|
|
12154
|
+
config: config,
|
|
12155
|
+
destory: () => {
|
|
12156
|
+
PopsContextMenu.closeAllMenu(rootElement);
|
|
12157
|
+
},
|
|
12072
12158
|
});
|
|
12073
12159
|
}
|
|
12074
12160
|
},
|
|
@@ -12372,7 +12458,8 @@ define((function () { 'use strict';
|
|
|
12372
12458
|
menuLiElement.appendChild(iconElement);
|
|
12373
12459
|
}
|
|
12374
12460
|
// 插入文字
|
|
12375
|
-
|
|
12461
|
+
const text = typeof item.text === "function" ? item.text() : item.text;
|
|
12462
|
+
menuLiElement.insertAdjacentHTML("beforeend", PopsSafeUtils.getSafeHTML(`<span>${text}</span>`));
|
|
12376
12463
|
// 如果存在子数据,显示
|
|
12377
12464
|
if (item.item && Array.isArray(item.item)) {
|
|
12378
12465
|
popsDOMUtils.addClassName(menuLiElement, `pops-${popsType}-item`);
|
|
@@ -13011,10 +13098,10 @@ define((function () { 'use strict';
|
|
|
13011
13098
|
setShowEvent(option = defaultListenerOption) {
|
|
13012
13099
|
/* 焦点|点击事件*/
|
|
13013
13100
|
if (config.followPosition === "target") {
|
|
13014
|
-
popsDOMUtils.on([config.$target], ["focus", "click"],
|
|
13101
|
+
popsDOMUtils.on([config.$target], ["focus", "click"], SearchSuggestion.showEvent, option);
|
|
13015
13102
|
}
|
|
13016
13103
|
else if (config.followPosition === "input") {
|
|
13017
|
-
popsDOMUtils.on([config.$inputTarget], ["focus", "click"],
|
|
13104
|
+
popsDOMUtils.on([config.$inputTarget], ["focus", "click"], SearchSuggestion.showEvent, option);
|
|
13018
13105
|
}
|
|
13019
13106
|
else if (config.followPosition === "inputCursor") {
|
|
13020
13107
|
popsDOMUtils.on([config.$inputTarget], ["focus", "click", "input"], SearchSuggestion.showEvent, option);
|
|
@@ -13028,9 +13115,9 @@ define((function () { 'use strict';
|
|
|
13028
13115
|
*/
|
|
13029
13116
|
removeShowEvent(option = defaultListenerOption) {
|
|
13030
13117
|
/* 焦点|点击事件*/
|
|
13031
|
-
popsDOMUtils.off([config.$target, config.$inputTarget], ["focus", "click"],
|
|
13118
|
+
popsDOMUtils.off([config.$target, config.$inputTarget], ["focus", "click"], SearchSuggestion.showEvent, option);
|
|
13032
13119
|
// 内容改变事件
|
|
13033
|
-
popsDOMUtils.off([config.$inputTarget], ["input"],
|
|
13120
|
+
popsDOMUtils.off([config.$inputTarget], ["input"], SearchSuggestion.showEvent, option);
|
|
13034
13121
|
},
|
|
13035
13122
|
/**
|
|
13036
13123
|
* 隐藏搜索建议框的事件
|
|
@@ -13061,7 +13148,7 @@ define((function () { 'use strict';
|
|
|
13061
13148
|
// 全局触摸屏点击事件
|
|
13062
13149
|
if (Array.isArray(SearchSuggestion.selfDocument)) {
|
|
13063
13150
|
SearchSuggestion.selfDocument.forEach(($checkParent) => {
|
|
13064
|
-
popsDOMUtils.on($checkParent, ["click", "touchstart"],
|
|
13151
|
+
popsDOMUtils.on($checkParent, ["click", "touchstart"], SearchSuggestion.hideEvent, option);
|
|
13065
13152
|
});
|
|
13066
13153
|
}
|
|
13067
13154
|
else {
|
|
@@ -13074,11 +13161,11 @@ define((function () { 'use strict';
|
|
|
13074
13161
|
removeHideEvent(option = defaultListenerOption) {
|
|
13075
13162
|
if (Array.isArray(SearchSuggestion.selfDocument)) {
|
|
13076
13163
|
SearchSuggestion.selfDocument.forEach(($checkParent) => {
|
|
13077
|
-
popsDOMUtils.off($checkParent, ["click", "touchstart"],
|
|
13164
|
+
popsDOMUtils.off($checkParent, ["click", "touchstart"], SearchSuggestion.hideEvent, option);
|
|
13078
13165
|
});
|
|
13079
13166
|
}
|
|
13080
13167
|
else {
|
|
13081
|
-
popsDOMUtils.off(SearchSuggestion.selfDocument, ["click", "touchstart"],
|
|
13168
|
+
popsDOMUtils.off(SearchSuggestion.selfDocument, ["click", "touchstart"], SearchSuggestion.hideEvent, option);
|
|
13082
13169
|
}
|
|
13083
13170
|
},
|
|
13084
13171
|
/**
|
|
@@ -13339,7 +13426,7 @@ define((function () { 'use strict';
|
|
|
13339
13426
|
},
|
|
13340
13427
|
};
|
|
13341
13428
|
|
|
13342
|
-
const version = "3.
|
|
13429
|
+
const version = "3.2.0";
|
|
13343
13430
|
|
|
13344
13431
|
class Pops {
|
|
13345
13432
|
/** 配置 */
|