@whitesev/pops 1.4.0 → 1.5.0
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.map +1 -1
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js.map +1 -1
- package/dist/index.iife.js.map +1 -1
- package/dist/index.system.js.map +1 -1
- package/dist/index.umd.js.map +1 -1
- package/package.json +50 -48
- package/src/Config.ts +3 -0
- package/src/Core.ts +45 -0
- package/src/Pops.ts +340 -0
- package/src/components/alert/index.css +45 -0
- package/src/components/alert/index.ts +216 -0
- package/src/components/alert/indexType.ts +30 -0
- package/src/components/confirm/index.css +45 -0
- package/src/components/confirm/index.ts +264 -0
- package/src/components/confirm/indexType.ts +17 -0
- package/src/components/drawer/index.css +47 -0
- package/src/components/drawer/index.ts +338 -0
- package/src/components/drawer/indexType.ts +53 -0
- package/src/components/folder/folderIcon.ts +28 -0
- package/src/components/folder/index.css +291 -0
- package/src/components/folder/index.ts +1111 -0
- package/src/components/folder/indexType.ts +87 -0
- package/src/components/iframe/index.css +90 -0
- package/src/components/iframe/index.ts +415 -0
- package/src/components/iframe/indexType.ts +144 -0
- package/src/components/loading/index.css +60 -0
- package/src/components/loading/index.ts +123 -0
- package/src/components/loading/indexType.ts +31 -0
- package/src/components/panel/buttonType.ts +60 -0
- package/src/components/panel/commonType.ts +50 -0
- package/src/components/panel/deepMenuType.ts +59 -0
- package/src/components/panel/formsType.ts +32 -0
- package/src/components/panel/index.css +754 -0
- package/src/components/panel/index.ts +2435 -0
- package/src/components/panel/indexType.ts +107 -0
- package/src/components/panel/inputType.ts +65 -0
- package/src/components/panel/ownType.ts +28 -0
- package/src/components/panel/selectType.ts +80 -0
- package/src/components/panel/sliderType.ts +59 -0
- package/src/components/panel/switchType.ts +43 -0
- package/src/components/panel/textareaType.ts +54 -0
- package/src/components/prompt/index.css +60 -0
- package/src/components/prompt/index.ts +293 -0
- package/src/components/prompt/indexType.ts +47 -0
- package/src/components/rightClickMenu/index.ts +729 -0
- package/src/components/rightClickMenu/indexType.ts +89 -0
- package/src/components/searchSuggestion/index.css +0 -0
- package/src/components/searchSuggestion/index.ts +656 -0
- package/src/components/searchSuggestion/indexType.ts +238 -0
- package/src/components/tooltip/index.css +171 -0
- package/src/components/tooltip/index.ts +358 -0
- package/src/components/tooltip/indexType.ts +95 -0
- package/src/css/animation.css +2240 -0
- package/src/css/button.css +290 -0
- package/src/css/common.css +24 -0
- package/src/css/index.css +135 -0
- package/src/css/ninePalaceGridPosition.css +50 -0
- package/src/css/scrollbar.css +18 -0
- package/src/handler/PopsElementHandler.ts +353 -0
- package/src/handler/PopsHandler.ts +659 -0
- package/src/svg/arrowLeft.svg +4 -0
- package/src/svg/arrowRight.svg +4 -0
- package/src/svg/chromeFilled.svg +14 -0
- package/src/svg/circleClose.svg +8 -0
- package/src/svg/close.svg +5 -0
- package/src/svg/cpu.svg +8 -0
- package/src/svg/delete.svg +5 -0
- package/src/svg/documentCopy.svg +5 -0
- package/src/svg/edit.svg +8 -0
- package/src/svg/eleme.svg +5 -0
- package/src/svg/elemePlus.svg +5 -0
- package/src/svg/headset.svg +5 -0
- package/src/svg/hide.svg +8 -0
- package/src/svg/keyboard.svg +8 -0
- package/src/svg/loading.svg +5 -0
- package/src/svg/max.svg +5 -0
- package/src/svg/min.svg +5 -0
- package/src/svg/mise.svg +5 -0
- package/src/svg/monitor.svg +5 -0
- package/src/svg/next.svg +5 -0
- package/src/svg/picture.svg +8 -0
- package/src/svg/prev.svg +5 -0
- package/src/svg/search.svg +5 -0
- package/src/svg/share.svg +5 -0
- package/src/svg/upload.svg +5 -0
- package/src/svg/videoPause.svg +5 -0
- package/src/svg/videoPlay.svg +5 -0
- package/src/svg/view.svg +5 -0
- package/src/types/PopsDOMUtilsEventType.d.ts +246 -0
- package/src/types/animation.d.ts +19 -0
- package/src/types/button.d.ts +226 -0
- package/src/types/components.d.ts +197 -0
- package/src/types/event.d.ts +62 -0
- package/src/types/global.d.ts +11 -0
- package/src/types/icon.d.ts +32 -0
- package/src/types/layer.d.ts +20 -0
- package/src/types/main.d.ts +136 -0
- package/src/types/mask.d.ts +35 -0
- package/src/types/position.d.ts +60 -0
- package/src/utils/AnyTouch.js +1394 -0
- package/src/utils/PopsDOMUtils.ts +2013 -0
- package/src/utils/PopsInstanceUtils.ts +685 -0
- package/src/utils/PopsMathUtils.ts +77 -0
- package/src/utils/PopsUtils.ts +380 -0
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
PopsTitleConfig,
|
|
3
|
+
PopsDragConfig,
|
|
4
|
+
PopsCommonConfig,
|
|
5
|
+
} from "../../types/components";
|
|
6
|
+
|
|
7
|
+
import type { PopsEventDetails } from "../../types/event";
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* pops.iframe的按钮的点击回调参数event
|
|
11
|
+
*/
|
|
12
|
+
export interface PopsBtnIframeCallBackEvent {
|
|
13
|
+
/**
|
|
14
|
+
* 动画元素(包裹着弹窗元素)
|
|
15
|
+
*/
|
|
16
|
+
animElement: HTMLElement;
|
|
17
|
+
/**
|
|
18
|
+
* 弹窗元素
|
|
19
|
+
*/
|
|
20
|
+
popsElement: HTMLElement;
|
|
21
|
+
/**
|
|
22
|
+
* 遮罩层元素,如果未设置,那么不存在
|
|
23
|
+
*/
|
|
24
|
+
maskElement?: HTMLElement;
|
|
25
|
+
/**
|
|
26
|
+
* iframe元素
|
|
27
|
+
*/
|
|
28
|
+
iframePopsElement: HTMLIFrameElement;
|
|
29
|
+
/**
|
|
30
|
+
* 使用的方法名
|
|
31
|
+
*/
|
|
32
|
+
function: "iframe";
|
|
33
|
+
/**
|
|
34
|
+
* 唯一id
|
|
35
|
+
*/
|
|
36
|
+
guid: string;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* pops.iframe
|
|
41
|
+
*/
|
|
42
|
+
export interface PopsIframeDetails
|
|
43
|
+
extends PopsTitleConfig,
|
|
44
|
+
PopsDragConfig,
|
|
45
|
+
PopsCommonConfig {
|
|
46
|
+
/**
|
|
47
|
+
* 加载配置
|
|
48
|
+
*/
|
|
49
|
+
loading: {
|
|
50
|
+
/**
|
|
51
|
+
* 是否启用加载中的loading
|
|
52
|
+
*/
|
|
53
|
+
enable: boolean;
|
|
54
|
+
/**
|
|
55
|
+
* 是否启用loading图标
|
|
56
|
+
*/
|
|
57
|
+
icon: boolean;
|
|
58
|
+
/**
|
|
59
|
+
* 文字
|
|
60
|
+
*/
|
|
61
|
+
text: string;
|
|
62
|
+
};
|
|
63
|
+
/**
|
|
64
|
+
* 按钮配置
|
|
65
|
+
*/
|
|
66
|
+
btn: {
|
|
67
|
+
/**
|
|
68
|
+
* 最小化
|
|
69
|
+
*/
|
|
70
|
+
min: {
|
|
71
|
+
/**
|
|
72
|
+
* 点击的回调函数
|
|
73
|
+
*/
|
|
74
|
+
callback: (
|
|
75
|
+
eventDetails: PopsEventDetails & {
|
|
76
|
+
iframeElement: HTMLIFrameElement;
|
|
77
|
+
},
|
|
78
|
+
event: MouseEvent | PointerEvent
|
|
79
|
+
) => void;
|
|
80
|
+
};
|
|
81
|
+
/**
|
|
82
|
+
* 最大化
|
|
83
|
+
*/
|
|
84
|
+
max: {
|
|
85
|
+
/**
|
|
86
|
+
* 点击的回调函数
|
|
87
|
+
*/
|
|
88
|
+
callback: (
|
|
89
|
+
eventDetails: PopsEventDetails & {
|
|
90
|
+
iframeElement: HTMLIFrameElement;
|
|
91
|
+
},
|
|
92
|
+
event: MouseEvent | PointerEvent
|
|
93
|
+
) => void;
|
|
94
|
+
};
|
|
95
|
+
/**
|
|
96
|
+
* 窗口化
|
|
97
|
+
*/
|
|
98
|
+
mise: {
|
|
99
|
+
/**
|
|
100
|
+
* 点击的回调函数
|
|
101
|
+
*/
|
|
102
|
+
callback: (
|
|
103
|
+
eventDetails: PopsEventDetails & {
|
|
104
|
+
iframeElement: HTMLIFrameElement;
|
|
105
|
+
},
|
|
106
|
+
event: MouseEvent | PointerEvent
|
|
107
|
+
) => void;
|
|
108
|
+
};
|
|
109
|
+
/**
|
|
110
|
+
* 关闭
|
|
111
|
+
*/
|
|
112
|
+
close: {
|
|
113
|
+
/**
|
|
114
|
+
* 点击的回调函数
|
|
115
|
+
*/
|
|
116
|
+
callback: (
|
|
117
|
+
eventDetails: PopsEventDetails & {
|
|
118
|
+
iframeElement: HTMLIFrameElement;
|
|
119
|
+
},
|
|
120
|
+
event: MouseEvent | PointerEvent
|
|
121
|
+
) => void;
|
|
122
|
+
};
|
|
123
|
+
};
|
|
124
|
+
/**
|
|
125
|
+
* 加载的地址,默认为window.location.href
|
|
126
|
+
*/
|
|
127
|
+
url?: string;
|
|
128
|
+
/**
|
|
129
|
+
* 右上角按钮顺序:最小化、最大化、窗口化、关闭
|
|
130
|
+
*/
|
|
131
|
+
topRightButton: "min|max|mise|close";
|
|
132
|
+
/**
|
|
133
|
+
* 是否启用沙箱,默认false
|
|
134
|
+
*/
|
|
135
|
+
sandbox?: boolean;
|
|
136
|
+
/**
|
|
137
|
+
* 加载完毕的回调
|
|
138
|
+
*/
|
|
139
|
+
loadEndCallBack?: (
|
|
140
|
+
details: PopsEventDetails & {
|
|
141
|
+
iframeElement: HTMLIFrameElement;
|
|
142
|
+
}
|
|
143
|
+
) => void;
|
|
144
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
.pops[type-value="loading"] {
|
|
2
|
+
position: absolute;
|
|
3
|
+
top: 272.5px;
|
|
4
|
+
top: 50%;
|
|
5
|
+
left: 26px;
|
|
6
|
+
left: 50%;
|
|
7
|
+
display: flex;
|
|
8
|
+
overflow: hidden;
|
|
9
|
+
padding: 10px 15px;
|
|
10
|
+
max-width: 100%;
|
|
11
|
+
max-height: 100%;
|
|
12
|
+
min-width: 0;
|
|
13
|
+
min-height: 0;
|
|
14
|
+
border: 1px solid rgba(0, 0, 0, 0.2);
|
|
15
|
+
border-radius: 5px;
|
|
16
|
+
background-color: rgb(255, 255, 255, var(--pops-bg-opacity));
|
|
17
|
+
box-shadow: 0 0 5px rgb(0 0 0 / 50%);
|
|
18
|
+
vertical-align: middle;
|
|
19
|
+
transition: all 0.35s;
|
|
20
|
+
transform: translate(-50%, -50%);
|
|
21
|
+
user-select: none;
|
|
22
|
+
-webkit-user-select: none;
|
|
23
|
+
-moz-user-select: none;
|
|
24
|
+
-ms-user-select: none;
|
|
25
|
+
flex-direction: column;
|
|
26
|
+
align-items: center;
|
|
27
|
+
justify-content: center;
|
|
28
|
+
align-content: center;
|
|
29
|
+
}
|
|
30
|
+
.pops[type-value="loading"]:before {
|
|
31
|
+
float: left;
|
|
32
|
+
display: inline-block;
|
|
33
|
+
width: 2em;
|
|
34
|
+
height: 2em;
|
|
35
|
+
border: 0.3em solid rgba(100, 149, 237, 0.1);
|
|
36
|
+
border-top: 0.3em solid rgb(100, 149, 237, var(--pops-bd-opacity));
|
|
37
|
+
border-radius: 50%;
|
|
38
|
+
content: " ";
|
|
39
|
+
vertical-align: middle;
|
|
40
|
+
font-size: inherit;
|
|
41
|
+
animation: pops-anim-wait-rotate 1.2s linear infinite;
|
|
42
|
+
}
|
|
43
|
+
.pops[type-value="loading"] .pops-loading-content {
|
|
44
|
+
position: static;
|
|
45
|
+
top: 0;
|
|
46
|
+
bottom: 0;
|
|
47
|
+
float: left;
|
|
48
|
+
overflow: hidden;
|
|
49
|
+
width: auto;
|
|
50
|
+
font-size: inherit;
|
|
51
|
+
line-height: 2em;
|
|
52
|
+
}
|
|
53
|
+
.pops[type-value="loading"] .pops-loading-content p[pops] {
|
|
54
|
+
display: inline-block;
|
|
55
|
+
padding: 5px 0px;
|
|
56
|
+
color: rgb(51, 51, 51);
|
|
57
|
+
text-indent: 15px;
|
|
58
|
+
font-size: inherit;
|
|
59
|
+
text-align: center;
|
|
60
|
+
}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import { PopsElementHandler } from "../../handler/PopsElementHandler";
|
|
2
|
+
import { PopsHandler } from "../../handler/PopsHandler";
|
|
3
|
+
import { pops } from "../../Pops";
|
|
4
|
+
import { popsDOMUtils } from "../../utils/PopsDOMUtils";
|
|
5
|
+
import { popsUtils } from "../../utils/PopsUtils";
|
|
6
|
+
import type { PopsLoadingDetails } from "./indexType";
|
|
7
|
+
|
|
8
|
+
export class PopsLoading {
|
|
9
|
+
constructor(details: PopsLoadingDetails) {
|
|
10
|
+
let config: Required<PopsLoadingDetails> = {
|
|
11
|
+
parent: document.body,
|
|
12
|
+
content: {
|
|
13
|
+
text: "加载中...",
|
|
14
|
+
icon: "loading",
|
|
15
|
+
style: "",
|
|
16
|
+
},
|
|
17
|
+
class: "",
|
|
18
|
+
only: false,
|
|
19
|
+
zIndex: 10000,
|
|
20
|
+
mask: {
|
|
21
|
+
enable: false,
|
|
22
|
+
clickEvent: {
|
|
23
|
+
toClose: false,
|
|
24
|
+
toHide: false,
|
|
25
|
+
},
|
|
26
|
+
|
|
27
|
+
clickCallBack: void 0,
|
|
28
|
+
},
|
|
29
|
+
animation: "pops-anim-fadein-zoom",
|
|
30
|
+
forbiddenScroll: false,
|
|
31
|
+
|
|
32
|
+
style: null,
|
|
33
|
+
addIndexCSS: true,
|
|
34
|
+
};
|
|
35
|
+
config = popsUtils.assign(config, details);
|
|
36
|
+
let guid = popsUtils.getRandomGUID();
|
|
37
|
+
const PopsType = "loading";
|
|
38
|
+
|
|
39
|
+
config = PopsHandler.handleOnly(PopsType, config);
|
|
40
|
+
let maskHTML = PopsElementHandler.getMaskHTML(guid, config.zIndex);
|
|
41
|
+
let { contentPStyle } = PopsElementHandler.getContentStyle(
|
|
42
|
+
"loading",
|
|
43
|
+
config
|
|
44
|
+
);
|
|
45
|
+
let animHTML = PopsElementHandler.getAnimHTML(
|
|
46
|
+
guid,
|
|
47
|
+
PopsType,
|
|
48
|
+
config,
|
|
49
|
+
`
|
|
50
|
+
<div class="pops-loading-content">
|
|
51
|
+
${
|
|
52
|
+
config.addIndexCSS
|
|
53
|
+
? `
|
|
54
|
+
<style data-model-name="index">${pops.config.cssText.index}</style>
|
|
55
|
+
<style data-model-name="anim">${pops.config.cssText.anim}</style>
|
|
56
|
+
<style data-model-name="common">${pops.config.cssText.common}</style>
|
|
57
|
+
`
|
|
58
|
+
: ""
|
|
59
|
+
}
|
|
60
|
+
<style data-model-name="loadingCSS">
|
|
61
|
+
${pops.config.cssText.loadingCSS}
|
|
62
|
+
</style>
|
|
63
|
+
${config.style != null ? `<style>${config.style}</style>` : ""}
|
|
64
|
+
<p pops style="${contentPStyle}">${config.content.text}</p>
|
|
65
|
+
</div>
|
|
66
|
+
`,
|
|
67
|
+
""
|
|
68
|
+
);
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* 弹窗的主元素,包括动画层
|
|
72
|
+
*/
|
|
73
|
+
|
|
74
|
+
let $anim = PopsElementHandler.parseElement<HTMLDivElement>(animHTML);
|
|
75
|
+
|
|
76
|
+
let { popsElement: $pops } = PopsHandler.handleQueryElement(
|
|
77
|
+
$anim,
|
|
78
|
+
PopsType
|
|
79
|
+
);
|
|
80
|
+
/**
|
|
81
|
+
* 遮罩层元素
|
|
82
|
+
*/
|
|
83
|
+
let $mask: HTMLDivElement | null = null;
|
|
84
|
+
/**
|
|
85
|
+
* 已创建的元素列表
|
|
86
|
+
*/
|
|
87
|
+
let elementList: HTMLElement[] = [$anim];
|
|
88
|
+
|
|
89
|
+
if (config.mask.enable) {
|
|
90
|
+
// 创建遮罩层
|
|
91
|
+
let _handleMask_ = PopsHandler.handleMask({
|
|
92
|
+
type: PopsType,
|
|
93
|
+
guid: guid,
|
|
94
|
+
|
|
95
|
+
config: config,
|
|
96
|
+
animElement: $anim,
|
|
97
|
+
maskHTML: maskHTML,
|
|
98
|
+
});
|
|
99
|
+
$mask = _handleMask_.maskElement;
|
|
100
|
+
elementList.push($mask);
|
|
101
|
+
}
|
|
102
|
+
let eventDetails = PopsHandler.handleLoadingEventDetails(
|
|
103
|
+
guid,
|
|
104
|
+
PopsType,
|
|
105
|
+
$anim,
|
|
106
|
+
$pops!,
|
|
107
|
+
$mask!,
|
|
108
|
+
config
|
|
109
|
+
);
|
|
110
|
+
popsDOMUtils.append(config.parent, elementList);
|
|
111
|
+
if ($mask != null) {
|
|
112
|
+
$anim.after($mask);
|
|
113
|
+
}
|
|
114
|
+
PopsHandler.handlePush(PopsType, {
|
|
115
|
+
guid: guid,
|
|
116
|
+
animElement: $anim,
|
|
117
|
+
popsElement: $pops!,
|
|
118
|
+
maskElement: $mask!,
|
|
119
|
+
} as any);
|
|
120
|
+
|
|
121
|
+
return PopsHandler.handleResultDetails(eventDetails);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
PopsCommonConfig,
|
|
3
|
+
PopsContentConfig,
|
|
4
|
+
} from "../../types/components";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* pops.loading
|
|
8
|
+
*/
|
|
9
|
+
export interface PopsLoadingDetails
|
|
10
|
+
extends Omit<
|
|
11
|
+
PopsCommonConfig,
|
|
12
|
+
"width" | "height" | "position" | "beforeAppendToPageCallBack"
|
|
13
|
+
> {
|
|
14
|
+
/**
|
|
15
|
+
* 父元素,默认为document.body
|
|
16
|
+
*/
|
|
17
|
+
parent: HTMLElement;
|
|
18
|
+
/**
|
|
19
|
+
* 内容配置
|
|
20
|
+
*/
|
|
21
|
+
content: Omit<PopsContentConfig["content"], "html"> & {
|
|
22
|
+
/**
|
|
23
|
+
* 图标
|
|
24
|
+
*/
|
|
25
|
+
icon?: string;
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* (可选)添加主CSS,默认为true,当页面中存在anim覆盖时,可能会有一些样式问题,取消添加该CSS即可解决
|
|
29
|
+
*/
|
|
30
|
+
addIndexCSS?: boolean;
|
|
31
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import type { PopsPanelCommonDetails } from "./commonType";
|
|
2
|
+
import type { PopsButtonStyleType } from "../../types/button";
|
|
3
|
+
import type { PopsIcon } from "../../types/icon";
|
|
4
|
+
/**
|
|
5
|
+
* pops.panel的 button
|
|
6
|
+
*/
|
|
7
|
+
export interface PopsPanelButtonDetails extends PopsPanelCommonDetails {
|
|
8
|
+
/**
|
|
9
|
+
* (可选)className属性
|
|
10
|
+
*/
|
|
11
|
+
className?: string;
|
|
12
|
+
/**
|
|
13
|
+
* (可选)自定义元素属性
|
|
14
|
+
*/
|
|
15
|
+
attributes?: any;
|
|
16
|
+
/**
|
|
17
|
+
* (可选)自定义属性
|
|
18
|
+
*/
|
|
19
|
+
props?: HTMLElement;
|
|
20
|
+
/**
|
|
21
|
+
* 显示在左边的文字
|
|
22
|
+
*/
|
|
23
|
+
text: string;
|
|
24
|
+
/**
|
|
25
|
+
* (可选)左边的文字下面的描述
|
|
26
|
+
*/
|
|
27
|
+
description?: string;
|
|
28
|
+
/**
|
|
29
|
+
* 类型
|
|
30
|
+
*/
|
|
31
|
+
type: "button";
|
|
32
|
+
/**
|
|
33
|
+
* (可选)是否禁用
|
|
34
|
+
*/
|
|
35
|
+
disable?: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* 按钮的类型
|
|
38
|
+
*/
|
|
39
|
+
buttonType: PopsButtonStyleType;
|
|
40
|
+
/**
|
|
41
|
+
* 按钮的文字
|
|
42
|
+
*/
|
|
43
|
+
buttonText: string | (() => string);
|
|
44
|
+
/**
|
|
45
|
+
* 按钮的图标,已配置的svg请看pops.config.iconSVG,或者自定义的图标svg代码
|
|
46
|
+
*/
|
|
47
|
+
buttonIcon?: PopsIcon;
|
|
48
|
+
/**
|
|
49
|
+
* 按钮的图标在右边
|
|
50
|
+
*/
|
|
51
|
+
buttonIsRightIcon?: boolean;
|
|
52
|
+
/**
|
|
53
|
+
* 按钮的图标旋转
|
|
54
|
+
*/
|
|
55
|
+
buttonIconIsLoading?: boolean;
|
|
56
|
+
/**
|
|
57
|
+
* 点击button触发的事件
|
|
58
|
+
*/
|
|
59
|
+
callback: (event: MouseEvent | PointerEvent) => void;
|
|
60
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { PopsPanelFormsTotalDetails } from "./indexType";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* 右侧容器的配置
|
|
5
|
+
*/
|
|
6
|
+
export interface PopsPanelRightAsideContainerOptions {
|
|
7
|
+
/** 把获取的项<li>元素添加到这个<ul>元素内 */
|
|
8
|
+
ulElement: HTMLUListElement;
|
|
9
|
+
/** */
|
|
10
|
+
sectionContainerULElement?: HTMLUListElement;
|
|
11
|
+
/** */
|
|
12
|
+
formContainerListElement?: HTMLLIElement;
|
|
13
|
+
/** */
|
|
14
|
+
formHeaderDivElement?: HTMLElement | HTMLDivElement;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* 通用配置
|
|
18
|
+
*/
|
|
19
|
+
export interface PopsPanelCommonDetails {
|
|
20
|
+
/**
|
|
21
|
+
* 在添加到<ul>元素后触发该回调
|
|
22
|
+
* @param formConfig 配置
|
|
23
|
+
* @param container 右侧容器的元素
|
|
24
|
+
* @example
|
|
25
|
+
* // 例如在type为own时
|
|
26
|
+
* afterAddToUListCallBack(formConfig, container) {
|
|
27
|
+
* DOMUtils.on(
|
|
28
|
+
container.formHeaderDivElement.querySelector(
|
|
29
|
+
"a"
|
|
30
|
+
),
|
|
31
|
+
"click",
|
|
32
|
+
void 0,
|
|
33
|
+
() => {
|
|
34
|
+
PopsPanel.deleteValue("xxxx");
|
|
35
|
+
container.ulElement.querySelector(
|
|
36
|
+
"textarea"
|
|
37
|
+
).value = xxxxx.defaultValue;
|
|
38
|
+
Qmsg.success("已重置");
|
|
39
|
+
}
|
|
40
|
+
);
|
|
41
|
+
* }
|
|
42
|
+
*
|
|
43
|
+
* // 例如在type为forms时
|
|
44
|
+
* container内只有container.ulElement这个属性
|
|
45
|
+
*/
|
|
46
|
+
afterAddToUListCallBack?: (
|
|
47
|
+
formConfig: PopsPanelFormsTotalDetails,
|
|
48
|
+
container: PopsPanelRightAsideContainerOptions
|
|
49
|
+
) => void;
|
|
50
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import type { PopsPanelFormsTotalDetails } from "./indexType";
|
|
2
|
+
import type { PopsPanelFormsDetails } from "./formsType";
|
|
3
|
+
import type { PopsPanelCommonDetails } from "./commonType";
|
|
4
|
+
/**
|
|
5
|
+
* pops.panel的 深层菜单
|
|
6
|
+
*/
|
|
7
|
+
export interface PopsPanelDeepMenuDetails extends PopsPanelCommonDetails {
|
|
8
|
+
/**
|
|
9
|
+
* 类型
|
|
10
|
+
*/
|
|
11
|
+
type: "deepMenu";
|
|
12
|
+
/**
|
|
13
|
+
* (可选)className属性
|
|
14
|
+
*/
|
|
15
|
+
className?: string;
|
|
16
|
+
/**
|
|
17
|
+
* (可选)自定义元素属性
|
|
18
|
+
*/
|
|
19
|
+
attributes?: any;
|
|
20
|
+
/**
|
|
21
|
+
* (可选)自定义属性
|
|
22
|
+
*/
|
|
23
|
+
props?: HTMLElement;
|
|
24
|
+
/**
|
|
25
|
+
* 显示在左边的文字
|
|
26
|
+
*/
|
|
27
|
+
text: string;
|
|
28
|
+
/**
|
|
29
|
+
* (可选)左边的文字下面的描述
|
|
30
|
+
*/
|
|
31
|
+
description?: string;
|
|
32
|
+
/**
|
|
33
|
+
* (可选)右侧的文字
|
|
34
|
+
*/
|
|
35
|
+
rightText?: string;
|
|
36
|
+
/**
|
|
37
|
+
* (可选)右侧的箭头图标,默认启用
|
|
38
|
+
*/
|
|
39
|
+
arrowRightIcon?: boolean;
|
|
40
|
+
/**
|
|
41
|
+
* 点击整行触发的事件,可为异步函数
|
|
42
|
+
* @param event click事件
|
|
43
|
+
* @returns
|
|
44
|
+
* + true 表示阻止进入深层菜单
|
|
45
|
+
* + false (默认)表示允许进入深层菜单
|
|
46
|
+
*/
|
|
47
|
+
clickCallBack?: (
|
|
48
|
+
event: MouseEvent | PointerEvent,
|
|
49
|
+
formConfig: PopsPanelDeepMenuDetails
|
|
50
|
+
) => boolean | void;
|
|
51
|
+
/**
|
|
52
|
+
* 菜单配置
|
|
53
|
+
*/
|
|
54
|
+
forms?: (PopsPanelFormsDetails | PopsPanelFormsTotalDetails)[];
|
|
55
|
+
/**
|
|
56
|
+
* (可选)头部的标题文字,没有的话默认是text
|
|
57
|
+
*/
|
|
58
|
+
headerTitle?: string;
|
|
59
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { PopsPanelCommonDetails } from "./commonType";
|
|
2
|
+
import type { PopsPanelFormsTotalDetails } from "./indexType";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* pops.panel的 forms
|
|
6
|
+
*/
|
|
7
|
+
export interface PopsPanelFormsDetails extends PopsPanelCommonDetails {
|
|
8
|
+
/**
|
|
9
|
+
* (可选)className属性
|
|
10
|
+
*/
|
|
11
|
+
className?: string;
|
|
12
|
+
/**
|
|
13
|
+
* (可选)自定义元素属性
|
|
14
|
+
*/
|
|
15
|
+
attributes?: any;
|
|
16
|
+
/**
|
|
17
|
+
* (可选)自定义属性
|
|
18
|
+
*/
|
|
19
|
+
props?: HTMLElement;
|
|
20
|
+
/**
|
|
21
|
+
* 显示在左边的文字
|
|
22
|
+
*/
|
|
23
|
+
text: string;
|
|
24
|
+
/**
|
|
25
|
+
* 类型
|
|
26
|
+
*/
|
|
27
|
+
type: "forms";
|
|
28
|
+
/**
|
|
29
|
+
* 子配置
|
|
30
|
+
*/
|
|
31
|
+
forms: PopsPanelFormsTotalDetails[];
|
|
32
|
+
}
|