@whitesev/pops 2.1.7 → 2.1.8
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 +127 -42
- package/dist/index.amd.js.map +1 -1
- package/dist/index.cjs.js +127 -42
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +127 -42
- package/dist/index.esm.js.map +1 -1
- package/dist/index.iife.js +127 -42
- package/dist/index.iife.js.map +1 -1
- package/dist/index.system.js +126 -41
- package/dist/index.system.js.map +1 -1
- package/dist/index.umd.js +127 -42
- package/dist/index.umd.js.map +1 -1
- package/dist/types/src/Pops.d.ts +1 -0
- package/dist/types/src/components/panel/handlerComponents.d.ts +5 -1
- package/dist/types/src/components/panel/types/components-button.d.ts +3 -1
- package/dist/types/src/components/panel/types/components-deepMenu.d.ts +3 -1
- package/dist/types/src/components/panel/types/components-forms.d.ts +3 -1
- package/dist/types/src/components/panel/types/components-input.d.ts +3 -1
- package/dist/types/src/components/panel/types/components-select.d.ts +3 -1
- package/dist/types/src/components/panel/types/components-selectMultiple.d.ts +3 -1
- package/dist/types/src/components/panel/types/components-slider.d.ts +3 -1
- package/dist/types/src/components/panel/types/components-switch.d.ts +3 -1
- package/dist/types/src/components/panel/types/components-textarea.d.ts +3 -1
- package/dist/types/src/components/panel/types/index.d.ts +44 -19
- package/package.json +5 -5
- package/src/Pops.ts +1 -1
- package/src/components/alert/index.ts +2 -2
- package/src/components/confirm/index.ts +2 -2
- package/src/components/drawer/index.ts +2 -2
- package/src/components/folder/index.ts +1 -1
- package/src/components/iframe/index.ts +1 -1
- package/src/components/loading/index.ts +3 -1
- package/src/components/panel/config.ts +46 -0
- package/src/components/panel/handlerComponents.ts +92 -33
- package/src/components/panel/index.css +60 -11
- package/src/components/panel/index.ts +5 -4
- package/src/components/panel/types/components-button.ts +7 -3
- package/src/components/panel/types/components-deepMenu.ts +7 -3
- package/src/components/panel/types/components-forms.ts +7 -3
- package/src/components/panel/types/components-input.ts +7 -3
- package/src/components/panel/types/components-select.ts +7 -3
- package/src/components/panel/types/components-selectMultiple.ts +7 -3
- package/src/components/panel/types/components-slider.ts +7 -3
- package/src/components/panel/types/components-switch.ts +7 -3
- package/src/components/panel/types/components-textarea.ts +7 -3
- package/src/components/panel/types/index.ts +59 -27
- package/src/components/prompt/index.ts +1 -1
package/dist/types/src/Pops.d.ts
CHANGED
|
@@ -209,6 +209,7 @@ declare class Pops {
|
|
|
209
209
|
/** pops.panel中用于处理各个类型的工具 */
|
|
210
210
|
PanelHandlerComponents: () => {
|
|
211
211
|
asideULElement: HTMLUListElement;
|
|
212
|
+
asideBottomULElement: HTMLUListElement;
|
|
212
213
|
sectionContainerHeaderULElement: HTMLUListElement;
|
|
213
214
|
sectionContainerULElement: HTMLUListElement;
|
|
214
215
|
$el: {
|
|
@@ -15,9 +15,13 @@ import type { PopsPanelTextAreaDetails } from "./types/components-textarea";
|
|
|
15
15
|
*/
|
|
16
16
|
export declare const PanelHandlerComponents: () => {
|
|
17
17
|
/**
|
|
18
|
-
*
|
|
18
|
+
* 左侧上方的的ul容器
|
|
19
19
|
*/
|
|
20
20
|
asideULElement: HTMLUListElement;
|
|
21
|
+
/**
|
|
22
|
+
* 左侧下方的ul容器
|
|
23
|
+
*/
|
|
24
|
+
asideBottomULElement: HTMLUListElement;
|
|
21
25
|
/**
|
|
22
26
|
* 右侧主内容的顶部文字ul容器
|
|
23
27
|
*/
|
|
@@ -35,37 +35,50 @@ export interface PopsPanelContentConfig {
|
|
|
35
35
|
*/
|
|
36
36
|
id: string;
|
|
37
37
|
/**
|
|
38
|
-
*
|
|
38
|
+
* (可选)元素的className,值为空的话就不设置
|
|
39
|
+
* @default ""
|
|
39
40
|
*/
|
|
40
41
|
className?: string | string[];
|
|
41
42
|
/**
|
|
42
43
|
* 左侧的标题,可以是html格式
|
|
43
44
|
*/
|
|
44
|
-
title: string;
|
|
45
|
+
title: string | (() => string);
|
|
45
46
|
/**
|
|
46
|
-
*
|
|
47
|
+
* (可选)中间顶部的标题,如果为空,则使用title的值代替
|
|
48
|
+
* @default title
|
|
47
49
|
*/
|
|
48
|
-
headerTitle?: string;
|
|
50
|
+
headerTitle?: string | (() => string);
|
|
49
51
|
/**
|
|
50
|
-
*
|
|
52
|
+
* (可选)是否是默认的,指打开弹窗的先显示出来的内容,默认为首位第一个项,如果多个配置都设置了isDefault的值为true,那么只有第一个值生效
|
|
53
|
+
* @default false
|
|
51
54
|
*/
|
|
52
|
-
|
|
55
|
+
isDefault?: boolean | (() => boolean);
|
|
53
56
|
/**
|
|
54
|
-
*
|
|
57
|
+
* (可选)是否是位于底部的
|
|
58
|
+
*
|
|
59
|
+
* 自上而下排序
|
|
60
|
+
* @default false
|
|
55
61
|
*/
|
|
56
|
-
|
|
62
|
+
isBottom?: boolean | (() => boolean);
|
|
63
|
+
/**
|
|
64
|
+
* (可选)是否禁用左侧项的hover的CSS样式
|
|
65
|
+
*/
|
|
66
|
+
disableAsideItemHoverCSS?: boolean | (() => boolean);
|
|
57
67
|
/**
|
|
58
68
|
* (可选)是否自动滚动到默认的项
|
|
69
|
+
* @default false
|
|
59
70
|
*/
|
|
60
71
|
scrollToDefaultView?: boolean;
|
|
61
72
|
/**
|
|
62
|
-
*
|
|
73
|
+
* (可选)自定义元素属性.setAttribute、.getAttribute
|
|
63
74
|
*/
|
|
64
75
|
attributes?: {
|
|
65
76
|
[key: string]: any;
|
|
66
|
-
}
|
|
77
|
+
} | {
|
|
78
|
+
[key: string]: any;
|
|
79
|
+
}[];
|
|
67
80
|
/**
|
|
68
|
-
*
|
|
81
|
+
* (可选)自定义元素内部的属性值
|
|
69
82
|
*/
|
|
70
83
|
props?: {
|
|
71
84
|
[K in keyof HTMLElement]?: HTMLElement[K];
|
|
@@ -74,16 +87,26 @@ export interface PopsPanelContentConfig {
|
|
|
74
87
|
* 子配置
|
|
75
88
|
*/
|
|
76
89
|
forms: (PopsPanelFormsDetails | PopsPanelFormsTotalDetails)[];
|
|
90
|
+
/**
|
|
91
|
+
* 左侧容器的点击回调(点击后第一个触发该回调)
|
|
92
|
+
* @returns
|
|
93
|
+
* + false 阻止默认行为
|
|
94
|
+
*/
|
|
95
|
+
clickFirstCallback?: (event: MouseEvent | PointerEvent, rightHeaderElement: HTMLUListElement, rightContainerElement: HTMLUListElement) => void | boolean | Promise<void | boolean>;
|
|
77
96
|
/**
|
|
78
97
|
* 左侧容器的点击回调
|
|
98
|
+
* @returns
|
|
99
|
+
* + false 阻止默认进入菜单详情
|
|
100
|
+
*/
|
|
101
|
+
clickCallback?: (event: MouseEvent | PointerEvent, rightHeaderElement: HTMLUListElement, rightContainerElement: HTMLUListElement) => void | boolean | Promise<void | boolean>;
|
|
102
|
+
/**
|
|
103
|
+
* 左侧项添加到panel后的回调
|
|
79
104
|
*/
|
|
80
|
-
|
|
105
|
+
afterRender?: (
|
|
81
106
|
/**
|
|
82
|
-
*
|
|
83
|
-
* @param rightHeaderElement
|
|
84
|
-
* @param rightContainerElement
|
|
107
|
+
* 配置
|
|
85
108
|
*/
|
|
86
|
-
|
|
109
|
+
data: {
|
|
87
110
|
/** 容器配置 */
|
|
88
111
|
asideConfig: PopsPanelContentConfig;
|
|
89
112
|
/** 左侧容器的元素 */
|
|
@@ -99,16 +122,18 @@ export interface PopsPanelDetails extends PopsTitleConfig, PopsDragConfig, PopsC
|
|
|
99
122
|
*/
|
|
100
123
|
content: PopsPanelContentConfig[];
|
|
101
124
|
/**
|
|
102
|
-
*
|
|
125
|
+
* 右上角的按钮配置
|
|
103
126
|
*/
|
|
104
127
|
btn?: {
|
|
105
128
|
/**
|
|
106
|
-
*
|
|
129
|
+
* 关闭按钮
|
|
107
130
|
*/
|
|
108
131
|
close?: PopsHeaderCloseButtonDetails;
|
|
109
132
|
};
|
|
110
133
|
/**
|
|
111
|
-
* 移动端适配的的className
|
|
134
|
+
* 移动端适配的的className
|
|
135
|
+
*
|
|
136
|
+
* @default "pops-panel-is-mobile"
|
|
112
137
|
*/
|
|
113
138
|
mobileClassName?: string;
|
|
114
139
|
/**
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/package.json",
|
|
3
3
|
"name": "@whitesev/pops",
|
|
4
|
-
"version": "2.1.
|
|
4
|
+
"version": "2.1.8",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description": "弹窗库",
|
|
7
7
|
"main": "dist/index.cjs.js",
|
|
@@ -50,9 +50,9 @@
|
|
|
50
50
|
"typescript": "^5.8.3"
|
|
51
51
|
},
|
|
52
52
|
"scripts": {
|
|
53
|
-
"dev": "rollup
|
|
54
|
-
"build": "rollup
|
|
55
|
-
"build:all": "rollup
|
|
56
|
-
"build:all-new": "rollup
|
|
53
|
+
"dev": "npx rollup -c -w",
|
|
54
|
+
"build": "npx rollup -c",
|
|
55
|
+
"build:all": "npx rollup -c",
|
|
56
|
+
"build:all-new": "npx rollup -c"
|
|
57
57
|
}
|
|
58
58
|
}
|
package/src/Pops.ts
CHANGED
|
@@ -53,12 +53,12 @@ export const PopsAlert = {
|
|
|
53
53
|
};${headerStyle}">${
|
|
54
54
|
config.title.html
|
|
55
55
|
? config.title.text
|
|
56
|
-
: `<p pops style="${headerPStyle}">${config.title.text}</p>`
|
|
56
|
+
: `<p pops class="pops-${PopsType}-title-text" style="${headerPStyle}">${config.title.text}</p>`
|
|
57
57
|
}${headerBtnHTML}</div>
|
|
58
58
|
<div class="pops-content pops-${PopsType}-content" style="${contentStyle}">${
|
|
59
59
|
config.content.html
|
|
60
60
|
? config.content.text
|
|
61
|
-
: `<p pops style="${contentPStyle}">${config.content.text}</p>`
|
|
61
|
+
: `<p pops class="pops-${PopsType}-content-text" style="${contentPStyle}">${config.content.text}</p>`
|
|
62
62
|
}</div>${bottomBtnHTML}`,
|
|
63
63
|
bottomBtnHTML,
|
|
64
64
|
zIndex
|
|
@@ -53,12 +53,12 @@ export const PopsConfirm = {
|
|
|
53
53
|
};${headerStyle}">${
|
|
54
54
|
config.title.html
|
|
55
55
|
? config.title.text
|
|
56
|
-
: `<p pops style="${headerPStyle}">${config.title.text}</p>`
|
|
56
|
+
: `<p pops class="pops-${PopsType}-title-text" style="${headerPStyle}">${config.title.text}</p>`
|
|
57
57
|
}${headerBtnHTML}</div>
|
|
58
58
|
<div class="pops-content pops-${PopsType}-content" style="${contentStyle}">${
|
|
59
59
|
config.content.html
|
|
60
60
|
? config.content.text
|
|
61
|
-
: `<p pops style="${contentPStyle}">${config.content.text}</p>`
|
|
61
|
+
: `<p pops class="pops-${PopsType}-content-text" style="${contentPStyle}">${config.content.text}</p>`
|
|
62
62
|
}</div>${bottomBtnHTML}`,
|
|
63
63
|
bottomBtnHTML,
|
|
64
64
|
zIndex
|
|
@@ -52,14 +52,14 @@ export const PopsDrawer = {
|
|
|
52
52
|
? /*html*/ `<div class="pops-title pops-${PopsType}-title" style="${headerStyle}">${
|
|
53
53
|
config.title.html
|
|
54
54
|
? config.title.text
|
|
55
|
-
: /*html*/ `<p pops style="width: 100%;text-align: ${config.title.position};${headerPStyle}">${config.title.text}</p>`
|
|
55
|
+
: /*html*/ `<p pops class="pops-${PopsType}-title-text" style="width: 100%;text-align: ${config.title.position};${headerPStyle}">${config.title.text}</p>`
|
|
56
56
|
}${headerBtnHTML}</div>`
|
|
57
57
|
: ""
|
|
58
58
|
}
|
|
59
59
|
<div class="pops-content pops-${PopsType}-content" style="${contentStyle}">${
|
|
60
60
|
config.content.html
|
|
61
61
|
? config.content.text
|
|
62
|
-
: `<p pops style="${contentPStyle}">${config.content.text}</p>`
|
|
62
|
+
: `<p pops class="pops-${PopsType}-content-text" style="${contentPStyle}">${config.content.text}</p>`
|
|
63
63
|
}</div>${bottomBtnHTML}`,
|
|
64
64
|
bottomBtnHTML,
|
|
65
65
|
zIndex
|
|
@@ -127,7 +127,7 @@ export const PopsFolder = {
|
|
|
127
127
|
};${headerStyle}">${
|
|
128
128
|
config.title.html
|
|
129
129
|
? config.title.text
|
|
130
|
-
: `<p pops style="${headerPStyle}">${config.title.text}</p>`
|
|
130
|
+
: `<p pops class="pops-${PopsType}-title-text" style="${headerPStyle}">${config.title.text}</p>`
|
|
131
131
|
}${headerBtnHTML}</div>
|
|
132
132
|
<div class="pops-content pops-${PopsType}-content ${
|
|
133
133
|
popsUtils.isPhone() ? "pops-mobile-folder-content" : ""
|
|
@@ -63,7 +63,7 @@ export const PopsIframe = {
|
|
|
63
63
|
};${headerStyle}">${
|
|
64
64
|
config.title.html
|
|
65
65
|
? titleText
|
|
66
|
-
: `<p pops style="${headerPStyle}">${titleText}</p>`
|
|
66
|
+
: `<p pops class="pops-${PopsType}-title-text" style="${headerPStyle}">${titleText}</p>`
|
|
67
67
|
}${headerBtnHTML}</div>
|
|
68
68
|
<div class="pops-content pops-${PopsType}-content">
|
|
69
69
|
<div class="pops-${PopsType}-content-global-loading"></div>
|
|
@@ -43,7 +43,9 @@ export const PopsLoading = {
|
|
|
43
43
|
${PopsCSS.loadingCSS}
|
|
44
44
|
</style>
|
|
45
45
|
${config.style != null ? `<style>${config.style}</style>` : ""}
|
|
46
|
-
<p pops style="${contentPStyle}">${
|
|
46
|
+
<p pops class="pops-${PopsType}-content-text" style="${contentPStyle}">${
|
|
47
|
+
config.content.text
|
|
48
|
+
}</p>
|
|
47
49
|
</div>`,
|
|
48
50
|
"",
|
|
49
51
|
zIndex
|
|
@@ -432,6 +432,52 @@ export const PopsPanelConfig = (): DeepRequired<PopsPanelDetails> => {
|
|
|
432
432
|
},
|
|
433
433
|
],
|
|
434
434
|
},
|
|
435
|
+
{
|
|
436
|
+
id: "whitesev-panel-bottom-config-1",
|
|
437
|
+
title: /*html*/ `
|
|
438
|
+
<a rel="nofollow" href="https://www.npmjs.com/package/@whitesev/pops" target="_blank"><img src="https://img.shields.io/npm/v/@whitesev/pops?label=pops" alt="npm pops version"></a>
|
|
439
|
+
`,
|
|
440
|
+
isBottom: true,
|
|
441
|
+
disableAsideItemHoverCSS: true,
|
|
442
|
+
attributes: [
|
|
443
|
+
{
|
|
444
|
+
"data-value": "value",
|
|
445
|
+
"data-value-2": "value2",
|
|
446
|
+
},
|
|
447
|
+
],
|
|
448
|
+
// @ts-ignore
|
|
449
|
+
props: {},
|
|
450
|
+
forms: [],
|
|
451
|
+
clickFirstCallback: function (
|
|
452
|
+
event: MouseEvent | PointerEvent,
|
|
453
|
+
rightHeaderElement: HTMLUListElement,
|
|
454
|
+
rightContainerElement: HTMLUListElement
|
|
455
|
+
) {
|
|
456
|
+
return false;
|
|
457
|
+
},
|
|
458
|
+
},
|
|
459
|
+
{
|
|
460
|
+
id: "whitesev-panel-bottom-config-2",
|
|
461
|
+
// @ts-ignore
|
|
462
|
+
title: "版本:" + pops.config.version,
|
|
463
|
+
isBottom: true,
|
|
464
|
+
attributes: [
|
|
465
|
+
{
|
|
466
|
+
"data-value": "value",
|
|
467
|
+
"data-value-2": "value2",
|
|
468
|
+
},
|
|
469
|
+
],
|
|
470
|
+
// @ts-ignore
|
|
471
|
+
props: {},
|
|
472
|
+
forms: [],
|
|
473
|
+
clickFirstCallback: function (
|
|
474
|
+
event: MouseEvent | PointerEvent,
|
|
475
|
+
rightHeaderElement: HTMLUListElement,
|
|
476
|
+
rightContainerElement: HTMLUListElement
|
|
477
|
+
) {
|
|
478
|
+
return false;
|
|
479
|
+
},
|
|
480
|
+
},
|
|
435
481
|
],
|
|
436
482
|
btn: {
|
|
437
483
|
close: {
|
|
@@ -34,9 +34,13 @@ import type { PopsPanelTextAreaDetails } from "./types/components-textarea";
|
|
|
34
34
|
export const PanelHandlerComponents = () => {
|
|
35
35
|
return {
|
|
36
36
|
/**
|
|
37
|
-
*
|
|
37
|
+
* 左侧上方的的ul容器
|
|
38
38
|
*/
|
|
39
39
|
asideULElement: null as any as HTMLUListElement,
|
|
40
|
+
/**
|
|
41
|
+
* 左侧下方的ul容器
|
|
42
|
+
*/
|
|
43
|
+
asideBottomULElement: null as any as HTMLUListElement,
|
|
40
44
|
/**
|
|
41
45
|
* 右侧主内容的顶部文字ul容器
|
|
42
46
|
*/
|
|
@@ -71,31 +75,48 @@ export const PanelHandlerComponents = () => {
|
|
|
71
75
|
$contentSectionContainer: HTMLElement;
|
|
72
76
|
};
|
|
73
77
|
}) {
|
|
78
|
+
const PopsType = "panel";
|
|
74
79
|
this.$el = {
|
|
75
80
|
...details.$el,
|
|
76
81
|
};
|
|
77
82
|
|
|
78
83
|
this.asideULElement =
|
|
79
|
-
this.$el.$contentAside.querySelector<HTMLUListElement>(
|
|
84
|
+
this.$el.$contentAside.querySelector<HTMLUListElement>(
|
|
85
|
+
`ul.pops-${PopsType}-aside-top-container`
|
|
86
|
+
)!;
|
|
87
|
+
this.asideBottomULElement =
|
|
88
|
+
this.$el.$contentAside.querySelector<HTMLUListElement>(
|
|
89
|
+
`ul.pops-${PopsType}-aside-bottom-container`
|
|
90
|
+
)!;
|
|
80
91
|
this.sectionContainerHeaderULElement =
|
|
81
|
-
this.$el.$contentSectionContainer.
|
|
82
|
-
|
|
83
|
-
)
|
|
92
|
+
this.$el.$contentSectionContainer.querySelector<HTMLUListElement>(
|
|
93
|
+
`ul.pops-${PopsType}-container-header-ul`
|
|
94
|
+
)!;
|
|
84
95
|
this.sectionContainerULElement =
|
|
85
|
-
this.$el.$contentSectionContainer.
|
|
86
|
-
|
|
87
|
-
)
|
|
96
|
+
this.$el.$contentSectionContainer.querySelector<HTMLUListElement>(
|
|
97
|
+
`ul.pops-${PopsType}-container-main-ul`
|
|
98
|
+
)!;
|
|
88
99
|
/**
|
|
89
100
|
* 默认点击的左侧容器项
|
|
90
101
|
*/
|
|
91
|
-
let $
|
|
102
|
+
let $defaultAsideItem: HTMLLIElement | null = null;
|
|
92
103
|
/** 是否滚动到默认位置(第一个项) */
|
|
93
104
|
let isScrollToDefaultView = false;
|
|
105
|
+
// 初始化配置
|
|
94
106
|
details.config.content.forEach((asideItemConfig) => {
|
|
95
107
|
let $asideLiElement = this.createAsideItem(asideItemConfig);
|
|
96
108
|
this.setAsideItemClickEvent($asideLiElement, asideItemConfig);
|
|
97
|
-
|
|
98
|
-
|
|
109
|
+
// 是否处于底部
|
|
110
|
+
let isBottom =
|
|
111
|
+
typeof asideItemConfig.isBottom === "function"
|
|
112
|
+
? asideItemConfig.isBottom()
|
|
113
|
+
: asideItemConfig.isBottom;
|
|
114
|
+
if (isBottom) {
|
|
115
|
+
this.asideBottomULElement.appendChild($asideLiElement);
|
|
116
|
+
} else {
|
|
117
|
+
this.asideULElement.appendChild($asideLiElement);
|
|
118
|
+
}
|
|
119
|
+
if ($defaultAsideItem == null) {
|
|
99
120
|
let flag = false;
|
|
100
121
|
if (typeof asideItemConfig.isDefault === "function") {
|
|
101
122
|
flag = Boolean(asideItemConfig.isDefault());
|
|
@@ -103,7 +124,7 @@ export const PanelHandlerComponents = () => {
|
|
|
103
124
|
flag = Boolean(asideItemConfig.isDefault);
|
|
104
125
|
}
|
|
105
126
|
if (flag) {
|
|
106
|
-
$
|
|
127
|
+
$defaultAsideItem = $asideLiElement;
|
|
107
128
|
isScrollToDefaultView = Boolean(
|
|
108
129
|
asideItemConfig.scrollToDefaultView
|
|
109
130
|
);
|
|
@@ -119,19 +140,15 @@ export const PanelHandlerComponents = () => {
|
|
|
119
140
|
});
|
|
120
141
|
|
|
121
142
|
/* 点击左侧列表 */
|
|
122
|
-
if (
|
|
123
|
-
$asideDefaultItemElement == null &&
|
|
124
|
-
this.asideULElement.children.length
|
|
125
|
-
) {
|
|
143
|
+
if ($defaultAsideItem == null && this.asideULElement.children.length) {
|
|
126
144
|
/* 默认第一个 */
|
|
127
|
-
$
|
|
128
|
-
.children[0] as HTMLLIElement;
|
|
145
|
+
$defaultAsideItem = <HTMLLIElement>this.asideULElement.children[0];
|
|
129
146
|
}
|
|
130
|
-
if ($
|
|
147
|
+
if ($defaultAsideItem) {
|
|
131
148
|
/* 点击选择的那一项 */
|
|
132
|
-
$
|
|
149
|
+
$defaultAsideItem.click();
|
|
133
150
|
if (isScrollToDefaultView) {
|
|
134
|
-
$
|
|
151
|
+
$defaultAsideItem?.scrollIntoView();
|
|
135
152
|
}
|
|
136
153
|
} else {
|
|
137
154
|
console.error("pops.panel:左侧容器没有项");
|
|
@@ -239,11 +256,28 @@ export const PanelHandlerComponents = () => {
|
|
|
239
256
|
let $li = document.createElement("li");
|
|
240
257
|
$li.id = asideConfig.id;
|
|
241
258
|
Reflect.set($li, "__forms__", asideConfig.forms);
|
|
242
|
-
|
|
259
|
+
let title =
|
|
260
|
+
typeof asideConfig.title === "function"
|
|
261
|
+
? asideConfig.title()
|
|
262
|
+
: asideConfig.title;
|
|
263
|
+
PopsSafeUtils.setSafeHTML($li, title);
|
|
243
264
|
/* 处理className */
|
|
244
265
|
this.setElementClassName($li, asideConfig.className);
|
|
245
266
|
this.setElementAttributes($li, asideConfig.attributes);
|
|
246
267
|
this.setElementProps($li, asideConfig.props);
|
|
268
|
+
/** 禁用左侧项的hover的CSS样式的类名 */
|
|
269
|
+
const disableAsideItemHoverCSSClassName =
|
|
270
|
+
"pops-panel-disabled-aside-hover-css";
|
|
271
|
+
/** 是否禁用左侧项的hover的CSS样式 */
|
|
272
|
+
let disableAsideItemHoverCSS =
|
|
273
|
+
typeof asideConfig.disableAsideItemHoverCSS === "function"
|
|
274
|
+
? asideConfig.disableAsideItemHoverCSS()
|
|
275
|
+
: asideConfig.disableAsideItemHoverCSS;
|
|
276
|
+
if (disableAsideItemHoverCSS) {
|
|
277
|
+
$li.classList.add(disableAsideItemHoverCSSClassName);
|
|
278
|
+
} else {
|
|
279
|
+
$li.classList.remove(disableAsideItemHoverCSSClassName);
|
|
280
|
+
}
|
|
247
281
|
return $li;
|
|
248
282
|
},
|
|
249
283
|
/**
|
|
@@ -2977,28 +3011,47 @@ export const PanelHandlerComponents = () => {
|
|
|
2977
3011
|
asideLiElement: HTMLElement,
|
|
2978
3012
|
asideConfig: PopsPanelContentConfig
|
|
2979
3013
|
) {
|
|
2980
|
-
const that = this;
|
|
2981
3014
|
popsDOMUtils.on<MouseEvent | PointerEvent>(
|
|
2982
3015
|
asideLiElement,
|
|
2983
3016
|
"click",
|
|
2984
|
-
|
|
2985
|
-
|
|
3017
|
+
async (event) => {
|
|
3018
|
+
if (typeof asideConfig.clickFirstCallback === "function") {
|
|
3019
|
+
let clickFirstCallbackResult = await asideConfig.clickFirstCallback(
|
|
3020
|
+
event,
|
|
3021
|
+
this.sectionContainerHeaderULElement,
|
|
3022
|
+
this.sectionContainerULElement
|
|
3023
|
+
);
|
|
3024
|
+
if (
|
|
3025
|
+
typeof clickFirstCallbackResult === "boolean" &&
|
|
3026
|
+
!clickFirstCallbackResult
|
|
3027
|
+
) {
|
|
3028
|
+
return;
|
|
3029
|
+
}
|
|
3030
|
+
}
|
|
2986
3031
|
this.clearContainer();
|
|
2987
|
-
let rightContainerFormConfig = Reflect.get(
|
|
3032
|
+
let rightContainerFormConfig: PopsPanelContentConfig[] = Reflect.get(
|
|
2988
3033
|
asideLiElement,
|
|
2989
3034
|
"__forms__"
|
|
2990
|
-
)
|
|
3035
|
+
);
|
|
2991
3036
|
|
|
2992
3037
|
Reflect.set(
|
|
2993
|
-
|
|
3038
|
+
this.$el.$contentSectionContainer,
|
|
2994
3039
|
"__formConfig__",
|
|
2995
3040
|
rightContainerFormConfig
|
|
2996
3041
|
);
|
|
2997
|
-
popsDOMUtils.cssShow(
|
|
3042
|
+
popsDOMUtils.cssShow(this.$el.$contentSectionContainer);
|
|
2998
3043
|
this.clearAsideItemIsVisited();
|
|
2999
3044
|
this.setAsideItemIsVisited(asideLiElement);
|
|
3000
3045
|
/* 顶部标题栏,存在就设置 */
|
|
3001
|
-
let
|
|
3046
|
+
let title =
|
|
3047
|
+
typeof asideConfig.title === "function"
|
|
3048
|
+
? asideConfig.title()
|
|
3049
|
+
: asideConfig.title;
|
|
3050
|
+
let headerTitleText =
|
|
3051
|
+
typeof asideConfig.headerTitle === "function"
|
|
3052
|
+
? asideConfig.headerTitle()
|
|
3053
|
+
: asideConfig.headerTitle;
|
|
3054
|
+
headerTitleText = headerTitleText ?? title;
|
|
3002
3055
|
if (
|
|
3003
3056
|
typeof headerTitleText === "string" &&
|
|
3004
3057
|
headerTitleText.trim() !== ""
|
|
@@ -3015,15 +3068,21 @@ export const PanelHandlerComponents = () => {
|
|
|
3015
3068
|
this.createSectionContainerItem_forms(formConfig);
|
|
3016
3069
|
});
|
|
3017
3070
|
|
|
3018
|
-
if (typeof asideConfig.
|
|
3071
|
+
if (typeof asideConfig.clickCallback === "function") {
|
|
3019
3072
|
/* 执行回调 */
|
|
3020
|
-
asideConfig.
|
|
3073
|
+
let asideClickCallbackResult = await asideConfig.clickCallback(
|
|
3021
3074
|
event,
|
|
3022
3075
|
this.sectionContainerHeaderULElement,
|
|
3023
3076
|
this.sectionContainerULElement
|
|
3024
3077
|
);
|
|
3078
|
+
if (
|
|
3079
|
+
typeof asideClickCallbackResult === "boolean" &&
|
|
3080
|
+
!asideClickCallbackResult
|
|
3081
|
+
) {
|
|
3082
|
+
return;
|
|
3083
|
+
}
|
|
3025
3084
|
}
|
|
3026
|
-
|
|
3085
|
+
this.triggerRenderRightContainer(this.$el.$contentSectionContainer);
|
|
3027
3086
|
}
|
|
3028
3087
|
);
|
|
3029
3088
|
},
|