@whitesev/pops 1.9.0 → 1.9.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 (75) hide show
  1. package/dist/index.amd.js +288 -170
  2. package/dist/index.amd.js.map +1 -1
  3. package/dist/index.cjs.js +288 -170
  4. package/dist/index.cjs.js.map +1 -1
  5. package/dist/index.esm.js +288 -170
  6. package/dist/index.esm.js.map +1 -1
  7. package/dist/index.iife.js +288 -170
  8. package/dist/index.iife.js.map +1 -1
  9. package/dist/index.system.js +288 -170
  10. package/dist/index.system.js.map +1 -1
  11. package/dist/index.umd.js +288 -170
  12. package/dist/index.umd.js.map +1 -1
  13. package/dist/types/src/GlobalConfig.d.ts +1 -0
  14. package/dist/types/src/Pops.d.ts +2 -0
  15. package/dist/types/src/components/alert/config.d.ts +1 -1
  16. package/dist/types/src/components/confirm/config.d.ts +1 -1
  17. package/dist/types/src/components/drawer/config.d.ts +1 -1
  18. package/dist/types/src/components/folder/config.d.ts +1 -1
  19. package/dist/types/src/components/iframe/config.d.ts +1 -1
  20. package/dist/types/src/components/loading/config.d.ts +1 -1
  21. package/dist/types/src/components/panel/config.d.ts +1 -1
  22. package/dist/types/src/components/prompt/config.d.ts +1 -1
  23. package/dist/types/src/components/rightClickMenu/config.d.ts +1 -1
  24. package/dist/types/src/components/rightClickMenu/indexType.d.ts +4 -21
  25. package/dist/types/src/components/searchSuggestion/config.d.ts +1 -1
  26. package/dist/types/src/components/searchSuggestion/indexType.d.ts +2 -10
  27. package/dist/types/src/components/tooltip/config.d.ts +1 -1
  28. package/dist/types/src/components/tooltip/index.d.ts +5 -5
  29. package/dist/types/src/components/tooltip/indexType.d.ts +28 -28
  30. package/dist/types/src/handler/PopsElementHandler.d.ts +1 -1
  31. package/dist/types/src/handler/PopsHandler.d.ts +7 -3
  32. package/dist/types/src/types/button.d.ts +13 -19
  33. package/dist/types/src/types/components.d.ts +26 -11
  34. package/dist/types/src/types/event.d.ts +1 -1
  35. package/dist/types/src/types/global.d.ts +9 -0
  36. package/dist/types/src/types/layer.d.ts +1 -1
  37. package/dist/types/src/types/mask.d.ts +14 -11
  38. package/dist/types/src/utils/PopsInstanceUtils.d.ts +2 -1
  39. package/package.json +1 -1
  40. package/src/Pops.ts +1 -1
  41. package/src/components/alert/config.ts +10 -9
  42. package/src/components/alert/index.ts +9 -9
  43. package/src/components/confirm/config.ts +18 -24
  44. package/src/components/confirm/index.ts +9 -9
  45. package/src/components/drawer/config.ts +22 -21
  46. package/src/components/drawer/index.ts +9 -9
  47. package/src/components/folder/config.ts +17 -16
  48. package/src/components/folder/index.ts +32 -24
  49. package/src/components/iframe/config.ts +3 -3
  50. package/src/components/iframe/index.ts +15 -11
  51. package/src/components/loading/config.ts +3 -3
  52. package/src/components/loading/index.ts +1 -1
  53. package/src/components/panel/config.ts +65 -2
  54. package/src/components/panel/index.ts +13 -11
  55. package/src/components/prompt/config.ts +17 -27
  56. package/src/components/prompt/index.ts +10 -8
  57. package/src/components/rightClickMenu/config.ts +117 -109
  58. package/src/components/rightClickMenu/index.ts +13 -12
  59. package/src/components/rightClickMenu/indexType.ts +13 -24
  60. package/src/components/searchSuggestion/config.ts +2 -1
  61. package/src/components/searchSuggestion/index.ts +11 -10
  62. package/src/components/searchSuggestion/indexType.ts +4 -10
  63. package/src/components/tooltip/config.ts +7 -5
  64. package/src/components/tooltip/index.ts +34 -21
  65. package/src/components/tooltip/indexType.ts +38 -35
  66. package/src/css/index.css +1 -1
  67. package/src/handler/PopsElementHandler.ts +2 -2
  68. package/src/handler/PopsHandler.ts +24 -20
  69. package/src/types/button.d.ts +13 -19
  70. package/src/types/components.d.ts +26 -11
  71. package/src/types/event.d.ts +1 -1
  72. package/src/types/global.d.ts +9 -0
  73. package/src/types/layer.d.ts +1 -1
  74. package/src/types/mask.d.ts +14 -11
  75. package/src/utils/PopsInstanceUtils.ts +8 -8
