@whitesev/pops 2.1.3 → 2.1.4

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.
@@ -3,7 +3,7 @@ import { PopsHandler } from "../../handler/PopsHandler";
3
3
  import { popsDOMUtils } from "../../utils/PopsDOMUtils";
4
4
  import { PopsInstanceUtils } from "../../utils/PopsInstanceUtils";
5
5
  import { popsUtils } from "../../utils/PopsUtils";
6
- import type { PopsPanelDetails } from "./indexType";
6
+ import type { PopsPanelDetails, PopsPanelEventType } from "./indexType";
7
7
  import { PopsPanelConfig } from "./config";
8
8
  import { PanelHandleContentDetails } from "./PanelHandleContentDetails";
9
9
  import { GlobalConfig } from "../../GlobalConfig";
@@ -142,6 +142,7 @@ export const PopsPanel = {
142
142
  panelHandleContentDetails.init({
143
143
  config: config,
144
144
  $el: {
145
+ $pops: $pops,
145
146
  $content: $content,
146
147
  $contentAside: $contentAside,
147
148
  $contentSectionContainer: $contentSectionContainer,
@@ -167,6 +168,23 @@ export const PopsPanel = {
167
168
  });
168
169
  }
169
170
  let result = PopsHandler.handleResultDetails(eventDetails);
170
- return result;
171
+
172
+ return {
173
+ ...result,
174
+ addEventListener: <K extends keyof PopsPanelEventType>(
175
+ event: K,
176
+ listener: (evt: CustomEvent<PopsPanelEventType[K]>) => void,
177
+ options?: boolean | EventListenerOptions
178
+ ) => {
179
+ $pops.addEventListener(event, listener as any, options);
180
+ },
181
+ removeEventListener: <K extends keyof PopsPanelEventType>(
182
+ event: K,
183
+ listener: (evt: CustomEvent<PopsPanelEventType[K]>) => void,
184
+ options?: boolean | EventListenerOptions
185
+ ) => {
186
+ $pops.removeEventListener(event, listener as any, options);
187
+ },
188
+ };
171
189
  },
172
190
  };
@@ -26,6 +26,22 @@ export type PopsPanelFormsTotalDetails =
26
26
  | PopsPanelButtonDetails
27
27
  | PopsPanelDeepMenuDetails
28
28
  | PopsPanelOwnDetails;
29
+
30
+ /**
31
+ * panel的内部事件
32
+ */
33
+ export type PopsPanelEventType = {
34
+ /**
35
+ * 该事件在右侧容器内的元素改变时触发
36
+ */
37
+ "pops:renderRightContainer": {
38
+ /**
39
+ * 菜单配置
40
+ */
41
+ formConfig: PopsPanelContentConfig[] | PopsPanelDeepMenuDetails;
42
+ };
43
+ };
44
+
29
45
  /**
30
46
  * pops.panel的content配置信息
31
47
  */
