@whitesev/pops 1.6.0 → 1.6.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 (62) hide show
  1. package/dist/index.amd.js +3666 -3125
  2. package/dist/index.amd.js.map +1 -1
  3. package/dist/index.cjs.js +3666 -3125
  4. package/dist/index.cjs.js.map +1 -1
  5. package/dist/index.esm.js +3666 -3125
  6. package/dist/index.esm.js.map +1 -1
  7. package/dist/index.iife.js +3666 -3125
  8. package/dist/index.iife.js.map +1 -1
  9. package/dist/index.system.js +3666 -3125
  10. package/dist/index.system.js.map +1 -1
  11. package/dist/index.umd.js +3666 -3125
  12. package/dist/index.umd.js.map +1 -1
  13. package/dist/types/src/Pops.d.ts +56 -7
  14. package/dist/types/src/components/alert/config.d.ts +2 -0
  15. package/dist/types/src/components/confirm/config.d.ts +2 -0
  16. package/dist/types/src/components/drawer/config.d.ts +2 -0
  17. package/dist/types/src/components/folder/config.d.ts +2 -0
  18. package/dist/types/src/components/iframe/config.d.ts +2 -0
  19. package/dist/types/src/components/loading/config.d.ts +2 -0
  20. package/dist/types/src/components/panel/PanelHandleContentDetails.d.ts +149 -0
  21. package/dist/types/src/components/panel/config.d.ts +2 -0
  22. package/dist/types/src/components/panel/selectMultipleType.d.ts +49 -24
  23. package/dist/types/src/components/prompt/config.d.ts +2 -0
  24. package/dist/types/src/components/rightClickMenu/config.d.ts +2 -0
  25. package/dist/types/src/components/searchSuggestion/config.d.ts +2 -0
  26. package/dist/types/src/components/searchSuggestion/indexType.d.ts +56 -32
  27. package/dist/types/src/components/tooltip/config.d.ts +2 -0
  28. package/dist/types/src/utils/PopsDOMUtils.d.ts +42 -13
  29. package/dist/types/src/utils/PopsInstanceUtils.d.ts +22 -0
  30. package/package.json +4 -1
  31. package/src/Pops.ts +8 -2
  32. package/src/components/alert/config.ts +59 -0
  33. package/src/components/alert/index.ts +2 -57
  34. package/src/components/confirm/config.ts +94 -0
  35. package/src/components/confirm/index.ts +4 -94
  36. package/src/components/drawer/config.ts +90 -0
  37. package/src/components/drawer/index.ts +2 -88
  38. package/src/components/folder/config.ts +130 -0
  39. package/src/components/folder/index.ts +3 -129
  40. package/src/components/iframe/config.ts +58 -0
  41. package/src/components/iframe/index.ts +2 -56
  42. package/src/components/loading/config.ts +27 -0
  43. package/src/components/loading/index.ts +2 -25
  44. package/src/components/panel/PanelHandleContentDetails.ts +2612 -0
  45. package/src/components/panel/config.ts +348 -0
  46. package/src/components/panel/index.css +191 -5
  47. package/src/components/panel/index.ts +10 -2521
  48. package/src/components/panel/selectMultipleType.ts +52 -25
  49. package/src/components/prompt/config.ts +102 -0
  50. package/src/components/prompt/index.ts +2 -100
  51. package/src/components/rightClickMenu/config.ts +122 -0
  52. package/src/components/rightClickMenu/index.css +78 -0
  53. package/src/components/rightClickMenu/index.ts +26 -202
  54. package/src/components/searchSuggestion/config.ts +55 -0
  55. package/src/components/searchSuggestion/index.ts +228 -205
  56. package/src/components/searchSuggestion/indexType.ts +56 -32
  57. package/src/components/tooltip/config.ts +29 -0
  58. package/src/components/tooltip/index.ts +2 -27
  59. package/src/css/animation.css +22 -0
  60. package/src/utils/PopsDOMUtils.ts +108 -29
  61. package/src/utils/PopsInstanceUtils.ts +80 -0
  62. package/src/components/searchSuggestion/index.css +0 -0
