@whitesev/pops 3.0.0 → 3.0.2

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 (61) hide show
  1. package/dist/index.amd.js +1964 -719
  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 +1964 -719
  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 +1964 -719
  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 +1964 -719
  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 +1964 -719
  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 +1964 -719
  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 +413 -22
  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 +1103 -21
  29. package/dist/types/src/components/panel/index.d.ts +2 -2
  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 +126 -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 +473 -213
  46. package/src/components/panel/handlerComponents.ts +1504 -499
  47. package/src/components/panel/index.css +149 -14
  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 +131 -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/rightClickMenu/index.css +1 -1
  59. package/src/components/searchSuggestion/index.ts +20 -65
  60. package/src/css/common.css +4 -4
  61. package/src/types/global.d.ts +3 -1
@@ -35,9 +35,10 @@ export interface PopsPanelSelectMultipleDataOption<T> {
35
35
  /**
36
36
  * pops.panel的 select
37
37
  */
38
- export interface PopsPanelSelectMultipleConfig<T = any> extends PopsPanelGeneralConfig<PopsPanelSelectMultipleConfig> {
38
+ export interface PopsPanelSelectMultipleConfig<T = any>
39
+ extends PopsPanelGeneralConfig<PopsPanelSelectMultipleConfig<T>> {
39
40
  /**
40
- * 类型
41
+ * 组件类型
41
42
  */
42
43
  type: "select-multiple";
43
44
  /**
@@ -60,30 +61,20 @@ export interface PopsPanelSelectMultipleConfig<T = any> extends PopsPanelGeneral
60
61
  * 获取该项的值的回调函数
61
62
  */
62
63
  getValue(): T[];
63
- /**
64
- * 弹出的下拉列表弹窗的配置
65
- */
66
- selectConfirmDialogConfig?: Partial<PopsAlertConfig>;
67
64
  /**
68
65
  * 选择器的值改变触发的回调函数
69
- * @param event 事件
70
- * @param isSelectedValue 当前选中的值,也就是元素属性上的__value__
71
- * @param isSelectedText 当前选中的文本
66
+ * @param isSelectedInfo 当前已选中的信息
72
67
  */
73
- callback?(
74
- /** 当前已选中的信息 */
75
- isSelectedInfo: PopsPanelSelectMultipleDataOption<any>[]
76
- ): void;
68
+ callback?(isSelectedInfo: PopsPanelSelectMultipleDataOption<T>[]): void;
77
69
  /**
78
70
  * 点击某个项的元素触发该回调
79
71
  * @param event 点击事件
80
- * @param selectElement 当前的选中的元素
81
72
  * @returns 如果返回boolean为false,则不会触发默认的点击事件
82
73
  */
83
74
  clickCallBack?(
84
75
  event: PointerEvent | MouseEvent,
85
76
  /** 当前已选中的信息 */
86
- isSelectedInfo: PopsPanelSelectMultipleDataOption<any>[]
77
+ isSelectedInfo: PopsPanelSelectMultipleDataOption<T>[]
87
78
  ): void | boolean;
88
79
  /**
89
80
  * 点击标签tag的关闭图标触发该回调
@@ -103,7 +94,11 @@ export interface PopsPanelSelectMultipleConfig<T = any> extends PopsPanelGeneral
103
94
  }
104
95
  ) => void | boolean;
105
96
  /**
106
- * 选择器内的数据组
97
+ * 选择列表内的数据
107
98
  */
108
99
  data: PopsPanelSelectMultipleDataOption<T>[];
100
+ /**
101
+ * 弹出的下拉列表弹窗的配置
102
+ */
103
+ selectConfirmDialogConfig?: Partial<PopsAlertConfig>;
109
104
  }
@@ -5,8 +5,7 @@ import type { PopsPanelGeneralConfig } from "./components-common";
5
5
  */
6
6
  export interface PopsPanelSliderConfig extends PopsPanelGeneralConfig<PopsPanelSliderConfig> {
7
7
  /**
8
- * 类型
9
- * @default "slider"
8
+ * 组件类型
10
9
  */
11
10
  type: "slider";
12
11
  /**
@@ -39,7 +38,7 @@ export interface PopsPanelSliderConfig extends PopsPanelGeneralConfig<PopsPanelS
39
38
  /**
40
39
  * 获取tooltip的提示内容,可自定义,默认为slider的值
41
40
  */
42
- getToolTipContent?: (value: number) => string;
41
+ getToolTipContent?(value: number): string;
43
42
  /**
44
43
  * 滑块的最小值
45
44
  */
@@ -5,7 +5,7 @@ import type { PopsPanelGeneralConfig } from "./components-common";
5
5
  */
6
6
  export interface PopsPanelSwitchConfig extends PopsPanelGeneralConfig<PopsPanelSwitchConfig> {
7
7
  /**
8
- * 类型
8
+ * 组件类型
9
9
  */
10
10
  type: "switch";
11
11
  /**
@@ -5,7 +5,7 @@ import type { PopsPanelGeneralConfig } from "./components-common";
5
5
  */
6
6
  export interface PopsPanelTextAreaConfig extends PopsPanelGeneralConfig<PopsPanelTextAreaConfig> {
7
7
  /**
8
- * 类型
8
+ * 组件类型
9
9
  */
10
10
  type: "textarea";
11
11
  /**
@@ -93,8 +93,8 @@ i.pops-rightClickMenu-icon[is-loading="true"] {
93
93
  margin: 5px 5px;
94
94
  border-radius: var(--pops-right-context-menu-row-bd-radius);
95
95
  display: flex;
96
- width: -webkit-fill-available;
97
96
  width: -moz-available;
97
+ width: -webkit-fill-available;
98
98
  text-align: left;
99
99
  align-items: center;
100
100
  -webkit-user-select: none;
@@ -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
  },
@@ -34,21 +34,21 @@
34
34
  }
35
35
  .pops-width-fill {
36
36
  width: 100%;
37
- width: -webkit-fill-available;
38
37
  width: -moz-available;
38
+ width: -webkit-fill-available;
39
39
  }
40
40
  .pops-height-fill {
41
41
  height: 100%;
42
- height: -webkit-fill-available;
43
42
  height: -moz-available;
43
+ height: -webkit-fill-available;
44
44
  }
45
45
  .pops-text-is-disabled {
46
46
  --pops-text-is-disabled-color: #a8abb2;
47
- color: var(--pops-text-is-disabled-color);
48
47
  --pops-panel-forms-container-item-left-desc-text-color: var(--pops-text-is-disabled-color);
48
+ color: var(--pops-text-is-disabled-color);
49
49
  }
50
50
  .pops-text-is-disabled-important {
51
51
  --pops-text-is-disabled-color: #a8abb2;
52
- color: var(--pops-text-is-disabled-color) !important;
53
52
  --pops-panel-forms-container-item-left-desc-text-color: var(--pops-text-is-disabled-color) !important;
53
+ color: var(--pops-text-is-disabled-color) !important;
54
54
  }
@@ -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);