@@ -213,7 +213,7 @@ export declare interface PopsDOMUtilsEventListenerOptionsAttribute {
213
213
  /**
214
214
  * 属性配置
215
215
  */
216
- option: DOMUtilsEventListenerOption;
216
+ option: PopsDOMUtilsEventListenerOption;
217
217
  /**
218
218
  * 用户添加的事件
219
219
  */
@@ -1,5 +1,6 @@
1
1
  import { PopsEventDetails, PopsHandlerEventDetails } from "./event";
2
2
  import type { PopsIconType } from "./icon";
3
+ import type { PopsMode } from "./main";
3
4
 
4
5
  /**
5
6
  * 按钮类型
@@ -105,7 +106,7 @@ export interface PopsButtonDetails<T = {}> {
105
106
  text: string;
106
107
  /**
107
108
  * 按钮点击的回调
108
- *
109
+ *
109
110
  * 如果传入该值,那么将不会自动关闭弹窗
110
111
  */
111
112
  callback(
@@ -151,7 +152,7 @@ export interface PopsButtonDetailsAnyType<T = {}> {
151
152
  text: string;
152
153
  /**
153
154
  * 按钮点击的回调
154
- *
155
+ *
155
156
  * 如果传入该值,那么将不会自动关闭弹窗
156
157
  */
157
158
  callback(
@@ -1,4 +1,5 @@
1
1
  import type { PopsIframeDetails } from "../components/iframe/indexType";
2
+ import type { PopsMode } from "./main";
2
3
 
3
4
  /**
4
5
  * 事件配置
@@ -46,8 +47,8 @@ export interface PopsEventDetails {
46
47
  /** 遮罩层 */
47
48
  maskElement?: HTMLDivElement;
48
49
  /** 当前弹窗类型 */
49
- mode: mode;
50
- guid: guid;
50
+ mode: PopsMode;
51
+ guid: string;
51
52
  close: () => Promise<void>;
52
53
  hide: () => Promise<void>;
53
54
  show: () => Promise<void>;
@@ -1,15 +1,15 @@
1
- declare var unsafeWindow: Window & typeof globalThis;
2
-
3
1
  declare module "*.css" {
4
2
  const content: string;
5
3
  export default content;
6
4
  }
7
-
8
5
  declare module "*.svg" {
9
6
  const content: string;
10
7
  export default content;
11
8
  }
12
- type DeepRequired<T> = T extends Function
9
+
10
+ declare var unsafeWindow: Window & typeof globalThis;
11
+
12
+ declare type DeepRequired<T> = T extends Function
13
13
  ? T
14
14
  : T extends object
15
15
  ? T extends Node
@@ -4,7 +4,15 @@ import type { PopsDrawerDetails } from "../components/drawer/indexType";
4
4
  import type { PopsFolderDetails } from "../components/folder/indexType";
5
5
  import type { PopsIframeDetails } from "../components/iframe/indexType";
6
6
  import type { PopsLoadingDetails } from "../components/loading/indexType";
7
+ import type { PopsPanelButtonDetails } from "../components/panel/buttonType";
8
+ import type { PopsPanelDeepMenuDetails } from "../components/panel/deepMenuType";
7
9
  import type { PopsPanelDetails } from "../components/panel/indexType";
10
+ import type { PopsPanelInputDetails } from "../components/panel/inputType";
11
+ import type { PopsPanelOwnDetails } from "../components/panel/ownType";
12
+ import type { PopsPanelSelectDetails } from "../components/panel/selectType";
13
+ import type { PopsPanelSliderDetails } from "../components/panel/sliderType";
14
+ import type { PopsPanelSwitchDetails } from "../components/panel/switchType";
15
+ import type { PopsPanelTextAreaDetails } from "../components/panel/textareaType";
8
16
  import type { PopsPromptDetails } from "../components/prompt/indexType";
9
17
  import { PopsRightClickMenuDetails } from "../components/rightClickMenu/indexType";
10
18
  import { PopsToolTipDetails } from "../components/tooltip/indexType";
@@ -1,3 +1,11 @@
1
+ import type { PopsAlertDetails } from "../components/alert/indexType";
2
+ import type { PopsDrawerDetails } from "../components/drawer/indexType";
3
+ import type { PopsFolderDetails } from "../components/folder/indexType";
4
+ import type { PopsIframeDetails } from "../components/iframe/indexType";
5
+ import type { PopsLoadingDetails } from "../components/loading/indexType";
6
+ import type { PopsPanelDetails } from "../components/panel/indexType";
7
+ import type { PopsPromptDetails } from "../components/prompt/indexType";
8
+
1
9
  /**
2
10
  * 遮罩层配置
3
11
  */
@@ -38,10 +38,7 @@ class PopsUtils {
38
38
  if (target === PopsCore.self) {
39
39
  return true;
40
40
  }
41
- if (
42
- typeof (unsafeWindow as any) !== "undefined" &&
43
- target === (unsafeWindow as any)
44
- ) {
41
+ if (typeof unsafeWindow !== "undefined" && target === unsafeWindow) {
45
42
  return true;
46
43
  }
47
44
  if (target?.Math?.toString() !== "[object Math]") {