@whitesev/pops 1.4.0 → 1.5.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.
Files changed (105) hide show
  1. package/dist/index.amd.js.map +1 -1
  2. package/dist/index.cjs.js.map +1 -1
  3. package/dist/index.esm.js.map +1 -1
  4. package/dist/index.iife.js.map +1 -1
  5. package/dist/index.system.js.map +1 -1
  6. package/dist/index.umd.js.map +1 -1
  7. package/package.json +50 -48
  8. package/src/Config.ts +3 -0
  9. package/src/Core.ts +45 -0
  10. package/src/Pops.ts +340 -0
  11. package/src/components/alert/index.css +45 -0
  12. package/src/components/alert/index.ts +216 -0
  13. package/src/components/alert/indexType.ts +30 -0
  14. package/src/components/confirm/index.css +45 -0
  15. package/src/components/confirm/index.ts +264 -0
  16. package/src/components/confirm/indexType.ts +17 -0
  17. package/src/components/drawer/index.css +47 -0
  18. package/src/components/drawer/index.ts +338 -0
  19. package/src/components/drawer/indexType.ts +53 -0
  20. package/src/components/folder/folderIcon.ts +28 -0
  21. package/src/components/folder/index.css +291 -0
  22. package/src/components/folder/index.ts +1111 -0
  23. package/src/components/folder/indexType.ts +87 -0
  24. package/src/components/iframe/index.css +90 -0
  25. package/src/components/iframe/index.ts +415 -0
  26. package/src/components/iframe/indexType.ts +144 -0
  27. package/src/components/loading/index.css +60 -0
  28. package/src/components/loading/index.ts +123 -0
  29. package/src/components/loading/indexType.ts +31 -0
  30. package/src/components/panel/buttonType.ts +60 -0
  31. package/src/components/panel/commonType.ts +50 -0
  32. package/src/components/panel/deepMenuType.ts +59 -0
  33. package/src/components/panel/formsType.ts +32 -0
  34. package/src/components/panel/index.css +754 -0
  35. package/src/components/panel/index.ts +2435 -0
  36. package/src/components/panel/indexType.ts +107 -0
  37. package/src/components/panel/inputType.ts +65 -0
  38. package/src/components/panel/ownType.ts +28 -0
  39. package/src/components/panel/selectType.ts +80 -0
  40. package/src/components/panel/sliderType.ts +59 -0
  41. package/src/components/panel/switchType.ts +43 -0
  42. package/src/components/panel/textareaType.ts +54 -0
  43. package/src/components/prompt/index.css +60 -0
  44. package/src/components/prompt/index.ts +293 -0
  45. package/src/components/prompt/indexType.ts +47 -0
  46. package/src/components/rightClickMenu/index.ts +729 -0
  47. package/src/components/rightClickMenu/indexType.ts +89 -0
  48. package/src/components/searchSuggestion/index.css +0 -0
  49. package/src/components/searchSuggestion/index.ts +656 -0
  50. package/src/components/searchSuggestion/indexType.ts +238 -0
  51. package/src/components/tooltip/index.css +171 -0
  52. package/src/components/tooltip/index.ts +358 -0
  53. package/src/components/tooltip/indexType.ts +95 -0
  54. package/src/css/animation.css +2240 -0
  55. package/src/css/button.css +290 -0
  56. package/src/css/common.css +24 -0
  57. package/src/css/index.css +135 -0
  58. package/src/css/ninePalaceGridPosition.css +50 -0
  59. package/src/css/scrollbar.css +18 -0
  60. package/src/handler/PopsElementHandler.ts +353 -0
  61. package/src/handler/PopsHandler.ts +659 -0
  62. package/src/svg/arrowLeft.svg +4 -0
  63. package/src/svg/arrowRight.svg +4 -0
  64. package/src/svg/chromeFilled.svg +14 -0
  65. package/src/svg/circleClose.svg +8 -0
  66. package/src/svg/close.svg +5 -0
  67. package/src/svg/cpu.svg +8 -0
  68. package/src/svg/delete.svg +5 -0
  69. package/src/svg/documentCopy.svg +5 -0
  70. package/src/svg/edit.svg +8 -0
  71. package/src/svg/eleme.svg +5 -0
  72. package/src/svg/elemePlus.svg +5 -0
  73. package/src/svg/headset.svg +5 -0
  74. package/src/svg/hide.svg +8 -0
  75. package/src/svg/keyboard.svg +8 -0
  76. package/src/svg/loading.svg +5 -0
  77. package/src/svg/max.svg +5 -0
  78. package/src/svg/min.svg +5 -0
  79. package/src/svg/mise.svg +5 -0
  80. package/src/svg/monitor.svg +5 -0
  81. package/src/svg/next.svg +5 -0
  82. package/src/svg/picture.svg +8 -0
  83. package/src/svg/prev.svg +5 -0
  84. package/src/svg/search.svg +5 -0
  85. package/src/svg/share.svg +5 -0
  86. package/src/svg/upload.svg +5 -0
  87. package/src/svg/videoPause.svg +5 -0
  88. package/src/svg/videoPlay.svg +5 -0
  89. package/src/svg/view.svg +5 -0
  90. package/src/types/PopsDOMUtilsEventType.d.ts +246 -0
  91. package/src/types/animation.d.ts +19 -0
  92. package/src/types/button.d.ts +226 -0
  93. package/src/types/components.d.ts +197 -0
  94. package/src/types/event.d.ts +62 -0
  95. package/src/types/global.d.ts +11 -0
  96. package/src/types/icon.d.ts +32 -0
  97. package/src/types/layer.d.ts +20 -0
  98. package/src/types/main.d.ts +136 -0
  99. package/src/types/mask.d.ts +35 -0
  100. package/src/types/position.d.ts +60 -0
  101. package/src/utils/AnyTouch.js +1394 -0
  102. package/src/utils/PopsDOMUtils.ts +2013 -0
  103. package/src/utils/PopsInstanceUtils.ts +685 -0
  104. package/src/utils/PopsMathUtils.ts +77 -0
  105. package/src/utils/PopsUtils.ts +380 -0
