@whitesev/pops 2.2.8 → 2.2.9

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 (146) hide show
  1. package/dist/index.amd.js +2815 -3010
  2. package/dist/index.amd.js.map +1 -1
  3. package/dist/index.cjs.js +2815 -3010
  4. package/dist/index.cjs.js.map +1 -1
  5. package/dist/index.esm.js +2815 -3010
  6. package/dist/index.esm.js.map +1 -1
  7. package/dist/index.iife.js +2815 -3010
  8. package/dist/index.iife.js.map +1 -1
  9. package/dist/index.system.js +2815 -3010
  10. package/dist/index.system.js.map +1 -1
  11. package/dist/index.umd.js +2815 -3010
  12. package/dist/index.umd.js.map +1 -1
  13. package/dist/types/src/Pops.d.ts +11 -11
  14. package/dist/types/src/PopsIcon.d.ts +2 -2
  15. package/dist/types/src/components/rightClickMenu/index.d.ts +2 -2
  16. package/dist/types/src/components/tooltip/index.d.ts +2 -2
  17. package/dist/types/src/types/PopsDOMUtilsEventType.d.ts +256 -259
  18. package/dist/types/src/types/animation.d.ts +19 -19
  19. package/dist/types/src/types/button.d.ts +187 -196
  20. package/dist/types/src/types/components.d.ts +213 -229
  21. package/dist/types/src/types/event.d.ts +63 -63
  22. package/dist/types/src/types/global.d.ts +20 -20
  23. package/dist/types/src/types/icon.d.ts +32 -32
  24. package/dist/types/src/types/inst.d.ts +24 -24
  25. package/dist/types/src/types/main.d.ts +114 -122
  26. package/dist/types/src/types/mask.d.ts +49 -49
  27. package/dist/types/src/types/position.d.ts +60 -60
  28. package/package.json +61 -56
  29. package/LICENSE +0 -674
  30. package/src/Pops.ts +0 -209
  31. package/src/PopsAnimation.ts +0 -32
  32. package/src/PopsCSS.ts +0 -51
  33. package/src/PopsCore.ts +0 -44
  34. package/src/PopsIcon.ts +0 -95
  35. package/src/PopsInst.ts +0 -21
  36. package/src/components/alert/config.ts +0 -62
  37. package/src/components/alert/index.css +0 -0
  38. package/src/components/alert/index.ts +0 -181
  39. package/src/components/alert/types/index.ts +0 -30
  40. package/src/components/confirm/config.ts +0 -90
  41. package/src/components/confirm/index.css +0 -0
  42. package/src/components/confirm/index.ts +0 -192
  43. package/src/components/confirm/types/index.ts +0 -17
  44. package/src/components/drawer/config.ts +0 -89
  45. package/src/components/drawer/index.css +0 -35
  46. package/src/components/drawer/index.ts +0 -260
  47. package/src/components/drawer/types/index.ts +0 -61
  48. package/src/components/folder/config.ts +0 -147
  49. package/src/components/folder/folderIcon.ts +0 -28
  50. package/src/components/folder/index.css +0 -314
  51. package/src/components/folder/index.ts +0 -1050
  52. package/src/components/folder/types/index.ts +0 -101
  53. package/src/components/iframe/config.ts +0 -60
  54. package/src/components/iframe/index.css +0 -75
  55. package/src/components/iframe/index.ts +0 -351
  56. package/src/components/iframe/types/index.ts +0 -146
  57. package/src/components/loading/config.ts +0 -29
  58. package/src/components/loading/index.css +0 -66
  59. package/src/components/loading/index.ts +0 -114
  60. package/src/components/loading/types/index.ts +0 -40
  61. package/src/components/panel/config.ts +0 -550
  62. package/src/components/panel/handlerComponents.ts +0 -3277
  63. package/src/components/panel/index.css +0 -1292
  64. package/src/components/panel/index.ts +0 -213
  65. package/src/components/panel/types/components-button.ts +0 -69
  66. package/src/components/panel/types/components-common.ts +0 -55
  67. package/src/components/panel/types/components-deepMenu.ts +0 -85
  68. package/src/components/panel/types/components-forms.ts +0 -45
  69. package/src/components/panel/types/components-input.ts +0 -82
  70. package/src/components/panel/types/components-own.ts +0 -31
  71. package/src/components/panel/types/components-select.ts +0 -101
  72. package/src/components/panel/types/components-selectMultiple.ts +0 -133
  73. package/src/components/panel/types/components-slider.ts +0 -78
  74. package/src/components/panel/types/components-switch.ts +0 -57
  75. package/src/components/panel/types/components-textarea.ts +0 -69
  76. package/src/components/panel/types/index.ts +0 -177
  77. package/src/components/prompt/config.ts +0 -94
  78. package/src/components/prompt/index.css +0 -34
  79. package/src/components/prompt/index.ts +0 -222
  80. package/src/components/prompt/types/index.ts +0 -55
  81. package/src/components/rightClickMenu/config.ts +0 -130
  82. package/src/components/rightClickMenu/index.css +0 -88
  83. package/src/components/rightClickMenu/index.ts +0 -689
  84. package/src/components/rightClickMenu/types/index.ts +0 -91
  85. package/src/components/searchSuggestion/config.ts +0 -59
  86. package/src/components/searchSuggestion/index.ts +0 -708
  87. package/src/components/searchSuggestion/types/index.ts +0 -147
  88. package/src/components/tooltip/config.ts +0 -34
  89. package/src/components/tooltip/index.css +0 -196
  90. package/src/components/tooltip/index.ts +0 -655
  91. package/src/components/tooltip/types/index.ts +0 -125
  92. package/src/config/CommonCSSClassName.ts +0 -17
  93. package/src/config/GlobalConfig.ts +0 -80
  94. package/src/css/animation.css +0 -2245
  95. package/src/css/button.css +0 -542
  96. package/src/css/common.css +0 -52
  97. package/src/css/index.css +0 -254
  98. package/src/css/ninePalaceGridPosition.css +0 -50
  99. package/src/css/scrollbar.css +0 -22
  100. package/src/handler/PopsElementHandler.ts +0 -325
  101. package/src/handler/PopsHandler.ts +0 -719
  102. package/src/svg/arrowLeft.svg +0 -4
  103. package/src/svg/arrowRight.svg +0 -4
  104. package/src/svg/chromeFilled.svg +0 -14
  105. package/src/svg/circleClose.svg +0 -8
  106. package/src/svg/close.svg +0 -5
  107. package/src/svg/cpu.svg +0 -8
  108. package/src/svg/delete.svg +0 -5
  109. package/src/svg/documentCopy.svg +0 -5
  110. package/src/svg/edit.svg +0 -8
  111. package/src/svg/eleme.svg +0 -5
  112. package/src/svg/elemePlus.svg +0 -5
  113. package/src/svg/headset.svg +0 -5
  114. package/src/svg/hide.svg +0 -8
  115. package/src/svg/keyboard.svg +0 -8
  116. package/src/svg/loading.svg +0 -5
  117. package/src/svg/max.svg +0 -5
  118. package/src/svg/min.svg +0 -5
  119. package/src/svg/mise.svg +0 -5
  120. package/src/svg/monitor.svg +0 -5
  121. package/src/svg/next.svg +0 -5
  122. package/src/svg/picture.svg +0 -8
  123. package/src/svg/prev.svg +0 -5
  124. package/src/svg/search.svg +0 -5
  125. package/src/svg/share.svg +0 -5
  126. package/src/svg/upload.svg +0 -5
  127. package/src/svg/videoPause.svg +0 -5
  128. package/src/svg/videoPlay.svg +0 -5
  129. package/src/svg/view.svg +0 -5
  130. package/src/types/PopsDOMUtilsEventType.d.ts +0 -259
  131. package/src/types/animation.d.ts +0 -19
  132. package/src/types/button.d.ts +0 -196
  133. package/src/types/components.d.ts +0 -229
  134. package/src/types/event.d.ts +0 -63
  135. package/src/types/global.d.ts +0 -20
  136. package/src/types/icon.d.ts +0 -32
  137. package/src/types/inst.d.ts +0 -24
  138. package/src/types/main.d.ts +0 -122
  139. package/src/types/mask.d.ts +0 -49
  140. package/src/types/position.d.ts +0 -60
  141. package/src/utils/PopsDOMUtils.ts +0 -2649
  142. package/src/utils/PopsDOMUtilsEventsConfig.ts +0 -6
  143. package/src/utils/PopsInstanceUtils.ts +0 -801
  144. package/src/utils/PopsMathUtils.ts +0 -77
  145. package/src/utils/PopsSafeUtils.ts +0 -24
  146. package/src/utils/PopsUtils.ts +0 -430
