@whitesev/pops 2.1.3 → 2.1.5
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 +253 -227
- package/dist/index.amd.js.map +1 -1
- package/dist/index.cjs.js +253 -227
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +253 -227
- package/dist/index.esm.js.map +1 -1
- package/dist/index.iife.js +253 -227
- package/dist/index.iife.js.map +1 -1
- package/dist/index.system.js +253 -227
- package/dist/index.system.js.map +1 -1
- package/dist/index.umd.js +253 -227
- package/dist/index.umd.js.map +1 -1
- package/dist/types/src/GlobalConfig.d.ts +7 -2
- package/dist/types/src/Pops.d.ts +61 -39
- package/dist/types/src/{Core.d.ts → PopsCore.d.ts} +4 -3
- package/dist/types/src/PopsIcon.d.ts +30 -2
- package/dist/types/src/PopsLayer.d.ts +3 -1
- package/dist/types/src/components/alert/config.d.ts +1 -1
- package/dist/types/src/components/alert/index.d.ts +1 -1
- package/dist/types/src/components/alert/{indexType.d.ts → types/index.d.ts} +2 -2
- package/dist/types/src/components/confirm/config.d.ts +1 -1
- package/dist/types/src/components/confirm/index.d.ts +1 -1
- package/dist/types/src/components/confirm/{indexType.d.ts → types/index.d.ts} +1 -1
- package/dist/types/src/components/drawer/config.d.ts +1 -1
- package/dist/types/src/components/drawer/index.d.ts +1 -1
- package/dist/types/src/components/drawer/{indexType.d.ts → types/index.d.ts} +1 -1
- package/dist/types/src/components/folder/config.d.ts +1 -1
- package/dist/types/src/components/folder/index.d.ts +1 -1
- package/dist/types/src/components/folder/{indexType.d.ts → types/index.d.ts} +1 -1
- package/dist/types/src/components/iframe/config.d.ts +1 -1
- package/dist/types/src/components/iframe/index.d.ts +1 -1
- package/dist/types/src/components/iframe/{indexType.d.ts → types/index.d.ts} +2 -2
- package/dist/types/src/components/loading/config.d.ts +1 -1
- package/dist/types/src/components/loading/index.d.ts +1 -1
- package/dist/types/src/components/loading/{indexType.d.ts → types/index.d.ts} +1 -1
- package/dist/types/src/components/panel/config.d.ts +1 -1
- package/dist/types/src/components/panel/{PanelHandleContentDetails.d.ts → handlerComponents.d.ts} +39 -28
- package/dist/types/src/components/panel/index.d.ts +16 -2
- package/dist/types/src/components/panel/{buttonType.d.ts → types/components-button.d.ts} +3 -3
- package/dist/types/src/components/panel/{commonType.d.ts → types/components-common.d.ts} +2 -2
- package/dist/types/src/components/panel/{deepMenuType.d.ts → types/components-deepMenu.d.ts} +3 -3
- package/dist/types/src/components/panel/{formsType.d.ts → types/components-forms.d.ts} +2 -2
- package/dist/types/src/components/panel/{inputType.d.ts → types/components-input.d.ts} +1 -1
- package/dist/types/src/components/panel/{ownType.d.ts → types/components-own.d.ts} +1 -1
- package/dist/types/src/components/panel/{selectType.d.ts → types/components-select.d.ts} +3 -3
- package/dist/types/src/components/panel/{selectMultipleType.d.ts → types/components-selectMultiple.d.ts} +2 -2
- package/dist/types/src/components/panel/{sliderType.d.ts → types/components-slider.d.ts} +1 -1
- package/dist/types/src/components/panel/{switchType.d.ts → types/components-switch.d.ts} +1 -1
- package/dist/types/src/components/panel/{textareaType.d.ts → types/components-textarea.d.ts} +1 -1
- package/dist/types/src/components/panel/{indexType.d.ts → types/index.d.ts} +26 -12
- package/dist/types/src/components/prompt/config.d.ts +1 -1
- package/dist/types/src/components/prompt/index.d.ts +1 -1
- package/dist/types/src/components/prompt/{indexType.d.ts → types/index.d.ts} +1 -1
- package/dist/types/src/components/rightClickMenu/config.d.ts +1 -1
- package/dist/types/src/components/rightClickMenu/index.d.ts +2 -2
- package/dist/types/src/components/rightClickMenu/{indexType.d.ts → types/index.d.ts} +2 -2
- package/dist/types/src/components/searchSuggestion/config.d.ts +1 -1
- package/dist/types/src/components/searchSuggestion/index.d.ts +2 -2
- package/dist/types/src/components/searchSuggestion/{indexType.d.ts → types/index.d.ts} +1 -1
- package/dist/types/src/components/tooltip/config.d.ts +1 -1
- package/dist/types/src/components/tooltip/index.d.ts +2 -2
- package/dist/types/src/components/tooltip/{indexType.d.ts → types/index.d.ts} +1 -1
- package/dist/types/src/handler/PopsHandler.d.ts +8 -8
- package/dist/types/src/types/PopsDOMUtilsEventType.d.ts +1 -1
- package/dist/types/src/types/button.d.ts +3 -2
- package/dist/types/src/types/event.d.ts +4 -3
- package/dist/types/src/types/global.d.ts +4 -4
- package/dist/types/src/types/main.d.ts +18 -10
- package/dist/types/src/types/mask.d.ts +8 -0
- package/dist/types/src/{Config.d.ts → utils/PopsDOMUtilsEventsConfig.d.ts} +3 -0
- package/dist/types/src/utils/PopsInstanceUtils.d.ts +8 -8
- package/package.json +9 -10
- package/src/GlobalConfig.ts +6 -5
- package/src/Pops.ts +17 -17
- package/src/{Core.ts → PopsCore.ts} +13 -14
- package/src/PopsIcon.ts +34 -32
- package/src/PopsLayer.ts +8 -7
- package/src/components/alert/config.ts +1 -1
- package/src/components/alert/index.ts +1 -1
- package/src/components/alert/{indexType.ts → types/index.ts} +2 -2
- package/src/components/confirm/config.ts +1 -1
- package/src/components/confirm/index.ts +1 -1
- package/src/components/confirm/{indexType.ts → types/index.ts} +1 -1
- package/src/components/drawer/config.ts +1 -1
- package/src/components/drawer/index.ts +1 -1
- package/src/components/drawer/{indexType.ts → types/index.ts} +1 -1
- package/src/components/folder/config.ts +1 -1
- package/src/components/folder/index.ts +1 -1
- package/src/components/folder/{indexType.ts → types/index.ts} +1 -1
- package/src/components/iframe/config.ts +1 -1
- package/src/components/iframe/index.ts +4 -4
- package/src/components/iframe/{indexType.ts → types/index.ts} +2 -2
- package/src/components/loading/config.ts +1 -1
- package/src/components/loading/index.ts +1 -1
- package/src/components/loading/{indexType.ts → types/index.ts} +1 -1
- package/src/components/panel/config.ts +1 -1
- package/src/components/panel/{PanelHandleContentDetails.ts → handlerComponents.ts} +287 -258
- package/src/components/panel/index.ts +23 -5
- package/src/components/panel/{buttonType.ts → types/components-button.ts} +5 -4
- package/src/components/panel/{commonType.ts → types/components-common.ts} +2 -2
- package/src/components/panel/{deepMenuType.ts → types/components-deepMenu.ts} +3 -3
- package/src/components/panel/{formsType.ts → types/components-forms.ts} +2 -2
- package/src/components/panel/{inputType.ts → types/components-input.ts} +1 -1
- package/src/components/panel/{ownType.ts → types/components-own.ts} +1 -1
- package/src/components/panel/{selectType.ts → types/components-select.ts} +3 -3
- package/src/components/panel/{selectMultipleType.ts → types/components-selectMultiple.ts} +2 -2
- package/src/components/panel/{sliderType.ts → types/components-slider.ts} +1 -1
- package/src/components/panel/{switchType.ts → types/components-switch.ts} +1 -1
- package/src/components/panel/{textareaType.ts → types/components-textarea.ts} +1 -1
- package/src/components/panel/{indexType.ts → types/index.ts} +28 -12
- package/src/components/prompt/config.ts +1 -1
- package/src/components/prompt/index.ts +1 -1
- package/src/components/prompt/{indexType.ts → types/index.ts} +1 -1
- package/src/components/rightClickMenu/config.ts +1 -1
- package/src/components/rightClickMenu/index.ts +2 -2
- package/src/components/rightClickMenu/{indexType.ts → types/index.ts} +2 -2
- package/src/components/searchSuggestion/config.ts +1 -1
- package/src/components/searchSuggestion/index.ts +1 -1
- package/src/components/searchSuggestion/{indexType.ts → types/index.ts} +1 -1
- package/src/components/tooltip/config.ts +1 -1
- package/src/components/tooltip/index.ts +1 -1
- package/src/components/tooltip/{indexType.ts → types/index.ts} +1 -1
- package/src/handler/PopsElementHandler.ts +3 -3
- package/src/handler/PopsHandler.ts +26 -26
- package/src/types/PopsDOMUtilsEventType.d.ts +1 -1
- package/src/types/button.d.ts +3 -2
- package/src/types/event.d.ts +4 -3
- package/src/types/global.d.ts +4 -4
- package/src/types/main.d.ts +18 -10
- package/src/types/mask.d.ts +8 -0
- package/src/utils/PopsDOMUtils.ts +2 -2
- package/src/{Config.ts → utils/PopsDOMUtilsEventsConfig.ts} +3 -0
- package/src/utils/PopsInstanceUtils.ts +12 -12
- package/src/utils/PopsUtils.ts +2 -5
|
@@ -5,29 +5,33 @@ import { PopsMathFloatUtils } from "../../utils/PopsMathUtils";
|
|
|
5
5
|
import { PopsSafeUtils } from "../../utils/PopsSafeUtils";
|
|
6
6
|
import { popsUtils } from "../../utils/PopsUtils";
|
|
7
7
|
import { PopsAlert } from "../alert";
|
|
8
|
-
import type { PopsAlertDetails } from "../alert/
|
|
8
|
+
import type { PopsAlertDetails } from "../alert/types";
|
|
9
9
|
import { PopsTooltip } from "../tooltip";
|
|
10
|
-
import type { PopsPanelButtonDetails } from "./
|
|
11
|
-
import type { PopsPanelRightAsideContainerOptions } from "./
|
|
12
|
-
import type { PopsPanelDeepMenuDetails } from "./
|
|
13
|
-
import type { PopsPanelFormsDetails } from "./
|
|
10
|
+
import type { PopsPanelButtonDetails } from "./types/components-button";
|
|
11
|
+
import type { PopsPanelRightAsideContainerOptions } from "./types/components-common";
|
|
12
|
+
import type { PopsPanelDeepMenuDetails } from "./types/components-deepMenu";
|
|
13
|
+
import type { PopsPanelFormsDetails } from "./types/components-forms";
|
|
14
14
|
import type {
|
|
15
15
|
PopsPanelContentConfig,
|
|
16
16
|
PopsPanelDetails,
|
|
17
|
+
PopsPanelEventType,
|
|
17
18
|
PopsPanelFormsTotalDetails,
|
|
18
|
-
} from "./
|
|
19
|
-
import type { PopsPanelInputDetails } from "./
|
|
20
|
-
import type { PopsPanelOwnDetails } from "./
|
|
19
|
+
} from "./types";
|
|
20
|
+
import type { PopsPanelInputDetails } from "./types/components-input";
|
|
21
|
+
import type { PopsPanelOwnDetails } from "./types/components-own";
|
|
21
22
|
import type {
|
|
22
23
|
PopsPanelSelectMultipleDataOption,
|
|
23
24
|
PopsPanelSelectMultipleDetails,
|
|
24
|
-
} from "./
|
|
25
|
-
import type { PopsPanelSelectDetails } from "./
|
|
26
|
-
import type { PopsPanelSliderDetails } from "./
|
|
27
|
-
import type { PopsPanelSwitchDetails } from "./
|
|
28
|
-
import type { PopsPanelTextAreaDetails } from "./
|
|
25
|
+
} from "./types/components-selectMultiple";
|
|
26
|
+
import type { PopsPanelSelectDetails } from "./types/components-select";
|
|
27
|
+
import type { PopsPanelSliderDetails } from "./types/components-slider";
|
|
28
|
+
import type { PopsPanelSwitchDetails } from "./types/components-switch";
|
|
29
|
+
import type { PopsPanelTextAreaDetails } from "./types/components-textarea";
|
|
29
30
|
|
|
30
|
-
|
|
31
|
+
/**
|
|
32
|
+
* 处理组件(把组件配置转为组件元素)
|
|
33
|
+
*/
|
|
34
|
+
export const PanelHandlerComponents = () => {
|
|
31
35
|
return {
|
|
32
36
|
/**
|
|
33
37
|
* 左侧的ul容器
|
|
@@ -45,12 +49,14 @@ export const PanelHandleContentDetails = () => {
|
|
|
45
49
|
* 元素
|
|
46
50
|
*/
|
|
47
51
|
$el: {
|
|
52
|
+
/** pops主元素 */
|
|
53
|
+
$pops: null as any as HTMLElement,
|
|
48
54
|
/** 内容 */
|
|
49
|
-
$content: null as any as
|
|
55
|
+
$content: null as any as HTMLElement,
|
|
50
56
|
/** 左侧容器 */
|
|
51
|
-
$contentAside: null as any as
|
|
57
|
+
$contentAside: null as any as HTMLElement,
|
|
52
58
|
/** 右侧容器 */
|
|
53
|
-
$contentSectionContainer: null as any as
|
|
59
|
+
$contentSectionContainer: null as any as HTMLElement,
|
|
54
60
|
},
|
|
55
61
|
/**
|
|
56
62
|
* 初始化
|
|
@@ -59,13 +65,12 @@ export const PanelHandleContentDetails = () => {
|
|
|
59
65
|
init(details: {
|
|
60
66
|
config: Required<PopsPanelDetails>;
|
|
61
67
|
$el: {
|
|
62
|
-
$
|
|
63
|
-
$
|
|
64
|
-
$
|
|
68
|
+
$pops: HTMLElement;
|
|
69
|
+
$content: HTMLElement;
|
|
70
|
+
$contentAside: HTMLElement;
|
|
71
|
+
$contentSectionContainer: HTMLElement;
|
|
65
72
|
};
|
|
66
73
|
}) {
|
|
67
|
-
// @ts-ignore
|
|
68
|
-
this.$el = null;
|
|
69
74
|
this.$el = {
|
|
70
75
|
...details.$el,
|
|
71
76
|
};
|
|
@@ -136,11 +141,15 @@ export const PanelHandleContentDetails = () => {
|
|
|
136
141
|
* 清空container容器的元素
|
|
137
142
|
*/
|
|
138
143
|
clearContainer() {
|
|
144
|
+
Reflect.deleteProperty(
|
|
145
|
+
this.$el.$contentSectionContainer,
|
|
146
|
+
"__formConfig__"
|
|
147
|
+
);
|
|
139
148
|
PopsSafeUtils.setSafeHTML(this.sectionContainerHeaderULElement, "");
|
|
140
149
|
PopsSafeUtils.setSafeHTML(this.sectionContainerULElement, "");
|
|
141
150
|
this.$el.$content
|
|
142
151
|
?.querySelectorAll("section.pops-panel-deepMenu-container")
|
|
143
|
-
.forEach((
|
|
152
|
+
.forEach(($el) => $el.remove());
|
|
144
153
|
},
|
|
145
154
|
/**
|
|
146
155
|
* 清空左侧容器已访问记录
|
|
@@ -148,8 +157,8 @@ export const PanelHandleContentDetails = () => {
|
|
|
148
157
|
clearAsideItemIsVisited() {
|
|
149
158
|
this.$el.$contentAside
|
|
150
159
|
.querySelectorAll<HTMLDivElement>(".pops-is-visited")
|
|
151
|
-
.forEach((
|
|
152
|
-
popsDOMUtils.removeClassName(
|
|
160
|
+
.forEach(($el) => {
|
|
161
|
+
popsDOMUtils.removeClassName($el, "pops-is-visited");
|
|
153
162
|
});
|
|
154
163
|
},
|
|
155
164
|
/**
|
|
@@ -227,35 +236,34 @@ export const PanelHandleContentDetails = () => {
|
|
|
227
236
|
* @param asideConfig
|
|
228
237
|
*/
|
|
229
238
|
createAsideItem(asideConfig: PopsPanelContentConfig) {
|
|
230
|
-
let
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
PopsSafeUtils.setSafeHTML(liElement, asideConfig.title);
|
|
239
|
+
let $li = document.createElement("li");
|
|
240
|
+
$li.id = asideConfig.id;
|
|
241
|
+
Reflect.set($li, "__forms__", asideConfig.forms);
|
|
242
|
+
PopsSafeUtils.setSafeHTML($li, asideConfig.title);
|
|
235
243
|
/* 处理className */
|
|
236
|
-
this.setElementClassName(
|
|
237
|
-
this.setElementAttributes(
|
|
238
|
-
this.setElementProps(
|
|
239
|
-
return
|
|
244
|
+
this.setElementClassName($li, asideConfig.className);
|
|
245
|
+
this.setElementAttributes($li, asideConfig.attributes);
|
|
246
|
+
this.setElementProps($li, asideConfig.props);
|
|
247
|
+
return $li;
|
|
240
248
|
},
|
|
241
249
|
/**
|
|
242
|
-
* 创建中间容器的元素<li>
|
|
243
250
|
* type ==> switch
|
|
251
|
+
* 创建中间容器的元素<li>
|
|
244
252
|
* @param formConfig
|
|
245
253
|
*/
|
|
246
254
|
createSectionContainerItem_switch(formConfig: PopsPanelSwitchDetails) {
|
|
247
|
-
let
|
|
248
|
-
(
|
|
249
|
-
this.setElementClassName(
|
|
250
|
-
this.setElementAttributes(
|
|
251
|
-
this.setElementProps(
|
|
255
|
+
let $li = document.createElement("li");
|
|
256
|
+
Reflect.set($li, "__formConfig__", formConfig);
|
|
257
|
+
this.setElementClassName($li, formConfig.className);
|
|
258
|
+
this.setElementAttributes($li, formConfig.attributes);
|
|
259
|
+
this.setElementProps($li, formConfig.props);
|
|
252
260
|
/* 左边底部的描述的文字 */
|
|
253
261
|
let leftDescriptionText = "";
|
|
254
262
|
if (Boolean(formConfig.description)) {
|
|
255
263
|
leftDescriptionText = /*html*/ `<p class="pops-panel-item-left-desc-text">${formConfig.description}</p>`;
|
|
256
264
|
}
|
|
257
265
|
PopsSafeUtils.setSafeHTML(
|
|
258
|
-
|
|
266
|
+
$li,
|
|
259
267
|
/*html*/ `
|
|
260
268
|
<div class="pops-panel-item-left-text">
|
|
261
269
|
<p class="pops-panel-item-left-main-text">${formConfig.text}</p>${leftDescriptionText}</div>
|
|
@@ -273,14 +281,11 @@ export const PanelHandleContentDetails = () => {
|
|
|
273
281
|
value: Boolean(formConfig.getValue()),
|
|
274
282
|
},
|
|
275
283
|
$ele: {
|
|
276
|
-
switch:
|
|
277
|
-
|
|
278
|
-
input: liElement.querySelector<HTMLInputElement>(
|
|
284
|
+
switch: $li.querySelector<HTMLDivElement>(".pops-panel-switch")!,
|
|
285
|
+
input: $li.querySelector<HTMLInputElement>(
|
|
279
286
|
".pops-panel-switch__input"
|
|
280
287
|
)!,
|
|
281
|
-
core:
|
|
282
|
-
".pops-panel-switch__core"
|
|
283
|
-
)!,
|
|
288
|
+
core: $li.querySelector<HTMLSpanElement>(".pops-panel-switch__core")!,
|
|
284
289
|
},
|
|
285
290
|
init() {
|
|
286
291
|
this.setStatus(this.$data.value);
|
|
@@ -355,27 +360,27 @@ export const PanelHandleContentDetails = () => {
|
|
|
355
360
|
};
|
|
356
361
|
|
|
357
362
|
PopsPanelSwitch.init();
|
|
358
|
-
(
|
|
359
|
-
return
|
|
363
|
+
Reflect.set($li, "data-switch", PopsPanelSwitch);
|
|
364
|
+
return $li;
|
|
360
365
|
},
|
|
361
366
|
/**
|
|
362
|
-
* 获取中间容器的元素<li>
|
|
363
367
|
* type ==> slider
|
|
368
|
+
* 获取中间容器的元素<li>
|
|
364
369
|
* @param formConfig
|
|
365
370
|
*/
|
|
366
371
|
createSectionContainerItem_slider(formConfig: PopsPanelSliderDetails) {
|
|
367
|
-
let
|
|
368
|
-
(
|
|
369
|
-
this.setElementClassName(
|
|
370
|
-
this.setElementAttributes(
|
|
371
|
-
this.setElementProps(
|
|
372
|
+
let $li = document.createElement("li");
|
|
373
|
+
Reflect.set($li, "__formConfig__", formConfig);
|
|
374
|
+
this.setElementClassName($li, formConfig.className);
|
|
375
|
+
this.setElementAttributes($li, formConfig.attributes);
|
|
376
|
+
this.setElementProps($li, formConfig.props);
|
|
372
377
|
/* 左边底部的描述的文字 */
|
|
373
378
|
let leftDescriptionText = "";
|
|
374
379
|
if (Boolean(formConfig.description)) {
|
|
375
380
|
leftDescriptionText = `<p class="pops-panel-item-left-desc-text">${formConfig.description}</p>`;
|
|
376
381
|
}
|
|
377
382
|
PopsSafeUtils.setSafeHTML(
|
|
378
|
-
|
|
383
|
+
$li,
|
|
379
384
|
/*html*/ `
|
|
380
385
|
<div class="pops-panel-item-left-text">
|
|
381
386
|
<p class="pops-panel-item-left-main-text">${formConfig.text}</p>${leftDescriptionText}</div>
|
|
@@ -384,13 +389,13 @@ export const PanelHandleContentDetails = () => {
|
|
|
384
389
|
</div>
|
|
385
390
|
`
|
|
386
391
|
);
|
|
387
|
-
let
|
|
392
|
+
let $rangeInput = $li.querySelector<HTMLInputElement>(
|
|
388
393
|
".pops-panel-slider input[type=range]"
|
|
389
394
|
)!;
|
|
390
395
|
if (formConfig.step) {
|
|
391
|
-
|
|
396
|
+
$rangeInput.setAttribute("step", formConfig.step.toString());
|
|
392
397
|
}
|
|
393
|
-
|
|
398
|
+
$rangeInput.value = formConfig.getValue().toString();
|
|
394
399
|
/**
|
|
395
400
|
* 获取提示的内容
|
|
396
401
|
* @param value
|
|
@@ -403,9 +408,9 @@ export const PanelHandleContentDetails = () => {
|
|
|
403
408
|
}
|
|
404
409
|
};
|
|
405
410
|
let tooltip = PopsTooltip.init({
|
|
406
|
-
target:
|
|
411
|
+
target: $rangeInput.parentElement!,
|
|
407
412
|
content: () => {
|
|
408
|
-
return getToolTipContent(
|
|
413
|
+
return getToolTipContent($rangeInput.value);
|
|
409
414
|
},
|
|
410
415
|
zIndex: () => {
|
|
411
416
|
return PopsInstanceUtils.getPopsMaxZIndex().zIndex;
|
|
@@ -416,43 +421,37 @@ export const PanelHandleContentDetails = () => {
|
|
|
416
421
|
position: "top",
|
|
417
422
|
arrowDistance: 10,
|
|
418
423
|
});
|
|
419
|
-
popsDOMUtils.on(
|
|
420
|
-
|
|
424
|
+
popsDOMUtils.on<InputEvent>(
|
|
425
|
+
$rangeInput,
|
|
421
426
|
["input", "propertychange"],
|
|
422
427
|
void 0,
|
|
423
428
|
function (event) {
|
|
424
|
-
tooltip.toolTip.changeContent(
|
|
425
|
-
getToolTipContent(rangeInputElement.value)
|
|
426
|
-
);
|
|
429
|
+
tooltip.toolTip.changeContent(getToolTipContent($rangeInput.value));
|
|
427
430
|
if (typeof formConfig.callback === "function") {
|
|
428
|
-
formConfig.callback(
|
|
429
|
-
event as InputEvent,
|
|
430
|
-
(event as any).target.value
|
|
431
|
-
);
|
|
431
|
+
formConfig.callback(event, $rangeInput.valueAsNumber);
|
|
432
432
|
}
|
|
433
433
|
}
|
|
434
434
|
);
|
|
435
|
-
return
|
|
435
|
+
return $li;
|
|
436
436
|
},
|
|
437
437
|
/**
|
|
438
|
-
* 获取中间容器的元素<li>
|
|
439
438
|
* type ==> slider
|
|
439
|
+
* 获取中间容器的元素<li>
|
|
440
440
|
* @param formConfig
|
|
441
441
|
*/
|
|
442
442
|
createSectionContainerItem_slider_new(formConfig: PopsPanelSliderDetails) {
|
|
443
|
-
let
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
this.
|
|
447
|
-
this.
|
|
448
|
-
this.setElementProps(liElement, formConfig.props);
|
|
443
|
+
let $li = document.createElement("li");
|
|
444
|
+
Reflect.set($li, "__formConfig__", formConfig);
|
|
445
|
+
this.setElementClassName($li, formConfig.className);
|
|
446
|
+
this.setElementAttributes($li, formConfig.attributes);
|
|
447
|
+
this.setElementProps($li, formConfig.props);
|
|
449
448
|
/* 左边底部的描述的文字 */
|
|
450
449
|
let leftDescriptionText = "";
|
|
451
450
|
if (Boolean(formConfig.description)) {
|
|
452
451
|
leftDescriptionText = /*html*/ `<p class="pops-panel-item-left-desc-text">${formConfig.description}</p>`;
|
|
453
452
|
}
|
|
454
453
|
PopsSafeUtils.setSafeHTML(
|
|
455
|
-
|
|
454
|
+
$li,
|
|
456
455
|
/*html*/ `
|
|
457
456
|
<div class="pops-panel-item-left-text" style="flex: 1;">
|
|
458
457
|
<p class="pops-panel-item-left-main-text">${formConfig.text}</p>${leftDescriptionText}</div>
|
|
@@ -537,15 +536,13 @@ export const PanelHandleContentDetails = () => {
|
|
|
537
536
|
tooltip: null as any as ReturnType<typeof PopsTooltip.init>,
|
|
538
537
|
},
|
|
539
538
|
$ele: {
|
|
540
|
-
slider:
|
|
541
|
-
runAway:
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
bar: liElement.querySelector<HTMLElement>(".pops-slider__bar")!,
|
|
545
|
-
buttonWrapper: liElement.querySelector<HTMLElement>(
|
|
539
|
+
slider: $li.querySelector<HTMLElement>(".pops-slider")!,
|
|
540
|
+
runAway: $li.querySelector<HTMLElement>(".pops-slider__runway")!,
|
|
541
|
+
bar: $li.querySelector<HTMLElement>(".pops-slider__bar")!,
|
|
542
|
+
buttonWrapper: $li.querySelector<HTMLElement>(
|
|
546
543
|
".pops-slider__button-wrapper"
|
|
547
544
|
)!,
|
|
548
|
-
button:
|
|
545
|
+
button: $li.querySelector<HTMLElement>(".pops-slider__button")!,
|
|
549
546
|
},
|
|
550
547
|
$interval: {
|
|
551
548
|
isCheck: false,
|
|
@@ -611,14 +608,10 @@ export const PanelHandleContentDetails = () => {
|
|
|
611
608
|
this.$ele.slider.setAttribute("data-max", this.max.toString());
|
|
612
609
|
this.$ele.slider.setAttribute("data-value", this.value.toString());
|
|
613
610
|
this.$ele.slider.setAttribute("data-step", this.step.toString());
|
|
614
|
-
|
|
615
|
-
this.$ele.slider
|
|
616
|
-
|
|
617
|
-
this.$ele.slider
|
|
618
|
-
// @ts-ignore
|
|
619
|
-
this.$ele.slider["data-value"] = this.value;
|
|
620
|
-
// @ts-ignore
|
|
621
|
-
this.$ele.slider["data-step"] = this.step;
|
|
611
|
+
Reflect.set(this.$ele.slider, "data-min", this.min);
|
|
612
|
+
Reflect.set(this.$ele.slider, "data-max", this.max);
|
|
613
|
+
Reflect.set(this.$ele.slider, "data-value", this.value);
|
|
614
|
+
Reflect.set(this.$ele.slider, "data-step", this.step);
|
|
622
615
|
},
|
|
623
616
|
/**
|
|
624
617
|
* 初始化滑块的总长度的数据(px)
|
|
@@ -642,7 +635,7 @@ export const PanelHandleContentDetails = () => {
|
|
|
642
635
|
stepValue += this.step
|
|
643
636
|
) {
|
|
644
637
|
let value = this.formatValue(stepValue);
|
|
645
|
-
let info
|
|
638
|
+
let info;
|
|
646
639
|
if (value === this.min) {
|
|
647
640
|
/* 起始 */
|
|
648
641
|
info = {
|
|
@@ -667,7 +660,7 @@ export const PanelHandleContentDetails = () => {
|
|
|
667
660
|
// info["pxRight"] = this.$data.totalWidth;
|
|
668
661
|
//}
|
|
669
662
|
}
|
|
670
|
-
this.$data.stepBlockMap.set(index, info
|
|
663
|
+
this.$data.stepBlockMap.set(index, info);
|
|
671
664
|
index++;
|
|
672
665
|
widthPx += this.$data.stepPx;
|
|
673
666
|
}
|
|
@@ -688,7 +681,7 @@ export const PanelHandleContentDetails = () => {
|
|
|
688
681
|
stepValue = PopsMathFloatUtils.add(stepValue, this.step)
|
|
689
682
|
) {
|
|
690
683
|
let value = this.formatValue(stepValue);
|
|
691
|
-
let info
|
|
684
|
+
let info;
|
|
692
685
|
if (value === this.min) {
|
|
693
686
|
/* 起始 */
|
|
694
687
|
info = {
|
|
@@ -713,7 +706,7 @@ export const PanelHandleContentDetails = () => {
|
|
|
713
706
|
// info["pxRight"] = this.$data.totalWidth;
|
|
714
707
|
//}
|
|
715
708
|
}
|
|
716
|
-
this.$data.stepBlockMap.set(index, info
|
|
709
|
+
this.$data.stepBlockMap.set(index, info);
|
|
717
710
|
index++;
|
|
718
711
|
widthPx += this.$data.stepPx;
|
|
719
712
|
}
|
|
@@ -845,7 +838,7 @@ export const PanelHandleContentDetails = () => {
|
|
|
845
838
|
* 设置进度条点击定位的事件
|
|
846
839
|
*/
|
|
847
840
|
setRunAwayClickEvent() {
|
|
848
|
-
popsDOMUtils.on(
|
|
841
|
+
popsDOMUtils.on<PointerEvent | MouseEvent>(
|
|
849
842
|
this.$ele.runAway,
|
|
850
843
|
"click",
|
|
851
844
|
void 0,
|
|
@@ -856,7 +849,7 @@ export const PanelHandleContentDetails = () => {
|
|
|
856
849
|
) {
|
|
857
850
|
return;
|
|
858
851
|
}
|
|
859
|
-
let clickX = parseFloat(
|
|
852
|
+
let clickX = parseFloat(event.offsetX.toString());
|
|
860
853
|
this.dragStartCallBack();
|
|
861
854
|
this.dragMoveCallBack(event, clickX, this.value);
|
|
862
855
|
this.dragEndCallBack(clickX);
|
|
@@ -1005,7 +998,7 @@ export const PanelHandleContentDetails = () => {
|
|
|
1005
998
|
if (typeof formConfig.getToolTipContent === "function") {
|
|
1006
999
|
return formConfig.getToolTipContent(PopsPanelSlider.value);
|
|
1007
1000
|
} else {
|
|
1008
|
-
return PopsPanelSlider.value
|
|
1001
|
+
return PopsPanelSlider.value.toString();
|
|
1009
1002
|
}
|
|
1010
1003
|
}
|
|
1011
1004
|
|
|
@@ -1052,20 +1045,20 @@ export const PanelHandleContentDetails = () => {
|
|
|
1052
1045
|
},
|
|
1053
1046
|
};
|
|
1054
1047
|
PopsPanelSlider.init();
|
|
1055
|
-
(
|
|
1056
|
-
return
|
|
1048
|
+
Reflect.set($li, "data-slider", PopsPanelSlider);
|
|
1049
|
+
return $li;
|
|
1057
1050
|
},
|
|
1058
1051
|
/**
|
|
1059
|
-
* 获取中间容器的元素<li>
|
|
1060
1052
|
* type ==> input
|
|
1053
|
+
* 获取中间容器的元素<li>
|
|
1061
1054
|
* @param formConfig
|
|
1062
1055
|
*/
|
|
1063
1056
|
createSectionContainerItem_input(formConfig: PopsPanelInputDetails) {
|
|
1064
|
-
let
|
|
1065
|
-
(
|
|
1066
|
-
this.setElementClassName(
|
|
1067
|
-
this.setElementAttributes(
|
|
1068
|
-
this.setElementProps(
|
|
1057
|
+
let $li = document.createElement("li");
|
|
1058
|
+
Reflect.set($li, "__formConfig__", formConfig);
|
|
1059
|
+
this.setElementClassName($li, formConfig.className);
|
|
1060
|
+
this.setElementAttributes($li, formConfig.attributes);
|
|
1061
|
+
this.setElementProps($li, formConfig.props);
|
|
1069
1062
|
let inputType = "text";
|
|
1070
1063
|
if (formConfig.isPassword) {
|
|
1071
1064
|
inputType = "password";
|
|
@@ -1078,7 +1071,7 @@ export const PanelHandleContentDetails = () => {
|
|
|
1078
1071
|
leftDescriptionText = `<p class="pops-panel-item-left-desc-text">${formConfig.description}</p>`;
|
|
1079
1072
|
}
|
|
1080
1073
|
PopsSafeUtils.setSafeHTML(
|
|
1081
|
-
|
|
1074
|
+
$li,
|
|
1082
1075
|
/*html*/ `
|
|
1083
1076
|
<div class="pops-panel-item-left-text">
|
|
1084
1077
|
<p class="pops-panel-item-left-main-text">${formConfig.text}</p>${leftDescriptionText}</div>
|
|
@@ -1090,9 +1083,8 @@ export const PanelHandleContentDetails = () => {
|
|
|
1090
1083
|
const PopsPanelInput = {
|
|
1091
1084
|
[Symbol.toStringTag]: "PopsPanelInput",
|
|
1092
1085
|
$ele: {
|
|
1093
|
-
panelInput:
|
|
1094
|
-
|
|
1095
|
-
input: liElement.querySelector<HTMLInputElement>("input")!,
|
|
1086
|
+
panelInput: $li.querySelector<HTMLDivElement>(".pops-panel-input")!,
|
|
1087
|
+
input: $li.querySelector<HTMLInputElement>("input")!,
|
|
1096
1088
|
inputSpanIcon: document.createElement("span"),
|
|
1097
1089
|
inputSpanIconInner: null as any as HTMLSpanElement,
|
|
1098
1090
|
icon: null as any as HTMLElement,
|
|
@@ -1121,7 +1113,7 @@ export const PanelHandleContentDetails = () => {
|
|
|
1121
1113
|
this.disable();
|
|
1122
1114
|
}
|
|
1123
1115
|
if (typeof formConfig.handlerCallBack === "function") {
|
|
1124
|
-
formConfig.handlerCallBack(
|
|
1116
|
+
formConfig.handlerCallBack($li, this.$ele.input);
|
|
1125
1117
|
}
|
|
1126
1118
|
},
|
|
1127
1119
|
/**
|
|
@@ -1237,7 +1229,7 @@ export const PanelHandleContentDetails = () => {
|
|
|
1237
1229
|
* 监听输入框内容改变
|
|
1238
1230
|
*/
|
|
1239
1231
|
setInputChangeEvent() {
|
|
1240
|
-
popsDOMUtils.on(
|
|
1232
|
+
popsDOMUtils.on<InputEvent>(
|
|
1241
1233
|
this.$ele.input,
|
|
1242
1234
|
["input", "propertychange"],
|
|
1243
1235
|
void 0,
|
|
@@ -1259,12 +1251,12 @@ export const PanelHandleContentDetails = () => {
|
|
|
1259
1251
|
if (typeof formConfig.callback === "function") {
|
|
1260
1252
|
if (formConfig.isNumber) {
|
|
1261
1253
|
formConfig.callback(
|
|
1262
|
-
event
|
|
1254
|
+
event,
|
|
1263
1255
|
this.$ele.input.value,
|
|
1264
1256
|
this.$ele.input.valueAsNumber
|
|
1265
1257
|
);
|
|
1266
1258
|
} else {
|
|
1267
|
-
formConfig.callback(event
|
|
1259
|
+
formConfig.callback(event, this.$ele.input.value);
|
|
1268
1260
|
}
|
|
1269
1261
|
}
|
|
1270
1262
|
}
|
|
@@ -1272,20 +1264,20 @@ export const PanelHandleContentDetails = () => {
|
|
|
1272
1264
|
},
|
|
1273
1265
|
};
|
|
1274
1266
|
PopsPanelInput.init();
|
|
1275
|
-
(
|
|
1276
|
-
return
|
|
1267
|
+
Reflect.set($li, "data-input", PopsPanelInput);
|
|
1268
|
+
return $li;
|
|
1277
1269
|
},
|
|
1278
1270
|
/**
|
|
1279
|
-
* 获取中间容器的元素<li>
|
|
1280
1271
|
* type ==> textarea
|
|
1272
|
+
* 获取中间容器的元素<li>
|
|
1281
1273
|
* @param formConfig
|
|
1282
1274
|
*/
|
|
1283
1275
|
createSectionContainerItem_textarea(formConfig: PopsPanelTextAreaDetails) {
|
|
1284
|
-
let
|
|
1285
|
-
(
|
|
1286
|
-
this.setElementClassName(
|
|
1287
|
-
this.setElementAttributes(
|
|
1288
|
-
this.setElementProps(
|
|
1276
|
+
let $li = document.createElement("li");
|
|
1277
|
+
Reflect.set($li, "__formConfig__", formConfig);
|
|
1278
|
+
this.setElementClassName($li, formConfig.className);
|
|
1279
|
+
this.setElementAttributes($li, formConfig.attributes);
|
|
1280
|
+
this.setElementProps($li, formConfig.props);
|
|
1289
1281
|
|
|
1290
1282
|
/* 左边底部的描述的文字 */
|
|
1291
1283
|
let leftDescriptionText = "";
|
|
@@ -1293,7 +1285,7 @@ export const PanelHandleContentDetails = () => {
|
|
|
1293
1285
|
leftDescriptionText = `<p class="pops-panel-item-left-desc-text">${formConfig.description}</p>`;
|
|
1294
1286
|
}
|
|
1295
1287
|
PopsSafeUtils.setSafeHTML(
|
|
1296
|
-
|
|
1288
|
+
$li,
|
|
1297
1289
|
/*html*/ `
|
|
1298
1290
|
<div class="pops-panel-item-left-text">
|
|
1299
1291
|
<p class="pops-panel-item-left-main-text">${
|
|
@@ -1308,10 +1300,10 @@ export const PanelHandleContentDetails = () => {
|
|
|
1308
1300
|
const PopsPanelTextArea = {
|
|
1309
1301
|
[Symbol.toStringTag]: "PopsPanelTextArea",
|
|
1310
1302
|
$ele: {
|
|
1311
|
-
panelTextarea:
|
|
1303
|
+
panelTextarea: $li.querySelector<HTMLDivElement>(
|
|
1312
1304
|
".pops-panel-textarea"
|
|
1313
1305
|
)!,
|
|
1314
|
-
textarea:
|
|
1306
|
+
textarea: $li.querySelector<HTMLTextAreaElement>(
|
|
1315
1307
|
".pops-panel-textarea textarea"
|
|
1316
1308
|
)!,
|
|
1317
1309
|
},
|
|
@@ -1350,14 +1342,20 @@ export const PanelHandleContentDetails = () => {
|
|
|
1350
1342
|
* 监听选择内容改变
|
|
1351
1343
|
*/
|
|
1352
1344
|
setChangeEvent() {
|
|
1353
|
-
popsDOMUtils.on(
|
|
1345
|
+
popsDOMUtils.on<InputEvent>(
|
|
1354
1346
|
this.$ele.textarea,
|
|
1355
1347
|
["input", "propertychange"],
|
|
1356
1348
|
void 0,
|
|
1357
1349
|
(event) => {
|
|
1358
|
-
|
|
1350
|
+
let value = this.$ele.textarea.value;
|
|
1351
|
+
this.$data.value = value;
|
|
1359
1352
|
if (typeof formConfig.callback === "function") {
|
|
1360
|
-
formConfig.callback(
|
|
1353
|
+
formConfig.callback(
|
|
1354
|
+
event as InputEvent & {
|
|
1355
|
+
target: HTMLTextAreaElement;
|
|
1356
|
+
},
|
|
1357
|
+
value
|
|
1358
|
+
);
|
|
1361
1359
|
}
|
|
1362
1360
|
}
|
|
1363
1361
|
);
|
|
@@ -1365,29 +1363,29 @@ export const PanelHandleContentDetails = () => {
|
|
|
1365
1363
|
};
|
|
1366
1364
|
|
|
1367
1365
|
PopsPanelTextArea.init();
|
|
1368
|
-
(
|
|
1366
|
+
Reflect.set($li, "data-textarea", PopsPanelTextArea);
|
|
1369
1367
|
|
|
1370
|
-
return
|
|
1368
|
+
return $li;
|
|
1371
1369
|
},
|
|
1372
1370
|
/**
|
|
1373
|
-
* 获取中间容器的元素<li>
|
|
1374
1371
|
* type ==> select
|
|
1372
|
+
* 获取中间容器的元素<li>
|
|
1375
1373
|
* @param formConfig
|
|
1376
1374
|
*/
|
|
1377
1375
|
createSectionContainerItem_select(formConfig: PopsPanelSelectDetails<any>) {
|
|
1378
1376
|
const that = this;
|
|
1379
|
-
let
|
|
1380
|
-
(
|
|
1381
|
-
this.setElementClassName(
|
|
1382
|
-
this.setElementAttributes(
|
|
1383
|
-
this.setElementProps(
|
|
1377
|
+
let $li = document.createElement("li");
|
|
1378
|
+
Reflect.set($li, "__formConfig__", formConfig);
|
|
1379
|
+
this.setElementClassName($li, formConfig.className);
|
|
1380
|
+
this.setElementAttributes($li, formConfig.attributes);
|
|
1381
|
+
this.setElementProps($li, formConfig.props);
|
|
1384
1382
|
/* 左边底部的描述的文字 */
|
|
1385
1383
|
let leftDescriptionText = "";
|
|
1386
1384
|
if (Boolean(formConfig.description)) {
|
|
1387
1385
|
leftDescriptionText = /*html*/ `<p class="pops-panel-item-left-desc-text">${formConfig.description}</p>`;
|
|
1388
1386
|
}
|
|
1389
1387
|
PopsSafeUtils.setSafeHTML(
|
|
1390
|
-
|
|
1388
|
+
$li,
|
|
1391
1389
|
/*html*/ `
|
|
1392
1390
|
<div class="pops-panel-item-left-text">
|
|
1393
1391
|
<p class="pops-panel-item-left-main-text">${formConfig.text}</p>${leftDescriptionText}</div>
|
|
@@ -1400,9 +1398,8 @@ export const PanelHandleContentDetails = () => {
|
|
|
1400
1398
|
const PopsPanelSelect = {
|
|
1401
1399
|
[Symbol.toStringTag]: "PopsPanelSelect",
|
|
1402
1400
|
$ele: {
|
|
1403
|
-
panelSelect:
|
|
1404
|
-
|
|
1405
|
-
select: liElement.querySelector<HTMLSelectElement>(
|
|
1401
|
+
panelSelect: $li.querySelector<HTMLDivElement>(".pops-panel-select")!,
|
|
1402
|
+
select: $li.querySelector<HTMLSelectElement>(
|
|
1406
1403
|
".pops-panel-select select"
|
|
1407
1404
|
)!,
|
|
1408
1405
|
},
|
|
@@ -1544,46 +1541,47 @@ export const PanelHandleContentDetails = () => {
|
|
|
1544
1541
|
* 监听选择内容改变
|
|
1545
1542
|
*/
|
|
1546
1543
|
setChangeEvent() {
|
|
1547
|
-
popsDOMUtils.on
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1544
|
+
popsDOMUtils.on<PointerEvent | TouchEvent>(
|
|
1545
|
+
this.$ele.select,
|
|
1546
|
+
"change",
|
|
1547
|
+
void 0,
|
|
1548
|
+
(event) => {
|
|
1549
|
+
let $isSelectedElement = this.$ele.select[
|
|
1550
|
+
this.$ele.select.selectedIndex
|
|
1551
|
+
] as HTMLOptionElement;
|
|
1552
|
+
let selectInfo = this.getSelectOptionInfo($isSelectedElement);
|
|
1553
|
+
this.setSelectOptionsDisableStatus();
|
|
1554
|
+
if (typeof formConfig.callback === "function") {
|
|
1555
|
+
formConfig.callback(event, selectInfo.value, selectInfo.text);
|
|
1556
|
+
}
|
|
1557
|
+
let forms =
|
|
1558
|
+
typeof selectInfo.forms === "function"
|
|
1559
|
+
? selectInfo.forms()
|
|
1560
|
+
: selectInfo.forms;
|
|
1561
|
+
if (Array.isArray(forms)) {
|
|
1562
|
+
/* 如果成功创建,加入到中间容器中 */
|
|
1563
|
+
let childUListClassName = "pops-panel-select-child-forms";
|
|
1564
|
+
// 移除旧的元素
|
|
1565
|
+
while ($li.nextElementSibling) {
|
|
1566
|
+
if (
|
|
1567
|
+
$li.nextElementSibling.classList.contains(
|
|
1568
|
+
childUListClassName
|
|
1569
|
+
)
|
|
1570
|
+
) {
|
|
1571
|
+
$li.nextElementSibling.remove();
|
|
1572
|
+
} else {
|
|
1573
|
+
break;
|
|
1574
|
+
}
|
|
1577
1575
|
}
|
|
1576
|
+
let $childUList = document.createElement("ul");
|
|
1577
|
+
$childUList.className = childUListClassName;
|
|
1578
|
+
popsDOMUtils.after($li, $childUList);
|
|
1579
|
+
that.uListContainerAddItem(formConfig, {
|
|
1580
|
+
ulElement: $childUList,
|
|
1581
|
+
});
|
|
1578
1582
|
}
|
|
1579
|
-
let $childUList = document.createElement("ul");
|
|
1580
|
-
$childUList.className = childUListClassName;
|
|
1581
|
-
popsDOMUtils.after(liElement, $childUList);
|
|
1582
|
-
that.uListContainerAddItem(formConfig as any, {
|
|
1583
|
-
ulElement: $childUList,
|
|
1584
|
-
});
|
|
1585
1583
|
}
|
|
1586
|
-
|
|
1584
|
+
);
|
|
1587
1585
|
},
|
|
1588
1586
|
/**
|
|
1589
1587
|
* 监听点击事件
|
|
@@ -1599,29 +1597,29 @@ export const PanelHandleContentDetails = () => {
|
|
|
1599
1597
|
};
|
|
1600
1598
|
|
|
1601
1599
|
PopsPanelSelect.init();
|
|
1602
|
-
Reflect.set(
|
|
1603
|
-
return
|
|
1600
|
+
Reflect.set($li, "data-select", PopsPanelSelect);
|
|
1601
|
+
return $li;
|
|
1604
1602
|
},
|
|
1605
1603
|
/**
|
|
1606
|
-
* 获取中间容器的元素<li>
|
|
1607
1604
|
* type ==> select-multiple
|
|
1605
|
+
* 获取中间容器的元素<li>
|
|
1608
1606
|
* @param formConfig
|
|
1609
1607
|
*/
|
|
1610
1608
|
createSectionContainerItem_select_multiple_new(
|
|
1611
1609
|
formConfig: PopsPanelSelectMultipleDetails<any>
|
|
1612
1610
|
) {
|
|
1613
|
-
let
|
|
1614
|
-
Reflect.set(
|
|
1615
|
-
this.setElementClassName(
|
|
1616
|
-
this.setElementAttributes(
|
|
1617
|
-
this.setElementProps(
|
|
1611
|
+
let $li = document.createElement("li");
|
|
1612
|
+
Reflect.set($li, "__formConfig__", formConfig);
|
|
1613
|
+
this.setElementClassName($li, formConfig.className);
|
|
1614
|
+
this.setElementAttributes($li, formConfig.attributes);
|
|
1615
|
+
this.setElementProps($li, formConfig.props);
|
|
1618
1616
|
/* 左边底部的描述的文字 */
|
|
1619
1617
|
let leftDescriptionText = "";
|
|
1620
1618
|
if (Boolean(formConfig.description)) {
|
|
1621
1619
|
leftDescriptionText = /*html*/ `<p class="pops-panel-item-left-desc-text">${formConfig.description}</p>`;
|
|
1622
1620
|
}
|
|
1623
1621
|
PopsSafeUtils.setSafeHTML(
|
|
1624
|
-
|
|
1622
|
+
$li,
|
|
1625
1623
|
/*html*/ `
|
|
1626
1624
|
<div class="pops-panel-item-left-text">
|
|
1627
1625
|
<p class="pops-panel-item-left-main-text">${formConfig.text}</p>${leftDescriptionText}</div>
|
|
@@ -1697,25 +1695,24 @@ export const PanelHandleContentDetails = () => {
|
|
|
1697
1695
|
},
|
|
1698
1696
|
/** 初始化$el变量 */
|
|
1699
1697
|
inintEl() {
|
|
1700
|
-
this.$el.$container =
|
|
1698
|
+
this.$el.$container = $li.querySelector<HTMLElement>(
|
|
1701
1699
|
".pops-panel-select-multiple"
|
|
1702
1700
|
)!;
|
|
1703
|
-
this.$el.$wrapper =
|
|
1701
|
+
this.$el.$wrapper = $li.querySelector<HTMLElement>(
|
|
1704
1702
|
".el-select__wrapper"
|
|
1705
1703
|
)!;
|
|
1706
|
-
this.$el.$section =
|
|
1704
|
+
this.$el.$section = $li.querySelector<HTMLElement>(
|
|
1707
1705
|
".el-select__selection"
|
|
1708
1706
|
)!;
|
|
1709
|
-
this.$el.$selectedInputWrapper =
|
|
1707
|
+
this.$el.$selectedInputWrapper = $li.querySelector<HTMLElement>(
|
|
1710
1708
|
".el-select__selected-item.el-select__input-wrapper"
|
|
1711
1709
|
)!;
|
|
1712
|
-
this.$el.$selectedPlaceHolderWrapper =
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
)!;
|
|
1710
|
+
this.$el.$selectedPlaceHolderWrapper = $li.querySelector<HTMLElement>(
|
|
1711
|
+
".el-select__selected-item.el-select__placeholder"
|
|
1712
|
+
)!;
|
|
1716
1713
|
this.$el.$suffix =
|
|
1717
|
-
|
|
1718
|
-
this.$el.$suffixIcon =
|
|
1714
|
+
$li.querySelector<HTMLElement>(".el-select__suffix")!;
|
|
1715
|
+
this.$el.$suffixIcon = $li.querySelector<HTMLElement>(
|
|
1719
1716
|
".el-select__suffix .el-icon"
|
|
1720
1717
|
)!;
|
|
1721
1718
|
|
|
@@ -2341,20 +2338,20 @@ export const PanelHandleContentDetails = () => {
|
|
|
2341
2338
|
};
|
|
2342
2339
|
|
|
2343
2340
|
PopsPanelSelectMultiple.init();
|
|
2344
|
-
Reflect.set(
|
|
2345
|
-
return
|
|
2341
|
+
Reflect.set($li, "data-select-multiple", PopsPanelSelectMultiple);
|
|
2342
|
+
return $li;
|
|
2346
2343
|
},
|
|
2347
2344
|
/**
|
|
2348
|
-
* 获取中间容器的元素<li>
|
|
2349
2345
|
* type ==> button
|
|
2346
|
+
* 获取中间容器的元素<li>
|
|
2350
2347
|
* @param formConfig
|
|
2351
2348
|
*/
|
|
2352
2349
|
createSectionContainerItem_button(formConfig: PopsPanelButtonDetails) {
|
|
2353
|
-
let
|
|
2354
|
-
(
|
|
2355
|
-
this.setElementClassName(
|
|
2356
|
-
this.setElementAttributes(
|
|
2357
|
-
this.setElementProps(
|
|
2350
|
+
let $li = document.createElement("li");
|
|
2351
|
+
Reflect.set($li, "__formConfig__", formConfig);
|
|
2352
|
+
this.setElementClassName($li, formConfig.className);
|
|
2353
|
+
this.setElementAttributes($li, formConfig.attributes);
|
|
2354
|
+
this.setElementProps($li, formConfig.props);
|
|
2358
2355
|
|
|
2359
2356
|
/* 左边底部的描述的文字 */
|
|
2360
2357
|
let leftDescriptionText = "";
|
|
@@ -2362,7 +2359,7 @@ export const PanelHandleContentDetails = () => {
|
|
|
2362
2359
|
leftDescriptionText = /*html*/ `<p class="pops-panel-item-left-desc-text">${formConfig.description}</p>`;
|
|
2363
2360
|
}
|
|
2364
2361
|
PopsSafeUtils.setSafeHTML(
|
|
2365
|
-
|
|
2362
|
+
$li,
|
|
2366
2363
|
/*html*/ `
|
|
2367
2364
|
<div class="pops-panel-item-left-text">
|
|
2368
2365
|
<p class="pops-panel-item-left-main-text">${formConfig.text}</p>${leftDescriptionText}</div>
|
|
@@ -2378,15 +2375,14 @@ export const PanelHandleContentDetails = () => {
|
|
|
2378
2375
|
const PopsPanelButton = {
|
|
2379
2376
|
[Symbol.toStringTag]: "PopsPanelButton",
|
|
2380
2377
|
$ele: {
|
|
2381
|
-
panelButton:
|
|
2382
|
-
|
|
2383
|
-
button: liElement.querySelector<HTMLDivElement>(
|
|
2378
|
+
panelButton: $li.querySelector<HTMLDivElement>(".pops-panel-button")!,
|
|
2379
|
+
button: $li.querySelector<HTMLDivElement>(
|
|
2384
2380
|
".pops-panel-button .pops-panel-button_inner"
|
|
2385
2381
|
)!,
|
|
2386
|
-
icon:
|
|
2382
|
+
icon: $li.querySelector<HTMLDivElement>(
|
|
2387
2383
|
".pops-panel-button .pops-bottom-icon"
|
|
2388
2384
|
)!,
|
|
2389
|
-
spanText:
|
|
2385
|
+
spanText: $li.querySelector<HTMLDivElement>(
|
|
2390
2386
|
".pops-panel-button .pops-panel-button-text"
|
|
2391
2387
|
)!,
|
|
2392
2388
|
},
|
|
@@ -2500,10 +2496,11 @@ export const PanelHandleContentDetails = () => {
|
|
|
2500
2496
|
},
|
|
2501
2497
|
};
|
|
2502
2498
|
PopsPanelButton.init();
|
|
2503
|
-
(
|
|
2504
|
-
return
|
|
2499
|
+
Reflect.set($li, "data-button", PopsPanelButton);
|
|
2500
|
+
return $li;
|
|
2505
2501
|
},
|
|
2506
2502
|
/**
|
|
2503
|
+
* type ==> deepMenu
|
|
2507
2504
|
* 获取深层容器的元素<li>
|
|
2508
2505
|
* @param formConfig
|
|
2509
2506
|
*/
|
|
@@ -2511,7 +2508,7 @@ export const PanelHandleContentDetails = () => {
|
|
|
2511
2508
|
let that = this;
|
|
2512
2509
|
let $li = document.createElement("li");
|
|
2513
2510
|
$li.classList.add("pops-panel-deepMenu-nav-item");
|
|
2514
|
-
($li
|
|
2511
|
+
Reflect.set($li, "__formConfig__", formConfig);
|
|
2515
2512
|
this.setElementClassName($li, formConfig.className);
|
|
2516
2513
|
// 设置属性
|
|
2517
2514
|
this.setElementAttributes($li, formConfig.attributes);
|
|
@@ -2647,13 +2644,16 @@ export const PanelHandleContentDetails = () => {
|
|
|
2647
2644
|
if (
|
|
2648
2645
|
typeof formConfig_forms.afterAddToUListCallBack === "function"
|
|
2649
2646
|
) {
|
|
2650
|
-
formConfig_forms.afterAddToUListCallBack(
|
|
2651
|
-
|
|
2652
|
-
|
|
2653
|
-
|
|
2654
|
-
|
|
2655
|
-
|
|
2656
|
-
|
|
2647
|
+
formConfig_forms.afterAddToUListCallBack(
|
|
2648
|
+
formConfig as any as PopsPanelFormsDetails,
|
|
2649
|
+
{
|
|
2650
|
+
target: formContainerListElement,
|
|
2651
|
+
ulElement: formContainerULElement,
|
|
2652
|
+
sectionContainerULElement: that.sectionContainerULElement,
|
|
2653
|
+
formContainerListElement: formContainerListElement,
|
|
2654
|
+
formHeaderDivElement: formHeaderDivElement,
|
|
2655
|
+
}
|
|
2656
|
+
);
|
|
2657
2657
|
}
|
|
2658
2658
|
} else {
|
|
2659
2659
|
/* 如果成功创建,加入到中间容器中 */
|
|
@@ -2669,9 +2669,9 @@ export const PanelHandleContentDetails = () => {
|
|
|
2669
2669
|
*/
|
|
2670
2670
|
gotoDeepMenu(event: Event, liElement: HTMLLIElement) {
|
|
2671
2671
|
/** 当前所在的容器 */
|
|
2672
|
-
let currentSection = liElement.closest(
|
|
2672
|
+
let currentSection = liElement.closest<HTMLElement>(
|
|
2673
2673
|
"section.pops-panel-container"
|
|
2674
|
-
)
|
|
2674
|
+
);
|
|
2675
2675
|
if (currentSection) {
|
|
2676
2676
|
popsDOMUtils.cssHide(currentSection, true);
|
|
2677
2677
|
}
|
|
@@ -2679,6 +2679,7 @@ export const PanelHandleContentDetails = () => {
|
|
|
2679
2679
|
let $deepMenuContainer = popsDOMUtils.createElement("section", {
|
|
2680
2680
|
className: "pops-panel-container pops-panel-deepMenu-container",
|
|
2681
2681
|
});
|
|
2682
|
+
Reflect.set($deepMenuContainer, "__formConfig__", formConfig);
|
|
2682
2683
|
let $deepMenuHeaderUL = popsDOMUtils.createElement("ul", {
|
|
2683
2684
|
className: "pops-panel-deepMenu-container-header-ul",
|
|
2684
2685
|
});
|
|
@@ -2696,14 +2697,15 @@ export const PanelHandleContentDetails = () => {
|
|
|
2696
2697
|
popsDOMUtils.on(
|
|
2697
2698
|
$headerLeftArrow,
|
|
2698
2699
|
"click",
|
|
2699
|
-
void 0,
|
|
2700
2700
|
(event) => {
|
|
2701
|
-
event
|
|
2702
|
-
event?.stopPropagation();
|
|
2701
|
+
popsDOMUtils.preventEvent(event);
|
|
2703
2702
|
// 返回上一层菜单
|
|
2704
|
-
let $prev =
|
|
2703
|
+
let $prev = <HTMLElement>(
|
|
2704
|
+
$deepMenuContainer.previousElementSibling
|
|
2705
|
+
);
|
|
2705
2706
|
popsDOMUtils.cssShow($prev);
|
|
2706
2707
|
$deepMenuContainer.remove();
|
|
2708
|
+
that.triggerRenderRightContainer($prev);
|
|
2707
2709
|
},
|
|
2708
2710
|
{
|
|
2709
2711
|
once: true,
|
|
@@ -2733,6 +2735,7 @@ export const PanelHandleContentDetails = () => {
|
|
|
2733
2735
|
sectionBodyContainer: $deepMenuBodyUL,
|
|
2734
2736
|
});
|
|
2735
2737
|
}
|
|
2738
|
+
that.triggerRenderRightContainer($deepMenuContainer);
|
|
2736
2739
|
},
|
|
2737
2740
|
/** 设置项的点击事件 */
|
|
2738
2741
|
setLiClickEvent() {
|
|
@@ -2749,23 +2752,23 @@ export const PanelHandleContentDetails = () => {
|
|
|
2749
2752
|
};
|
|
2750
2753
|
|
|
2751
2754
|
PopsPanelDeepMenu.init();
|
|
2752
|
-
($li
|
|
2755
|
+
Reflect.set($li, "data-deepMenu", PopsPanelDeepMenu);
|
|
2753
2756
|
|
|
2754
2757
|
return $li;
|
|
2755
2758
|
},
|
|
2756
2759
|
/**
|
|
2757
|
-
* 获取中间容器的元素<li>
|
|
2758
2760
|
* type ===> own
|
|
2761
|
+
* 获取中间容器的元素<li>
|
|
2759
2762
|
* @param formConfig
|
|
2760
2763
|
*/
|
|
2761
2764
|
createSectionContainerItem_own(formConfig: PopsPanelOwnDetails) {
|
|
2762
|
-
let
|
|
2763
|
-
(
|
|
2765
|
+
let $li = document.createElement("li");
|
|
2766
|
+
Reflect.set($li, "__formConfig__", formConfig);
|
|
2764
2767
|
if (formConfig.className) {
|
|
2765
|
-
|
|
2768
|
+
$li.className = formConfig.className;
|
|
2766
2769
|
}
|
|
2767
|
-
|
|
2768
|
-
return
|
|
2770
|
+
$li = formConfig.getLiElementCallBack($li);
|
|
2771
|
+
return $li;
|
|
2769
2772
|
},
|
|
2770
2773
|
/**
|
|
2771
2774
|
* 获取中间容器的元素<li>
|
|
@@ -2885,12 +2888,15 @@ export const PanelHandleContentDetails = () => {
|
|
|
2885
2888
|
);
|
|
2886
2889
|
that.setElementProps(formContainerListElement, formConfig.props);
|
|
2887
2890
|
childForms.forEach((childFormConfig) => {
|
|
2888
|
-
that.uListContainerAddItem(
|
|
2889
|
-
|
|
2890
|
-
|
|
2891
|
-
|
|
2892
|
-
|
|
2893
|
-
|
|
2891
|
+
that.uListContainerAddItem(
|
|
2892
|
+
childFormConfig as PopsPanelFormsTotalDetails,
|
|
2893
|
+
{
|
|
2894
|
+
ulElement: formContainerULElement,
|
|
2895
|
+
sectionContainerULElement: that.sectionContainerULElement,
|
|
2896
|
+
formContainerListElement: formContainerListElement,
|
|
2897
|
+
formHeaderDivElement: formHeaderDivElement,
|
|
2898
|
+
}
|
|
2899
|
+
);
|
|
2894
2900
|
});
|
|
2895
2901
|
formContainerListElement.appendChild(formContainerULElement);
|
|
2896
2902
|
that.sectionContainerULElement.appendChild(formContainerListElement);
|
|
@@ -2906,11 +2912,31 @@ export const PanelHandleContentDetails = () => {
|
|
|
2906
2912
|
}
|
|
2907
2913
|
} else {
|
|
2908
2914
|
/* 如果成功创建,加入到中间容器中 */
|
|
2909
|
-
that.uListContainerAddItem(
|
|
2910
|
-
|
|
2911
|
-
|
|
2915
|
+
that.uListContainerAddItem(
|
|
2916
|
+
formConfig as any as PopsPanelFormsTotalDetails,
|
|
2917
|
+
{
|
|
2918
|
+
ulElement: that.sectionContainerULElement,
|
|
2919
|
+
}
|
|
2920
|
+
);
|
|
2912
2921
|
}
|
|
2913
2922
|
},
|
|
2923
|
+
/**
|
|
2924
|
+
* 触发触发渲染右侧容器的事件
|
|
2925
|
+
*/
|
|
2926
|
+
triggerRenderRightContainer($container: HTMLElement) {
|
|
2927
|
+
let __formConfig__: PopsPanelEventType["pops:renderRightContainer"]["formConfig"] =
|
|
2928
|
+
Reflect.get($container, "__formConfig__");
|
|
2929
|
+
this.$el.$pops.dispatchEvent(
|
|
2930
|
+
new CustomEvent<PopsPanelEventType["pops:renderRightContainer"]>(
|
|
2931
|
+
<keyof PopsPanelEventType>"pops:renderRightContainer",
|
|
2932
|
+
{
|
|
2933
|
+
detail: {
|
|
2934
|
+
formConfig: __formConfig__,
|
|
2935
|
+
},
|
|
2936
|
+
}
|
|
2937
|
+
)
|
|
2938
|
+
);
|
|
2939
|
+
},
|
|
2914
2940
|
/**
|
|
2915
2941
|
*
|
|
2916
2942
|
* @param formConfig
|
|
@@ -2947,6 +2973,16 @@ export const PanelHandleContentDetails = () => {
|
|
|
2947
2973
|
void 0,
|
|
2948
2974
|
(event) => {
|
|
2949
2975
|
this.clearContainer();
|
|
2976
|
+
let rightContainerFormConfig = Reflect.get(
|
|
2977
|
+
asideLiElement,
|
|
2978
|
+
"__forms__"
|
|
2979
|
+
) as PopsPanelContentConfig[];
|
|
2980
|
+
|
|
2981
|
+
Reflect.set(
|
|
2982
|
+
that.$el.$contentSectionContainer,
|
|
2983
|
+
"__formConfig__",
|
|
2984
|
+
rightContainerFormConfig
|
|
2985
|
+
);
|
|
2950
2986
|
popsDOMUtils.cssShow(that.$el.$contentSectionContainer);
|
|
2951
2987
|
this.clearAsideItemIsVisited();
|
|
2952
2988
|
this.setAsideItemIsVisited(asideLiElement);
|
|
@@ -2956,23 +2992,15 @@ export const PanelHandleContentDetails = () => {
|
|
|
2956
2992
|
typeof headerTitleText === "string" &&
|
|
2957
2993
|
headerTitleText.trim() !== ""
|
|
2958
2994
|
) {
|
|
2959
|
-
let
|
|
2960
|
-
(
|
|
2961
|
-
|
|
2962
|
-
PopsSafeUtils.setSafeHTML(
|
|
2963
|
-
containerHeaderTitleLIElement,
|
|
2964
|
-
headerTitleText
|
|
2965
|
-
);
|
|
2995
|
+
let $containerHeaderTitle = document.createElement("li");
|
|
2996
|
+
Reflect.set($containerHeaderTitle, "__asideConfig__", asideConfig);
|
|
2997
|
+
PopsSafeUtils.setSafeHTML($containerHeaderTitle, headerTitleText);
|
|
2966
2998
|
this.sectionContainerHeaderULElement.appendChild(
|
|
2967
|
-
|
|
2999
|
+
$containerHeaderTitle
|
|
2968
3000
|
);
|
|
2969
3001
|
}
|
|
2970
3002
|
|
|
2971
|
-
|
|
2972
|
-
"__forms__"
|
|
2973
|
-
] as PopsPanelContentConfig[];
|
|
2974
|
-
|
|
2975
|
-
__forms__.forEach((formConfig) => {
|
|
3003
|
+
rightContainerFormConfig.forEach((formConfig) => {
|
|
2976
3004
|
this.createSectionContainerItem_forms(formConfig);
|
|
2977
3005
|
});
|
|
2978
3006
|
|
|
@@ -2984,6 +3012,7 @@ export const PanelHandleContentDetails = () => {
|
|
|
2984
3012
|
this.sectionContainerULElement
|
|
2985
3013
|
);
|
|
2986
3014
|
}
|
|
3015
|
+
that.triggerRenderRightContainer(that.$el.$contentSectionContainer);
|
|
2987
3016
|
}
|
|
2988
3017
|
);
|
|
2989
3018
|
},
|