@@ -1,6 +1,6 @@
1
1
  import type { PopsPanelDetails } from "./indexType";
2
2
 
3
- export const PopsPanelConfig = (): Required<PopsPanelDetails> => {
3
+ export const PopsPanelConfig = (): DeepRequired<PopsPanelDetails> => {
4
4
  return {
5
5
  title: {
6
6
  text: "默认标题",
@@ -31,6 +31,9 @@ export const PopsPanelConfig = (): Required<PopsPanelDetails> => {
31
31
  className: "panel-switch",
32
32
  text: "switch",
33
33
  type: "switch",
34
+ // @ts-ignore
35
+ props: {},
36
+ disabled: false,
34
37
  attributes: [],
35
38
  getValue() {
36
39
  return true;
@@ -43,6 +46,8 @@ export const PopsPanelConfig = (): Required<PopsPanelDetails> => {
43
46
  className: "panel-slider",
44
47
  text: "slider",
45
48
  type: "slider",
49
+ // @ts-ignore
50
+ props: {},
46
51
  attributes: [],
47
52
  getValue() {
48
53
  return 50;
@@ -57,6 +62,8 @@ export const PopsPanelConfig = (): Required<PopsPanelDetails> => {
57
62
  className: "panel-button",
58
63
  text: "button",
59
64
  type: "button",
65
+ // @ts-ignore
66
+ props: {},
60
67
  attributes: [],
61
68
  buttonIcon: "eleme",
62
69
  buttonIconIsLoading: true,
@@ -69,6 +76,8 @@ export const PopsPanelConfig = (): Required<PopsPanelDetails> => {
69
76
  {
70
77
  className: "panel-button",
71
78
  text: "button",
79
+ // @ts-ignore
80
+ props: {},
72
81
  type: "button",
73
82
  attributes: [],
74
83
  buttonIcon: "chromeFilled",
@@ -84,6 +93,8 @@ export const PopsPanelConfig = (): Required<PopsPanelDetails> => {
84
93
  text: "button",
85
94
  type: "button",
86
95
  attributes: [],
96
+ // @ts-ignore
97
+ props: {},
87
98
  buttonIcon: "upload",
88
99
  buttonIconIsLoading: false,
89
100
  buttonType: "info",
@@ -112,6 +123,8 @@ export const PopsPanelConfig = (): Required<PopsPanelDetails> => {
112
123
  className: "panel-input",
113
124
  text: "input",
114
125
  type: "input",
126
+ // @ts-ignore
127
+ props: {},
115
128
  attributes: [],
116
129
  getValue() {
117
130
  return "50";
@@ -125,6 +138,8 @@ export const PopsPanelConfig = (): Required<PopsPanelDetails> => {
125
138
  className: "panel-input-password",
126
139
  text: "input-password",
127
140
  type: "input",
141
+ // @ts-ignore
142
+ props: {},
128
143
  attributes: [],
129
144
  getValue() {
130
145
  return "123456";
@@ -139,6 +154,8 @@ export const PopsPanelConfig = (): Required<PopsPanelDetails> => {
139
154
  className: "panel-textarea",
140
155
  text: "textarea",
141
156
  type: "textarea",
157
+ // @ts-ignore
158
+ props: {},
142
159
  attributes: [],
143
160
  getValue() {
144
161
  return "50";
@@ -152,6 +169,8 @@ export const PopsPanelConfig = (): Required<PopsPanelDetails> => {
152
169
  className: "panel-select",
153
170
  text: "select",
154
171
  type: "select",
172
+ // @ts-ignore
173
+ props: {},
155
174
  attributes: [],
156
175
  getValue() {
157
176
  return 50;
@@ -165,14 +184,23 @@ export const PopsPanelConfig = (): Required<PopsPanelDetails> => {
165
184
  {
166
185
  value: "all",
167
186
  text: "所有",
187
+ disable() {
188
+ return false;
189
+ },
168
190
  },
169
191
  {
170
192
  value: "text",
171
193
  text: "文本",
194
+ disable() {
195
+ return false;
196
+ },
172
197
  },
173
198
  {
174
199
  value: "html",
175
200
  text: "超文本",
201
+ disable() {
202
+ return false;
203
+ },
176
204
  },
177
205
  ],
178
206
  },
@@ -180,6 +208,8 @@ export const PopsPanelConfig = (): Required<PopsPanelDetails> => {
180
208
  className: "panel-select-multiple",
181
209
  type: "select-multiple",
182
210
  text: "select-multiple",
211
+ // @ts-ignore
212
+ props: {},
183
213
 
184
214
  attributes: [],
185
215
  placeholder: "请至少选择一个选项",
@@ -199,22 +229,42 @@ export const PopsPanelConfig = (): Required<PopsPanelDetails> => {
199
229
  {
200
230
  value: "select-1",
201
231
  text: "单选1",
232
+ isHTML: false,
233
+ disable() {
234
+ return false;
235
+ },
202
236
  },
203
237
  {
204
238
  value: "select-2",
205
239
  text: "单选2",
240
+ isHTML: false,
241
+ disable() {
242
+ return false;
243
+ },
206
244
  },
207
245
  {
208
246
  value: "select-3",
209
247
  text: "单选3",
248
+ isHTML: false,
249
+ disable() {
250
+ return false;
251
+ },
210
252
  },
211
253
  {
212
254
  value: "select-4",
213
255
  text: "单选4",
256
+ isHTML: false,
257
+ disable() {
258
+ return false;
259
+ },
214
260
  },
215
261
  {
216
262
  value: "select-5",
217
263
  text: "单选5",
264
+ isHTML: false,
265
+ disable() {
266
+ return false;
267
+ },
218
268
  },
219
269
  ],
220
270
  },
@@ -246,6 +296,8 @@ export const PopsPanelConfig = (): Required<PopsPanelDetails> => {
246
296
  className: "panel-switch",
247
297
  text: "switch",
248
298
  type: "switch",
299
+ // @ts-ignore
300
+ props: {},
249
301
  attributes: [],
250
302
  getValue() {
251
303
  return true;
@@ -257,6 +309,8 @@ export const PopsPanelConfig = (): Required<PopsPanelDetails> => {
257
309
  {
258
310
  className: "panel-slider",
259
311
  text: "slider",
312
+ // @ts-ignore
313
+ props: {},
260
314
  type: "slider",
261
315
  attributes: [],
262
316
  getValue() {
@@ -271,6 +325,8 @@ export const PopsPanelConfig = (): Required<PopsPanelDetails> => {
271
325
  {
272
326
  className: "panel-button",
273
327
  text: "button",
328
+ // @ts-ignore
329
+ props: {},
274
330
  type: "button",
275
331
  attributes: [],
276
332
  buttonIcon: "eleme",
@@ -285,6 +341,8 @@ export const PopsPanelConfig = (): Required<PopsPanelDetails> => {
285
341
  className: "panel-button",
286
342
  text: "button",
287
343
  type: "button",
344
+ // @ts-ignore
345
+ props: {},
288
346
  attributes: [],
289
347
  buttonIcon: "chromeFilled",
290
348
  buttonIconIsLoading: true,
@@ -297,6 +355,8 @@ export const PopsPanelConfig = (): Required<PopsPanelDetails> => {
297
355
  {
298
356
  className: "panel-button",
299
357
  text: "button",
358
+ // @ts-ignore
359
+ props: {},
300
360
  type: "button",
301
361
  attributes: [],
302
362
  buttonIcon: "upload",
@@ -324,6 +384,8 @@ export const PopsPanelConfig = (): Required<PopsPanelDetails> => {
324
384
  {
325
385
  className: "panel-switch",
326
386
  text: "switch",
387
+ // @ts-ignore
388
+ props: {},
327
389
  type: "switch",
328
390
  attributes: [],
329
391
  getValue() {
@@ -352,8 +414,9 @@ export const PopsPanelConfig = (): Required<PopsPanelDetails> => {
352
414
  toClose: false,
353
415
  toHide: false,
354
416
  },
355
- clickCallBack: void 0,
417
+ clickCallBack: null,
356
418
  },
419
+ useShadowRoot: true,
357
420
  class: "",
358
421
  mobileClassName: "pops-panel-is-mobile",
359
422
  isMobile: false,
@@ -11,7 +11,19 @@ import { GlobalConfig } from "../../GlobalConfig";
11
11
 
12
12
  export class PopsPanel {
13
13
  constructor(details: PopsPanelDetails) {
14
- const { $shadowContainer, $shadowRoot } = PopsHandler.handlerShadow();
14
+ const guid = popsUtils.getRandomGUID();
15
+ // 设置当前类型
16
+ const PopsType = "panel";
17
+
18
+ let config: Required<PopsPanelDetails> = PopsPanelConfig();
19
+ config = popsUtils.assign(config, GlobalConfig.getGlobalConfig());
20
+ config = popsUtils.assign(config, details);
21
+ if (details && Array.isArray(details.content)) {
22
+ config.content = details.content;
23
+ }
24
+ config = PopsHandler.handleOnly(PopsType, config);
25
+
26
+ const { $shadowContainer, $shadowRoot } = PopsHandler.handlerShadow(config);
15
27
  PopsHandler.handleInit($shadowRoot, [
16
28
  pops.config.cssText.index,
17
29
  pops.config.cssText.ninePalaceGridPosition,
@@ -22,16 +34,6 @@ export class PopsPanel {
22
34
  pops.config.cssText.panelCSS,
23
35
  ]);
24
36
 
25
- let config: Required<PopsPanelDetails> = PopsPanelConfig();
26
- config = popsUtils.assign(config, GlobalConfig.getGlobalConfig());
27
- config = popsUtils.assign(config, details);
28
- if (details && Array.isArray(details.content)) {
29
- config.content = details.content;
30
- }
31
- let guid = popsUtils.getRandomGUID();
32
- const PopsType = "panel";
33
- config = PopsHandler.handleOnly(PopsType, config);
34
-
35
37
  // 先把z-index提取出来
36
38
  let zIndex = PopsHandler.handleZIndex(config.zIndex);
37
39
  let maskHTML = PopsElementHandler.getMaskHTML(guid, zIndex);
@@ -1,6 +1,6 @@
1
1
  import type { PopsPromptDetails } from "./indexType";
2
2
 
3
- export const PopsPromptConfig = (): Required<PopsPromptDetails> => {
3
+ export const PopsPromptConfig = (): DeepRequired<PopsPromptDetails> => {
4
4
  return {
5
5
  title: {
6
6
  text: "默认标题",
@@ -24,57 +24,48 @@ export const PopsPromptConfig = (): Required<PopsPromptDetails> => {
24
24
  position: "flex-end",
25
25
  ok: {
26
26
  enable: true,
27
-
28
- size: void 0,
29
-
30
- icon: void 0,
27
+ size: void 0 as any,
28
+ icon: void 0 as any,
31
29
  rightIcon: false,
32
30
  iconIsLoading: false,
33
31
  text: "确定",
34
32
  type: "success",
35
- callback(event) {
36
- console.log(event);
37
- event.close();
33
+ callback(detail) {
34
+ detail.close();
38
35
  },
39
36
  },
40
37
  cancel: {
41
38
  enable: true,
42
-
43
- size: void 0,
44
-
45
- icon: void 0,
39
+ size: void 0 as any,
40
+ icon: void 0 as any,
46
41
  rightIcon: false,
47
42
  iconIsLoading: false,
48
43
  text: "关闭",
49
44
  type: "default",
50
- callback(event) {
51
- console.log(event);
52
- event.close();
45
+ callback(detail) {
46
+ detail.close();
53
47
  },
54
48
  },
55
49
  other: {
56
50
  enable: false,
57
-
58
- size: void 0,
59
-
60
- icon: void 0,
51
+ size: void 0 as any,
52
+ icon: void 0 as any,
61
53
  rightIcon: false,
62
54
  iconIsLoading: false,
63
55
  text: "其它按钮",
64
56
  type: "default",
65
- callback(event) {
66
- console.log(event);
67
- event.close();
57
+ callback(detail) {
58
+ detail.close();
68
59
  },
69
60
  },
70
61
  close: {
71
62
  enable: true,
72
- callback(event) {
73
- console.log(event);
74
- event.close();
63
+ callback(detail) {
64
+ detail.close();
75
65
  },
76
66
  },
77
67
  },
68
+ useShadowRoot: true,
78
69
  class: "",
79
70
  only: false,
80
71
  width: "350px",
@@ -88,8 +79,7 @@ export const PopsPromptConfig = (): Required<PopsPromptDetails> => {
88
79
  toClose: false,
89
80
  toHide: false,
90
81
  },
91
-
92
- clickCallBack: void 0,
82
+ clickCallBack: null,
93
83
  },
94
84
  drag: false,
95
85
  dragLimit: true,
@@ -10,7 +10,16 @@ import type { PopsPromptDetails } from "./indexType";
10
10
 
11
11
  export class PopsPrompt {
12
12
  constructor(details: PopsPromptDetails) {
13
- const { $shadowContainer, $shadowRoot } = PopsHandler.handlerShadow();
13
+ const guid = popsUtils.getRandomGUID();
14
+ // 设置当前类型
15
+ const PopsType = "prompt";
16
+
17
+ let config = PopsPromptConfig();
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);
14
23
  PopsHandler.handleInit($shadowRoot, [
15
24
  pops.config.cssText.index,
16
25
  pops.config.cssText.ninePalaceGridPosition,
@@ -20,13 +29,6 @@ export class PopsPrompt {
20
29
  pops.config.cssText.common,
21
30
  pops.config.cssText.promptCSS,
22
31
  ]);
23
- let config: Required<PopsPromptDetails> = PopsPromptConfig();
24
- config = popsUtils.assign(config, GlobalConfig.getGlobalConfig());
25
- config = popsUtils.assign(config, details);
26
- let guid = popsUtils.getRandomGUID();
27
- const PopsType = "prompt";
28
-
29
- config = PopsHandler.handleOnly(PopsType, config);
30
32
 
31
33
  // 先把z-index提取出来
32
34
  let zIndex = PopsHandler.handleZIndex(config.zIndex);
@@ -1,120 +1,128 @@
1
1
  import { pops } from "../../Pops";
2
2
  import type { PopsRightClickMenuDetails } from "./indexType";
3
3
 
4
- export const rightClickMenuConfig = (): Required<PopsRightClickMenuDetails> => {
5
- return {
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
- ]);
4
+ export const rightClickMenuConfig =
5
+ (): DeepRequired<PopsRightClickMenuDetails> => {
6
+ return {
7
+ target: document.documentElement,
8
+ targetSelector: null,
9
+ data: [
10
+ {
11
+ icon: pops.config.iconSVG.search,
12
+ iconIsLoading: false,
13
+ text: "搜索",
14
+ item: [],
15
+ callback(clickEvent, contextMenuEvent, liElement) {
16
+ console.log("点击:" + this.text, [
17
+ clickEvent,
18
+ contextMenuEvent,
19
+ liElement,
20
+ ]);
21
+ },
31
22
  },
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
- ]);
23
+ {
24
+ icon: pops.config.iconSVG.documentCopy,
25
+ iconIsLoading: false,
26
+ text: "复制",
27
+ item: [],
28
+ callback(clickEvent, contextMenuEvent, liElement) {
29
+ console.log("点击:" + this.text, [
30
+ clickEvent,
31
+ contextMenuEvent,
32
+ liElement,
33
+ ]);
34
+ },
43
35
  },
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;
36
+ {
37
+ icon: pops.config.iconSVG.delete,
38
+ text: "删除",
39
+ iconIsLoading: false,
40
+ item: [],
41
+ callback(clickEvent, contextMenuEvent, liElement) {
42
+ console.log("点击:" + this.text, [
43
+ clickEvent,
44
+ contextMenuEvent,
45
+ liElement,
46
+ ]);
47
+ },
56
48
  },
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;
49
+ {
50
+ icon: pops.config.iconSVG.loading,
51
+ iconIsLoading: true,
52
+ text: "加载",
53
+ item: [],
54
+ callback(clickEvent, contextMenuEvent, liElement) {
55
+ console.log("点击:" + this.text, [
56
+ clickEvent,
57
+ contextMenuEvent,
58
+ liElement,
59
+ ]);
60
+ return false;
61
+ },
69
62
  },
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
- },
63
+ {
64
+ icon: pops.config.iconSVG.elemePlus,
65
+ iconIsLoading: true,
66
+ text: "饿了么",
67
+ callback(clickEvent, contextMenuEvent, liElement) {
68
+ console.log("点击:" + this.text, [
69
+ clickEvent,
70
+ contextMenuEvent,
71
+ liElement,
72
+ ]);
73
+ return false;
82
74
  },
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
- ]);
75
+ item: [
76
+ {
77
+ icon: "",
78
+ iconIsLoading: false,
79
+ text: "处理文件",
80
+ item: [],
81
+ callback(clickEvent, contextMenuEvent, liElement) {
82
+ console.log("点击:" + this.text, [
83
+ clickEvent,
84
+ contextMenuEvent,
85
+ liElement,
86
+ ]);
87
+ },
93
88
  },
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
- },
89
+ {
90
+ icon: "",
91
+ iconIsLoading: false,
92
+ text: "其它处理",
93
+ callback(clickEvent, contextMenuEvent, liElement) {
94
+ console.log("点击:" + this.text, [
95
+ clickEvent,
96
+ contextMenuEvent,
97
+ liElement,
98
+ ]);
106
99
  },
107
- ],
108
- },
109
- ],
110
- },
111
- ],
112
- className: "",
113
- isAnimation: true,
114
- only: false,
115
- zIndex: 10000,
116
- preventDefault: true,
117
- style: null,
118
- beforeAppendToPageCallBack() {},
100
+ item: [
101
+ {
102
+ icon: pops.config.iconSVG.view,
103
+ iconIsLoading: false,
104
+ text: "查看",
105
+ item: [],
106
+ callback(clickEvent, contextMenuEvent, liElement) {
107
+ console.log("点击:" + this.text, [
108
+ clickEvent,
109
+ contextMenuEvent,
110
+ liElement,
111
+ ]);
112
+ },
113
+ },
114
+ ],
115
+ },
116
+ ],
117
+ },
118
+ ],
119
+ useShadowRoot: true,
120
+ className: "",
121
+ isAnimation: true,
122
+ only: false,
123
+ zIndex: 10000,
124
+ preventDefault: true,
125
+ style: null,
126
+ beforeAppendToPageCallBack() {},
127
+ };
119
128
  };
120
- };
@@ -13,27 +13,28 @@ import type {
13
13
 
14
14
  export class PopsRightClickMenu {
15
15
  constructor(details: PopsRightClickMenuDetails) {
16
- const { $shadowContainer, $shadowRoot } = PopsHandler.handlerShadow();
17
- PopsHandler.handleInit($shadowRoot, [
18
- pops.config.cssText.index,
19
- pops.config.cssText.anim,
20
- pops.config.cssText.common,
21
- pops.config.cssText.rightClickMenu,
22
- ]);
16
+ const guid = popsUtils.getRandomGUID();
17
+ // 设置当前类型
18
+ const PopsType = "rightClickMenu";
23
19
 
24
- let config: Required<PopsRightClickMenuDetails> =
25
- PopsRightClickMenuConfig();
20
+ let config = PopsRightClickMenuConfig();
26
21
  config = popsUtils.assign(config, GlobalConfig.getGlobalConfig());
27
22
  config = popsUtils.assign(config, details);
23
+ config = PopsHandler.handleOnly(PopsType, config);
28
24
  if (config.target == null) {
29
25
  throw "config.target 不能为空";
30
26
  }
31
27
  if (details.data) {
28
+ // @ts-ignore
32
29
  config.data = details.data;
33
30
  }
34
- let guid = popsUtils.getRandomGUID();
35
- const PopsType = "rightClickMenu";
36
- config = PopsHandler.handleOnly(PopsType, config);
31
+ const { $shadowContainer, $shadowRoot } = PopsHandler.handlerShadow(config);
32
+ PopsHandler.handleInit($shadowRoot, [
33
+ pops.config.cssText.index,
34
+ pops.config.cssText.anim,
35
+ pops.config.cssText.common,
36
+ pops.config.cssText.rightClickMenu,
37
+ ]);
37
38
 
38
39
  if (config.style != null) {
39
40
  let cssNode = document.createElement("style");