@whitesev/pops 3.2.0 → 3.2.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 (126) hide show
  1. package/README.md +249 -249
  2. package/dist/index.amd.js +702 -667
  3. package/dist/index.amd.js.map +1 -1
  4. package/dist/index.amd.min.js +1 -1
  5. package/dist/index.amd.min.js.map +1 -1
  6. package/dist/index.cjs.js +702 -667
  7. package/dist/index.cjs.js.map +1 -1
  8. package/dist/index.cjs.min.js +1 -1
  9. package/dist/index.cjs.min.js.map +1 -1
  10. package/dist/index.esm.js +702 -667
  11. package/dist/index.esm.js.map +1 -1
  12. package/dist/index.esm.min.js +1 -1
  13. package/dist/index.esm.min.js.map +1 -1
  14. package/dist/index.iife.js +702 -667
  15. package/dist/index.iife.js.map +1 -1
  16. package/dist/index.iife.min.js +1 -1
  17. package/dist/index.iife.min.js.map +1 -1
  18. package/dist/index.system.js +702 -667
  19. package/dist/index.system.js.map +1 -1
  20. package/dist/index.system.min.js +1 -1
  21. package/dist/index.system.min.js.map +1 -1
  22. package/dist/index.umd.js +702 -667
  23. package/dist/index.umd.js.map +1 -1
  24. package/dist/index.umd.min.js +1 -1
  25. package/dist/index.umd.min.js.map +1 -1
  26. package/dist/types/src/components/folder/types/index.d.ts +43 -13
  27. package/dist/types/src/types/PopsDOMUtilsEventType.d.ts +313 -313
  28. package/dist/types/src/types/animation.d.ts +19 -19
  29. package/dist/types/src/types/button.d.ts +94 -94
  30. package/dist/types/src/types/components.d.ts +211 -211
  31. package/dist/types/src/types/event.d.ts +43 -43
  32. package/dist/types/src/types/global.d.ts +31 -31
  33. package/dist/types/src/types/icon.d.ts +32 -32
  34. package/dist/types/src/types/inst.d.ts +28 -28
  35. package/dist/types/src/types/main.d.ts +66 -66
  36. package/dist/types/src/types/mask.d.ts +52 -52
  37. package/dist/types/src/types/position.d.ts +60 -60
  38. package/package.json +27 -25
  39. package/src/Pops.ts +206 -206
  40. package/src/PopsAnimation.ts +32 -32
  41. package/src/PopsCSS.ts +54 -54
  42. package/src/PopsCore.ts +37 -37
  43. package/src/PopsIcon.ts +95 -95
  44. package/src/PopsInst.ts +21 -21
  45. package/src/components/alert/defaultConfig.ts +62 -62
  46. package/src/components/alert/index.ts +163 -163
  47. package/src/components/alert/types/index.ts +23 -23
  48. package/src/components/confirm/defaultConfig.ts +90 -90
  49. package/src/components/confirm/index.ts +165 -165
  50. package/src/components/confirm/types/index.ts +13 -17
  51. package/src/components/drawer/defaultConfig.ts +89 -89
  52. package/src/components/drawer/index.css +37 -37
  53. package/src/components/drawer/index.ts +245 -245
  54. package/src/components/drawer/types/index.ts +62 -61
  55. package/src/components/folder/defaultConfig.ts +151 -151
  56. package/src/components/folder/folderIcon.ts +28 -28
  57. package/src/components/folder/index.css +303 -303
  58. package/src/components/folder/index.ts +953 -932
  59. package/src/components/folder/types/index.ts +143 -110
  60. package/src/components/iframe/defaultConfig.ts +60 -60
  61. package/src/components/iframe/index.css +76 -76
  62. package/src/components/iframe/index.ts +331 -331
  63. package/src/components/iframe/types/index.ts +96 -96
  64. package/src/components/loading/defaultConfig.ts +29 -29
  65. package/src/components/loading/index.css +66 -66
  66. package/src/components/loading/index.ts +101 -101
  67. package/src/components/loading/types/index.ts +36 -34
  68. package/src/components/panel/css/components-select.css +84 -84
  69. package/src/components/panel/defaultConfig.ts +868 -868
  70. package/src/components/panel/handlerComponents.ts +3993 -3993
  71. package/src/components/panel/index.css +1403 -1401
  72. package/src/components/panel/index.ts +221 -221
  73. package/src/components/panel/types/components-button.ts +56 -56
  74. package/src/components/panel/types/components-common.ts +73 -73
  75. package/src/components/panel/types/components-container.ts +25 -25
  76. package/src/components/panel/types/components-deepMenu.ts +64 -64
  77. package/src/components/panel/types/components-input.ts +90 -90
  78. package/src/components/panel/types/components-own.ts +16 -16
  79. package/src/components/panel/types/components-select.ts +169 -169
  80. package/src/components/panel/types/components-selectMultiple.ts +105 -104
  81. package/src/components/panel/types/components-slider.ts +55 -55
  82. package/src/components/panel/types/components-switch.ts +33 -33
  83. package/src/components/panel/types/components-textarea.ts +45 -45
  84. package/src/components/panel/types/index.ts +244 -244
  85. package/src/components/prompt/defaultConfig.ts +94 -94
  86. package/src/components/prompt/index.css +34 -34
  87. package/src/components/prompt/index.ts +187 -215
  88. package/src/components/prompt/types/index.ts +57 -56
  89. package/src/components/rightClickMenu/defaultConfig.ts +103 -103
  90. package/src/components/rightClickMenu/index.css +115 -115
  91. package/src/components/rightClickMenu/index.ts +662 -662
  92. package/src/components/rightClickMenu/types/index.ts +145 -143
  93. package/src/components/searchSuggestion/defaultConfig.ts +63 -63
  94. package/src/components/searchSuggestion/index.ts +813 -813
  95. package/src/components/searchSuggestion/types/index.ts +244 -242
  96. package/src/components/tooltip/defaultConfig.ts +33 -33
  97. package/src/components/tooltip/index.css +199 -199
  98. package/src/components/tooltip/index.ts +617 -617
  99. package/src/components/tooltip/types/index.ts +123 -121
  100. package/src/config/CommonCSSClassName.ts +17 -17
  101. package/src/config/GlobalConfig.ts +63 -63
  102. package/src/css/animation.css +987 -987
  103. package/src/css/button.css +551 -551
  104. package/src/css/common.css +54 -54
  105. package/src/css/index.css +253 -253
  106. package/src/css/ninePalaceGridPosition.css +50 -50
  107. package/src/css/scrollbar.css +22 -22
  108. package/src/handler/PopsElementHandler.ts +303 -303
  109. package/src/handler/PopsHandler.ts +611 -611
  110. package/src/types/PopsDOMUtilsEventType.d.ts +313 -313
  111. package/src/types/animation.d.ts +19 -19
  112. package/src/types/button.d.ts +94 -94
  113. package/src/types/components.d.ts +211 -211
  114. package/src/types/event.d.ts +43 -43
  115. package/src/types/global.d.ts +31 -31
  116. package/src/types/icon.d.ts +32 -32
  117. package/src/types/inst.d.ts +28 -28
  118. package/src/types/main.d.ts +66 -66
  119. package/src/types/mask.d.ts +52 -52
  120. package/src/types/position.d.ts +60 -60
  121. package/src/utils/PopsDOMUtils.ts +2483 -2483
  122. package/src/utils/PopsDOMUtilsEventsConfig.ts +4 -4
  123. package/src/utils/PopsInstanceUtils.ts +714 -714
  124. package/src/utils/PopsMathUtils.ts +71 -71
  125. package/src/utils/PopsSafeUtils.ts +22 -22
  126. package/src/utils/PopsUtils.ts +421 -421
