@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.
Files changed (59) hide show
  1. package/dist/index.amd.js +1417 -579
  2. package/dist/index.amd.js.map +1 -1
  3. package/dist/index.amd.min.js +1 -1
  4. package/dist/index.amd.min.js.map +1 -1
  5. package/dist/index.cjs.js +1417 -579
  6. package/dist/index.cjs.js.map +1 -1
  7. package/dist/index.cjs.min.js +1 -1
  8. package/dist/index.cjs.min.js.map +1 -1
  9. package/dist/index.esm.js +1417 -579
  10. package/dist/index.esm.js.map +1 -1
  11. package/dist/index.esm.min.js +1 -1
  12. package/dist/index.esm.min.js.map +1 -1
  13. package/dist/index.iife.js +1417 -579
  14. package/dist/index.iife.js.map +1 -1
  15. package/dist/index.iife.min.js +1 -1
  16. package/dist/index.iife.min.js.map +1 -1
  17. package/dist/index.system.js +1417 -579
  18. package/dist/index.system.js.map +1 -1
  19. package/dist/index.system.min.js +1 -1
  20. package/dist/index.system.min.js.map +1 -1
  21. package/dist/index.umd.js +1417 -579
  22. package/dist/index.umd.js.map +1 -1
  23. package/dist/index.umd.min.js +1 -1
  24. package/dist/index.umd.min.js.map +1 -1
  25. package/dist/types/src/Pops.d.ts +372 -21
  26. package/dist/types/src/PopsCSS.d.ts +3 -1
  27. package/dist/types/src/PopsIcon.d.ts +1 -1
  28. package/dist/types/src/components/panel/handlerComponents.d.ts +956 -21
  29. package/dist/types/src/components/panel/index.d.ts +1 -1
  30. package/dist/types/src/components/panel/types/components-button.d.ts +1 -1
  31. package/dist/types/src/components/panel/types/components-container.d.ts +1 -1
  32. package/dist/types/src/components/panel/types/components-deepMenu.d.ts +1 -1
  33. package/dist/types/src/components/panel/types/components-input.d.ts +41 -16
  34. package/dist/types/src/components/panel/types/components-own.d.ts +3 -3
  35. package/dist/types/src/components/panel/types/components-select.d.ts +89 -30
  36. package/dist/types/src/components/panel/types/components-selectMultiple.d.ts +10 -15
  37. package/dist/types/src/components/panel/types/components-slider.d.ts +2 -3
  38. package/dist/types/src/components/panel/types/components-switch.d.ts +1 -1
  39. package/dist/types/src/components/panel/types/components-textarea.d.ts +1 -1
  40. package/dist/types/src/components/searchSuggestion/index.d.ts +3 -3
  41. package/dist/types/src/types/global.d.ts +3 -1
  42. package/package.json +8 -8
  43. package/src/PopsCSS.ts +4 -1
  44. package/src/components/panel/css/components-select.css +84 -0
  45. package/src/components/panel/defaultConfig.ts +290 -80
  46. package/src/components/panel/handlerComponents.ts +1112 -461
  47. package/src/components/panel/index.css +85 -5
  48. package/src/components/panel/types/components-button.ts +1 -1
  49. package/src/components/panel/types/components-container.ts +1 -1
  50. package/src/components/panel/types/components-deepMenu.ts +1 -1
  51. package/src/components/panel/types/components-input.ts +51 -16
  52. package/src/components/panel/types/components-own.ts +3 -3
  53. package/src/components/panel/types/components-select.ts +94 -32
  54. package/src/components/panel/types/components-selectMultiple.ts +11 -16
  55. package/src/components/panel/types/components-slider.ts +2 -3
  56. package/src/components/panel/types/components-switch.ts +1 -1
  57. package/src/components/panel/types/components-textarea.ts +1 -1
  58. package/src/components/searchSuggestion/index.ts +20 -65
  59. 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 liElement
425
+ * @param $li 每一项元素
420
426
  */
421
427
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
422
- setSearchItemSelectEvent(liElement: HTMLLIElement) {
423
- // popsDOMUtils.on(
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
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
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
- option: AddEventListenerOptions = {
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
  },
@@ -26,4 +26,6 @@ declare type DeepRequired<T> = T extends any[]
26
26
  }
27
27
  : T;
28
28
 
29
- declare type IPromise<T> = Promise<T> | T;
29
+ declare type IPromise<T> = T | Promise<T>;
30
+
31
+ declare type IFunction<T> = T | (() => T);