@@ -1,5 +1,27 @@
1
+ import type { PopsAlertDetails } from "../alert/indexType";
1
2
  import type { PopsPanelCommonDetails } from "./commonType";
2
3
 
4
+ export interface PopsPanelSelectMultipleDataOption<T> {
5
+ /**
6
+ * 真正的值
7
+ */
8
+ value: T;
9
+ /**
10
+ * 显示的文字
11
+ */
12
+ text: string;
13
+ /**
14
+ * 显示的文字是否是html
15
+ */
16
+ isHTML?: boolean;
17
+ /**
18
+ * (可选)是否禁用项
19
+ * 触发条件:
20
+ * + 点击select元素
21
+ * + select元素触发change事件
22
+ */
23
+ disable?(value: T): boolean;
24
+ }
3
25
  /**
4
26
  * pops.panel的 select
5
27
  */
@@ -33,10 +55,18 @@ export interface PopsPanelSelectMultipleDetails<T = any>
33
55
  * (可选)是否禁用
34
56
  */
35
57
  disabled?: boolean | ((value: T) => boolean);
58
+ /**
59
+ * 提示文字
60
+ */
61
+ placeholder?: string | (() => string);
36
62
  /**
37
63
  * 获取该项的值的回调函数
38
64
  */
39
65
  getValue(): T[];
66
+ /**
67
+ * 弹出的下拉列表弹窗的配置
68
+ */
69
+ selectConfirmDialogDetails?: Partial<PopsAlertDetails>;
40
70
  /**
41
71
  * 选择器的值改变触发的回调函数
42
72
  * @param event 事件
@@ -44,21 +74,19 @@ export interface PopsPanelSelectMultipleDetails<T = any>
44
74
  * @param isSelectedText 当前选中的文本
45
75
  */
46
76
  callback?(
47
- event: PointerEvent | TouchEvent,
48
77
  /** 当前已选中的信息 */
49
78
  isSelectedInfo: {
50
79
  /** 值 */
51
80
  value: T;
52
81
  /** 显示的文字 */
53
82
  text: string;
54
- /** 选中的元素 */
55
- $option: HTMLOptionElement;
56
83
  }[]
57
84
  ): void;
58
85
  /**
59
- * 点击select元素触发该回调
86
+ * 点击某个项的元素触发该回调
60
87
  * @param event 点击事件
61
- * @param selectElement 当前的select元素
88
+ * @param selectElement 当前的选中的元素
89
+ * @returns 如果返回boolean为false,则不会触发默认的点击事件
62
90
  */
63
91
  clickCallBack?(
64
92
  event: PointerEvent | MouseEvent,
@@ -68,28 +96,27 @@ export interface PopsPanelSelectMultipleDetails<T = any>
68
96
  value: T;
69
97
  /** 显示的文字 */
70
98
  text: string;
71
- /** 选中的元素 */
72
- $option: HTMLOptionElement;
73
99
  }[]
74
- ): void;
100
+ ): void | boolean;
101
+ /**
102
+ * 点击标签tag的关闭图标触发该回调
103
+ * 如果返回boolean类型且为false,则阻止默认的事件
104
+ */
105
+ closeIconClickCallBack?: (
106
+ event: PointerEvent | MouseEvent,
107
+ data: {
108
+ /** 标签元素 */
109
+ $tag: HTMLElement;
110
+ /** 关闭图标元素 */
111
+ $closeIcon: HTMLElement;
112
+ /** 值 */
113
+ value: T;
114
+ /** 显示的文字 */
115
+ text: string;
116
+ }
117
+ ) => void | boolean;
75
118
  /**
76
119
  * 选择器内的数据组
77
120
  */
78
- data: {
79
- /**
80
- * 真正的值
81
- */
82
- value: T;
83
- /**
84
- * 显示的文字
85
- */
86
- text: string;
87
- /**
88
- * (可选)是否禁用项
89
- * 触发条件:
90
- * + 点击select元素
91
- * + select元素触发change事件
92
- */
93
- disable?(value: T): boolean;
94
- }[];
121
+ data: PopsPanelSelectMultipleDataOption<T>[];
95
122
  }