@@ -1,96 +1,96 @@
1
- import type { PopsTitleConfig, PopsDragConfig, PopsGeneralConfig } from "../../../types/components";
2
-
3
- import type { PopsEventConfig } from "../../../types/event";
4
-
5
- /**
6
- * pops.iframe的按钮点击事件回调的配置参数
7
- */
8
- export type PopsIframeClickEventConfig = PopsEventConfig & {
9
- /**
10
- * iframe元素
11
- */
12
- $iframe: HTMLIFrameElement;
13
- };
14
-
15
- /**
16
- * pops.iframe
17
- */
18
- export interface PopsIframeConfig extends PopsTitleConfig, PopsDragConfig, PopsGeneralConfig {
19
- /**
20
- * 加载配置
21
- */
22
- loading: {
23
- /**
24
- * 是否启用加载中的loading
25
- */
26
- enable: boolean;
27
- /**
28
- * 是否启用loading图标
29
- */
30
- icon: boolean;
31
- /**
32
- * 文字
33
- */
34
- text: string;
35
- };
36
- /**
37
- * 按钮配置
38
- */
39
- btn: {
40
- /**
41
- * 最小化
42
- */
43
- min: {
44
- /**
45
- * 点击的回调函数
46
- */
47
- callback: (eventConfig: PopsIframeClickEventConfig, event: MouseEvent | PointerEvent) => void;
48
- };
49
- /**
50
- * 最大化
51
- */
52
- max: {
53
- /**
54
- * 点击的回调函数
55
- */
56
- callback: (eventConfig: PopsIframeClickEventConfig, event: MouseEvent | PointerEvent) => void;
57
- };
58
- /**
59
- * 窗口化
60
- */
61
- mise: {
62
- /**
63
- * 点击的回调函数
64
- */
65
- callback: (eventConfig: PopsIframeClickEventConfig, event: MouseEvent | PointerEvent) => void;
66
- };
67
- /**
68
- * 关闭
69
- */
70
- close: {
71
- /**
72
- * 点击的回调函数
73
- */
74
- callback: (eventConfig: PopsIframeClickEventConfig, event: MouseEvent | PointerEvent) => void;
75
- };
76
- };
77
- /**
78
- * 加载的地址,默认为window.location.href
79
- * @default window.location.href
80
- */
81
- url?: string;
82
- /**
83
- * 右上角按钮顺序:最小化、最大化、窗口化、关闭
84
- * @default "min|max|mise|close"
85
- */
86
- topRightButton: string;
87
- /**
88
- * 是否启用沙箱,默认false
89
- * @default false
90
- */
91
- sandbox?: boolean;
92
- /**
93
- * 加载完毕的回调
94
- */
95
- loadEndCallBack?: (eventConfig: PopsIframeClickEventConfig) => void;
96
- }
1
+ import type { PopsTitleConfig, PopsDragConfig, PopsGeneralConfig } from "../../../types/components";
2
+
3
+ import type { PopsEventConfig } from "../../../types/event";
4
+
5
+ /**
6
+ * pops.iframe的按钮点击事件回调的配置参数
7
+ */
8
+ export type PopsIframeClickEventConfig = PopsEventConfig & {
9
+ /**
10
+ * iframe元素
11
+ */
12
+ $iframe: HTMLIFrameElement;
13
+ };
14
+
15
+ /**
16
+ * pops.iframe
17
+ */
18
+ export interface PopsIframeConfig extends PopsTitleConfig, PopsDragConfig, PopsGeneralConfig {
19
+ /**
20
+ * 加载配置
21
+ */
22
+ loading: {
23
+ /**
24
+ * 是否启用加载中的loading
25
+ */
26
+ enable: boolean;
27
+ /**
28
+ * 是否启用loading图标
29
+ */
30
+ icon: boolean;
31
+ /**
32
+ * 文字
33
+ */
34
+ text: string;
35
+ };
36
+ /**
37
+ * 按钮配置
38
+ */
39
+ btn: {
40
+ /**
41
+ * 最小化
42
+ */
43
+ min: {
44
+ /**
45
+ * 点击的回调函数
46
+ */
47
+ callback: (eventConfig: PopsIframeClickEventConfig, event: MouseEvent | PointerEvent) => void;
48
+ };
49
+ /**
50
+ * 最大化
51
+ */
52
+ max: {
53
+ /**
54
+ * 点击的回调函数
55
+ */
56
+ callback: (eventConfig: PopsIframeClickEventConfig, event: MouseEvent | PointerEvent) => void;
57
+ };
58
+ /**
59
+ * 窗口化
60
+ */
61
+ mise: {
62
+ /**
63
+ * 点击的回调函数
64
+ */
65
+ callback: (eventConfig: PopsIframeClickEventConfig, event: MouseEvent | PointerEvent) => void;
66
+ };
67
+ /**
68
+ * 关闭
69
+ */
70
+ close: {
71
+ /**
72
+ * 点击的回调函数
73
+ */
74
+ callback: (eventConfig: PopsIframeClickEventConfig, event: MouseEvent | PointerEvent) => void;
75
+ };
76
+ };
77
+ /**
78
+ * 加载的地址,默认为window.location.href
79
+ * @default window.location.href
80
+ */
81
+ url?: string;
82
+ /**
83
+ * 右上角按钮顺序:最小化、最大化、窗口化、关闭
84
+ * @default "min|max|mise|close"
85
+ */
86
+ topRightButton: string;
87
+ /**
88
+ * 是否启用沙箱,默认false
89
+ * @default false
90
+ */
91
+ sandbox?: boolean;
92
+ /**
93
+ * 加载完毕的回调
94
+ */
95
+ loadEndCallBack?: (eventConfig: PopsIframeClickEventConfig) => void;
96
+ }
@@ -1,29 +1,29 @@
1
- import type { PopsLoadingConfig } from "./types";
2
-
3
- export const PopsLoadingDefaultConfig = (): DeepRequired<PopsLoadingConfig> => {
4
- return {
5
- $parent: document.body || document.documentElement,
6
- content: {
7
- text: "加载中...",
8
- icon: "loading",
9
- style: "",
10
- },
11
- useShadowRoot: true,
12
- class: "",
13
- only: false,
14
- zIndex: 10000,
15
- mask: {
16
- enable: false,
17
- clickEvent: {
18
- toClose: false,
19
- toHide: false,
20
- },
21
- clickCallBack: null,
22
- },
23
- animation: "pops-anim-fadein-zoom",
24
- forbiddenScroll: false,
25
- isAbsolute: false,
26
- style: null,
27
- addIndexCSS: true,
28
- };
29
- };
1
+ import type { PopsLoadingConfig } from "./types";
2
+
3
+ export const PopsLoadingDefaultConfig = (): DeepRequired<PopsLoadingConfig> => {
4
+ return {
5
+ $parent: document.body || document.documentElement,
6
+ content: {
7
+ text: "加载中...",
8
+ icon: "loading",
9
+ style: "",
10
+ },
11
+ useShadowRoot: true,
12
+ class: "",
13
+ only: false,
14
+ zIndex: 10000,
15
+ mask: {
16
+ enable: false,
17
+ clickEvent: {
18
+ toClose: false,
19
+ toHide: false,
20
+ },
21
+ clickCallBack: null,
22
+ },
23
+ animation: "pops-anim-fadein-zoom",
24
+ forbiddenScroll: false,
25
+ isAbsolute: false,
26
+ style: null,
27
+ addIndexCSS: true,
28
+ };
29
+ };
@@ -1,66 +1,66 @@
1
- .pops[type-value="loading"] {
2
- --loading-bd-color: rgba(0, 0, 0, 0.2);
3
- --loading-bg-color: rgb(255, 255, 255, var(--pops-bg-opacity));
4
- --loading-box-shadow-color: rgb(0 0 0 / 50%);
5
- --loading-icon-color: rgba(100, 149, 237, 0.1);
6
- --loading-icon-bd-top-color: rgb(100, 149, 237, var(--pops-bd-opacity));
7
- }
8
- .pops[type-value="loading"] {
9
- position: absolute;
10
- top: 272.5px;
11
- top: 50%;
12
- left: 26px;
13
- left: 50%;
14
- display: flex;
15
- overflow: hidden;
16
- padding: 10px 15px;
17
- max-width: 100%;
18
- max-height: 100%;
19
- min-width: 0;
20
- min-height: 0;
21
- border: 1px solid var(--loading-bd-color);
22
- border-radius: 5px;
23
- background-color: var(--loading-bg-color);
24
- box-shadow: 0 0 5px var(--loading-box-shadow-color);
25
- vertical-align: middle;
26
- transition: all 0.35s;
27
- transform: translate(-50%, -50%);
28
- -webkit-user-select: none;
29
- -moz-user-select: none;
30
- -ms-user-select: none;
31
- user-select: none;
32
- flex-direction: column;
33
- align-items: center;
34
- justify-content: center;
35
- align-content: center;
36
- }
37
- .pops[type-value="loading"]:before {
38
- float: left;
39
- display: inline-block;
40
- width: 2em;
41
- height: 2em;
42
- border: 0.3em solid var(--loading-icon-color);
43
- border-top: 0.3em solid var(--loading-icon-bd-top-color);
44
- border-radius: 50%;
45
- content: " ";
46
- vertical-align: middle;
47
- font-size: inherit;
48
- animation: pops-anim-wait-rotate 1.2s linear infinite;
49
- }
50
- .pops[type-value="loading"] .pops-loading-content {
51
- position: static;
52
- top: 0;
53
- bottom: 0;
54
- float: left;
55
- overflow: hidden;
56
- width: auto;
57
- font-size: inherit;
58
- line-height: normal;
59
- align-content: center;
60
- }
61
-
62
- @media (prefers-color-scheme: dark) {
63
- .pops[type-value="loading"] {
64
- --loading-bg-color: #222222;
65
- }
66
- }
1
+ .pops[type-value="loading"] {
2
+ --loading-bd-color: rgba(0, 0, 0, 0.2);
3
+ --loading-bg-color: rgb(255, 255, 255, var(--pops-bg-opacity));
4
+ --loading-box-shadow-color: rgb(0 0 0 / 50%);
5
+ --loading-icon-color: rgba(100, 149, 237, 0.1);
6
+ --loading-icon-bd-top-color: rgb(100, 149, 237, var(--pops-bd-opacity));
7
+ }
8
+ .pops[type-value="loading"] {
9
+ position: absolute;
10
+ top: 272.5px;
11
+ top: 50%;
12
+ left: 26px;
13
+ left: 50%;
14
+ display: flex;
15
+ overflow: hidden;
16
+ padding: 10px 15px;
17
+ max-width: 100%;
18
+ max-height: 100%;
19
+ min-width: 0;
20
+ min-height: 0;
21
+ border: 1px solid var(--loading-bd-color);
22
+ border-radius: 5px;
23
+ background-color: var(--loading-bg-color);
24
+ box-shadow: 0 0 5px var(--loading-box-shadow-color);
25
+ vertical-align: middle;
26
+ transition: all 0.35s;
27
+ transform: translate(-50%, -50%);
28
+ -webkit-user-select: none;
29
+ -moz-user-select: none;
30
+ -ms-user-select: none;
31
+ user-select: none;
32
+ flex-direction: column;
33
+ align-items: center;
34
+ justify-content: center;
35
+ align-content: center;
36
+ }
37
+ .pops[type-value="loading"]:before {
38
+ float: left;
39
+ display: inline-block;
40
+ width: 2em;
41
+ height: 2em;
42
+ border: 0.3em solid var(--loading-icon-color);
43
+ border-top: 0.3em solid var(--loading-icon-bd-top-color);
44
+ border-radius: 50%;
45
+ content: " ";
46
+ vertical-align: middle;
47
+ font-size: inherit;
48
+ animation: pops-anim-wait-rotate 1.2s linear infinite;
49
+ }
50
+ .pops[type-value="loading"] .pops-loading-content {
51
+ position: static;
52
+ top: 0;
53
+ bottom: 0;
54
+ float: left;
55
+ overflow: hidden;
56
+ width: auto;
57
+ font-size: inherit;
58
+ line-height: normal;
59
+ align-content: center;
60
+ }
61
+
62
+ @media (prefers-color-scheme: dark) {
63
+ .pops[type-value="loading"] {
64
+ --loading-bg-color: #222222;
65
+ }
66
+ }
@@ -1,101 +1,101 @@
1
- import { GlobalConfig } from "../../config/GlobalConfig";
2
- import { PopsElementHandler } from "../../handler/PopsElementHandler";
3
- import { PopsHandler } from "../../handler/PopsHandler";
4
- import { PopsCSS } from "../../PopsCSS";
5
- import { popsDOMUtils } from "../../utils/PopsDOMUtils";
6
- import { popsUtils } from "../../utils/PopsUtils";
7
- import { PopsLoadingDefaultConfig } from "./defaultConfig";
8
- import type { PopsLoadingConfig } from "./types";
9
-
10
- export const PopsLoading = {
11
- init(__config__: PopsLoadingConfig) {
12
- const guid = popsUtils.getRandomGUID();
13
- // 设置当前类型
14
- const PopsType = "loading";
15
- let config = PopsLoadingDefaultConfig();
16
- config = popsUtils.assign(config, GlobalConfig.getGlobalConfig());
17
- config = popsUtils.assign(config, __config__);
18
-
19
- config = PopsHandler.handleOnly(PopsType, config);
20
-
21
- // 先把z-index提取出来
22
- const zIndex = PopsHandler.handleZIndex(config.zIndex);
23
- const maskHTML = PopsElementHandler.createMask(guid, zIndex);
24
-
25
- const { contentPStyle } = PopsElementHandler.createContentStyle("loading", config);
26
- const animHTML = PopsElementHandler.createAnim(
27
- guid,
28
- PopsType,
29
- config,
30
- /*html*/ `
31
- <div class="pops-content pops-${PopsType}-content">${
32
- config.addIndexCSS
33
- ? /*html*/ `
34
- <style data-model-name="index">${PopsCSS.index}</style>
35
- <style data-model-name="anim">${PopsCSS.anim}</style>
36
- <style data-model-name="common">${PopsCSS.common}</style>
37
- `
38
- : ""
39
- }
40
- <style data-model-name="loadingCSS">
41
- ${PopsCSS.loadingCSS}
42
- </style>
43
- ${config.style != null ? `<style>${config.style}</style>` : ""}
44
- <p pops class="pops-${PopsType}-content-text" style="${contentPStyle}">${config.content.text}</p>
45
- </div>`,
46
- "",
47
- zIndex
48
- );
49
-
50
- /**
51
- * 弹窗的主元素,包括动画层
52
- */
53
-
54
- const $anim = PopsElementHandler.parseElement<HTMLDivElement>(animHTML);
55
-
56
- const { $pops: $pops } = PopsHandler.handleQueryElement($anim, PopsType);
57
- /**
58
- * 遮罩层元素
59
- */
60
- let $mask: HTMLDivElement | undefined = void 0;
61
- /**
62
- * 已创建的元素列表
63
- */
64
- const $elList: HTMLElement[] = [$anim];
65
-
66
- if (config.mask.enable) {
67
- // 创建遮罩层
68
- const handleMask = PopsHandler.handleMask({
69
- type: PopsType,
70
- guid: guid,
71
-
72
- config: config,
73
- animElement: $anim,
74
- maskHTML: maskHTML,
75
- });
76
- $mask = handleMask.maskElement;
77
- $elList.push($mask);
78
- }
79
- const evtConfig = PopsHandler.handleLoadingEventConfig(config, guid, PopsType, $anim, $pops, $mask);
80
- popsDOMUtils.append(config.$parent, $elList);
81
- if ($mask != null) {
82
- $anim.after($mask);
83
- }
84
- // @ts-ignore
85
- PopsHandler.handlePush(PopsType, {
86
- guid: guid,
87
- $anim: $anim,
88
- $pops: $pops!,
89
- $mask: $mask!,
90
- });
91
-
92
- if (config.isAbsolute) {
93
- // 遮罩层必须是跟随主内容
94
- // 即设置主内容position: relative,mask:position: absolute
95
- popsDOMUtils.css($anim, "position", "absolute !important");
96
- $mask && popsDOMUtils.css($mask, "position", "absolute !important");
97
- }
98
- const result = PopsHandler.handleResultConfig(evtConfig);
99
- return result;
100
- },
101
- };
1
+ import { GlobalConfig } from "../../config/GlobalConfig";
2
+ import { PopsElementHandler } from "../../handler/PopsElementHandler";
3
+ import { PopsHandler } from "../../handler/PopsHandler";
4
+ import { PopsCSS } from "../../PopsCSS";
5
+ import { popsDOMUtils } from "../../utils/PopsDOMUtils";
6
+ import { popsUtils } from "../../utils/PopsUtils";
7
+ import { PopsLoadingDefaultConfig } from "./defaultConfig";
8
+ import type { PopsLoadingConfig } from "./types";
9
+
10
+ export const PopsLoading = {
11
+ init(__config__: PopsLoadingConfig) {
12
+ const guid = popsUtils.getRandomGUID();
13
+ // 设置当前类型
14
+ const PopsType = "loading";
15
+ let config = PopsLoadingDefaultConfig();
16
+ config = popsUtils.assign(config, GlobalConfig.getGlobalConfig());
17
+ config = popsUtils.assign(config, __config__);
18
+
19
+ config = PopsHandler.handleOnly(PopsType, config);
20
+
21
+ // 先把z-index提取出来
22
+ const zIndex = PopsHandler.handleZIndex(config.zIndex);
23
+ const maskHTML = PopsElementHandler.createMask(guid, zIndex);
24
+
25
+ const { contentPStyle } = PopsElementHandler.createContentStyle("loading", config);
26
+ const animHTML = PopsElementHandler.createAnim(
27
+ guid,
28
+ PopsType,
29
+ config,
30
+ /*html*/ `
31
+ <div class="pops-content pops-${PopsType}-content">${
32
+ config.addIndexCSS
33
+ ? /*html*/ `
34
+ <style data-model-name="index">${PopsCSS.index}</style>
35
+ <style data-model-name="anim">${PopsCSS.anim}</style>
36
+ <style data-model-name="common">${PopsCSS.common}</style>
37
+ `
38
+ : ""
39
+ }
40
+ <style data-model-name="loadingCSS">
41
+ ${PopsCSS.loadingCSS}
42
+ </style>
43
+ ${config.style != null ? `<style>${config.style}</style>` : ""}
44
+ <p pops class="pops-${PopsType}-content-text" style="${contentPStyle}">${config.content.text}</p>
45
+ </div>`,
46
+ "",
47
+ zIndex
48
+ );
49
+
50
+ /**
51
+ * 弹窗的主元素,包括动画层
52
+ */
53
+
54
+ const $anim = PopsElementHandler.parseElement<HTMLDivElement>(animHTML);
55
+
56
+ const { $pops: $pops } = PopsHandler.handleQueryElement($anim, PopsType);
57
+ /**
58
+ * 遮罩层元素
59
+ */
60
+ let $mask: HTMLDivElement | undefined = void 0;
61
+ /**
62
+ * 已创建的元素列表
63
+ */
64
+ const $elList: HTMLElement[] = [$anim];
65
+
66
+ if (config.mask.enable) {
67
+ // 创建遮罩层
68
+ const handleMask = PopsHandler.handleMask({
69
+ type: PopsType,
70
+ guid: guid,
71
+
72
+ config: config,
73
+ animElement: $anim,
74
+ maskHTML: maskHTML,
75
+ });
76
+ $mask = handleMask.maskElement;
77
+ $elList.push($mask);
78
+ }
79
+ const evtConfig = PopsHandler.handleLoadingEventConfig(config, guid, PopsType, $anim, $pops, $mask);
80
+ popsDOMUtils.append(config.$parent, $elList);
81
+ if ($mask != null) {
82
+ $anim.after($mask);
83
+ }
84
+ // @ts-ignore
85
+ PopsHandler.handlePush(PopsType, {
86
+ guid: guid,
87
+ $anim: $anim,
88
+ $pops: $pops!,
89
+ $mask: $mask!,
90
+ });
91
+
92
+ if (config.isAbsolute) {
93
+ // 遮罩层必须是跟随主内容
94
+ // 即设置主内容position: relative,mask:position: absolute
95
+ popsDOMUtils.css($anim, "position", "absolute !important");
96
+ $mask && popsDOMUtils.css($mask, "position", "absolute !important");
97
+ }
98
+ const result = PopsHandler.handleResultConfig(evtConfig);
99
+ return result;
100
+ },
101
+ };
@@ -1,34 +1,36 @@
1
- import type { PopsGeneralConfig, PopsContentConfig } from "../../../types/components";
2
-
3
- /**
4
- * pops.loading
5
- */
6
- export interface PopsLoadingConfig
7
- extends Omit<PopsGeneralConfig, "width" | "height" | "position" | "beforeAppendToPageCallBack"> {
8
- /**
9
- * 父元素,默认为document.body
10
- * @default document.body || document.documentElement
11
- */
12
- $parent?: HTMLElement;
13
- /**
14
- * 内容配置
15
- */
16
- content: Omit<PopsContentConfig["content"], "html"> & {
17
- /**
18
- * 图标
19
- */
20
- icon?: string;
21
- };
22
- /**
23
- * (可选)添加主CSS,默认为true,当页面中存在anim覆盖时,可能会有一些样式问题,取消添加该CSS即可解决
24
- * @default true
25
- */
26
- addIndexCSS?: boolean;
27
- /**
28
- * 为pops-anim和pops-mask设置position: absolute(需要自行设置parent的position为relative)
29
- *
30
- * 它们默认的position为fixed
31
- * @default false
32
- */
33
- isAbsolute?: boolean;
34
- }
1
+ import type { PopsGeneralConfig, PopsContentConfig } from "../../../types/components";
2
+
3
+ /**
4
+ * pops.loading
5
+ */
6
+ export interface PopsLoadingConfig extends Omit<
7
+ PopsGeneralConfig,
8
+ "width" | "height" | "position" | "beforeAppendToPageCallBack"
9
+ > {
10
+ /**
11
+ * 父元素,默认为document.body
12
+ * @default document.body || document.documentElement
13
+ */
14
+ $parent?: HTMLElement;
15
+ /**
16
+ * 内容配置
17
+ */
18
+ content: Omit<PopsContentConfig["content"], "html"> & {
19
+ /**
20
+ * 图标
21
+ */
22
+ icon?: string;
23
+ };
24
+ /**
25
+ * (可选)添加主CSS,默认为true,当页面中存在anim覆盖时,可能会有一些样式问题,取消添加该CSS即可解决
26
+ * @default true
27
+ */
28
+ addIndexCSS?: boolean;
29
+ /**
30
+ * 为pops-anim和pops-mask设置position: absolute(需要自行设置parent的positionrelative)
31
+ *
32
+ * 它们默认的position为fixed
33
+ * @default false
34
+ */
35
+ isAbsolute?: boolean;
36
+ }