package/src/Pops.ts DELETED
@@ -1,209 +0,0 @@
1
- import { popsDOMUtils } from "./utils/PopsDOMUtils";
2
- import { PopsInstanceUtils } from "./utils/PopsInstanceUtils";
3
- import { popsUtils } from "./utils/PopsUtils";
4
- import { PopsCore } from "./PopsCore";
5
- import { PopsAlert } from "./components/alert";
6
- import type { PopsAlertDetails } from "./components/alert/types";
7
- import { PopsConfirm } from "./components/confirm";
8
- import type { PopsConfirmDetails } from "./components/confirm/types";
9
- import type { PopsPromptDetails } from "./components/prompt/types/index";
10
- import { PopsPrompt } from "./components/prompt";
11
- import type { PopsLoadingDetails } from "./components/loading/types";
12
- import { PopsLoading } from "./components/loading";
13
- import type { PopsIframeDetails } from "./components/iframe/types";
14
- import { PopsIframe } from "./components/iframe";
15
- import type { PopsToolTipDetails } from "./components/tooltip/types/index";
16
- import { PopsDrawer } from "./components/drawer";
17
- import type { PopsDrawerDetails } from "./components/drawer/types";
18
- import type { PopsFolderDetails } from "./components/folder/types";
19
- import { PopsFolder } from "./components/folder";
20
- import type { PopsPanelDetails } from "./components/panel/types";
21
- import { PopsPanel } from "./components/panel";
22
- import { PopsRightClickMenu } from "./components/rightClickMenu";
23
- import type { PopsRightClickMenuDetails } from "./components/rightClickMenu/types";
24
- import type { PopsSearchSuggestionDetails } from "./components/searchSuggestion/types/index";
25
- import { PopsSearchSuggestion } from "./components/searchSuggestion";
26
- import { PopsMathFloatUtils } from "./utils/PopsMathUtils";
27
- import { PanelHandlerComponents } from "./components/panel/handlerComponents";
28
- import { GlobalConfig } from "./config/GlobalConfig";
29
- import { PopsTooltip } from "./components/tooltip";
30
- import { PopsCSS } from "./PopsCSS";
31
- import { PopsIcon } from "./PopsIcon";
32
- import { PopsInstData } from "./PopsInst";
33
- import { PopsAnimation } from "./PopsAnimation";
34
-
35
- class Pops {
36
- /** 配置 */
37
- config = {
38
- /** 版本号 */
39
- version: "2025.7.29",
40
- cssText: PopsCSS,
41
- /** icon图标的svg代码 */
42
- iconSVG: PopsIcon.$data,
43
- /** 当前已配置的动画@keyframes名字映射(初始化时生成) */
44
- animation: PopsAnimation.$data,
45
- /** 存储已创建的元素 */
46
- instData: PopsInstData,
47
- /** 禁止滚动 */
48
- forbiddenScroll: {
49
- event(event: Event) {
50
- return popsDOMUtils.preventEvent(event);
51
- },
52
- },
53
- /** pops使用的工具类 */
54
- Utils: popsUtils,
55
- /** pops使用的DOM工具类 */
56
- DOMUtils: popsDOMUtils,
57
- /** pops创建的实例使用的工具类 */
58
- InstanceUtils: PopsInstanceUtils,
59
- /** pops处理float类型使用的工具类 */
60
- MathFloatUtils: PopsMathFloatUtils,
61
- /** pops.panel中用于处理各个类型的工具 */
62
- PanelHandlerComponents: PanelHandlerComponents,
63
- };
64
- init() {}
65
- /**
66
- * 释放原有的pops控制权
67
- * @example
68
- * let pops = window.pops.noConflict()
69
- */
70
- noConflict() {
71
- if (typeof (PopsCore.globalThis as any).pops === "object") {
72
- popsUtils.delete(PopsCore.globalThis, "pops");
73
- }
74
- if (
75
- typeof unsafeWindow === "object" &&
76
- unsafeWindow != null &&
77
- typeof (unsafeWindow as any).pops === "object"
78
- ) {
79
- popsUtils.delete(unsafeWindow, "pops");
80
- }
81
- return new Pops();
82
- }
83
- /**
84
- * 通过navigator.userAgent判断是否是手机访问
85
- * @param userAgent
86
- */
87
- isPhone(userAgent?: string) {
88
- return popsUtils.isPhone(userAgent);
89
- }
90
- /**
91
- * 为所有弹窗设置全局属性
92
- */
93
- GlobalConfig = GlobalConfig;
94
- /**
95
- * 普通信息框
96
- * @param details 配置
97
- */
98
- alert = (details: PopsAlertDetails) => {
99
- let dialog = PopsAlert.init(details);
100
- return dialog;
101
- };
102
-
103
- /**
104
- * 询问框
105
- * @param details 配置
106
- */
107
- confirm = (details: PopsConfirmDetails) => {
108
- let dialog = PopsConfirm.init(details);
109
- return dialog;
110
- };
111
-
112
- /**
113
- * 输入框
114
- * @param details 配置
115
- */
116
- prompt = (details: PopsPromptDetails) => {
117
- let dialog = PopsPrompt.init(details);
118
- return dialog;
119
- };
120
-
121
- /**
122
- * 加载层
123
- * @param details 配置
124
- */
125
- loading = (details: PopsLoadingDetails) => {
126
- let popsLoading = PopsLoading.init(details);
127
- return popsLoading;
128
- };
129
-
130
- /**
131
- * iframe层
132
- * @param details 配置
133
- */
134
- iframe = (details: PopsIframeDetails) => {
135
- let dialog = PopsIframe.init(details);
136
- return dialog;
137
- };
138
-
139
- /**
140
- * 提示框
141
- * @param details 配置
142
- */
143
- tooltip = (details: PopsToolTipDetails) => {
144
- let popsTooltip = PopsTooltip.init(details);
145
- return popsTooltip;
146
- };
147
-
148
- /**
149
- * 抽屉
150
- * @param details 配置
151
- */
152
- drawer = (details: PopsDrawerDetails) => {
153
- let dialog = PopsDrawer.init(details);
154
- return dialog;
155
- };
156
-
157
- /**
158
- * 文件夹
159
- * @param details 配置
160
- */
161
- folder = (details: PopsFolderDetails) => {
162
- let dialog = PopsFolder.init(details);
163
- return dialog;
164
- };
165
-
166
- /**
167
- * 配置面板
168
- * @param details 配置
169
- */
170
- panel = (details: PopsPanelDetails) => {
171
- let dialog = PopsPanel.init(details);
172
- return dialog;
173
- };
174
-
175
- /**
176
- * 右键菜单
177
- * @param details 配置
178
- */
179
- rightClickMenu = (details: PopsRightClickMenuDetails) => {
180
- let popsRightClickMenu = PopsRightClickMenu.init(details);
181
- return popsRightClickMenu;
182
- };
183
-
184
- /**
185
- * 搜索建议
186
- *
187
- * 注意:调用后需要主动调用.init()和.setAllEvent()进行初始化
188
- * @param details 配置
189
- * @example
190
- * let $input = document.querySelector("#input");
191
- * let searchSuggestion = pops.searchSuggestion({
192
- * target: $input,
193
- * inputTarget: $input,
194
- * getItemHTML: function (item) {
195
- * return item.value;
196
- * }
197
- * });
198
- * searchSuggestion.init();
199
- * searchSuggestion.setAllEvent();
200
- */
201
- searchSuggestion = <T = any>(details: PopsSearchSuggestionDetails<T>) => {
202
- let popsSearchSuggestion = PopsSearchSuggestion.init(details);
203
- return popsSearchSuggestion;
204
- };
205
- }
206
-
207
- const pops = new Pops();
208
-
209
- export { pops };
@@ -1,32 +0,0 @@
1
- import { PopsCSS } from "./PopsCSS";
2
- import { popsDOMUtils } from "./utils/PopsDOMUtils";
3
- import { PopsSafeUtils } from "./utils/PopsSafeUtils";
4
- import { popsUtils } from "./utils/PopsUtils";
5
-
6
- export const PopsAnimation = {
7
- $data: {} as { [key: string]: CSSKeyframesRule },
8
- $flag: {
9
- /** 是否初始化 */
10
- isInit: false,
11
- },
12
- init() {
13
- if (!this.$flag.isInit) {
14
- this.$flag.isInit = true;
15
- /* 处理获取当前所有的动画名 */
16
- let animationStyle = document.createElement("style");
17
- PopsSafeUtils.setSafeHTML(animationStyle, PopsCSS.anim);
18
- popsDOMUtils.appendHead(animationStyle);
19
- this.$data = null as any;
20
- this.$data = popsDOMUtils.getKeyFrames(animationStyle.sheet!);
21
- popsUtils.setTimeout(() => {
22
- animationStyle.remove();
23
- }, 50);
24
- }
25
- },
26
- /**
27
- * 判断是否存在某个动画名
28
- */
29
- hasAnim(name: string) {
30
- return this.$data.hasOwnProperty(name);
31
- },
32
- };
package/src/PopsCSS.ts DELETED
@@ -1,51 +0,0 @@
1
- import indexCSS from "./css/index.css";
2
- import ninePalaceGridPositionCSS from "./css/ninePalaceGridPosition.css";
3
- import scrollbarCSS from "./css/scrollbar.css";
4
- import buttonCSS from "./css/button.css";
5
- import commonCSS from "./css/common.css";
6
- import animCSS from "./css/animation.css";
7
- import alertCSS from "./components/alert/index.css";
8
- import confirmCSS from "./components/confirm/index.css";
9
- import promptCSS from "./components/prompt/index.css";
10
- import loadingCSS from "./components/loading/index.css";
11
- import iframeCSS from "./components/iframe/index.css";
12
- import tooltipCSS from "./components/tooltip/index.css";
13
- import drawerCSS from "./components/drawer/index.css";
14
- import folderCSS from "./components/folder/index.css";
15
- import panelCSS from "./components/panel/index.css";
16
- import rightClickMenuCSS from "./components/rightClickMenu/index.css";
17
-
18
- export const PopsCSS = {
19
- /** 主CSS */
20
- index: indexCSS,
21
- /** 九宫格位置CSS */
22
- ninePalaceGridPosition: ninePalaceGridPositionCSS,
23
- /** 滚动条CSS */
24
- scrollbar: scrollbarCSS,
25
- /** 按钮CSS */
26
- button: buttonCSS,
27
- /** 通用的CSS */
28
- common: commonCSS,
29
- /** 动画 */
30
- anim: animCSS,
31
- /** pops.alert */
32
- alertCSS: alertCSS,
33
- /** pops.cponfirm */
34
- confirmCSS: confirmCSS,
35
- /** pops.prompt */
36
- promptCSS: promptCSS,
37
- /** pops.loading */
38
- loadingCSS: loadingCSS,
39
- /** pops.iframe */
40
- iframeCSS: iframeCSS,
41
- /** pops.tooltip */
42
- tooltipCSS: tooltipCSS,
43
- /** pops.drawer */
44
- drawerCSS: drawerCSS,
45
- /** pops.folder */
46
- folderCSS: folderCSS,
47
- /** pops.folder */
48
- panelCSS: panelCSS,
49
- /** pops.rightClickMenu */
50
- rightClickMenu: rightClickMenuCSS,
51
- };
package/src/PopsCore.ts DELETED
@@ -1,44 +0,0 @@
1
- interface PopsCoreOption {
2
- document: Document;
3
- window: Window;
4
- globalThis: typeof globalThis;
5
- self: typeof globalThis;
6
- }
7
-
8
- const PopsCoreDefaultEnv: PopsCoreOption = {
9
- document: document,
10
- window: window,
11
- globalThis: globalThis,
12
- self: self,
13
- };
14
-
15
- const PopsCoreEnv: PopsCoreOption = Object.assign({}, PopsCoreDefaultEnv);
16
-
17
- const PopsCore = {
18
- init(option?: PopsCoreOption) {
19
- if (!option) {
20
- option = Object.assign({}, PopsCoreDefaultEnv);
21
- }
22
- Object.assign(PopsCoreEnv, option);
23
- },
24
- get document() {
25
- return PopsCoreEnv.document;
26
- },
27
- get window() {
28
- return PopsCoreEnv.window;
29
- },
30
- get globalThis() {
31
- return PopsCoreEnv.globalThis;
32
- },
33
- get self() {
34
- return PopsCoreEnv.self;
35
- },
36
- };
37
-
38
- const OriginPrototype = {
39
- Object: {
40
- defineProperty: Object.defineProperty,
41
- },
42
- };
43
-
44
- export { PopsCoreOption, PopsCore, OriginPrototype };
package/src/PopsIcon.ts DELETED
@@ -1,95 +0,0 @@
1
- import type { PopsIconType } from "./types/icon";
2
- import SVG_min from "./svg/min.svg";
3
- import SVG_mise from "./svg/mise.svg";
4
- import SVG_max from "./svg/max.svg";
5
- import SVG_close from "./svg/close.svg";
6
- import SVG_edit from "./svg/edit.svg";
7
- import SVG_share from "./svg/share.svg";
8
- import SVG_delete from "./svg/delete.svg";
9
- import SVG_search from "./svg/search.svg";
10
- import SVG_upload from "./svg/upload.svg";
11
- import SVG_loading from "./svg/loading.svg";
12
- import SVG_next from "./svg/next.svg";
13
- import SVG_prev from "./svg/prev.svg";
14
- import SVG_eleme from "./svg/eleme.svg";
15
- import SVG_elemePlus from "./svg/elemePlus.svg";
16
- import SVG_chromeFilled from "./svg/chromeFilled.svg";
17
- import SVG_cpu from "./svg/cpu.svg";
18
- import SVG_videoPlay from "./svg/videoPlay.svg";
19
- import SVG_videoPause from "./svg/videoPause.svg";
20
- import SVG_headset from "./svg/headset.svg";
21
- import SVG_monitor from "./svg/monitor.svg";
22
- import SVG_documentCopy from "./svg/documentCopy.svg";
23
- import SVG_picture from "./svg/picture.svg";
24
- import SVG_circleClose from "./svg/circleClose.svg";
25
- import SVG_view from "./svg/view.svg";
26
- import SVG_hide from "./svg/hide.svg";
27
- import SVG_keyboard from "./svg/keyboard.svg";
28
- import SVG_arrowRight from "./svg/arrowRight.svg";
29
- import SVG_arrowLeft from "./svg/arrowLeft.svg";
30
-
31
- const PopsIconData: {
32
- [key in PopsIconType]: string;
33
- } = {
34
- min: SVG_min,
35
- mise: SVG_mise,
36
- max: SVG_max,
37
- close: SVG_close,
38
- edit: SVG_edit,
39
- share: SVG_share,
40
- delete: SVG_delete,
41
- search: SVG_search,
42
- upload: SVG_upload,
43
- loading: SVG_loading,
44
- next: SVG_next,
45
- prev: SVG_prev,
46
- eleme: SVG_eleme,
47
- elemePlus: SVG_elemePlus,
48
- chromeFilled: SVG_chromeFilled,
49
- cpu: SVG_cpu,
50
- videoPlay: SVG_videoPlay,
51
- videoPause: SVG_videoPause,
52
- headset: SVG_headset,
53
- monitor: SVG_monitor,
54
- documentCopy: SVG_documentCopy,
55
- picture: SVG_picture,
56
- circleClose: SVG_circleClose,
57
- view: SVG_view,
58
- hide: SVG_hide,
59
- keyboard: SVG_keyboard,
60
- arrowRight: SVG_arrowRight,
61
- arrowLeft: SVG_arrowLeft,
62
- };
63
-
64
- export const PopsIcon = {
65
- $data: PopsIconData,
66
- /**
67
- * 判断是否存在某个icon
68
- * @param iconName 图标名
69
- */
70
- hasIcon(iconName: string) {
71
- return Object.keys(PopsIcon.$data).includes(iconName);
72
- },
73
- /**
74
- * 获取icon
75
- * @param iconName 图标名
76
- */
77
- getIcon(iconName: string): string | null {
78
- return PopsIcon.$data[iconName as keyof typeof this.$data];
79
- },
80
- /**
81
- * 删除图标
82
- * @param iconName 图标名
83
- */
84
- deleteIcon(iconName: string) {
85
- return Reflect.deleteProperty(PopsIcon.$data, iconName);
86
- },
87
- /**
88
- * 设置图标
89
- * @param iconName 图标名
90
- * @param iconHTML 图标html
91
- */
92
- setIcon(iconName: string, iconHTML: string) {
93
- Reflect.set(PopsIcon.$data, iconName, iconHTML);
94
- },
95
- };
package/src/PopsInst.ts DELETED
@@ -1,21 +0,0 @@
1
- import type { PopsInstCommonConfig } from "./types/inst";
2
- import type { PopsInstStoreType } from "./types/main";
3
-
4
- /**
5
- * 弹窗实例数据
6
- */
7
- export const PopsInstData: {
8
- [key in PopsInstStoreType]: PopsInstCommonConfig[];
9
- } = {
10
- alert: [],
11
- confirm: [],
12
- drawer: [],
13
- folder: [],
14
- iframe: [],
15
- loading: [],
16
- panel: [],
17
- prompt: [],
18
- rightClickMenu: [],
19
- // 没有 searchSuggestion
20
- tooltip: [],
21
- };
@@ -1,62 +0,0 @@
1
- import type { PopsAlertDetails } from "./types";
2
-
3
- export const PopsAlertConfig = (): DeepRequired<PopsAlertDetails> => {
4
- return {
5
- title: {
6
- text: "默认标题",
7
- position: "left",
8
- html: false,
9
- style: "",
10
- },
11
- content: {
12
- text: "默认内容",
13
- html: false,
14
- style: "",
15
- },
16
- btn: {
17
- position: "flex-end",
18
- ok: {
19
- size: void 0 as any,
20
- enable: true,
21
- icon: void 0 as any,
22
- rightIcon: false,
23
- iconIsLoading: false,
24
- text: "确定",
25
- type: "primary",
26
- callback: function (details: any) {
27
- details.close();
28
- },
29
- },
30
- close: {
31
- enable: true,
32
- callback: function (details: any) {
33
- details.close();
34
- },
35
- },
36
- },
37
- useShadowRoot: true,
38
- class: "",
39
- only: false,
40
- width: window.innerWidth < 550 ? "88vw" : "350px",
41
- height: window.innerHeight < 450 ? "70vh" : "200px",
42
- position: "center",
43
- animation: "pops-anim-fadein-zoom",
44
- zIndex: 10000,
45
- mask: {
46
- enable: false,
47
- clickEvent: {
48
- toClose: false,
49
- toHide: false,
50
- },
51
- clickCallBack: null,
52
- },
53
- drag: false,
54
- dragLimit: true,
55
- dragExtraDistance: 3,
56
- dragMoveCallBack() {},
57
- dragEndCallBack() {},
58
- forbiddenScroll: false,
59
- style: null,
60
- beforeAppendToPageCallBack() {},
61
- } as DeepRequired<PopsAlertDetails>;
62
- };
File without changes
@@ -1,181 +0,0 @@
1
- import { GlobalConfig } from "../../config/GlobalConfig";
2
- import { PopsElementHandler } from "../../handler/PopsElementHandler";
3
- import { PopsHandler } from "../../handler/PopsHandler";
4
- import { popsDOMUtils } from "../../utils/PopsDOMUtils";
5
- import { PopsInstanceUtils } from "../../utils/PopsInstanceUtils";
6
- import { popsUtils } from "../../utils/PopsUtils";
7
- import { PopsAlertConfig } from "./config";
8
- import type { PopsType } from "../../types/main";
9
- import type { PopsAlertDetails } from "./types";
10
- import { PopsCSS } from "../../PopsCSS";
11
-
12
- export const PopsAlert = {
13
- init(details: PopsAlertDetails) {
14
- const guid = popsUtils.getRandomGUID();
15
- // 设置当前类型
16
- const popsType: PopsType = "alert";
17
- let config = PopsAlertConfig();
18
- config = popsUtils.assign(config, GlobalConfig.getGlobalConfig());
19
- config = popsUtils.assign(config, details);
20
- config = PopsHandler.handleOnly(popsType, config);
21
-
22
- const { $shadowContainer, $shadowRoot } = PopsHandler.handlerShadow(config);
23
- PopsHandler.handleInit($shadowRoot, [
24
- {
25
- name: "index",
26
- css: PopsCSS.index,
27
- },
28
- {
29
- name: "ninePalaceGridPosition",
30
- css: PopsCSS.ninePalaceGridPosition,
31
- },
32
- {
33
- name: "scrollbar",
34
- css: PopsCSS.scrollbar,
35
- },
36
- {
37
- name: "button",
38
- css: PopsCSS.button,
39
- },
40
- {
41
- name: "anim",
42
- css: PopsCSS.anim,
43
- },
44
- {
45
- name: "common",
46
- css: PopsCSS.common,
47
- },
48
- {
49
- name: "alertCSS",
50
- css: PopsCSS.alertCSS,
51
- },
52
- ]);
53
-
54
- // 先把z-index提取出来
55
- let zIndex = PopsHandler.handleZIndex(config.zIndex);
56
- let maskHTML = PopsElementHandler.createMask(guid, zIndex);
57
- let headerBtnHTML = PopsElementHandler.createHeader(popsType, config);
58
- let bottomBtnHTML = PopsElementHandler.createBottom(popsType, config);
59
- let { headerStyle, headerPStyle } = PopsElementHandler.createHeaderStyle(
60
- popsType,
61
- config
62
- );
63
- let { contentStyle, contentPStyle } = PopsElementHandler.createContentStyle(
64
- popsType,
65
- config
66
- );
67
- let animHTML = PopsElementHandler.createAnim(
68
- guid,
69
- popsType,
70
- config,
71
- /*html*/ `
72
- <div class="pops-title pops-${popsType}-title" style="text-align: ${
73
- config.title.position
74
- };${headerStyle}">${
75
- config.title.html
76
- ? config.title.text
77
- : `<p pops class="pops-${popsType}-title-text" style="${headerPStyle}">${config.title.text}</p>`
78
- }${headerBtnHTML}</div>
79
- <div class="pops-content pops-${popsType}-content" style="${contentStyle}">${
80
- config.content.html
81
- ? config.content.text
82
- : `<p pops class="pops-${popsType}-content-text" style="${contentPStyle}">${config.content.text}</p>`
83
- }</div>${bottomBtnHTML}`,
84
- bottomBtnHTML,
85
- zIndex
86
- );
87
- /**
88
- * 弹窗的主元素,包括动画层
89
- */
90
- let $anim = PopsElementHandler.parseElement<HTMLDivElement>(animHTML);
91
-
92
- let {
93
- popsElement: $pops,
94
- headerCloseBtnElement: $headerCloseBtn,
95
- btnOkElement,
96
- titleElement: $title,
97
- } = PopsHandler.handleQueryElement($anim, popsType);
98
-
99
- /** 遮罩层元素 */
100
- let $mask: HTMLDivElement | null = null;
101
- /** 已创建的元素列表 */
102
- let elementList: HTMLElement[] = [$anim];
103
-
104
- /* 遮罩层元素 */
105
-
106
- if (config.mask.enable) {
107
- let _handleMask_ = PopsHandler.handleMask({
108
- type: popsType,
109
- guid: guid,
110
- config: config,
111
- animElement: $anim,
112
- maskHTML: maskHTML,
113
- });
114
- $mask = _handleMask_.maskElement;
115
- elementList.push($mask);
116
- }
117
- /* 处理返回的配置 */
118
- let eventDetails = PopsHandler.handleEventDetails(
119
- guid,
120
- $shadowContainer,
121
- $shadowRoot,
122
- popsType,
123
- $anim,
124
- $pops!,
125
- $mask!,
126
- config
127
- );
128
- /* 为顶部右边的关闭按钮添加点击事件 */
129
- PopsHandler.handleClickEvent(
130
- "close",
131
- $headerCloseBtn!,
132
- eventDetails,
133
- config.btn.close!.callback!
134
- );
135
- /* 为底部ok按钮添加点击事件 */
136
- PopsHandler.handleClickEvent(
137
- "ok",
138
- btnOkElement!,
139
- eventDetails!,
140
- config.btn.ok!.callback!
141
- );
142
-
143
- /* 创建到页面中 */
144
-
145
- popsDOMUtils.append($shadowRoot, elementList);
146
- if (typeof config.beforeAppendToPageCallBack === "function") {
147
- config.beforeAppendToPageCallBack($shadowRoot, $shadowContainer);
148
- }
149
-
150
- popsDOMUtils.appendBody($shadowContainer);
151
- if ($mask != null) {
152
- // 添加遮罩层
153
- $anim.after($mask);
154
- }
155
- /* 保存 */
156
- PopsHandler.handlePush(popsType, {
157
- guid: guid,
158
-
159
- animElement: $anim,
160
-
161
- popsElement: $pops!,
162
-
163
- maskElement: $mask!,
164
- $shadowContainer: $shadowContainer,
165
- $shadowRoot: $shadowRoot,
166
- });
167
- /* 拖拽 */
168
- if (config.drag) {
169
- PopsInstanceUtils.drag($pops!, {
170
- dragElement: $title!,
171
- limit: config.dragLimit,
172
- extraDistance: config.dragExtraDistance!,
173
- moveCallBack: config.dragMoveCallBack!,
174
- endCallBack: config.dragEndCallBack!,
175
- });
176
- }
177
-
178
- let result = PopsHandler.handleResultDetails(eventDetails);
179
- return result;
180
- },
181
- };