@@ -0,0 +1,102 @@
1
+ import type { PopsPromptDetails } from "./indexType";
2
+
3
+ export const PopsPromptConfig: Required<PopsPromptDetails> = {
4
+ title: {
5
+ text: "默认标题",
6
+ position: "left",
7
+ html: false,
8
+ style: "",
9
+ },
10
+ content: {
11
+ text: "",
12
+ select: false,
13
+ password: false,
14
+ row: false,
15
+ focus: true,
16
+ placeholder: "默认提示",
17
+ style: "",
18
+ },
19
+ btn: {
20
+ merge: false,
21
+ mergeReverse: false,
22
+ reverse: false,
23
+ position: "flex-end",
24
+ ok: {
25
+ enable: true,
26
+
27
+ size: void 0,
28
+
29
+ icon: void 0,
30
+ rightIcon: false,
31
+ iconIsLoading: false,
32
+ text: "确定",
33
+ type: "success",
34
+ callback(event) {
35
+ console.log(event);
36
+ event.close();
37
+ },
38
+ },
39
+ cancel: {
40
+ enable: true,
41
+
42
+ size: void 0,
43
+
44
+ icon: void 0,
45
+ rightIcon: false,
46
+ iconIsLoading: false,
47
+ text: "关闭",
48
+ type: "default",
49
+ callback(event) {
50
+ console.log(event);
51
+ event.close();
52
+ },
53
+ },
54
+ other: {
55
+ enable: false,
56
+
57
+ size: void 0,
58
+
59
+ icon: void 0,
60
+ rightIcon: false,
61
+ iconIsLoading: false,
62
+ text: "其它按钮",
63
+ type: "default",
64
+ callback(event) {
65
+ console.log(event);
66
+ event.close();
67
+ },
68
+ },
69
+ close: {
70
+ enable: true,
71
+ callback(event) {
72
+ console.log(event);
73
+ event.close();
74
+ },
75
+ },
76
+ },
77
+ class: "",
78
+ only: false,
79
+ width: "350px",
80
+ height: "200px",
81
+ position: "center",
82
+ animation: "pops-anim-fadein-zoom",
83
+ zIndex: 10000,
84
+ mask: {
85
+ enable: false,
86
+ clickEvent: {
87
+ toClose: false,
88
+ toHide: false,
89
+ },
90
+
91
+ clickCallBack: void 0,
92
+ },
93
+ drag: false,
94
+ dragLimit: true,
95
+ dragExtraDistance: 3,
96
+ dragMoveCallBack() {},
97
+ dragEndCallBack() {},
98
+ forbiddenScroll: false,
99
+
100
+ style: null,
101
+ beforeAppendToPageCallBack() {},
102
+ };
@@ -4,6 +4,7 @@ import { pops } from "../../Pops";
4
4
  import { popsDOMUtils } from "../../utils/PopsDOMUtils";
5
5
  import { PopsInstanceUtils } from "../../utils/PopsInstanceUtils";
6
6
  import { popsUtils } from "../../utils/PopsUtils";
7
+ import { PopsPromptConfig } from "./config";
7
8
  import type { PopsPromptDetails } from "./indexType";
8
9
 
9
10
  export class PopsPrompt {
@@ -18,106 +19,7 @@ export class PopsPrompt {
18
19
  pops.config.cssText.common,
19
20
  pops.config.cssText.promptCSS,
20
21
  ]);
