@whitesev/pops 1.5.6 → 1.5.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.
- package/dist/index.amd.js +216 -18
- package/dist/index.amd.js.map +1 -1
- package/dist/index.cjs.js +216 -18
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +216 -18
- package/dist/index.esm.js.map +1 -1
- package/dist/index.iife.js +216 -18
- package/dist/index.iife.js.map +1 -1
- package/dist/index.system.js +216 -18
- package/dist/index.system.js.map +1 -1
- package/dist/index.umd.js +216 -18
- package/dist/index.umd.js.map +1 -1
- package/dist/types/src/components/folder/indexType.d.ts +5 -5
- package/dist/types/src/components/panel/indexType.d.ts +2 -1
- package/dist/types/src/components/panel/selectMultipleType.d.ts +89 -0
- package/dist/types/src/types/layer.d.ts +2 -0
- package/dist/types/src/types/main.d.ts +1 -1
- package/dist/types/src/types/mask.d.ts +1 -1
- package/package.json +1 -1
- package/src/Pops.ts +2 -1
- package/src/components/folder/index.ts +2 -1
- package/src/components/folder/indexType.ts +21 -10
- package/src/components/panel/index.css +6 -0
- package/src/components/panel/index.ts +205 -7
- package/src/components/panel/indexType.ts +2 -0
- package/src/components/panel/selectMultipleType.ts +95 -0
- package/src/components/rightClickMenu/index.ts +20 -4
- package/src/handler/PopsHandler.ts +5 -6
- package/src/types/layer.d.ts +2 -0
- package/src/types/main.d.ts +1 -1
- package/src/types/mask.d.ts +1 -1
- package/src/utils/PopsInstanceUtils.ts +15 -5
|
@@ -255,13 +255,24 @@ export class PopsRightClickMenu {
|
|
|
255
255
|
if (config.preventDefault) {
|
|
256
256
|
popsDOMUtils.preventEvent(event);
|
|
257
257
|
}
|
|
258
|
+
PopsHandler.handleOnly(PopsType, config);
|
|
258
259
|
if (PopsContextMenu.rootElement) {
|
|
259
260
|
PopsContextMenu.closeAllMenu(PopsContextMenu.rootElement);
|
|
260
261
|
}
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
262
|
+
let rootElement = PopsContextMenu.showMenu(event, config.data);
|
|
263
|
+
PopsContextMenu.rootElement = rootElement;
|
|
264
|
+
if (config.only) {
|
|
265
|
+
PopsHandler.handlePush(PopsType, {
|
|
266
|
+
$shadowRoot: $shadowRoot,
|
|
267
|
+
$shadowContainer: $shadowContainer,
|
|
268
|
+
guid: guid,
|
|
269
|
+
animElement: rootElement as HTMLDivElement,
|
|
270
|
+
popsElement: rootElement as HTMLDivElement,
|
|
271
|
+
beforeRemoveCallBack(layerCommonConfig) {
|
|
272
|
+
PopsContextMenu.closeAllMenu(layerCommonConfig.popsElement);
|
|
273
|
+
},
|
|
274
|
+
});
|
|
275
|
+
}
|
|
265
276
|
},
|
|
266
277
|
/**
|
|
267
278
|
* 添加contextmenu事件
|
|
@@ -337,6 +348,9 @@ export class PopsRightClickMenu {
|
|
|
337
348
|
* @param rootElement
|
|
338
349
|
*/
|
|
339
350
|
closeAllMenu(rootElement: HTMLElement) {
|
|
351
|
+
if (rootElement == null) {
|
|
352
|
+
return;
|
|
353
|
+
}
|
|
340
354
|
if ((rootElement as any)?.["__menuData__"]?.root) {
|
|
341
355
|
rootElement = (rootElement as any)?.["__menuData__"]?.root;
|
|
342
356
|
}
|
|
@@ -725,7 +739,9 @@ export class PopsRightClickMenu {
|
|
|
725
739
|
},
|
|
726
740
|
};
|
|
727
741
|
|
|
742
|
+
// 添加右键菜单事件
|
|
728
743
|
PopsContextMenu.addContextMenuEvent(config.target, config.targetSelector!);
|
|
744
|
+
// 添加全局点击检测
|
|
729
745
|
PopsContextMenu.addWindowCheckClickListener();
|
|
730
746
|
|
|
731
747
|
return {
|
|
@@ -631,11 +631,10 @@ export const PopsHandler = {
|
|
|
631
631
|
type === "tooltip" ||
|
|
632
632
|
type === "rightClickMenu"
|
|
633
633
|
) {
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
"",
|
|
637
|
-
|
|
638
|
-
);
|
|
634
|
+
let layer = pops.config.layer[type as keyof typeof pops.config.layer];
|
|
635
|
+
if (layer) {
|
|
636
|
+
PopsInstanceUtils.removeInstance([layer], "", true);
|
|
637
|
+
}
|
|
639
638
|
} else {
|
|
640
639
|
PopsInstanceUtils.removeInstance(
|
|
641
640
|
[
|
|
@@ -662,7 +661,7 @@ export const PopsHandler = {
|
|
|
662
661
|
);
|
|
663
662
|
return maxZIndex;
|
|
664
663
|
};
|
|
665
|
-
}else{
|
|
664
|
+
} else {
|
|
666
665
|
const { zIndex: maxZIndex } = PopsInstanceUtils.getPopsMaxZIndex(
|
|
667
666
|
PopsHandler.handleZIndex(config.zIndex) + 100
|
|
668
667
|
);
|
package/src/types/layer.d.ts
CHANGED
package/src/types/main.d.ts
CHANGED
|
@@ -48,7 +48,7 @@ export type PopsType = keyof PopsTypeDetails;
|
|
|
48
48
|
export type PopsMode = PopsType | "tooltip" | "rightClickMenu";
|
|
49
49
|
|
|
50
50
|
/** 存储实例的类型 9个 */
|
|
51
|
-
export type PopsLayerMode = PopsType | "tooltip";
|
|
51
|
+
export type PopsLayerMode = PopsType | "tooltip" | "rightClickMenu";
|
|
52
52
|
|
|
53
53
|
/** pops弹窗支持动画元素的配置 */
|
|
54
54
|
export interface PopsSupportAnim {
|
package/src/types/mask.d.ts
CHANGED
|
@@ -84,17 +84,27 @@ export const PopsInstanceUtils = {
|
|
|
84
84
|
guid: string,
|
|
85
85
|
isAll = false
|
|
86
86
|
) {
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
87
|
+
/**
|
|
88
|
+
* 移除元素实例
|
|
89
|
+
* @param layerCommonConfig
|
|
90
|
+
*/
|
|
91
|
+
function removeItem(layerCommonConfig: PopsLayerCommonConfig) {
|
|
92
|
+
if (typeof layerCommonConfig.beforeRemoveCallBack === "function") {
|
|
93
|
+
// 调用移除签的回调
|
|
94
|
+
layerCommonConfig.beforeRemoveCallBack(layerCommonConfig);
|
|
95
|
+
}
|
|
96
|
+
layerCommonConfig?.animElement?.remove();
|
|
97
|
+
layerCommonConfig?.popsElement?.remove();
|
|
98
|
+
layerCommonConfig?.maskElement?.remove();
|
|
99
|
+
layerCommonConfig?.$shadowContainer?.remove();
|
|
92
100
|
}
|
|
93
101
|
// [ layer[], layer[],...]
|
|
94
102
|
moreLayerConfigList.forEach((layerConfigList) => {
|
|
95
103
|
// layer[]
|
|
96
104
|
layerConfigList.forEach((layerConfigItem, index) => {
|
|
105
|
+
// 移除全部或者guid相同
|
|
97
106
|
if (isAll || layerConfigItem["guid"] === guid) {
|
|
107
|
+
// 判断是否有动画
|
|
98
108
|
if (
|
|
99
109
|
pops.config.animation.hasOwnProperty(
|
|
100
110
|
layerConfigItem.animElement.getAttribute("anim") as string
|