@whitesev/pops 2.5.0 → 2.5.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.
- package/dist/index.amd.js +319 -159
- package/dist/index.amd.js.map +1 -1
- package/dist/index.amd.min.js +1 -1
- package/dist/index.amd.min.js.map +1 -1
- package/dist/index.cjs.js +319 -159
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.cjs.min.js +1 -1
- package/dist/index.cjs.min.js.map +1 -1
- package/dist/index.esm.js +319 -159
- package/dist/index.esm.js.map +1 -1
- package/dist/index.esm.min.js +1 -1
- package/dist/index.esm.min.js.map +1 -1
- package/dist/index.iife.js +319 -159
- package/dist/index.iife.js.map +1 -1
- package/dist/index.iife.min.js +1 -1
- package/dist/index.iife.min.js.map +1 -1
- package/dist/index.system.js +319 -159
- package/dist/index.system.js.map +1 -1
- package/dist/index.system.min.js +1 -1
- package/dist/index.system.min.js.map +1 -1
- package/dist/index.umd.js +319 -159
- package/dist/index.umd.js.map +1 -1
- package/dist/index.umd.min.js +1 -1
- package/dist/index.umd.min.js.map +1 -1
- package/dist/types/src/Pops.d.ts +23 -19
- package/dist/types/src/components/panel/handlerComponents.d.ts +40 -21
- package/dist/types/src/components/panel/types/components-button.d.ts +8 -19
- package/dist/types/src/components/panel/types/components-common.d.ts +23 -0
- package/dist/types/src/components/panel/types/components-deepMenu.d.ts +0 -18
- package/dist/types/src/components/panel/types/components-forms.d.ts +0 -18
- package/dist/types/src/components/panel/types/components-input.d.ts +0 -21
- package/dist/types/src/components/panel/types/components-own.d.ts +0 -14
- package/dist/types/src/components/panel/types/components-select.d.ts +0 -21
- package/dist/types/src/components/panel/types/components-selectMultiple.d.ts +0 -18
- package/dist/types/src/components/panel/types/components-slider.d.ts +0 -19
- package/dist/types/src/components/panel/types/components-switch.d.ts +0 -21
- package/dist/types/src/components/panel/types/components-textarea.d.ts +0 -21
- package/dist/types/src/components/panel/types/index.d.ts +76 -11
- package/dist/types/src/components/rightClickMenu/index.d.ts +2 -8
- package/dist/types/src/handler/PopsHandler.d.ts +44 -28
- package/dist/types/src/types/global.d.ts +11 -9
- package/dist/types/src/utils/PopsDOMUtils.d.ts +1 -1
- package/package.json +1 -1
- package/src/PopsAnimation.ts +6 -6
- package/src/components/alert/index.ts +4 -4
- package/src/components/confirm/index.ts +6 -6
- package/src/components/drawer/index.ts +7 -2
- package/src/components/folder/index.ts +22 -22
- package/src/components/iframe/index.ts +13 -12
- package/src/components/loading/index.ts +1 -1
- package/src/components/panel/config.ts +58 -5
- package/src/components/panel/handlerComponents.ts +161 -74
- package/src/components/panel/index.css +30 -6
- package/src/components/panel/index.ts +30 -15
- package/src/components/panel/types/components-button.ts +8 -21
- package/src/components/panel/types/components-common.ts +27 -0
- package/src/components/panel/types/components-deepMenu.ts +0 -20
- package/src/components/panel/types/components-forms.ts +0 -20
- package/src/components/panel/types/components-input.ts +0 -23
- package/src/components/panel/types/components-own.ts +0 -14
- package/src/components/panel/types/components-select.ts +0 -23
- package/src/components/panel/types/components-selectMultiple.ts +0 -20
- package/src/components/panel/types/components-slider.ts +0 -21
- package/src/components/panel/types/components-switch.ts +0 -23
- package/src/components/panel/types/components-textarea.ts +0 -23
- package/src/components/panel/types/index.ts +81 -13
- package/src/components/prompt/index.ts +7 -7
- package/src/components/searchSuggestion/index.ts +5 -11
- package/src/handler/PopsHandler.ts +47 -30
- package/src/types/global.d.ts +11 -9
- package/src/utils/PopsDOMUtils.ts +14 -14
|
@@ -12,7 +12,13 @@ import type { PopsPanelButtonDetails } from "./types/components-button";
|
|
|
12
12
|
import type { PopsPanelRightAsideContainerOptions } from "./types/components-common";
|
|
13
13
|
import type { PopsPanelDeepMenuDetails } from "./types/components-deepMenu";
|
|
14
14
|
import type { PopsPanelFormsDetails } from "./types/components-forms";
|
|
15
|
-
import type {
|
|
15
|
+
import type {
|
|
16
|
+
PopsPanelBottomContentConfig,
|
|
17
|
+
PopsPanelContentConfig,
|
|
18
|
+
PopsPanelDetails,
|
|
19
|
+
PopsPanelEventType,
|
|
20
|
+
PopsPanelFormsTotalDetails,
|
|
21
|
+
} from "./types";
|
|
16
22
|
import type { PopsPanelInputDetails } from "./types/components-input";
|
|
17
23
|
import type { PopsPanelOwnDetails } from "./types/components-own";
|
|
18
24
|
import type {
|
|
@@ -53,11 +59,15 @@ export const PanelHandlerComponents = () => {
|
|
|
53
59
|
/** 内容 */
|
|
54
60
|
$content: null as any as HTMLElement,
|
|
55
61
|
/** section元素的包裹容器 */
|
|
56
|
-
$
|
|
62
|
+
$panelRightSectionWrapper: null as any as HTMLElement,
|
|
57
63
|
/** 左侧容器 */
|
|
58
|
-
$
|
|
64
|
+
$panelLeftAside: null as any as HTMLElement,
|
|
59
65
|
/** 右侧容器 */
|
|
60
|
-
$
|
|
66
|
+
$panelContentSectionContainer: null as any as HTMLElement,
|
|
67
|
+
$panelBottomWrapper: null as any as HTMLElement,
|
|
68
|
+
$panelBottomContainer: null as any as HTMLElement,
|
|
69
|
+
$panelBottomLeftContainer: null as any as HTMLElement,
|
|
70
|
+
$panelBottomRightContainer: null as any as HTMLElement,
|
|
61
71
|
},
|
|
62
72
|
$config: {} as Required<PopsPanelDetails>,
|
|
63
73
|
/**
|
|
@@ -69,9 +79,13 @@ export const PanelHandlerComponents = () => {
|
|
|
69
79
|
$el: {
|
|
70
80
|
$pops: HTMLElement;
|
|
71
81
|
$content: HTMLElement;
|
|
72
|
-
$
|
|
73
|
-
$
|
|
74
|
-
$
|
|
82
|
+
$panelRightSectionWrapper: HTMLElement;
|
|
83
|
+
$panelLeftAside: HTMLElement;
|
|
84
|
+
$panelContentSectionContainer: HTMLElement;
|
|
85
|
+
$panelBottomWrapper: HTMLElement;
|
|
86
|
+
$panelBottomContainer: HTMLElement;
|
|
87
|
+
$panelBottomLeftContainer: HTMLElement;
|
|
88
|
+
$panelBottomRightContainer: HTMLElement;
|
|
75
89
|
};
|
|
76
90
|
}) {
|
|
77
91
|
const PopsType = "panel";
|
|
@@ -80,16 +94,16 @@ export const PanelHandlerComponents = () => {
|
|
|
80
94
|
};
|
|
81
95
|
this.$config = details.config;
|
|
82
96
|
|
|
83
|
-
this.asideULElement = this.$el.$
|
|
97
|
+
this.asideULElement = this.$el.$panelLeftAside.querySelector<HTMLUListElement>(
|
|
84
98
|
`ul.pops-${PopsType}-aside-top-container`
|
|
85
99
|
)!;
|
|
86
|
-
this.asideBottomULElement = this.$el.$
|
|
100
|
+
this.asideBottomULElement = this.$el.$panelLeftAside.querySelector<HTMLUListElement>(
|
|
87
101
|
`ul.pops-${PopsType}-aside-bottom-container`
|
|
88
102
|
)!;
|
|
89
|
-
this.sectionContainerHeaderULElement = this.$el.$
|
|
103
|
+
this.sectionContainerHeaderULElement = this.$el.$panelContentSectionContainer.querySelector<HTMLUListElement>(
|
|
90
104
|
`ul.pops-${PopsType}-container-header-ul`
|
|
91
105
|
)!;
|
|
92
|
-
this.sectionContainerULElement = this.$el.$
|
|
106
|
+
this.sectionContainerULElement = this.$el.$panelContentSectionContainer.querySelector<HTMLUListElement>(
|
|
93
107
|
`ul.pops-${PopsType}-container-main-ul`
|
|
94
108
|
)!;
|
|
95
109
|
/**
|
|
@@ -98,7 +112,7 @@ export const PanelHandlerComponents = () => {
|
|
|
98
112
|
let $defaultAsideItem: HTMLLIElement | null = null;
|
|
99
113
|
/** 是否滚动到默认位置(第一个项) */
|
|
100
114
|
let isScrollToDefaultView = false;
|
|
101
|
-
//
|
|
115
|
+
// 初始化内容配置
|
|
102
116
|
details.config.content.forEach((asideItemConfig) => {
|
|
103
117
|
const $asideLiElement = this.createAsideItem(asideItemConfig);
|
|
104
118
|
this.setAsideItemClickEvent($asideLiElement, asideItemConfig);
|
|
@@ -130,6 +144,27 @@ export const PanelHandlerComponents = () => {
|
|
|
130
144
|
});
|
|
131
145
|
}
|
|
132
146
|
});
|
|
147
|
+
// 初始化底部内容配置
|
|
148
|
+
(details.config?.bottomContentConfig || []).forEach((bottomItemConfig) => {
|
|
149
|
+
const $bottomLiElement = this.createBottomItem(bottomItemConfig);
|
|
150
|
+
this.setBottomItemClickEvent($bottomLiElement, bottomItemConfig);
|
|
151
|
+
if (bottomItemConfig.position === "left" || bottomItemConfig.position == null) {
|
|
152
|
+
this.$el.$panelBottomLeftContainer.appendChild($bottomLiElement);
|
|
153
|
+
} else if (bottomItemConfig.position === "right") {
|
|
154
|
+
this.$el.$panelBottomRightContainer.appendChild($bottomLiElement);
|
|
155
|
+
} else {
|
|
156
|
+
throw new Error("pops.panel:bottomContentConfig.position参数错误");
|
|
157
|
+
}
|
|
158
|
+
if (typeof bottomItemConfig.afterRender === "function") {
|
|
159
|
+
// 执行渲染完毕的回调
|
|
160
|
+
bottomItemConfig.afterRender({
|
|
161
|
+
$bottomWrapper: this.$el.$panelBottomWrapper,
|
|
162
|
+
$bottomContainer: this.$el.$panelBottomContainer,
|
|
163
|
+
$bottomLeftContainer: this.$el.$panelBottomLeftContainer,
|
|
164
|
+
$bottomRightContainer: this.$el.$panelBottomRightContainer,
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
});
|
|
133
168
|
|
|
134
169
|
/* 点击左侧列表 */
|
|
135
170
|
if ($defaultAsideItem == null && this.asideULElement.children.length) {
|
|
@@ -150,7 +185,7 @@ export const PanelHandlerComponents = () => {
|
|
|
150
185
|
* 清空container容器的元素
|
|
151
186
|
*/
|
|
152
187
|
clearContainer() {
|
|
153
|
-
Reflect.deleteProperty(this.$el.$
|
|
188
|
+
Reflect.deleteProperty(this.$el.$panelContentSectionContainer, "__formConfig__");
|
|
154
189
|
PopsSafeUtils.setSafeHTML(this.sectionContainerHeaderULElement, "");
|
|
155
190
|
PopsSafeUtils.setSafeHTML(this.sectionContainerULElement, "");
|
|
156
191
|
this.clearDeepMenuContainer();
|
|
@@ -159,7 +194,7 @@ export const PanelHandlerComponents = () => {
|
|
|
159
194
|
* 清空deepMenu的容器元素
|
|
160
195
|
*/
|
|
161
196
|
clearDeepMenuContainer() {
|
|
162
|
-
this.$el.$
|
|
197
|
+
this.$el.$panelRightSectionWrapper
|
|
163
198
|
?.querySelectorAll("section.pops-panel-deepMenu-container")
|
|
164
199
|
.forEach(($el) => $el.remove());
|
|
165
200
|
},
|
|
@@ -167,60 +202,60 @@ export const PanelHandlerComponents = () => {
|
|
|
167
202
|
* 清空左侧容器已访问记录
|
|
168
203
|
*/
|
|
169
204
|
clearAsideItemIsVisited() {
|
|
170
|
-
this.$el.$
|
|
205
|
+
this.$el.$panelLeftAside.querySelectorAll<HTMLDivElement>(".pops-is-visited").forEach(($el) => {
|
|
171
206
|
popsDOMUtils.removeClassName($el, "pops-is-visited");
|
|
172
207
|
});
|
|
173
208
|
},
|
|
174
209
|
/**
|
|
175
210
|
* 设置左侧容器已访问记录
|
|
176
|
-
* @param
|
|
211
|
+
* @param $el
|
|
177
212
|
*/
|
|
178
|
-
setAsideItemIsVisited(
|
|
179
|
-
popsDOMUtils.addClassName(
|
|
213
|
+
setAsideItemIsVisited($el: HTMLElement) {
|
|
214
|
+
popsDOMUtils.addClassName($el, "pops-is-visited");
|
|
180
215
|
},
|
|
181
216
|
/**
|
|
182
217
|
* 为元素添加自定义属性
|
|
183
|
-
* @param
|
|
184
|
-
* @param attributes
|
|
218
|
+
* @param $el 元素
|
|
219
|
+
* @param attributes 属性
|
|
185
220
|
*/
|
|
186
|
-
setElementAttributes(
|
|
221
|
+
setElementAttributes($el: HTMLElement, attributes?: any) {
|
|
187
222
|
if (attributes == null) {
|
|
188
223
|
return;
|
|
189
224
|
}
|
|
190
225
|
if (Array.isArray(attributes)) {
|
|
191
226
|
attributes.forEach((attrObject) => {
|
|
192
|
-
this.setElementAttributes(
|
|
227
|
+
this.setElementAttributes($el, attrObject);
|
|
193
228
|
});
|
|
194
229
|
} else {
|
|
195
230
|
Object.keys(attributes).forEach((attributeName) => {
|
|
196
|
-
|
|
231
|
+
$el.setAttribute(attributeName, attributes[attributeName]);
|
|
197
232
|
});
|
|
198
233
|
}
|
|
199
234
|
},
|
|
200
235
|
/**
|
|
201
236
|
* 为元素设置(自定义)属性
|
|
202
|
-
* @param
|
|
203
|
-
* @param props
|
|
237
|
+
* @param $el 元素
|
|
238
|
+
* @param props 属性
|
|
204
239
|
*/
|
|
205
|
-
setElementProps(
|
|
240
|
+
setElementProps($el: HTMLElement, props?: any) {
|
|
206
241
|
if (props == null) {
|
|
207
242
|
return;
|
|
208
243
|
}
|
|
209
244
|
Object.keys(props).forEach((propName) => {
|
|
210
245
|
const value = props[propName];
|
|
211
246
|
if (propName === "innerHTML") {
|
|
212
|
-
PopsSafeUtils.setSafeHTML(
|
|
247
|
+
PopsSafeUtils.setSafeHTML($el, value);
|
|
213
248
|
return;
|
|
214
249
|
}
|
|
215
|
-
Reflect.set(
|
|
250
|
+
Reflect.set($el, propName, value);
|
|
216
251
|
});
|
|
217
252
|
},
|
|
218
253
|
/**
|
|
219
254
|
* 为元素设置classname
|
|
220
|
-
* @param
|
|
255
|
+
* @param $el 元素
|
|
221
256
|
* @param className
|
|
222
257
|
*/
|
|
223
|
-
setElementClassName(
|
|
258
|
+
setElementClassName($el: HTMLElement, className?: string | string[] | (() => string | string[])) {
|
|
224
259
|
if (className == null) {
|
|
225
260
|
return;
|
|
226
261
|
}
|
|
@@ -230,40 +265,92 @@ export const PanelHandlerComponents = () => {
|
|
|
230
265
|
if (typeof className === "string") {
|
|
231
266
|
const splitClassName = className.split(" ");
|
|
232
267
|
splitClassName.forEach((classNameStr) => {
|
|
233
|
-
|
|
268
|
+
$el.classList.add(classNameStr);
|
|
234
269
|
});
|
|
235
270
|
} else if (Array.isArray(className)) {
|
|
236
271
|
className.forEach((classNameStr) => {
|
|
237
|
-
this.setElementClassName(
|
|
272
|
+
this.setElementClassName($el, classNameStr);
|
|
238
273
|
});
|
|
239
274
|
}
|
|
240
275
|
},
|
|
276
|
+
/**
|
|
277
|
+
* 创建底部项元素<li>
|
|
278
|
+
* @param bottomItemConfig 配置
|
|
279
|
+
*/
|
|
280
|
+
createBottomItem(bottomItemConfig: PopsPanelBottomContentConfig) {
|
|
281
|
+
// 显示的文本
|
|
282
|
+
const text = typeof bottomItemConfig.text === "function" ? bottomItemConfig.text() : bottomItemConfig.text;
|
|
283
|
+
const className = Array.isArray(bottomItemConfig.className)
|
|
284
|
+
? bottomItemConfig.className.join(" ")
|
|
285
|
+
: bottomItemConfig.className || "";
|
|
286
|
+
const $li = popsDOMUtils.createElement("li", {
|
|
287
|
+
className: ["pops-panel-bottom-item", "pops-user-select-none", className].join(" "),
|
|
288
|
+
innerHTML: text,
|
|
289
|
+
});
|
|
290
|
+
/* 处理attr */
|
|
291
|
+
this.setElementAttributes($li, bottomItemConfig.attributes);
|
|
292
|
+
/* 处理props */
|
|
293
|
+
this.setElementProps($li, bottomItemConfig.props);
|
|
294
|
+
/** 禁用左侧项的hover的CSS样式的类名 */
|
|
295
|
+
const disablHoverCSSClassName = "pops-panel-disable-bottom-item-hover-css";
|
|
296
|
+
/** 是否禁用左侧项的hover的CSS样式 */
|
|
297
|
+
const isDisableHoverCSS =
|
|
298
|
+
typeof bottomItemConfig.disableHoverCSS === "function"
|
|
299
|
+
? bottomItemConfig.disableHoverCSS()
|
|
300
|
+
: bottomItemConfig.disableHoverCSS;
|
|
301
|
+
if (isDisableHoverCSS) {
|
|
302
|
+
$li.classList.add(disablHoverCSSClassName);
|
|
303
|
+
} else {
|
|
304
|
+
$li.classList.remove(disablHoverCSSClassName);
|
|
305
|
+
}
|
|
306
|
+
return $li;
|
|
307
|
+
},
|
|
308
|
+
/**
|
|
309
|
+
* 为底部元素添加点击事件
|
|
310
|
+
* @param $bottomItem 底部<li>元素
|
|
311
|
+
* @param bottomItemConfig 配置
|
|
312
|
+
*/
|
|
313
|
+
setBottomItemClickEvent($bottomItem: HTMLElement, bottomItemConfig: PopsPanelBottomContentConfig) {
|
|
314
|
+
popsDOMUtils.on<MouseEvent | PointerEvent>($bottomItem, "click", async (event) => {
|
|
315
|
+
if (typeof bottomItemConfig.clickCallback === "function") {
|
|
316
|
+
/* 执行回调 */
|
|
317
|
+
const asideClickCallbackResult = await bottomItemConfig.clickCallback(event);
|
|
318
|
+
if (typeof asideClickCallbackResult === "boolean" && !asideClickCallbackResult) {
|
|
319
|
+
return;
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
});
|
|
323
|
+
},
|
|
241
324
|
/**
|
|
242
325
|
* 创建左侧容器元素<li>
|
|
243
|
-
* @param asideConfig
|
|
326
|
+
* @param asideConfig 配置
|
|
244
327
|
*/
|
|
245
328
|
createAsideItem(asideConfig: PopsPanelContentConfig) {
|
|
246
|
-
|
|
247
|
-
|
|
329
|
+
// 显示的文本
|
|
330
|
+
const text = typeof asideConfig.title === "function" ? asideConfig.title() : asideConfig.title;
|
|
331
|
+
const $li = popsDOMUtils.createElement("li", {
|
|
332
|
+
id: asideConfig.id,
|
|
333
|
+
innerHTML: text,
|
|
334
|
+
});
|
|
248
335
|
Reflect.set($li, "__forms__", asideConfig.forms);
|
|
249
|
-
const title = typeof asideConfig.title === "function" ? asideConfig.title() : asideConfig.title;
|
|
250
|
-
PopsSafeUtils.setSafeHTML($li, title);
|
|
251
336
|
/* 处理className */
|
|
252
337
|
this.setElementClassName($li, "pops-panel-aside-item");
|
|
253
338
|
this.setElementClassName($li, asideConfig.className);
|
|
339
|
+
/* 处理attr */
|
|
254
340
|
this.setElementAttributes($li, asideConfig.attributes);
|
|
341
|
+
/* 处理props */
|
|
255
342
|
this.setElementProps($li, asideConfig.props);
|
|
256
343
|
/** 禁用左侧项的hover的CSS样式的类名 */
|
|
257
|
-
const
|
|
344
|
+
const disablHoverCSSClassName = "pops-panel-disabled-aside-hover-css";
|
|
258
345
|
/** 是否禁用左侧项的hover的CSS样式 */
|
|
259
|
-
const
|
|
346
|
+
const isDisableItemHoverCSS =
|
|
260
347
|
typeof asideConfig.disableAsideItemHoverCSS === "function"
|
|
261
348
|
? asideConfig.disableAsideItemHoverCSS()
|
|
262
349
|
: asideConfig.disableAsideItemHoverCSS;
|
|
263
|
-
if (
|
|
264
|
-
$li.classList.add(
|
|
350
|
+
if (isDisableItemHoverCSS) {
|
|
351
|
+
$li.classList.add(disablHoverCSSClassName);
|
|
265
352
|
} else {
|
|
266
|
-
$li.classList.remove(
|
|
353
|
+
$li.classList.remove(disablHoverCSSClassName);
|
|
267
354
|
}
|
|
268
355
|
return $li;
|
|
269
356
|
},
|
|
@@ -273,7 +360,7 @@ export const PanelHandlerComponents = () => {
|
|
|
273
360
|
* @param formConfig
|
|
274
361
|
*/
|
|
275
362
|
createSectionContainerItem_switch(formConfig: PopsPanelSwitchDetails) {
|
|
276
|
-
const $li =
|
|
363
|
+
const $li = popsDOMUtils.createElement("li");
|
|
277
364
|
Reflect.set($li, "__formConfig__", formConfig);
|
|
278
365
|
this.setElementClassName($li, formConfig.className);
|
|
279
366
|
this.setElementAttributes($li, formConfig.attributes);
|
|
@@ -381,7 +468,7 @@ export const PanelHandlerComponents = () => {
|
|
|
381
468
|
* @param formConfig
|
|
382
469
|
*/
|
|
383
470
|
createSectionContainerItem_slider(formConfig: PopsPanelSliderDetails) {
|
|
384
|
-
const $li =
|
|
471
|
+
const $li = popsDOMUtils.createElement("li");
|
|
385
472
|
Reflect.set($li, "__formConfig__", formConfig);
|
|
386
473
|
this.setElementClassName($li, formConfig.className);
|
|
387
474
|
this.setElementAttributes($li, formConfig.attributes);
|
|
@@ -445,7 +532,7 @@ export const PanelHandlerComponents = () => {
|
|
|
445
532
|
* @param formConfig
|
|
446
533
|
*/
|
|
447
534
|
createSectionContainerItem_slider_new(formConfig: PopsPanelSliderDetails) {
|
|
448
|
-
const $li =
|
|
535
|
+
const $li = popsDOMUtils.createElement("li");
|
|
449
536
|
Reflect.set($li, "__formConfig__", formConfig);
|
|
450
537
|
this.setElementClassName($li, formConfig.className);
|
|
451
538
|
this.setElementAttributes($li, formConfig.attributes);
|
|
@@ -1041,7 +1128,7 @@ export const PanelHandlerComponents = () => {
|
|
|
1041
1128
|
* @param formConfig
|
|
1042
1129
|
*/
|
|
1043
1130
|
createSectionContainerItem_input(formConfig: PopsPanelInputDetails) {
|
|
1044
|
-
const $li =
|
|
1131
|
+
const $li = popsDOMUtils.createElement("li");
|
|
1045
1132
|
Reflect.set($li, "__formConfig__", formConfig);
|
|
1046
1133
|
this.setElementClassName($li, formConfig.className);
|
|
1047
1134
|
this.setElementAttributes($li, formConfig.attributes);
|
|
@@ -1073,7 +1160,7 @@ export const PanelHandlerComponents = () => {
|
|
|
1073
1160
|
itemLeftTextContainer: $li.querySelector<HTMLElement>(".pops-panel-item-left-text"),
|
|
1074
1161
|
panelInput: $li.querySelector<HTMLDivElement>(".pops-panel-input")!,
|
|
1075
1162
|
input: $li.querySelector<HTMLInputElement>("input")!,
|
|
1076
|
-
inputSpanIcon:
|
|
1163
|
+
inputSpanIcon: popsDOMUtils.createElement("span"),
|
|
1077
1164
|
inputSpanIconInner: null as any as HTMLSpanElement,
|
|
1078
1165
|
icon: null as any as HTMLElement,
|
|
1079
1166
|
},
|
|
@@ -1247,7 +1334,7 @@ export const PanelHandlerComponents = () => {
|
|
|
1247
1334
|
* @param formConfig
|
|
1248
1335
|
*/
|
|
1249
1336
|
createSectionContainerItem_textarea(formConfig: PopsPanelTextAreaDetails) {
|
|
1250
|
-
const $li =
|
|
1337
|
+
const $li = popsDOMUtils.createElement("li");
|
|
1251
1338
|
Reflect.set($li, "__formConfig__", formConfig);
|
|
1252
1339
|
this.setElementClassName($li, formConfig.className);
|
|
1253
1340
|
this.setElementAttributes($li, formConfig.attributes);
|
|
@@ -1337,7 +1424,7 @@ export const PanelHandlerComponents = () => {
|
|
|
1337
1424
|
*/
|
|
1338
1425
|
createSectionContainerItem_select(formConfig: PopsPanelSelectDetails<any>) {
|
|
1339
1426
|
const that = this;
|
|
1340
|
-
const $li =
|
|
1427
|
+
const $li = popsDOMUtils.createElement("li");
|
|
1341
1428
|
Reflect.set($li, "__formConfig__", formConfig);
|
|
1342
1429
|
this.setElementClassName($li, formConfig.className);
|
|
1343
1430
|
this.setElementAttributes($li, formConfig.attributes);
|
|
@@ -1432,7 +1519,7 @@ export const PanelHandlerComponents = () => {
|
|
|
1432
1519
|
initOption() {
|
|
1433
1520
|
formConfig.data.forEach((dataItem) => {
|
|
1434
1521
|
// 初始化默认选中
|
|
1435
|
-
const optionElement =
|
|
1522
|
+
const optionElement = popsDOMUtils.createElement("option");
|
|
1436
1523
|
this.setNodeValue(optionElement, this.$eleKey.value, dataItem.value);
|
|
1437
1524
|
this.setNodeValue(optionElement, this.$eleKey.disable, dataItem.disable);
|
|
1438
1525
|
this.setNodeValue(optionElement, this.$eleKey.forms, dataItem.forms);
|
|
@@ -1506,7 +1593,7 @@ export const PanelHandlerComponents = () => {
|
|
|
1506
1593
|
break;
|
|
1507
1594
|
}
|
|
1508
1595
|
}
|
|
1509
|
-
const $childUList =
|
|
1596
|
+
const $childUList = popsDOMUtils.createElement("ul");
|
|
1510
1597
|
$childUList.className = childUListClassName;
|
|
1511
1598
|
popsDOMUtils.after($li, $childUList);
|
|
1512
1599
|
that.uListContainerAddItem(formConfig, {
|
|
@@ -1538,7 +1625,7 @@ export const PanelHandlerComponents = () => {
|
|
|
1538
1625
|
* @param formConfig
|
|
1539
1626
|
*/
|
|
1540
1627
|
createSectionContainerItem_select_multiple_new(formConfig: PopsPanelSelectMultipleDetails<any>) {
|
|
1541
|
-
const $li =
|
|
1628
|
+
const $li = popsDOMUtils.createElement("li");
|
|
1542
1629
|
Reflect.set($li, "__formConfig__", formConfig);
|
|
1543
1630
|
this.setElementClassName($li, formConfig.className);
|
|
1544
1631
|
this.setElementAttributes($li, formConfig.attributes);
|
|
@@ -2245,7 +2332,7 @@ export const PanelHandlerComponents = () => {
|
|
|
2245
2332
|
* @param formConfig
|
|
2246
2333
|
*/
|
|
2247
2334
|
createSectionContainerItem_button(formConfig: PopsPanelButtonDetails) {
|
|
2248
|
-
const $li =
|
|
2335
|
+
const $li = popsDOMUtils.createElement("li");
|
|
2249
2336
|
Reflect.set($li, "__formConfig__", formConfig);
|
|
2250
2337
|
this.setElementClassName($li, formConfig.className);
|
|
2251
2338
|
this.setElementAttributes($li, formConfig.attributes);
|
|
@@ -2395,7 +2482,7 @@ export const PanelHandlerComponents = () => {
|
|
|
2395
2482
|
*/
|
|
2396
2483
|
createSectionContainerItem_deepMenu(formConfig: PopsPanelDeepMenuDetails) {
|
|
2397
2484
|
const that = this;
|
|
2398
|
-
const $li =
|
|
2485
|
+
const $li = popsDOMUtils.createElement("li");
|
|
2399
2486
|
popsDOMUtils.addClassName($li, "pops-panel-deepMenu-nav-item");
|
|
2400
2487
|
Reflect.set($li, "__formConfig__", formConfig);
|
|
2401
2488
|
this.setElementClassName($li, formConfig.className);
|
|
@@ -2432,7 +2519,7 @@ export const PanelHandlerComponents = () => {
|
|
|
2432
2519
|
[Symbol.toStringTag]: "PopsPanelDeepMenu",
|
|
2433
2520
|
$ele: {
|
|
2434
2521
|
get parentSection() {
|
|
2435
|
-
return that.$el.$
|
|
2522
|
+
return that.$el.$panelContentSectionContainer;
|
|
2436
2523
|
},
|
|
2437
2524
|
},
|
|
2438
2525
|
init() {
|
|
@@ -2448,9 +2535,9 @@ export const PanelHandlerComponents = () => {
|
|
|
2448
2535
|
if (formConfig_forms.type === "forms") {
|
|
2449
2536
|
const childForms = formConfig_forms["forms"];
|
|
2450
2537
|
/* 每一项<li>元素 */
|
|
2451
|
-
const formContainerListElement =
|
|
2538
|
+
const formContainerListElement = popsDOMUtils.createElement("li");
|
|
2452
2539
|
/* 每一项<li>内的子<ul>元素 */
|
|
2453
|
-
const formContainerULElement =
|
|
2540
|
+
const formContainerULElement = popsDOMUtils.createElement("ul");
|
|
2454
2541
|
formContainerULElement.classList.add("pops-panel-forms-container-item-formlist");
|
|
2455
2542
|
formContainerListElement.classList.add("pops-panel-forms-container-item");
|
|
2456
2543
|
/* 区域头部的文字 */
|
|
@@ -2626,7 +2713,7 @@ export const PanelHandlerComponents = () => {
|
|
|
2626
2713
|
this.initFormItem($deepMenuMain, formItemConfig);
|
|
2627
2714
|
}
|
|
2628
2715
|
}
|
|
2629
|
-
that.$el.$
|
|
2716
|
+
that.$el.$panelRightSectionWrapper.appendChild($deepMenuSection);
|
|
2630
2717
|
};
|
|
2631
2718
|
if (that.$config.useDeepMenuSwtichAnimation && document.startViewTransition) {
|
|
2632
2719
|
const transition = document.startViewTransition(enterViewTransition);
|
|
@@ -2683,11 +2770,11 @@ export const PanelHandlerComponents = () => {
|
|
|
2683
2770
|
* @param formConfig
|
|
2684
2771
|
*/
|
|
2685
2772
|
createSectionContainerItem_own(formConfig: PopsPanelOwnDetails) {
|
|
2686
|
-
let $li =
|
|
2773
|
+
let $li = popsDOMUtils.createElement("li");
|
|
2687
2774
|
Reflect.set($li, "__formConfig__", formConfig);
|
|
2688
|
-
|
|
2689
|
-
|
|
2690
|
-
|
|
2775
|
+
this.setElementClassName($li, formConfig.className);
|
|
2776
|
+
this.setElementAttributes($li, formConfig.attributes);
|
|
2777
|
+
this.setElementProps($li, formConfig.props);
|
|
2691
2778
|
$li = formConfig.getLiElementCallBack($li);
|
|
2692
2779
|
return $li;
|
|
2693
2780
|
},
|
|
@@ -2732,9 +2819,9 @@ export const PanelHandlerComponents = () => {
|
|
|
2732
2819
|
if (formConfig_forms.type === "forms") {
|
|
2733
2820
|
const childForms = formConfig["forms"];
|
|
2734
2821
|
/* 每一项<li>元素 */
|
|
2735
|
-
const formContainerListElement =
|
|
2822
|
+
const formContainerListElement = popsDOMUtils.createElement("li");
|
|
2736
2823
|
/* 每一项<li>内的子<ul>元素 */
|
|
2737
|
-
const formContainerULElement =
|
|
2824
|
+
const formContainerULElement = popsDOMUtils.createElement("ul");
|
|
2738
2825
|
formContainerListElement.classList.add("pops-panel-forms-container-item");
|
|
2739
2826
|
formContainerULElement.classList.add("pops-panel-forms-container-item-formlist");
|
|
2740
2827
|
/* 区域头部的文字 */
|
|
@@ -2803,7 +2890,7 @@ export const PanelHandlerComponents = () => {
|
|
|
2803
2890
|
}
|
|
2804
2891
|
},
|
|
2805
2892
|
/**
|
|
2806
|
-
*
|
|
2893
|
+
* 主动触发触发渲染右侧容器的事件
|
|
2807
2894
|
*/
|
|
2808
2895
|
triggerRenderRightContainer($container: HTMLElement) {
|
|
2809
2896
|
const __formConfig__: PopsPanelEventType["pops:renderRightContainer"]["formConfig"] = Reflect.get(
|
|
@@ -2843,11 +2930,11 @@ export const PanelHandlerComponents = () => {
|
|
|
2843
2930
|
},
|
|
2844
2931
|
/**
|
|
2845
2932
|
* 为左侧容器元素添加点击事件
|
|
2846
|
-
* @param
|
|
2933
|
+
* @param $asideItem 左侧的容器<li>元素
|
|
2847
2934
|
* @param asideConfig 配置
|
|
2848
2935
|
*/
|
|
2849
|
-
setAsideItemClickEvent(
|
|
2850
|
-
popsDOMUtils.on<MouseEvent | PointerEvent>(
|
|
2936
|
+
setAsideItemClickEvent($asideItem: HTMLElement, asideConfig: PopsPanelContentConfig) {
|
|
2937
|
+
popsDOMUtils.on<MouseEvent | PointerEvent>($asideItem, "click", async (event) => {
|
|
2851
2938
|
if (typeof asideConfig.clickFirstCallback === "function") {
|
|
2852
2939
|
const clickFirstCallbackResult = await asideConfig.clickFirstCallback(
|
|
2853
2940
|
event,
|
|
@@ -2859,19 +2946,19 @@ export const PanelHandlerComponents = () => {
|
|
|
2859
2946
|
}
|
|
2860
2947
|
}
|
|
2861
2948
|
this.clearContainer();
|
|
2862
|
-
const rightContainerFormConfig: PopsPanelContentConfig[] = Reflect.get(
|
|
2949
|
+
const rightContainerFormConfig: PopsPanelContentConfig[] = Reflect.get($asideItem, "__forms__");
|
|
2863
2950
|
|
|
2864
|
-
Reflect.set(this.$el.$
|
|
2865
|
-
popsDOMUtils.cssShow(this.$el.$
|
|
2951
|
+
Reflect.set(this.$el.$panelContentSectionContainer, "__formConfig__", rightContainerFormConfig);
|
|
2952
|
+
popsDOMUtils.cssShow(this.$el.$panelContentSectionContainer);
|
|
2866
2953
|
this.clearAsideItemIsVisited();
|
|
2867
|
-
this.setAsideItemIsVisited(
|
|
2954
|
+
this.setAsideItemIsVisited($asideItem);
|
|
2868
2955
|
/* 顶部标题栏,存在就设置 */
|
|
2869
2956
|
const title = typeof asideConfig.title === "function" ? asideConfig.title() : asideConfig.title;
|
|
2870
2957
|
let headerTitleText =
|
|
2871
2958
|
typeof asideConfig.headerTitle === "function" ? asideConfig.headerTitle() : asideConfig.headerTitle;
|
|
2872
2959
|
headerTitleText = headerTitleText ?? title;
|
|
2873
2960
|
if (typeof headerTitleText === "string" && headerTitleText.trim() !== "") {
|
|
2874
|
-
const $containerHeaderTitle =
|
|
2961
|
+
const $containerHeaderTitle = popsDOMUtils.createElement("li");
|
|
2875
2962
|
$containerHeaderTitle.classList.add("pops-panel-container-header-title-text");
|
|
2876
2963
|
Reflect.set($containerHeaderTitle, "__asideConfig__", asideConfig);
|
|
2877
2964
|
PopsSafeUtils.setSafeHTML($containerHeaderTitle, headerTitleText);
|
|
@@ -2893,7 +2980,7 @@ export const PanelHandlerComponents = () => {
|
|
|
2893
2980
|
return;
|
|
2894
2981
|
}
|
|
2895
2982
|
}
|
|
2896
|
-
this.triggerRenderRightContainer(this.$el.$
|
|
2983
|
+
this.triggerRenderRightContainer(this.$el.$panelContentSectionContainer);
|
|
2897
2984
|
});
|
|
2898
2985
|
},
|
|
2899
2986
|
};
|
|
@@ -49,12 +49,6 @@ aside.pops-panel-aside {
|
|
|
49
49
|
flex-direction: column;
|
|
50
50
|
justify-content: space-between;
|
|
51
51
|
}
|
|
52
|
-
aside.pops-panel-aside {
|
|
53
|
-
-webkit-user-select: none;
|
|
54
|
-
-moz-user-select: none;
|
|
55
|
-
-ms-user-select: none;
|
|
56
|
-
user-select: none;
|
|
57
|
-
}
|
|
58
52
|
aside.pops-panel-aside .pops-panel-aside-top-container {
|
|
59
53
|
overflow: auto;
|
|
60
54
|
}
|
|
@@ -74,6 +68,36 @@ aside.pops-panel-aside ul li:not(.pops-panel-disabled-aside-hover-css):hover {
|
|
|
74
68
|
}
|
|
75
69
|
/* 左侧的列表 */
|
|
76
70
|
|
|
71
|
+
/* 底部的容器 */
|
|
72
|
+
.pops-panel-bottom-wrapper {
|
|
73
|
+
background: var(--panel-aside-bg-color);
|
|
74
|
+
border-top: 1px solid #ebeef5;
|
|
75
|
+
}
|
|
76
|
+
.pops-panel-bottom-wrapper:has(.pops-panel-bottom-left-container:empty):has(.pops-panel-bottom-right-container:empty) {
|
|
77
|
+
border-top: 0;
|
|
78
|
+
}
|
|
79
|
+
.pops-panel-bottom-container {
|
|
80
|
+
display: flex;
|
|
81
|
+
flex-wrap: nowrap;
|
|
82
|
+
justify-content: space-between;
|
|
83
|
+
}
|
|
84
|
+
.pops-panel-bottom-left-container {
|
|
85
|
+
}
|
|
86
|
+
.pops-panel-bottom-right-container {
|
|
87
|
+
}
|
|
88
|
+
.pops-panel-bottom-wrapper .pops-panel-bottom-item {
|
|
89
|
+
list-style-type: none;
|
|
90
|
+
margin: 6px 8px;
|
|
91
|
+
border-radius: 4px;
|
|
92
|
+
padding: 6px 10px;
|
|
93
|
+
cursor: default;
|
|
94
|
+
}
|
|
95
|
+
.pops-panel-bottom-wrapper:not(.pops-panel-disable-bottom-item-hover-css) .pops-panel-bottom-item:hover {
|
|
96
|
+
color: var(--panel-aside-hover-color);
|
|
97
|
+
background: var(--panel-aside-hover-bg-color);
|
|
98
|
+
}
|
|
99
|
+
/* 底部的容器 */
|
|
100
|
+
|
|
77
101
|
.pops-panel-content {
|
|
78
102
|
display: flex;
|
|
79
103
|
flex-direction: row;
|
|
@@ -74,7 +74,7 @@ export const PopsPanel = {
|
|
|
74
74
|
: `<p pops class="pops-${popsType}-title-text" class="pops-${popsType}-title-text" style="${headerPStyle}">${config.title.text}</p>`
|
|
75
75
|
}${headerBtnHTML}</div>
|
|
76
76
|
<div class="pops-content pops-${popsType}-content">
|
|
77
|
-
<aside class="pops-${popsType}-aside">
|
|
77
|
+
<aside class="pops-${popsType}-aside pops-user-select-none">
|
|
78
78
|
<ul class="pops-${popsType}-aside-top-container"></ul>
|
|
79
79
|
<ul class="pops-${popsType}-aside-bottom-container"></ul>
|
|
80
80
|
</aside>
|
|
@@ -84,7 +84,14 @@ export const PopsPanel = {
|
|
|
84
84
|
<ul class="pops-${popsType}-container-main-ul"></ul>
|
|
85
85
|
</section>
|
|
86
86
|
</div>
|
|
87
|
-
</div
|
|
87
|
+
</div>
|
|
88
|
+
<div class="pops-${popsType}-bottom-wrapper">
|
|
89
|
+
<section class="pops-${popsType}-bottom-container">
|
|
90
|
+
<ul class="pops-${popsType}-bottom-left-container"></ul>
|
|
91
|
+
<ul class="pops-${popsType}-bottom-right-container"></ul>
|
|
92
|
+
</section>
|
|
93
|
+
</div>
|
|
94
|
+
`,
|
|
88
95
|
"",
|
|
89
96
|
zIndex
|
|
90
97
|
);
|
|
@@ -94,13 +101,17 @@ export const PopsPanel = {
|
|
|
94
101
|
const $anim = PopsElementHandler.parseElement<HTMLDivElement>(animHTML);
|
|
95
102
|
/* 结构元素 */
|
|
96
103
|
const {
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
+
$pops,
|
|
105
|
+
$headerBtnClose,
|
|
106
|
+
$title,
|
|
107
|
+
$content,
|
|
108
|
+
$panelRightSectionWrapper,
|
|
109
|
+
$panelLeftAside,
|
|
110
|
+
$panelContentSectionContainer,
|
|
111
|
+
$panelBottomWrapper,
|
|
112
|
+
$panelBottomContainer,
|
|
113
|
+
$panelBottomLeftContainer,
|
|
114
|
+
$panelBottomRightContainer,
|
|
104
115
|
} = PopsHandler.handleQueryElement($anim, popsType);
|
|
105
116
|
if (config.isMobile || popsUtils.isPhone()) {
|
|
106
117
|
popsDOMUtils.addClassName($pops, config.mobileClassName);
|
|
@@ -139,7 +150,7 @@ export const PopsPanel = {
|
|
|
139
150
|
config
|
|
140
151
|
);
|
|
141
152
|
/* 为顶部右边的关闭按钮添加点击事件 */
|
|
142
|
-
PopsHandler.handleClickEvent("close", $
|
|
153
|
+
PopsHandler.handleClickEvent("close", $headerBtnClose, eventDetails, config.btn.close!.callback!);
|
|
143
154
|
|
|
144
155
|
/* 创建到页面中 */
|
|
145
156
|
popsDOMUtils.append($shadowRoot, isCreatedElementList);
|
|
@@ -158,11 +169,15 @@ export const PopsPanel = {
|
|
|
158
169
|
panelHandlerComponents.init({
|
|
159
170
|
config: config,
|
|
160
171
|
$el: {
|
|
161
|
-
$pops
|
|
162
|
-
$content
|
|
163
|
-
$
|
|
164
|
-
$
|
|
165
|
-
$
|
|
172
|
+
$pops,
|
|
173
|
+
$content,
|
|
174
|
+
$panelRightSectionWrapper,
|
|
175
|
+
$panelLeftAside,
|
|
176
|
+
$panelContentSectionContainer,
|
|
177
|
+
$panelBottomWrapper,
|
|
178
|
+
$panelBottomContainer,
|
|
179
|
+
$panelBottomLeftContainer,
|
|
180
|
+
$panelBottomRightContainer,
|
|
166
181
|
},
|
|
167
182
|
});
|
|
168
183
|
|