21
- let config: Required<PopsPromptDetails> = {
22
- title: {
23
- text: "默认标题",
24
- position: "left",
25
- html: false,
26
- style: "",
27
- },
28
- content: {
29
- text: "",
30
- select: false,
31
- password: false,
32
- row: false,
33
- focus: true,
34
- placeholder: "默认提示",
35
- style: "",
36
- },
37
- btn: {
38
- merge: false,
39
- mergeReverse: false,
40
- reverse: false,
41
- position: "flex-end",
42
- ok: {
43
- enable: true,
44
-
45
- size: void 0,
46
-
47
- icon: void 0,
48
- rightIcon: false,
49
- iconIsLoading: false,
50
- text: "确定",
51
- type: "success",
52
- callback(event) {
53
- console.log(event);
54
- event.close();
55
- },
56
- },
57
- cancel: {
58
- enable: true,
59
-
60
- size: void 0,
61
-
62
- icon: void 0,
63
- rightIcon: false,
64
- iconIsLoading: false,
65
- text: "关闭",
66
- type: "default",
67
- callback(event) {
68
- console.log(event);
69
- event.close();
70
- },
71
- },
72
- other: {
73
- enable: false,
74
-
75
- size: void 0,
76
-
77
- icon: void 0,
78
- rightIcon: false,
79
- iconIsLoading: false,
80
- text: "其它按钮",
81
- type: "default",
82
- callback(event) {
83
- console.log(event);
84
- event.close();
85
- },
86
- },
87
- close: {
88
- enable: true,
89
- callback(event) {
90
- console.log(event);
91
- event.close();
92
- },
93
- },
94
- },
95
- class: "",
96
- only: false,
97
- width: "350px",
98
- height: "200px",
99
- position: "center",
100
- animation: "pops-anim-fadein-zoom",
101
- zIndex: 10000,
102
- mask: {
103
- enable: false,
104
- clickEvent: {
105
- toClose: false,
106
- toHide: false,
107
- },
108
-
109
- clickCallBack: void 0,
110
- },
111
- drag: false,
112
- dragLimit: true,
113
- dragExtraDistance: 3,
114
- dragMoveCallBack() {},
115
- dragEndCallBack() {},
116
- forbiddenScroll: false,
117
-
118
- style: null,
119
- beforeAppendToPageCallBack() {},
120
- };
22
+ let config: Required<PopsPromptDetails> = PopsPromptConfig;
121
23
  config = popsUtils.assign(config, details);
122
24
  let guid = popsUtils.getRandomGUID();
123
25
  const PopsType = "prompt";
