@whitesev/pops 3.0.0 → 3.0.1
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 +1417 -579
- 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 +1417 -579
- 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 +1417 -579
- 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 +1417 -579
- 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 +1417 -579
- 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 +1417 -579
- 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 +372 -21
- package/dist/types/src/PopsCSS.d.ts +3 -1
- package/dist/types/src/PopsIcon.d.ts +1 -1
- package/dist/types/src/components/panel/handlerComponents.d.ts +956 -21
- package/dist/types/src/components/panel/index.d.ts +1 -1
- package/dist/types/src/components/panel/types/components-button.d.ts +1 -1
- package/dist/types/src/components/panel/types/components-container.d.ts +1 -1
- package/dist/types/src/components/panel/types/components-deepMenu.d.ts +1 -1
- package/dist/types/src/components/panel/types/components-input.d.ts +41 -16
- package/dist/types/src/components/panel/types/components-own.d.ts +3 -3
- package/dist/types/src/components/panel/types/components-select.d.ts +89 -30
- package/dist/types/src/components/panel/types/components-selectMultiple.d.ts +10 -15
- package/dist/types/src/components/panel/types/components-slider.d.ts +2 -3
- package/dist/types/src/components/panel/types/components-switch.d.ts +1 -1
- package/dist/types/src/components/panel/types/components-textarea.d.ts +1 -1
- package/dist/types/src/components/searchSuggestion/index.d.ts +3 -3
- package/dist/types/src/types/global.d.ts +3 -1
- package/package.json +8 -8
- package/src/PopsCSS.ts +4 -1
- package/src/components/panel/css/components-select.css +84 -0
- package/src/components/panel/defaultConfig.ts +290 -80
- package/src/components/panel/handlerComponents.ts +1112 -461
- package/src/components/panel/index.css +85 -5
- package/src/components/panel/types/components-button.ts +1 -1
- package/src/components/panel/types/components-container.ts +1 -1
- package/src/components/panel/types/components-deepMenu.ts +1 -1
- package/src/components/panel/types/components-input.ts +51 -16
- package/src/components/panel/types/components-own.ts +3 -3
- package/src/components/panel/types/components-select.ts +94 -32
- package/src/components/panel/types/components-selectMultiple.ts +11 -16
- package/src/components/panel/types/components-slider.ts +2 -3
- package/src/components/panel/types/components-switch.ts +1 -1
- package/src/components/panel/types/components-textarea.ts +1 -1
- package/src/components/searchSuggestion/index.ts +20 -65
- package/src/types/global.d.ts +3 -1
|
@@ -46,7 +46,13 @@ export const PopsSearchSuggestion = {
|
|
|
46
46
|
});
|
|
47
47
|
$shadowRoot.appendChild($css);
|
|
48
48
|
}
|
|
49
|
-
|
|
49
|
+
/**
|
|
50
|
+
* 监听器的默认配置
|
|
51
|
+
*/
|
|
52
|
+
const defaultListenerOption: AddEventListenerOptions = {
|
|
53
|
+
capture: true,
|
|
54
|
+
passive: true,
|
|
55
|
+
};
|
|
50
56
|
const SearchSuggestion = {
|
|
51
57
|
/**
|
|
52
58
|
* 当前的环境,可以是document,可以是shadowroot,默认是document
|
|
@@ -416,31 +422,16 @@ export const PopsSearchSuggestion = {
|
|
|
416
422
|
},
|
|
417
423
|
/**
|
|
418
424
|
* 设置搜索建议框每一项的选中事件
|
|
419
|
-
* @param
|
|
425
|
+
* @param $li 每一项元素
|
|
420
426
|
*/
|
|
421
427
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
422
|
-
setSearchItemSelectEvent(
|
|
423
|
-
//
|
|
424
|
-
// liElement,
|
|
425
|
-
// "keyup",
|
|
426
|
-
// void 0,
|
|
427
|
-
// (event) => {
|
|
428
|
-
// let value = liElement["data-value"];
|
|
429
|
-
// config.selectCallBack(event, liElement, value);
|
|
430
|
-
// },
|
|
431
|
-
// {
|
|
432
|
-
// capture: true,
|
|
433
|
-
// }
|
|
434
|
-
// );
|
|
428
|
+
setSearchItemSelectEvent($li: HTMLLIElement) {
|
|
429
|
+
// TODO
|
|
435
430
|
},
|
|
436
431
|
/**
|
|
437
432
|
* 监听输入框内容改变
|
|
438
433
|
*/
|
|
439
|
-
setInputChangeEvent(
|
|
440
|
-
option: AddEventListenerOptions = {
|
|
441
|
-
capture: true,
|
|
442
|
-
}
|
|
443
|
-
) {
|
|
434
|
+
setInputChangeEvent(option: AddEventListenerOptions = defaultListenerOption) {
|
|
444
435
|
// 必须是input或者textarea才有input事件
|
|
445
436
|
if (!(config.$inputTarget instanceof HTMLInputElement || config.$inputTarget instanceof HTMLTextAreaElement)) {
|
|
446
437
|
return;
|
|
@@ -451,8 +442,7 @@ export const PopsSearchSuggestion = {
|
|
|
451
442
|
// 内容改变事件
|
|
452
443
|
const listenerHandler = popsDOMUtils.onInput(
|
|
453
444
|
config.$inputTarget,
|
|
454
|
-
|
|
455
|
-
async (_event) => {
|
|
445
|
+
async () => {
|
|
456
446
|
const data = SearchSuggestion.getData();
|
|
457
447
|
const queryDataResult = await config.inputTargetChangeRefreshShowDataCallback(
|
|
458
448
|
config.$inputTarget.value,
|
|
@@ -469,12 +459,7 @@ export const PopsSearchSuggestion = {
|
|
|
469
459
|
/**
|
|
470
460
|
* 移除输入框内容改变的监听
|
|
471
461
|
*/
|
|
472
|
-
removeInputChangeEvent(
|
|
473
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
474
|
-
option: AddEventListenerOptions = {
|
|
475
|
-
capture: true,
|
|
476
|
-
}
|
|
477
|
-
) {
|
|
462
|
+
removeInputChangeEvent() {
|
|
478
463
|
for (let index = 0; index < SearchSuggestion.$evt.offInputChangeEvtHandler.length; index++) {
|
|
479
464
|
const handler = SearchSuggestion.$evt.offInputChangeEvtHandler[index];
|
|
480
465
|
handler();
|
|
@@ -500,12 +485,7 @@ export const PopsSearchSuggestion = {
|
|
|
500
485
|
/**
|
|
501
486
|
* 设置显示搜索建议框的事件
|
|
502
487
|
*/
|
|
503
|
-
setShowEvent(
|
|
504
|
-
option: AddEventListenerOptions = {
|
|
505
|
-
capture: true,
|
|
506
|
-
passive: true,
|
|
507
|
-
}
|
|
508
|
-
) {
|
|
488
|
+
setShowEvent(option: AddEventListenerOptions = defaultListenerOption) {
|
|
509
489
|
/* 焦点|点击事件*/
|
|
510
490
|
if (config.followPosition === "target") {
|
|
511
491
|
popsDOMUtils.on([config.$target], ["focus", "click"], void 0, SearchSuggestion.showEvent, option);
|
|
@@ -520,12 +500,7 @@ export const PopsSearchSuggestion = {
|
|
|
520
500
|
/**
|
|
521
501
|
* 移除显示搜索建议框的事件
|
|
522
502
|
*/
|
|
523
|
-
removeShowEvent(
|
|
524
|
-
option: AddEventListenerOptions = {
|
|
525
|
-
capture: true,
|
|
526
|
-
passive: true,
|
|
527
|
-
}
|
|
528
|
-
) {
|
|
503
|
+
removeShowEvent(option: AddEventListenerOptions = defaultListenerOption) {
|
|
529
504
|
/* 焦点|点击事件*/
|
|
530
505
|
popsDOMUtils.off(
|
|
531
506
|
[config.$target, config.$inputTarget],
|
|
@@ -561,12 +536,7 @@ export const PopsSearchSuggestion = {
|
|
|
561
536
|
/**
|
|
562
537
|
* 设置隐藏搜索建议框的事件
|
|
563
538
|
*/
|
|
564
|
-
setHideEvent(
|
|
565
|
-
option: AddEventListenerOptions = {
|
|
566
|
-
capture: true,
|
|
567
|
-
passive: true,
|
|
568
|
-
}
|
|
569
|
-
) {
|
|
539
|
+
setHideEvent(option: AddEventListenerOptions = defaultListenerOption) {
|
|
570
540
|
// 全局点击事件
|
|
571
541
|
// 全局触摸屏点击事件
|
|
572
542
|
if (Array.isArray(SearchSuggestion.selfDocument)) {
|
|
@@ -580,12 +550,7 @@ export const PopsSearchSuggestion = {
|
|
|
580
550
|
/**
|
|
581
551
|
* 移除隐藏搜索建议框的事件
|
|
582
552
|
*/
|
|
583
|
-
removeHideEvent(
|
|
584
|
-
option: AddEventListenerOptions = {
|
|
585
|
-
capture: true,
|
|
586
|
-
passive: true,
|
|
587
|
-
}
|
|
588
|
-
) {
|
|
553
|
+
removeHideEvent(option: AddEventListenerOptions = defaultListenerOption) {
|
|
589
554
|
if (Array.isArray(SearchSuggestion.selfDocument)) {
|
|
590
555
|
SearchSuggestion.selfDocument.forEach(($checkParent) => {
|
|
591
556
|
popsDOMUtils.off($checkParent, ["click", "touchstart"], void 0, SearchSuggestion.hideEvent, option);
|
|
@@ -603,12 +568,7 @@ export const PopsSearchSuggestion = {
|
|
|
603
568
|
/**
|
|
604
569
|
* 设置所有监听,包括(input值改变、全局点击判断显示/隐藏建议框)
|
|
605
570
|
*/
|
|
606
|
-
setAllEvent(
|
|
607
|
-
option: AddEventListenerOptions = {
|
|
608
|
-
capture: true,
|
|
609
|
-
passive: true,
|
|
610
|
-
}
|
|
611
|
-
) {
|
|
571
|
+
setAllEvent(option: AddEventListenerOptions = defaultListenerOption) {
|
|
612
572
|
SearchSuggestion.setInputChangeEvent(option);
|
|
613
573
|
SearchSuggestion.setHideEvent(option);
|
|
614
574
|
SearchSuggestion.setShowEvent(option);
|
|
@@ -616,13 +576,8 @@ export const PopsSearchSuggestion = {
|
|
|
616
576
|
/**
|
|
617
577
|
* 移除所有监听
|
|
618
578
|
*/
|
|
619
|
-
removeAllEvent(
|
|
620
|
-
|
|
621
|
-
capture: true,
|
|
622
|
-
passive: true,
|
|
623
|
-
}
|
|
624
|
-
) {
|
|
625
|
-
SearchSuggestion.removeInputChangeEvent(option);
|
|
579
|
+
removeAllEvent(option: AddEventListenerOptions = defaultListenerOption) {
|
|
580
|
+
SearchSuggestion.removeInputChangeEvent();
|
|
626
581
|
SearchSuggestion.removeHideEvent(option);
|
|
627
582
|
SearchSuggestion.removeShowEvent(option);
|
|
628
583
|
},
|