@whitesev/pops 2.4.5 → 2.4.7
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/README.md +117 -111
- package/dist/index.amd.js +1248 -1287
- package/dist/index.amd.js.map +1 -1
- package/dist/index.cjs.js +1248 -1287
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +1248 -1287
- package/dist/index.esm.js.map +1 -1
- package/dist/index.iife.js +1248 -1287
- package/dist/index.iife.js.map +1 -1
- package/dist/index.system.js +1248 -1287
- package/dist/index.system.js.map +1 -1
- package/dist/index.umd.js +1248 -1287
- package/dist/index.umd.js.map +1 -1
- package/dist/types/src/Pops.d.ts +9 -10
- package/dist/types/src/components/panel/types/components-common.d.ts +26 -26
- package/dist/types/src/components/panel/types/index.d.ts +1 -1
- package/dist/types/src/components/rightClickMenu/index.d.ts +3 -4
- package/dist/types/src/components/searchSuggestion/index.d.ts +2 -2
- package/dist/types/src/components/searchSuggestion/types/index.d.ts +2 -2
- package/dist/types/src/handler/PopsHandler.d.ts +3 -3
- package/dist/types/src/types/PopsDOMUtilsEventType.d.ts +252 -256
- package/dist/types/src/types/animation.d.ts +19 -19
- package/dist/types/src/types/button.d.ts +187 -187
- package/dist/types/src/types/components.d.ts +210 -213
- package/dist/types/src/types/event.d.ts +63 -63
- package/dist/types/src/types/global.d.ts +25 -20
- package/dist/types/src/types/icon.d.ts +32 -32
- package/dist/types/src/types/inst.d.ts +24 -24
- package/dist/types/src/types/main.d.ts +111 -114
- package/dist/types/src/types/mask.d.ts +49 -49
- package/dist/types/src/types/position.d.ts +60 -60
- package/dist/types/src/utils/PopsDOMUtils.d.ts +1 -1
- package/dist/types/src/utils/PopsInstanceUtils.d.ts +1 -1
- package/dist/types/src/utils/PopsUtils.d.ts +16 -16
- package/index.ts +3 -0
- package/package.json +20 -9
- package/src/Pops.ts +206 -0
- package/src/PopsAnimation.ts +32 -0
- package/src/PopsCSS.ts +51 -0
- package/src/PopsCore.ts +64 -0
- package/src/PopsIcon.ts +95 -0
- package/src/PopsInst.ts +21 -0
- package/src/components/alert/config.ts +62 -0
- package/src/components/alert/index.css +0 -0
- package/src/components/alert/index.ts +163 -0
- package/src/components/alert/types/index.ts +23 -0
- package/src/components/confirm/config.ts +90 -0
- package/src/components/confirm/index.css +0 -0
- package/src/components/confirm/index.ts +166 -0
- package/src/components/confirm/types/index.ts +17 -0
- package/src/components/drawer/config.ts +89 -0
- package/src/components/drawer/index.css +37 -0
- package/src/components/drawer/index.ts +237 -0
- package/src/components/drawer/types/index.ts +61 -0
- package/src/components/folder/config.ts +147 -0
- package/src/components/folder/folderIcon.ts +28 -0
- package/src/components/folder/index.css +303 -0
- package/src/components/folder/index.ts +929 -0
- package/src/components/folder/types/index.ts +97 -0
- package/src/components/iframe/config.ts +60 -0
- package/src/components/iframe/index.css +76 -0
- package/src/components/iframe/index.ts +334 -0
- package/src/components/iframe/types/index.ts +139 -0
- package/src/components/loading/config.ts +29 -0
- package/src/components/loading/index.css +66 -0
- package/src/components/loading/index.ts +99 -0
- package/src/components/loading/types/index.ts +34 -0
- package/src/components/panel/config.ts +519 -0
- package/src/components/panel/handlerComponents.ts +2900 -0
- package/src/components/panel/index.css +1222 -0
- package/src/components/panel/index.ts +207 -0
- package/src/components/panel/types/components-button.ts +68 -0
- package/src/components/panel/types/components-common.ts +50 -0
- package/src/components/panel/types/components-deepMenu.ts +84 -0
- package/src/components/panel/types/components-forms.ts +44 -0
- package/src/components/panel/types/components-input.ts +78 -0
- package/src/components/panel/types/components-own.ts +30 -0
- package/src/components/panel/types/components-select.ts +93 -0
- package/src/components/panel/types/components-selectMultiple.ts +130 -0
- package/src/components/panel/types/components-slider.ts +77 -0
- package/src/components/panel/types/components-switch.ts +56 -0
- package/src/components/panel/types/components-textarea.ts +68 -0
- package/src/components/panel/types/index.ts +177 -0
- package/src/components/prompt/config.ts +94 -0
- package/src/components/prompt/index.css +34 -0
- package/src/components/prompt/index.ts +216 -0
- package/src/components/prompt/types/index.ts +55 -0
- package/src/components/rightClickMenu/config.ts +98 -0
- package/src/components/rightClickMenu/index.css +112 -0
- package/src/components/rightClickMenu/index.ts +602 -0
- package/src/components/rightClickMenu/types/index.ts +97 -0
- package/src/components/searchSuggestion/config.ts +56 -0
- package/src/components/searchSuggestion/index.ts +856 -0
- package/src/components/searchSuggestion/types/index.ts +239 -0
- package/src/components/tooltip/config.ts +34 -0
- package/src/components/tooltip/index.css +199 -0
- package/src/components/tooltip/index.ts +604 -0
- package/src/components/tooltip/types/index.ts +117 -0
- package/src/config/CommonCSSClassName.ts +17 -0
- package/src/config/GlobalConfig.ts +63 -0
- package/src/css/animation.css +987 -0
- package/src/css/button.css +551 -0
- package/src/css/common.css +48 -0
- package/src/css/index.css +253 -0
- package/src/css/ninePalaceGridPosition.css +50 -0
- package/src/css/scrollbar.css +22 -0
- package/src/handler/PopsElementHandler.ts +304 -0
- package/src/handler/PopsHandler.ts +589 -0
- package/src/svg/arrowLeft.svg +4 -0
- package/src/svg/arrowRight.svg +4 -0
- package/src/svg/chromeFilled.svg +11 -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 +252 -0
- package/src/types/animation.d.ts +19 -0
- package/src/types/button.d.ts +187 -0
- package/src/types/components.d.ts +210 -0
- package/src/types/event.d.ts +63 -0
- package/src/types/global.d.ts +25 -0
- package/src/types/icon.d.ts +32 -0
- package/src/types/inst.d.ts +24 -0
- package/src/types/main.d.ts +111 -0
- package/src/types/mask.d.ts +49 -0
- package/src/types/position.d.ts +60 -0
- package/src/utils/PopsDOMUtils.ts +2408 -0
- package/src/utils/PopsDOMUtilsEventsConfig.ts +4 -0
- package/src/utils/PopsInstanceUtils.ts +688 -0
- package/src/utils/PopsMathUtils.ts +71 -0
- package/src/utils/PopsSafeUtils.ts +22 -0
- package/src/utils/PopsUtils.ts +406 -0
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
import { PopsElementHandler } from "../../handler/PopsElementHandler";
|
|
2
|
+
import { PopsHandler } from "../../handler/PopsHandler";
|
|
3
|
+
import { popsDOMUtils } from "../../utils/PopsDOMUtils";
|
|
4
|
+
import { PopsInstanceUtils } from "../../utils/PopsInstanceUtils";
|
|
5
|
+
import { popsUtils } from "../../utils/PopsUtils";
|
|
6
|
+
import type { PopsPanelDetails, PopsPanelEventType } from "./types";
|
|
7
|
+
import { PopsPanelConfig } from "./config";
|
|
8
|
+
import { PanelHandlerComponents } from "./handlerComponents";
|
|
9
|
+
import { GlobalConfig } from "../../config/GlobalConfig";
|
|
10
|
+
import { PopsCSS } from "../../PopsCSS";
|
|
11
|
+
import type { PopsType } from "../../types/main";
|
|
12
|
+
|
|
13
|
+
export const PopsPanel = {
|
|
14
|
+
init(details: PopsPanelDetails) {
|
|
15
|
+
const guid = popsUtils.getRandomGUID();
|
|
16
|
+
// 设置当前类型
|
|
17
|
+
const popsType: PopsType = "panel";
|
|
18
|
+
|
|
19
|
+
let config: Required<PopsPanelDetails> = PopsPanelConfig();
|
|
20
|
+
config = popsUtils.assign(config, GlobalConfig.getGlobalConfig());
|
|
21
|
+
config = popsUtils.assign(config, details);
|
|
22
|
+
if (details && Array.isArray(details.content)) {
|
|
23
|
+
config.content = details.content;
|
|
24
|
+
}
|
|
25
|
+
config = PopsHandler.handleOnly(popsType, config);
|
|
26
|
+
|
|
27
|
+
const { $shadowContainer, $shadowRoot } = PopsHandler.handlerShadow(config);
|
|
28
|
+
PopsHandler.handleInit($shadowRoot, [
|
|
29
|
+
{
|
|
30
|
+
name: "index",
|
|
31
|
+
css: PopsCSS.index,
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
name: "ninePalaceGridPosition",
|
|
35
|
+
css: PopsCSS.ninePalaceGridPosition,
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
name: "scrollbar",
|
|
39
|
+
css: PopsCSS.scrollbar,
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
name: "button",
|
|
43
|
+
css: PopsCSS.button,
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
name: "anim",
|
|
47
|
+
css: PopsCSS.anim,
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
name: "common",
|
|
51
|
+
css: PopsCSS.common,
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
name: "panelCSS",
|
|
55
|
+
css: PopsCSS.panelCSS,
|
|
56
|
+
},
|
|
57
|
+
]);
|
|
58
|
+
|
|
59
|
+
// 先把z-index提取出来
|
|
60
|
+
const zIndex = PopsHandler.handleZIndex(config.zIndex);
|
|
61
|
+
const maskHTML = PopsElementHandler.createMask(guid, zIndex);
|
|
62
|
+
|
|
63
|
+
const headerBtnHTML = PopsElementHandler.createHeader(popsType, config);
|
|
64
|
+
const { headerStyle, headerPStyle } = PopsElementHandler.createHeaderStyle(popsType, config);
|
|
65
|
+
|
|
66
|
+
const animHTML = PopsElementHandler.createAnim(
|
|
67
|
+
guid,
|
|
68
|
+
popsType,
|
|
69
|
+
config,
|
|
70
|
+
/*html*/ `
|
|
71
|
+
<div class="pops-title pops-${popsType}-title" style="text-align: ${config.title.position};${headerStyle}">${
|
|
72
|
+
config.title.html
|
|
73
|
+
? config.title.text
|
|
74
|
+
: `<p pops class="pops-${popsType}-title-text" class="pops-${popsType}-title-text" style="${headerPStyle}">${config.title.text}</p>`
|
|
75
|
+
}${headerBtnHTML}</div>
|
|
76
|
+
<div class="pops-content pops-${popsType}-content">
|
|
77
|
+
<aside class="pops-${popsType}-aside">
|
|
78
|
+
<ul class="pops-${popsType}-aside-top-container"></ul>
|
|
79
|
+
<ul class="pops-${popsType}-aside-bottom-container"></ul>
|
|
80
|
+
</aside>
|
|
81
|
+
<div class="pops-${popsType}-section-wrapper">
|
|
82
|
+
<section class="pops-${popsType}-container">
|
|
83
|
+
<ul class="pops-${popsType}-container-header-ul"></ul>
|
|
84
|
+
<ul class="pops-${popsType}-container-main-ul"></ul>
|
|
85
|
+
</section>
|
|
86
|
+
</div>
|
|
87
|
+
</div>`,
|
|
88
|
+
"",
|
|
89
|
+
zIndex
|
|
90
|
+
);
|
|
91
|
+
/**
|
|
92
|
+
* 弹窗的主元素,包括动画层
|
|
93
|
+
*/
|
|
94
|
+
const $anim = PopsElementHandler.parseElement<HTMLDivElement>(animHTML);
|
|
95
|
+
/* 结构元素 */
|
|
96
|
+
const {
|
|
97
|
+
popsElement: $pops,
|
|
98
|
+
headerCloseBtnElement: $headerCloseBtn,
|
|
99
|
+
titleElement: $title,
|
|
100
|
+
contentElement: $content,
|
|
101
|
+
panelSectionWrapper: $panelSectionWrapper,
|
|
102
|
+
contentAsideElement: $contentAside,
|
|
103
|
+
contentSectionContainerElement: $contentSectionContainer,
|
|
104
|
+
} = PopsHandler.handleQueryElement($anim, popsType);
|
|
105
|
+
if (config.isMobile || popsUtils.isPhone()) {
|
|
106
|
+
popsDOMUtils.addClassName($pops, config.mobileClassName);
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* 遮罩层元素
|
|
110
|
+
*/
|
|
111
|
+
let $mask: HTMLDivElement | null = null;
|
|
112
|
+
/**
|
|
113
|
+
* 已创建的元素列表
|
|
114
|
+
*/
|
|
115
|
+
const isCreatedElementList: HTMLElement[] = [$anim];
|
|
116
|
+
|
|
117
|
+
/* 遮罩层元素 */
|
|
118
|
+
if (config.mask.enable) {
|
|
119
|
+
const { maskElement } = PopsHandler.handleMask({
|
|
120
|
+
type: popsType,
|
|
121
|
+
guid: guid,
|
|
122
|
+
config: config,
|
|
123
|
+
animElement: $anim,
|
|
124
|
+
maskHTML: maskHTML,
|
|
125
|
+
});
|
|
126
|
+
$mask = maskElement;
|
|
127
|
+
isCreatedElementList.push($mask);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/* 处理返回的配置 */
|
|
131
|
+
const eventDetails = PopsHandler.handleEventDetails(
|
|
132
|
+
guid,
|
|
133
|
+
$shadowContainer,
|
|
134
|
+
$shadowRoot,
|
|
135
|
+
popsType,
|
|
136
|
+
$anim,
|
|
137
|
+
$pops,
|
|
138
|
+
$mask!,
|
|
139
|
+
config
|
|
140
|
+
);
|
|
141
|
+
/* 为顶部右边的关闭按钮添加点击事件 */
|
|
142
|
+
PopsHandler.handleClickEvent("close", $headerCloseBtn, eventDetails, config.btn.close!.callback!);
|
|
143
|
+
|
|
144
|
+
/* 创建到页面中 */
|
|
145
|
+
popsDOMUtils.append($shadowRoot, isCreatedElementList);
|
|
146
|
+
if (typeof config.beforeAppendToPageCallBack === "function") {
|
|
147
|
+
config.beforeAppendToPageCallBack($shadowRoot, $shadowContainer);
|
|
148
|
+
}
|
|
149
|
+
popsDOMUtils.appendBody($shadowContainer);
|
|
150
|
+
/* 追加遮罩层元素 */
|
|
151
|
+
if ($mask != null) {
|
|
152
|
+
$anim.after($mask);
|
|
153
|
+
}
|
|
154
|
+
const panelHandlerComponents = PanelHandlerComponents();
|
|
155
|
+
/**
|
|
156
|
+
* 处理内部配置
|
|
157
|
+
*/
|
|
158
|
+
panelHandlerComponents.init({
|
|
159
|
+
config: config,
|
|
160
|
+
$el: {
|
|
161
|
+
$pops: $pops,
|
|
162
|
+
$content: $content,
|
|
163
|
+
$sectionWrapper: $panelSectionWrapper,
|
|
164
|
+
$contentAside: $contentAside,
|
|
165
|
+
$contentSectionContainer: $contentSectionContainer,
|
|
166
|
+
},
|
|
167
|
+
});
|
|
168
|
+
|
|
169
|
+
PopsHandler.handlePush(popsType, {
|
|
170
|
+
guid: guid,
|
|
171
|
+
animElement: $anim,
|
|
172
|
+
popsElement: $pops,
|
|
173
|
+
maskElement: $mask!,
|
|
174
|
+
$shadowContainer: $shadowContainer,
|
|
175
|
+
$shadowRoot: $shadowRoot,
|
|
176
|
+
});
|
|
177
|
+
/* 拖拽 */
|
|
178
|
+
if (config.drag) {
|
|
179
|
+
PopsInstanceUtils.drag($pops, {
|
|
180
|
+
dragElement: $title,
|
|
181
|
+
limit: config.dragLimit,
|
|
182
|
+
extraDistance: config.dragExtraDistance,
|
|
183
|
+
moveCallBack: config.dragMoveCallBack,
|
|
184
|
+
endCallBack: config.dragEndCallBack,
|
|
185
|
+
});
|
|
186
|
+
}
|
|
187
|
+
const result = PopsHandler.handleResultDetails(eventDetails);
|
|
188
|
+
|
|
189
|
+
return {
|
|
190
|
+
...result,
|
|
191
|
+
addEventListener: <K extends keyof PopsPanelEventType>(
|
|
192
|
+
event: K,
|
|
193
|
+
listener: (evt: CustomEvent<PopsPanelEventType[K]>) => void,
|
|
194
|
+
options?: boolean | EventListenerOptions
|
|
195
|
+
) => {
|
|
196
|
+
$pops.addEventListener(event, listener as any, options);
|
|
197
|
+
},
|
|
198
|
+
removeEventListener: <K extends keyof PopsPanelEventType>(
|
|
199
|
+
event: K,
|
|
200
|
+
listener: (evt: CustomEvent<PopsPanelEventType[K]>) => void,
|
|
201
|
+
options?: boolean | EventListenerOptions
|
|
202
|
+
) => {
|
|
203
|
+
$pops.removeEventListener(event, listener as any, options);
|
|
204
|
+
},
|
|
205
|
+
};
|
|
206
|
+
},
|
|
207
|
+
};
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import type { PopsPanelCommonDetails } from "./components-common";
|
|
2
|
+
import type { PopsButtonStyleType } from "../../../types/button";
|
|
3
|
+
import type { PopsIconType } from "../../../types/icon";
|
|
4
|
+
/**
|
|
5
|
+
* pops.panel的 button
|
|
6
|
+
*/
|
|
7
|
+
export interface PopsPanelButtonDetails extends PopsPanelCommonDetails<PopsPanelButtonDetails> {
|
|
8
|
+
/**
|
|
9
|
+
* (可选)className属性
|
|
10
|
+
*/
|
|
11
|
+
className?: string;
|
|
12
|
+
/**
|
|
13
|
+
* (可选)自定义元素属性
|
|
14
|
+
*/
|
|
15
|
+
attributes?:
|
|
16
|
+
| {
|
|
17
|
+
[key: string]: any;
|
|
18
|
+
}
|
|
19
|
+
| {
|
|
20
|
+
[key: string]: any;
|
|
21
|
+
}[];
|
|
22
|
+
/**
|
|
23
|
+
* (可选)自定义属性
|
|
24
|
+
*/
|
|
25
|
+
props?: {
|
|
26
|
+
[K in keyof HTMLElement]?: HTMLElement[K];
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* 显示在左边的文字
|
|
30
|
+
*/
|
|
31
|
+
text: string;
|
|
32
|
+
/**
|
|
33
|
+
* (可选)左边的文字下面的描述
|
|
34
|
+
*/
|
|
35
|
+
description?: string;
|
|
36
|
+
/**
|
|
37
|
+
* 类型
|
|
38
|
+
*/
|
|
39
|
+
type: "button";
|
|
40
|
+
/**
|
|
41
|
+
* (可选)是否禁用
|
|
42
|
+
*/
|
|
43
|
+
disable?: boolean;
|
|
44
|
+
/**
|
|
45
|
+
* 按钮的类型
|
|
46
|
+
*/
|
|
47
|
+
buttonType: PopsButtonStyleType;
|
|
48
|
+
/**
|
|
49
|
+
* 按钮的文字
|
|
50
|
+
*/
|
|
51
|
+
buttonText: string | (() => string);
|
|
52
|
+
/**
|
|
53
|
+
* 按钮的图标,已配置的svg请看pops.config.iconSVG,或者自定义的图标svg代码
|
|
54
|
+
*/
|
|
55
|
+
buttonIcon?: PopsIconType;
|
|
56
|
+
/**
|
|
57
|
+
* 按钮的图标在右边
|
|
58
|
+
*/
|
|
59
|
+
buttonIsRightIcon?: boolean;
|
|
60
|
+
/**
|
|
61
|
+
* 按钮的图标旋转
|
|
62
|
+
*/
|
|
63
|
+
buttonIconIsLoading?: boolean;
|
|
64
|
+
/**
|
|
65
|
+
* 点击button触发的事件
|
|
66
|
+
*/
|
|
67
|
+
callback: (event: MouseEvent | PointerEvent) => void;
|
|
68
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import type { PopsPanelFormsDetails } from "./components-forms";
|
|
2
|
+
import type { PopsPanelFormsTotalDetails } from ".";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* 右侧容器的配置
|
|
6
|
+
*/
|
|
7
|
+
export interface PopsPanelRightAsideContainerOptions {
|
|
8
|
+
/** 当前的<li>元素 */
|
|
9
|
+
target: HTMLLIElement | undefined;
|
|
10
|
+
/** 当前的<li>元素的父<ul>元素 */
|
|
11
|
+
ulElement: HTMLUListElement;
|
|
12
|
+
/** 当前的<li>元素所在的统一的<ul>元素 */
|
|
13
|
+
sectionContainerULElement?: HTMLUListElement;
|
|
14
|
+
/** */
|
|
15
|
+
formContainerListElement?: HTMLLIElement;
|
|
16
|
+
/** */
|
|
17
|
+
formHeaderDivElement?: HTMLElement | HTMLDivElement;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* 通用配置
|
|
21
|
+
*/
|
|
22
|
+
export interface PopsPanelCommonDetails<T extends PopsPanelFormsTotalDetails | PopsPanelFormsDetails> {
|
|
23
|
+
/**
|
|
24
|
+
* 在添加到<ul>元素后触发该回调
|
|
25
|
+
* @param formConfig 配置
|
|
26
|
+
* @param container 右侧容器的元素
|
|
27
|
+
* @example
|
|
28
|
+
* // 例如在type为own时
|
|
29
|
+
* afterAddToUListCallBack(formConfig, container) {
|
|
30
|
+
* DOMUtils.on(
|
|
31
|
+
container.formHeaderDivElement.querySelector(
|
|
32
|
+
"a"
|
|
33
|
+
),
|
|
34
|
+
"click",
|
|
35
|
+
void 0,
|
|
36
|
+
() => {
|
|
37
|
+
PopsPanel.deleteValue("xxxx");
|
|
38
|
+
container.ulElement.querySelector(
|
|
39
|
+
"textarea"
|
|
40
|
+
).value = xxxxx.defaultValue;
|
|
41
|
+
Qmsg.success("已重置");
|
|
42
|
+
}
|
|
43
|
+
);
|
|
44
|
+
* }
|
|
45
|
+
*
|
|
46
|
+
* // 例如在type为forms时
|
|
47
|
+
* container内只有container.ulElement这个属性
|
|
48
|
+
*/
|
|
49
|
+
afterAddToUListCallBack?: (formConfig: T, container: PopsPanelRightAsideContainerOptions) => void;
|
|
50
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import type { PopsPanelFormsTotalDetails } from ".";
|
|
2
|
+
import type { PopsPanelFormsDetails } from "./components-forms";
|
|
3
|
+
import type { PopsPanelCommonDetails } from "./components-common";
|
|
4
|
+
/**
|
|
5
|
+
* pops.panel的 深层菜单
|
|
6
|
+
*/
|
|
7
|
+
export interface PopsPanelDeepMenuDetails extends PopsPanelCommonDetails<PopsPanelDeepMenuDetails> {
|
|
8
|
+
/**
|
|
9
|
+
* 类型
|
|
10
|
+
*/
|
|
11
|
+
type: "deepMenu";
|
|
12
|
+
/**
|
|
13
|
+
* (可选)className属性
|
|
14
|
+
*/
|
|
15
|
+
className?: string;
|
|
16
|
+
/**
|
|
17
|
+
* (可选)自定义元素属性
|
|
18
|
+
*/
|
|
19
|
+
attributes?:
|
|
20
|
+
| {
|
|
21
|
+
[key: string]: any;
|
|
22
|
+
}
|
|
23
|
+
| {
|
|
24
|
+
[key: string]: any;
|
|
25
|
+
}[];
|
|
26
|
+
/**
|
|
27
|
+
* (可选)自定义属性
|
|
28
|
+
*/
|
|
29
|
+
props?: {
|
|
30
|
+
[K in keyof HTMLElement]?: HTMLElement[K];
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* 显示在左边的文字
|
|
34
|
+
*/
|
|
35
|
+
text: string;
|
|
36
|
+
/**
|
|
37
|
+
* (可选)左边的文字下面的描述
|
|
38
|
+
*/
|
|
39
|
+
description?: string;
|
|
40
|
+
/**
|
|
41
|
+
* (可选)右侧的文字
|
|
42
|
+
*/
|
|
43
|
+
rightText?: string;
|
|
44
|
+
/**
|
|
45
|
+
* (可选)右侧的箭头图标,默认启用
|
|
46
|
+
*/
|
|
47
|
+
arrowRightIcon?: boolean;
|
|
48
|
+
/**
|
|
49
|
+
* 点击整行触发的事件,可为异步函数
|
|
50
|
+
* @param event click事件
|
|
51
|
+
* @returns
|
|
52
|
+
* + true 表示阻止进入深层菜单
|
|
53
|
+
* + false (默认)表示允许进入深层菜单
|
|
54
|
+
*/
|
|
55
|
+
clickCallBack?: (
|
|
56
|
+
event: MouseEvent | PointerEvent,
|
|
57
|
+
formConfig: PopsPanelDeepMenuDetails
|
|
58
|
+
) => boolean | void | Promise<boolean | void>;
|
|
59
|
+
/**
|
|
60
|
+
* 进入深层菜单后触发的回调
|
|
61
|
+
* @param formConfig
|
|
62
|
+
*/
|
|
63
|
+
afterEnterDeepMenuCallBack?: (
|
|
64
|
+
formConfig: PopsPanelDeepMenuDetails,
|
|
65
|
+
container: {
|
|
66
|
+
/** 右侧的总容器 */
|
|
67
|
+
sectionContainer: HTMLElement;
|
|
68
|
+
/** 右侧的总容器的标题头容器 */
|
|
69
|
+
sectionContainerHeaderContainer: HTMLUListElement;
|
|
70
|
+
/** 右侧的总容器的标题头 */
|
|
71
|
+
sectionContainerHeader: HTMLLIElement;
|
|
72
|
+
/** 右侧的内容容器 */
|
|
73
|
+
sectionBodyContainer: HTMLUListElement;
|
|
74
|
+
}
|
|
75
|
+
) => void;
|
|
76
|
+
/**
|
|
77
|
+
* 菜单配置
|
|
78
|
+
*/
|
|
79
|
+
forms?: (PopsPanelFormsDetails | PopsPanelFormsTotalDetails)[];
|
|
80
|
+
/**
|
|
81
|
+
* (可选)头部的标题文字,没有的话默认是text
|
|
82
|
+
*/
|
|
83
|
+
headerTitle?: string;
|
|
84
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { PopsPanelCommonDetails } from "./components-common";
|
|
2
|
+
import type { PopsPanelFormsTotalDetails } from ".";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* pops.panel的 forms
|
|
6
|
+
*/
|
|
7
|
+
export interface PopsPanelFormsDetails extends PopsPanelCommonDetails<PopsPanelFormsDetails> {
|
|
8
|
+
/**
|
|
9
|
+
* (可选)className属性
|
|
10
|
+
*/
|
|
11
|
+
className?: string;
|
|
12
|
+
/**
|
|
13
|
+
* (可选)自定义元素属性
|
|
14
|
+
*/
|
|
15
|
+
attributes?:
|
|
16
|
+
| {
|
|
17
|
+
[key: string]: any;
|
|
18
|
+
}
|
|
19
|
+
| {
|
|
20
|
+
[key: string]: any;
|
|
21
|
+
}[];
|
|
22
|
+
/**
|
|
23
|
+
* (可选)自定义属性
|
|
24
|
+
*/
|
|
25
|
+
props?: {
|
|
26
|
+
[K in keyof HTMLElement]?: HTMLElement[K];
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* 显示在左边的文字
|
|
30
|
+
*/
|
|
31
|
+
text: string;
|
|
32
|
+
/**
|
|
33
|
+
* 是否进行折叠
|
|
34
|
+
*/
|
|
35
|
+
isFold?: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* 类型
|
|
38
|
+
*/
|
|
39
|
+
type: "forms";
|
|
40
|
+
/**
|
|
41
|
+
* 子配置
|
|
42
|
+
*/
|
|
43
|
+
forms: PopsPanelFormsTotalDetails[];
|
|
44
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import type { PopsPanelCommonDetails } from "./components-common";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* pops.panel的 input
|
|
5
|
+
*/
|
|
6
|
+
export interface PopsPanelInputDetails extends PopsPanelCommonDetails<PopsPanelInputDetails> {
|
|
7
|
+
/**
|
|
8
|
+
* (可选)className属性
|
|
9
|
+
* @default ""
|
|
10
|
+
*/
|
|
11
|
+
className?: string;
|
|
12
|
+
/**
|
|
13
|
+
* (可选)自定义元素属性
|
|
14
|
+
* @default {}
|
|
15
|
+
*/
|
|
16
|
+
attributes?:
|
|
17
|
+
| {
|
|
18
|
+
[key: string]: any;
|
|
19
|
+
}
|
|
20
|
+
| {
|
|
21
|
+
[key: string]: any;
|
|
22
|
+
}[];
|
|
23
|
+
/**
|
|
24
|
+
* (可选)自定义属性
|
|
25
|
+
* @default {}
|
|
26
|
+
*/
|
|
27
|
+
props?: {
|
|
28
|
+
[K in keyof HTMLElement]?: HTMLElement[K];
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* 显示在左边的文字
|
|
32
|
+
*/
|
|
33
|
+
text: string;
|
|
34
|
+
/**
|
|
35
|
+
* (可选)左边的文字下面的描述
|
|
36
|
+
* @default ""
|
|
37
|
+
*/
|
|
38
|
+
description?: string;
|
|
39
|
+
/**
|
|
40
|
+
* 类型
|
|
41
|
+
*/
|
|
42
|
+
type: "input";
|
|
43
|
+
/**
|
|
44
|
+
* (可选)是否禁用
|
|
45
|
+
* @default false
|
|
46
|
+
*/
|
|
47
|
+
disabled?: boolean | (() => boolean);
|
|
48
|
+
/**
|
|
49
|
+
* 获取该项的值的回调函数
|
|
50
|
+
*/
|
|
51
|
+
getValue(): string;
|
|
52
|
+
/**
|
|
53
|
+
* 输入框的值改变触发的回调函数
|
|
54
|
+
* @param event 输入事件
|
|
55
|
+
* @param value 输入框的值
|
|
56
|
+
* @param valueAsNumber 当isNumber为true时,有该值,它可能是NaN
|
|
57
|
+
*/
|
|
58
|
+
callback(event: InputEvent, value: string, valueAsNumber?: number): void;
|
|
59
|
+
/**
|
|
60
|
+
* (可选)输入框内的提示
|
|
61
|
+
* @default ""
|
|
62
|
+
*/
|
|
63
|
+
placeholder?: string;
|
|
64
|
+
/**
|
|
65
|
+
* (可选)是否是密码框
|
|
66
|
+
* @default false
|
|
67
|
+
*/
|
|
68
|
+
isPassword?: boolean;
|
|
69
|
+
/**
|
|
70
|
+
* (可选)是否是数字框
|
|
71
|
+
* @default false
|
|
72
|
+
*/
|
|
73
|
+
isNumber?: boolean;
|
|
74
|
+
/**
|
|
75
|
+
* (可选)自己调用的处理回调函数
|
|
76
|
+
*/
|
|
77
|
+
handlerCallBack?(liElement: HTMLLIElement, inputElement: HTMLInputElement): void;
|
|
78
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { PopsPanelCommonDetails } from "./components-common";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* pops.panel的 own
|
|
5
|
+
* 自定义的
|
|
6
|
+
*/
|
|
7
|
+
export interface PopsPanelOwnDetails extends PopsPanelCommonDetails<PopsPanelOwnDetails> {
|
|
8
|
+
/**
|
|
9
|
+
* (可选)className属性
|
|
10
|
+
*/
|
|
11
|
+
className?: string;
|
|
12
|
+
/**
|
|
13
|
+
* (可选)自定义元素属性
|
|
14
|
+
*/
|
|
15
|
+
attributes?: any;
|
|
16
|
+
/**
|
|
17
|
+
* (可选)自定义属性
|
|
18
|
+
*/
|
|
19
|
+
props?: {
|
|
20
|
+
[K in keyof HTMLElement]?: HTMLElement[K];
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* 类型
|
|
24
|
+
*/
|
|
25
|
+
type: "own";
|
|
26
|
+
/**
|
|
27
|
+
* 获取自定义<li>标签元素
|
|
28
|
+
*/
|
|
29
|
+
getLiElementCallBack: (liElement: HTMLLIElement) => HTMLLIElement;
|
|
30
|
+
}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import type { PopsPanelCommonDetails } from "./components-common";
|
|
2
|
+
import type { PopsPanelFormsDetails } from "./components-forms";
|
|
3
|
+
import type { PopsPanelFormsTotalDetails } from ".";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* pops.panel的 select
|
|
7
|
+
*/
|
|
8
|
+
export interface PopsPanelSelectDetails<T = any> extends PopsPanelCommonDetails<PopsPanelSelectDetails> {
|
|
9
|
+
/**
|
|
10
|
+
* (可选)className属性
|
|
11
|
+
* @default ""
|
|
12
|
+
*/
|
|
13
|
+
className?: string;
|
|
14
|
+
/**
|
|
15
|
+
* (可选)自定义元素属性
|
|
16
|
+
* @default {}
|
|
17
|
+
*/
|
|
18
|
+
attributes?:
|
|
19
|
+
| {
|
|
20
|
+
[key: string]: any;
|
|
21
|
+
}
|
|
22
|
+
| {
|
|
23
|
+
[key: string]: any;
|
|
24
|
+
}[];
|
|
25
|
+
/**
|
|
26
|
+
* (可选)自定义属性
|
|
27
|
+
* @default {}
|
|
28
|
+
*/
|
|
29
|
+
props?: {
|
|
30
|
+
[K in keyof HTMLElement]?: HTMLElement[K];
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* 显示在左边的文字
|
|
34
|
+
*/
|
|
35
|
+
text: string;
|
|
36
|
+
/**
|
|
37
|
+
* (可选)左边的文字下面的描述
|
|
38
|
+
* @default ""
|
|
39
|
+
*/
|
|
40
|
+
description?: string;
|
|
41
|
+
/**
|
|
42
|
+
* 类型
|
|
43
|
+
*/
|
|
44
|
+
type: "select";
|
|
45
|
+
/**
|
|
46
|
+
* (可选)是否禁用
|
|
47
|
+
* @default false
|
|
48
|
+
*/
|
|
49
|
+
disabled?: boolean | (() => boolean);
|
|
50
|
+
/**
|
|
51
|
+
* 获取该项的值的回调函数
|
|
52
|
+
*/
|
|
53
|
+
getValue(): T;
|
|
54
|
+
/**
|
|
55
|
+
* 选择器的值改变触发的回调函数
|
|
56
|
+
* @param event 事件
|
|
57
|
+
* @param isSelectedValue 当前选中的值,也就是元素属性上的__value__
|
|
58
|
+
* @param isSelectedText 当前选中的文本
|
|
59
|
+
*/
|
|
60
|
+
callback?(event: PointerEvent | TouchEvent, isSelectedValue: T, isSelectedText: string): void;
|
|
61
|
+
/**
|
|
62
|
+
* 点击select元素触发该回调
|
|
63
|
+
* @param event 点击事件
|
|
64
|
+
* @param selectElement 当前的select元素
|
|
65
|
+
*/
|
|
66
|
+
clickCallBack?(event: PointerEvent | MouseEvent, selectElement: HTMLSelectElement): void;
|
|
67
|
+
/**
|
|
68
|
+
* 选择器内的数据组
|
|
69
|
+
*/
|
|
70
|
+
data: {
|
|
71
|
+
/**
|
|
72
|
+
* 真正的值
|
|
73
|
+
*/
|
|
74
|
+
value: T;
|
|
75
|
+
/**
|
|
76
|
+
* 显示的文字
|
|
77
|
+
*/
|
|
78
|
+
text: string;
|
|
79
|
+
/**
|
|
80
|
+
* (可选)是否禁用项
|
|
81
|
+
* 触发条件:
|
|
82
|
+
* + 点击select元素
|
|
83
|
+
* + select元素触发change事件
|
|
84
|
+
*/
|
|
85
|
+
disable?(value: T): boolean;
|
|
86
|
+
/**
|
|
87
|
+
* 子配置,跟随切换改变
|
|
88
|
+
*/
|
|
89
|
+
forms?:
|
|
90
|
+
| (PopsPanelFormsDetails | PopsPanelFormsTotalDetails)[]
|
|
91
|
+
| (() => (PopsPanelFormsDetails | PopsPanelFormsTotalDetails)[]);
|
|
92
|
+
}[];
|
|
93
|
+
}
|