@@ -0,0 +1,122 @@
1
+ import { pops } from "../../Pops";
2
+ import type { PopsRightClickMenuDetails } from "./indexType";
3
+
4
+ export const rightClickMenuConfig = () => {
5
+ let config: Required<PopsRightClickMenuDetails> = {
6
+ target: document.documentElement,
7
+ targetSelector: null,
8
+ data: [
9
+ {
10
+ icon: pops.config.iconSVG.search,
11
+ iconIsLoading: false,
12
+ text: "搜索",
13
+ callback(clickEvent, contextMenuEvent, liElement) {
14
+ console.log("点击:" + this.text, [
15
+ clickEvent,
16
+ contextMenuEvent,
17
+ liElement,
18
+ ]);
19
+ },
20
+ },
21
+ {
22
+ icon: pops.config.iconSVG.documentCopy,
23
+ iconIsLoading: false,
24
+ text: "复制",
25
+ callback(clickEvent, contextMenuEvent, liElement) {
26
+ console.log("点击:" + this.text, [
27
+ clickEvent,
28
+ contextMenuEvent,
29
+ liElement,
30
+ ]);
31
+ },
32
+ },
33
+ {
34
+ icon: pops.config.iconSVG.delete,
35
+ text: "删除",
36
+ iconIsLoading: false,
37
+ callback(clickEvent, contextMenuEvent, liElement) {
38
+ console.log("点击:" + this.text, [
39
+ clickEvent,
40
+ contextMenuEvent,
41
+ liElement,
42
+ ]);
43
+ },
44
+ },
45
+ {
46
+ icon: pops.config.iconSVG.loading,
47
+ iconIsLoading: true,
48
+ text: "加载",
49
+ callback(clickEvent, contextMenuEvent, liElement) {
50
+ console.log("点击:" + this.text, [
51
+ clickEvent,
52
+ contextMenuEvent,
53
+ liElement,
54
+ ]);
55
+ return false;
56
+ },
57
+ },
58
+ {
59
+ icon: pops.config.iconSVG.elemePlus,
60
+ iconIsLoading: true,
61
+ text: "饿了么",
62
+ callback(clickEvent, contextMenuEvent, liElement) {
63
+ console.log("点击:" + this.text, [
64
+ clickEvent,
65
+ contextMenuEvent,
66
+ liElement,
67
+ ]);
68
+ return false;
69
+ },
70
+ item: [
71
+ {
72
+ icon: "",
73
+ iconIsLoading: false,
74
+ text: "处理文件",
75
+ callback(clickEvent, contextMenuEvent, liElement) {
76
+ console.log("点击:" + this.text, [
77
+ clickEvent,
78
+ contextMenuEvent,
79
+ liElement,
80
+ ]);
81
+ },
82
+ },
83
+ {
84
+ icon: "",
85
+ iconIsLoading: false,
86
+ text: "其它处理",
87
+ callback(clickEvent, contextMenuEvent, liElement) {
88
+ console.log("点击:" + this.text, [
89
+ clickEvent,
90
+ contextMenuEvent,
91
+ liElement,
92
+ ]);
93
+ },
94
+ item: [
95
+ {
96
+ icon: pops.config.iconSVG.view,
97
+ iconIsLoading: false,
98
+ text: "查看",
99
+ callback(clickEvent, contextMenuEvent, liElement) {
100
+ console.log("点击:" + this.text, [
101
+ clickEvent,
102
+ contextMenuEvent,
103
+ liElement,
104
+ ]);
105
+ },
106
+ },
107
+ ],
108
+ },
109
+ ],
110
+ },
111
+ ],
112
+ className: "",
113
+ isAnimation: true,
114
+ only: false,
115
+ zIndex: 10000,
116
+ preventDefault: true,
117
+ style: null,
118
+ beforeAppendToPageCallBack() {},
119
+ };
120
+
121
+ return config;
122
+ };
@@ -0,0 +1,78 @@
1
+ .pops-rightClickMenu * {
2
+ -webkit-box-sizing: border-box;
3
+ box-sizing: border-box;
4
+ margin: 0;
5
+ padding: 0;
6
+ -webkit-tap-highlight-color: transparent;
7
+ scrollbar-width: thin;
8
+ }
9
+ .pops-rightClickMenu {
10
+ position: fixed;
11
+ z-index: 111430;
12
+ text-align: center;
13
+ border-radius: 3px;
14
+ font-size: 16px;
15
+ font-weight: 500;
16
+ background: #fff;
17
+ box-shadow: 0px 1px 6px 1px #cacaca;
18
+ }
19
+ .pops-rightClickMenu-anim-grid {
20
+ display: grid;
21
+ transition: 0.3s;
22
+ grid-template-rows: 0fr;
23
+ }
24
+ .pops-rightClickMenu-anim-show {
25
+ grid-template-rows: 1fr;
26
+ }
27
+ .pops-rightClickMenu-is-visited {
28
+ background: #dfdfdf;
29
+ }
30
+ i.pops-rightClickMenu-icon {
31
+ height: 1em;
32
+ width: 1em;
33
+ line-height: 1em;
34
+ display: inline-flex;
35
+ justify-content: center;
36
+ align-items: center;
37
+ position: relative;
38
+ fill: currentColor;
39
+ color: inherit;
40
+ font-size: inherit;
41
+ margin-right: 6px;
42
+ }
43
+ i.pops-rightClickMenu-icon[is-loading="true"] {
44
+ animation: rotating 2s linear infinite;
45
+ }
46
+ .pops-rightClickMenu li:hover {
47
+ background: #dfdfdf;
48
+ cursor: pointer;
49
+ }
50
+ .pops-rightClickMenu ul {
51
+ margin: 0;
52
+ padding: 0;
53
+ display: flex;
54
+ flex-direction: column;
55
+ align-items: flex-start;
56
+ justify-content: center;
57
+ overflow: hidden;
58
+ }
59
+ .pops-rightClickMenu ul li {
60
+ padding: 5px 10px;
61
+ margin: 2.5px 5px;
62
+ border-radius: 3px;
63
+ display: flex;
64
+ width: -webkit-fill-available;
65
+ width: -moz-available;
66
+ text-align: left;
67
+ user-select: none;
68
+ -webkit-user-select: none;
69
+ -moz-user-select: none;
70
+ -ms-user-select: none;
71
+ align-items: center;
72
+ }
73
+ .pops-rightClickMenu ul li:first-child {
74
+ margin-top: 5px;
75
+ }
76
+ .pops-rightClickMenu ul li:last-child {
77
+ margin-bottom: 5px;
78
+ }