@@ -0,0 +1,238 @@
1
+ /**
2
+ * 搜索建议悬浮窗
3
+ * pops.searchSuggestion
4
+ */
5
+ export interface PopsSearchSuggestionDetails<T = any> {
6
+ /**
7
+ * 当前的环境,可以是document,可以是shadowroot,默认是document
8
+ */
9
+ selfDocument?: Document;
10
+ /**
11
+ * 目标元素,一般是跟随它的位置变化,监听它的focus/click
12
+ */
13
+ target: HTMLElement;
14
+ /**
15
+ * 目标input元素,监听它的focus/click/input事件
16
+ */
17
+ inputTarget?: HTMLInputElement;
18
+ /**
19
+ * 数据
20
+ */
21
+ data: T[];
22
+ /**
23
+ * 右边的删除按钮图标
24
+ */
25
+ deleteIcon?: {
26
+ /**
27
+ * 是否启用,默认true
28
+ */
29
+ enable?: boolean;
30
+ /**
31
+ * 点击回调
32
+ */
33
+ callback?: (
34
+ event: MouseEvent | PointerEvent,
35
+ liElement: HTMLLIElement,
36
+ data: T
37
+ ) => void;
38
+ };
39
+ /**
40
+ * 自定义的className
41
+ */
42
+ className?: string;
43
+ /**
44
+ * position是否使用absolut,默认true
45
+ */
46
+ isAbsolute?: boolean;
47
+ /**
48
+ * 是否启用动画,默认true
49
+ */
50
+ isAnimation?: true;
51
+ /**
52
+ * 建议框的宽度,默认250px
53
+ */
54
+ width?: string;
55
+ /**
56
+ * 是否和config.target的宽度同步,默认true
57
+ */
58
+ followTargetWidth?: true;
59
+ /**
60
+ * 建议框的最大高度,默认300px
61
+ */
62
+ maxHeight?: string;
63
+ /**
64
+ * 建议框距离元素的距离,默认0
65
+ */
66
+ topDistance?: number;
67
+ /**
68
+ * 建议框显示的位置,默认是auto(自动判断位置)
69
+ */
70
+ position?: "top" | "bottom" | "auto";
71
+ /**
72
+ * 当位置在上面时(包括auto自动判断在上面时),是否对搜索项进行反转,默认true
73
+ */
74
+ positionTopToReverse?: boolean;
75
+ /**
76
+ * 层级,默认10000
77
+ */
78
+ zIndex?: 10000;
79
+ /**
80
+ * 搜索中的提示
81
+ */
82
+ searchingTip?: string;
83
+ /**
84
+ * 没有搜索结果的提示的html
85
+ */
86
+ toSearhNotResultHTML?: string;
87
+ /**
88
+ * 没有搜索结果是否隐藏提示框,默认false
89
+ */
90
+ toHideWithNotResult?: boolean;
91
+ /**
92
+ * 跟随目标的位置,默认为target的位置
93
+ */
94
+ followPosition?: "target" | "input" | "inputCursor";
95
+ /**
96
+ * 获取每一项的html
97
+ */
98
+ getItemHTML: (item: T) => string;
99
+ /**
100
+ * 当config.target触发input时自动调用该函数来获取数据
101
+ * @param inputValue 当前输入框的值
102
+ */
103
+ getData: (inputValue: string) => Promise<T[]> | T[];
104
+ /**
105
+ * 每一项的点击回调
106
+ * @param event 触发的事件
107
+ * @param liElement 每一项的元素
108
+ * @param data config.data的数据
109
+ */
110
+ itemClickCallBack?: (
111
+ event: MouseEvent | PointerEvent,
112
+ liElement: HTMLLIElement,
113
+ data: T
114
+ ) => void;
115
+ /**
116
+ * 键盘的上下键选择的回调
117
+ * @param event 触发的事件
118
+ * @param liElement 每一项的元素
119
+ * @param data config.data的数据
120
+ */
121
+ selectCallBack?: (
122
+ event: MouseEvent,
123
+ liElement: HTMLLIElement,
124
+ data: T
125
+ ) => void;
126
+ /**
127
+ * (可选)自定义style
128
+ */
129
+ style?: string;
130
+ }
131
+
132
+ /**
133
+ * pops.searchSuggestion的函数返回值
134
+ */
135
+ export interface PopsSearchSuggestionResult<T = any> {
136
+ /**
137
+ * 根元素
138
+ */
139
+ root: HTMLElement;
140
+ /**
141
+ * ul元素
142
+ */
143
+ hintULElement: HTMLUListElement;
144
+ /**
145
+ * 初始化
146
+ */
147
+ init: () => void;
148
+ /**
149
+ * 获取显示出搜索建议框的html
150
+ */
151
+ getSearchSelectElement: () => HTMLElement;
152
+ /**
153
+ * 获取显示出搜索建议框的每一项的html
154
+ */
155
+ getSearchItemLiElement: (data: T, index: number) => HTMLElement;
156
+ /**
157
+ * 获取data-value值
158
+ */
159
+ getItemDataValue: (data: T) => T;
160
+ /**
161
+ * 设置搜索建议框每一项的点击事件
162
+ */
163
+ setSearchItemClickEvent: (liElement: HTMLLIElement) => void;
164
+ /**
165
+ * 监听输入框内容改变
166
+ */
167
+ setInputChangeEvent: () => void;
168
+ /**
169
+ * 移除输入框内容改变的监听
170
+ */
171
+ removeInputChangeEvent: () => void;
172
+ /**
173
+ * 设置显示搜索建议框的事件
174
+ */
175
+ setShowEvent: () => void;
176
+ /**
177
+ * 移除显示搜索建议框的事件
178
+ */
179
+ removeShowEvent: () => void;
180
+ /**
181
+ * 设置隐藏搜索建议框的事件
182
+ */
183
+ setHideEvent: () => void;
184
+ /**
185
+ * 移除隐藏搜索建议框的事件
186
+ */
187
+ removeHideEvent: () => void;
188
+ /**
189
+ * 设置所有监听
190
+ */
191
+ setAllEvent: () => void;
192
+ /**
193
+ * 移除所有监听
194
+ */
195
+ removeAllEvent: () => void;
196
+ /**
197
+ * 获取删除按钮的html
198
+ */
199
+ getDeleteIconHTML: (size: number, fill: string) => void;
200
+ /**
201
+ * 设置当前正在搜索中的提示
202
+ */
203
+ setPromptsInSearch: () => void;
204
+ /**
205
+ * 移除正在搜索中的提示
206
+ */
207
+ removePromptsInSearch: () => void;
208
+ /**
209
+ * 清空所有的搜索结果
210
+ */
211
+ clearAllSearchItemLi: () => void;
212
+ /**
213
+ * 修改搜索建议框的位置(top、left)
214
+ * 因为目标元素可能是动态隐藏的
215
+ */
216
+ changeHintULElementPosition: () => void;
217
+ /**
218
+ * 修改搜索建议框的width
219
+ * 因为目标元素可能是动态隐藏的
220
+ */
221
+ changeHintULElementWidth: () => void;
222
+ /**
223
+ * 更新页面显示的搜索结果
224
+ */
225
+ update: (data: T[]) => void;
226
+ /**
227
+ * 清空当前的搜索结果并显示无结果
228
+ */
229
+ clear: () => void;
230
+ /**
231
+ * 隐藏搜索建议框
232
+ */
233
+ hide: () => void;
234
+ /**
235
+ * 显示搜索建议框
236
+ */
237
+ show: () => void;
238
+ }
@@ -0,0 +1,171 @@
1
+ .pops-tip {
2
+ --tooltip-color: #4e4e4e;
3
+ --tooltip-bg-color: rgb(255, 255, 255, var(--pops-bg-opacity));
4
+ --tooltip-bd-radius: 2px;
5
+ --tooltip-font-size: 14px;
6
+ --tooltip-padding-top: 13px;
7
+ --tooltip-padding-right: 13px;
8
+ --tooltip-padding-bottom: 13px;
9
+ --tooltip-padding-left: 13px;
10
+
11
+ --tooltip-arrow--after-color: rgb(78, 78, 78);
12
+ --tooltip-arrow--after-bg-color: rgb(255, 255, 255, var(--pops-bg-opacity));
13
+ --tooltip-arrow--after-width: 12px;
14
+ --tooltip-arrow--after-height: 12px;
15
+
16
+ position: absolute;
17
+ padding: var(--tooltip-padding-top) var(--tooltip-padding-right)
18
+ var(--tooltip-padding-bottom) var(--tooltip-padding-left);
19
+ max-width: 400px;
20
+ max-height: 300px;
21
+ border-radius: var(--tooltip-bd-radius);
22
+ background-color: var(--tooltip-bg-color);
23
+ box-shadow: 0 1.5px 4px rgba(0, 0, 0, 0.24), 0 1.5px 6px rgba(0, 0, 0, 0.12);
24
+ color: var(--tooltip-color);
25
+ font-size: var(--tooltip-font-size);
26
+ }
27
+ /* github的样式 */
28
+ .pops-tip.github-tooltip {
29
+ --tooltip-bg-opacity: 1;
30
+ --tooltip-color: rgb(255, 255, 255);
31
+ --tooltip-bg-color: rgb(36, 41, 47, var(--tooltip-bg-opacity));
32
+ --tooltip-bd-radius: 6px;
33
+ --tooltip-padding-top: 6px;
34
+ --tooltip-padding-right: 8px;
35
+ --tooltip-padding-bottom: 6px;
36
+ --tooltip-padding-left: 8px;
37
+
38
+ --tooltip-arrow--after-color: rgb(255, 255, 255);
39
+ --tooltip-arrow--after-bg-color: rgb(36, 41, 47, var(--tooltip-bg-opacity));
40
+ --tooltip-arrow--after-width: 8px;
41
+ --tooltip-arrow--after-height: 8px;
42
+ }
43
+ .pops-tip .pops-tip-arrow {
44
+ position: absolute;
45
+ top: 100%;
46
+ left: 50%;
47
+ overflow: hidden;
48
+ width: 100%;
49
+ height: 12.5px;
50
+ transform: translateX(-50%);
51
+ }
52
+
53
+ .pops-tip .pops-tip-arrow::after {
54
+ position: absolute;
55
+ top: 0;
56
+ left: 50%;
57
+ width: var(--tooltip-arrow--after-width);
58
+ height: var(--tooltip-arrow--after-height);
59
+ background: var(--tooltip-arrow--after-bg-color);
60
+ color: var(--tooltip-arrow--after-color);
61
+ box-shadow: 0 1px 7px rgba(0, 0, 0, 0.24), 0 1px 7px rgba(0, 0, 0, 0.12);
62
+ content: "";
63
+ transform: translateX(-50%) translateY(-50%) rotate(45deg);
64
+ }
65
+
66
+ .pops-tip .pops-tip-arrow[data-position="bottom"] {
67
+ position: absolute;
68
+ top: 100%;
69
+ left: 50%;
70
+ overflow: hidden;
71
+ width: 100%;
72
+ height: 12.5px;
73
+ transform: translateX(-50%);
74
+ }
75
+
76
+ .pops-tip .pops-tip-arrow[data-position="bottom"]:after {
77
+ position: absolute;
78
+ top: 0;
79
+ left: 50%;
80
+ width: var(--tooltip-arrow--after-width);
81
+ height: var(--tooltip-arrow--after-height);
82
+ background: var(--tooltip-arrow--after-bg-color);
83
+ box-shadow: 0 1px 7px rgba(0, 0, 0, 0.24), 0 1px 7px rgba(0, 0, 0, 0.12);
84
+ content: "";
85
+ transform: translateX(-50%) translateY(-50%) rotate(45deg);
86
+ }
87
+
88
+ .pops-tip .pops-tip-arrow[data-position="left"] {
89
+ top: 50%;
90
+ left: -12.5px;
91
+ width: 12.5px;
92
+ height: 50px;
93
+ transform: translateY(-50%);
94
+ }
95
+
96
+ .pops-tip .pops-tip-arrow[data-position="left"]:after {
97
+ position: absolute;
98
+ top: 50%;
99
+ left: 100%;
100
+ content: "";
101
+ }
102
+
103
+ .pops-tip .pops-tip-arrow[data-position="right"] {
104
+ top: 50%;
105
+ right: -12.5px;
106
+ left: auto;
107
+ width: 12.5px;
108
+ height: 50px;
109
+ transform: translateY(-50%);
110
+ }
111
+
112
+ .pops-tip .pops-tip-arrow[data-position="right"]:after {
113
+ position: absolute;
114
+ top: 50%;
115
+ left: 0;
116
+ content: "";
117
+ }
118
+
119
+ .pops-tip .pops-tip-arrow[data-position="top"] {
120
+ top: -12.5px;
121
+ left: 50%;
122
+ transform: translateX(-50%);
123
+ }
124
+
125
+ .pops-tip .pops-tip-arrow[data-position="top"]:after {
126
+ position: absolute;
127
+ top: 100%;
128
+ left: 50%;
129
+ content: "";
130
+ }
131
+
132
+ .pops-tip[data-motion] {
133
+ -webkit-animation-duration: 0.25s;
134
+ animation-duration: 0.25s;
135
+ -webkit-animation-fill-mode: forwards;
136
+ animation-fill-mode: forwards;
137
+ }
138
+ .pops-tip[data-motion="fadeOutRight"] {
139
+ -webkit-animation-name: pops-motion-fadeOutRight;
140
+ animation-name: pops-motion-fadeOutRight;
141
+ }
142
+ .pops-tip[data-motion="fadeInTop"] {
143
+ -webkit-animation-name: pops-motion-fadeInTop;
144
+ animation-name: pops-motion-fadeInTop;
145
+ animation-timing-function: cubic-bezier(0.49, 0.49, 0.13, 1.3);
146
+ }
147
+ .pops-tip[data-motion="fadeOutTop"] {
148
+ -webkit-animation-name: pops-motion-fadeOutTop;
149
+ animation-name: pops-motion-fadeOutTop;
150
+ animation-timing-function: cubic-bezier(0.32, 0.37, 0.06, 0.87);
151
+ }
152
+ .pops-tip[data-motion="fadeInBottom"] {
153
+ -webkit-animation-name: pops-motion-fadeInBottom;
154
+ animation-name: pops-motion-fadeInBottom;
155
+ }
156
+ .pops-tip[data-motion="fadeOutBottom"] {
157
+ -webkit-animation-name: pops-motion-fadeOutBottom;
158
+ animation-name: pops-motion-fadeOutBottom;
159
+ }
160
+ .pops-tip[data-motion="fadeInLeft"] {
161
+ -webkit-animation-name: pops-motion-fadeInLeft;
162
+ animation-name: pops-motion-fadeInLeft;
163
+ }
164
+ .pops-tip[data-motion="fadeOutLeft"] {
165
+ -webkit-animation-name: pops-motion-fadeOutLeft;
166
+ animation-name: pops-motion-fadeOutLeft;
167
+ }
168
+ .pops-tip[data-motion="fadeInRight"] {
169
+ -webkit-animation-name: pops-motion-fadeInRight;
170
+ animation-name: pops-motion-fadeInRight;
171
+ }