@whitesev/pops 1.9.6 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.amd.js +307 -177
- package/dist/index.amd.js.map +1 -1
- package/dist/index.cjs.js +307 -177
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +307 -177
- package/dist/index.esm.js.map +1 -1
- package/dist/index.iife.js +307 -177
- package/dist/index.iife.js.map +1 -1
- package/dist/index.system.js +307 -177
- package/dist/index.system.js.map +1 -1
- package/dist/index.umd.js +307 -177
- package/dist/index.umd.js.map +1 -1
- package/dist/types/src/components/panel/selectType.d.ts +6 -0
- package/dist/types/src/utils/PopsSafeUtils.d.ts +6 -0
- package/package.json +1 -1
- package/src/Pops.ts +4 -3
- package/src/components/folder/index.ts +45 -32
- package/src/components/panel/PanelHandleContentDetails.ts +270 -138
- package/src/components/panel/config.ts +3 -0
- package/src/components/panel/selectType.ts +8 -0
- package/src/components/rightClickMenu/index.ts +9 -3
- package/src/components/searchSuggestion/index.ts +13 -4
- package/src/components/tooltip/index.ts +2 -1
- package/src/utils/PopsDOMUtils.ts +9 -3
- package/src/utils/PopsSafeUtils.ts +22 -0
|
@@ -2,6 +2,7 @@ import { pops } from "../../Pops";
|
|
|
2
2
|
import { popsDOMUtils } from "../../utils/PopsDOMUtils";
|
|
3
3
|
import { PopsInstanceUtils } from "../../utils/PopsInstanceUtils";
|
|
4
4
|
import { PopsMathFloatUtils } from "../../utils/PopsMathUtils";
|
|
5
|
+
import { PopsSafeUtils } from "../../utils/PopsSafeUtils";
|
|
5
6
|
import { popsUtils } from "../../utils/PopsUtils";
|
|
6
7
|
import type { PopsAlertDetails } from "../alert/indexType";
|
|
7
8
|
import type { PopsTooltipResult } from "../tooltip";
|
|
@@ -135,8 +136,8 @@ export const PanelHandleContentDetails = () => {
|
|
|
135
136
|
* 清空container容器的元素
|
|
136
137
|
*/
|
|
137
138
|
clearContainer() {
|
|
138
|
-
this.sectionContainerHeaderULElement
|
|
139
|
-
this.sectionContainerULElement
|
|
139
|
+
PopsSafeUtils.setSafeHTML(this.sectionContainerHeaderULElement, "");
|
|
140
|
+
PopsSafeUtils.setSafeHTML(this.sectionContainerULElement, "");
|
|
140
141
|
this.$el.$content
|
|
141
142
|
?.querySelectorAll("section.pops-panel-deepMenu-container")
|
|
142
143
|
.forEach((ele) => ele.remove());
|
|
@@ -223,8 +224,9 @@ export const PanelHandleContentDetails = () => {
|
|
|
223
224
|
createAsideItem(asideConfig: PopsPanelContentConfig) {
|
|
224
225
|
let liElement = document.createElement("li");
|
|
225
226
|
liElement.id = asideConfig.id;
|
|
226
|
-
|
|
227
|
-
liElement
|
|
227
|
+
// @ts-ignore
|
|
228
|
+
liElement["__forms__"] = asideConfig.forms;
|
|
229
|
+
PopsSafeUtils.setSafeHTML(liElement, asideConfig.title);
|
|
228
230
|
/* 处理className */
|
|
229
231
|
this.setElementClassName(liElement, asideConfig.className);
|
|
230
232
|
this.setElementAttributes(liElement, asideConfig.attributes);
|
|
@@ -247,18 +249,21 @@ export const PanelHandleContentDetails = () => {
|
|
|
247
249
|
if (Boolean(formConfig.description)) {
|
|
248
250
|
leftDescriptionText = /*html*/ `<p class="pops-panel-item-left-desc-text">${formConfig.description}</p>`;
|
|
249
251
|
}
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
<
|
|
258
|
-
<
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
252
|
+
PopsSafeUtils.setSafeHTML(
|
|
253
|
+
liElement,
|
|
254
|
+
/*html*/ `
|
|
255
|
+
<div class="pops-panel-item-left-text">
|
|
256
|
+
<p class="pops-panel-item-left-main-text">${formConfig.text}</p>
|
|
257
|
+
${leftDescriptionText}
|
|
258
|
+
</div>
|
|
259
|
+
<div class="pops-panel-switch">
|
|
260
|
+
<input class="pops-panel-switch__input" type="checkbox">
|
|
261
|
+
<span class="pops-panel-switch__core">
|
|
262
|
+
<div class="pops-panel-switch__action">
|
|
263
|
+
</div>
|
|
264
|
+
</span>
|
|
265
|
+
</div>`
|
|
266
|
+
);
|
|
262
267
|
const PopsPanelSwitch = {
|
|
263
268
|
[Symbol.toStringTag]: "PopsPanelSwitch",
|
|
264
269
|
$data: {
|
|
@@ -366,15 +371,18 @@ export const PanelHandleContentDetails = () => {
|
|
|
366
371
|
if (Boolean(formConfig.description)) {
|
|
367
372
|
leftDescriptionText = `<p class="pops-panel-item-left-desc-text">${formConfig.description}</p>`;
|
|
368
373
|
}
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
374
|
+
PopsSafeUtils.setSafeHTML(
|
|
375
|
+
liElement,
|
|
376
|
+
/*html*/ `
|
|
377
|
+
<div class="pops-panel-item-left-text">
|
|
378
|
+
<p class="pops-panel-item-left-main-text">${formConfig.text}</p>
|
|
379
|
+
${leftDescriptionText}
|
|
380
|
+
</div>
|
|
381
|
+
<div class="pops-panel-slider">
|
|
382
|
+
<input type="range" min="${formConfig.min}" max="${formConfig.max}">
|
|
383
|
+
</div>
|
|
384
|
+
`
|
|
385
|
+
);
|
|
378
386
|
let rangeInputElement = liElement.querySelector<HTMLInputElement>(
|
|
379
387
|
".pops-panel-slider input[type=range]"
|
|
380
388
|
)!;
|
|
@@ -441,19 +449,22 @@ export const PanelHandleContentDetails = () => {
|
|
|
441
449
|
if (Boolean(formConfig.description)) {
|
|
442
450
|
leftDescriptionText = /*html*/ `<p class="pops-panel-item-left-desc-text">${formConfig.description}</p>`;
|
|
443
451
|
}
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
<div class="pops-slider__runway">
|
|
451
|
-
<div class="pops-slider__bar" style="width: 0%; left: 0%"></div>
|
|
452
|
-
<div class="pops-slider__button-wrapper" style="left: 0%">
|
|
453
|
-
<div class="pops-slider__button"></div>
|
|
454
|
-
</div>
|
|
452
|
+
PopsSafeUtils.setSafeHTML(
|
|
453
|
+
liElement,
|
|
454
|
+
/*html*/ `
|
|
455
|
+
<div class="pops-panel-item-left-text" style="flex: 1;">
|
|
456
|
+
<p class="pops-panel-item-left-main-text">${formConfig.text}</p>
|
|
457
|
+
${leftDescriptionText}
|
|
455
458
|
</div>
|
|
456
|
-
|
|
459
|
+
<div class="pops-slider pops-slider-width">
|
|
460
|
+
<div class="pops-slider__runway">
|
|
461
|
+
<div class="pops-slider__bar" style="width: 0%; left: 0%"></div>
|
|
462
|
+
<div class="pops-slider__button-wrapper" style="left: 0%">
|
|
463
|
+
<div class="pops-slider__button"></div>
|
|
464
|
+
</div>
|
|
465
|
+
</div>
|
|
466
|
+
</div>`
|
|
467
|
+
);
|
|
457
468
|
const PopsPanelSlider = {
|
|
458
469
|
[Symbol.toStringTag]: "PopsPanelSlider",
|
|
459
470
|
/**
|
|
@@ -1033,15 +1044,18 @@ export const PanelHandleContentDetails = () => {
|
|
|
1033
1044
|
if (Boolean(formConfig.description)) {
|
|
1034
1045
|
leftDescriptionText = `<p class="pops-panel-item-left-desc-text">${formConfig.description}</p>`;
|
|
1035
1046
|
}
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1047
|
+
PopsSafeUtils.setSafeHTML(
|
|
1048
|
+
liElement,
|
|
1049
|
+
/*html*/ `
|
|
1050
|
+
<div class="pops-panel-item-left-text">
|
|
1051
|
+
<p class="pops-panel-item-left-main-text">${formConfig.text}</p>
|
|
1052
|
+
${leftDescriptionText}
|
|
1053
|
+
</div>
|
|
1054
|
+
<div class="pops-panel-input pops-user-select-none">
|
|
1055
|
+
<input type="${inputType}" placeholder="${formConfig.placeholder}">
|
|
1056
|
+
</div>
|
|
1057
|
+
`
|
|
1058
|
+
);
|
|
1045
1059
|
const PopsPanelInput = {
|
|
1046
1060
|
[Symbol.toStringTag]: "PopsPanelInput",
|
|
1047
1061
|
$ele: {
|
|
@@ -1088,11 +1102,14 @@ export const PanelHandleContentDetails = () => {
|
|
|
1088
1102
|
this.$ele.input.nextSibling
|
|
1089
1103
|
);
|
|
1090
1104
|
this.$ele.inputSpanIcon.className = "pops-panel-input__suffix";
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1105
|
+
PopsSafeUtils.setSafeHTML(
|
|
1106
|
+
this.$ele.inputSpanIcon,
|
|
1107
|
+
/*html*/ `
|
|
1108
|
+
<span class="pops-panel-input__suffix-inner">
|
|
1109
|
+
<i class="pops-panel-icon"></i>
|
|
1110
|
+
</span>
|
|
1111
|
+
`
|
|
1112
|
+
);
|
|
1096
1113
|
this.$ele.inputSpanIconInner =
|
|
1097
1114
|
this.$ele.inputSpanIcon.querySelector<HTMLElement>(
|
|
1098
1115
|
".pops-panel-input__suffix-inner"
|
|
@@ -1131,7 +1148,7 @@ export const PanelHandleContentDetails = () => {
|
|
|
1131
1148
|
},
|
|
1132
1149
|
/**
|
|
1133
1150
|
* 设置input元素的type
|
|
1134
|
-
* @param
|
|
1151
|
+
* @param [typeValue="text"] type值
|
|
1135
1152
|
*/
|
|
1136
1153
|
setInputType(typeValue = "text") {
|
|
1137
1154
|
this.$ele.input.setAttribute("type", typeValue);
|
|
@@ -1140,14 +1157,14 @@ export const PanelHandleContentDetails = () => {
|
|
|
1140
1157
|
* 删除图标按钮
|
|
1141
1158
|
*/
|
|
1142
1159
|
removeCircleIcon() {
|
|
1143
|
-
this.$ele.icon
|
|
1160
|
+
PopsSafeUtils.setSafeHTML(this.$ele.icon, "");
|
|
1144
1161
|
},
|
|
1145
1162
|
/**
|
|
1146
1163
|
* 添加清空图标按钮
|
|
1147
|
-
* @param
|
|
1164
|
+
* @param [svgHTML=pops.config.iconSVG.circleClose] svg图标,默认为清空的图标
|
|
1148
1165
|
*/
|
|
1149
1166
|
setCircleIcon(svgHTML = pops.config.iconSVG.circleClose) {
|
|
1150
|
-
this.$ele.icon
|
|
1167
|
+
PopsSafeUtils.setSafeHTML(this.$ele.icon, svgHTML);
|
|
1151
1168
|
},
|
|
1152
1169
|
/**
|
|
1153
1170
|
* 添加图标按钮的点击事件
|
|
@@ -1244,16 +1261,19 @@ export const PanelHandleContentDetails = () => {
|
|
|
1244
1261
|
if (Boolean(formConfig.description)) {
|
|
1245
1262
|
leftDescriptionText = `<p class="pops-panel-item-left-desc-text">${formConfig.description}</p>`;
|
|
1246
1263
|
}
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1264
|
+
PopsSafeUtils.setSafeHTML(
|
|
1265
|
+
liElement,
|
|
1266
|
+
/*html*/ `
|
|
1267
|
+
<div class="pops-panel-item-left-text">
|
|
1268
|
+
<p class="pops-panel-item-left-main-text">${formConfig.text}</p>
|
|
1269
|
+
${leftDescriptionText}
|
|
1270
|
+
</div>
|
|
1271
|
+
<div class="pops-panel-textarea">
|
|
1272
|
+
<textarea placeholder="${formConfig.placeholder ?? ""}">
|
|
1273
|
+
</textarea>
|
|
1274
|
+
</div>
|
|
1275
|
+
`
|
|
1276
|
+
);
|
|
1257
1277
|
|
|
1258
1278
|
const PopsPanelTextArea = {
|
|
1259
1279
|
[Symbol.toStringTag]: "PopsPanelTextArea",
|
|
@@ -1325,6 +1345,7 @@ export const PanelHandleContentDetails = () => {
|
|
|
1325
1345
|
* @param formConfig
|
|
1326
1346
|
*/
|
|
1327
1347
|
createSectionContainerItem_select(formConfig: PopsPanelSelectDetails<any>) {
|
|
1348
|
+
const that = this;
|
|
1328
1349
|
let liElement = document.createElement("li");
|
|
1329
1350
|
(liElement as any)["__formConfig__"] = formConfig;
|
|
1330
1351
|
this.setElementClassName(liElement, formConfig.className);
|
|
@@ -1335,15 +1356,18 @@ export const PanelHandleContentDetails = () => {
|
|
|
1335
1356
|
if (Boolean(formConfig.description)) {
|
|
1336
1357
|
leftDescriptionText = /*html*/ `<p class="pops-panel-item-left-desc-text">${formConfig.description}</p>`;
|
|
1337
1358
|
}
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1359
|
+
PopsSafeUtils.setSafeHTML(
|
|
1360
|
+
liElement,
|
|
1361
|
+
/*html*/ `
|
|
1362
|
+
<div class="pops-panel-item-left-text">
|
|
1363
|
+
<p class="pops-panel-item-left-main-text">${formConfig.text}</p>
|
|
1364
|
+
${leftDescriptionText}
|
|
1365
|
+
</div>
|
|
1366
|
+
<div class="pops-panel-select pops-user-select-none">
|
|
1367
|
+
<select></select>
|
|
1368
|
+
</div>
|
|
1369
|
+
`
|
|
1370
|
+
);
|
|
1347
1371
|
|
|
1348
1372
|
const PopsPanelSelect = {
|
|
1349
1373
|
[Symbol.toStringTag]: "PopsPanelSelect",
|
|
@@ -1357,6 +1381,7 @@ export const PanelHandleContentDetails = () => {
|
|
|
1357
1381
|
$eleKey: {
|
|
1358
1382
|
disable: "__disable__",
|
|
1359
1383
|
value: "__value__",
|
|
1384
|
+
forms: "__forms__",
|
|
1360
1385
|
},
|
|
1361
1386
|
$data: {
|
|
1362
1387
|
defaultValue: formConfig.getValue(),
|
|
@@ -1387,14 +1412,23 @@ export const PanelHandleContentDetails = () => {
|
|
|
1387
1412
|
getNodeValue($ele: HTMLElement, key: string) {
|
|
1388
1413
|
return Reflect.get($ele, key);
|
|
1389
1414
|
},
|
|
1415
|
+
/**
|
|
1416
|
+
* 禁用选项
|
|
1417
|
+
*/
|
|
1390
1418
|
disable() {
|
|
1391
1419
|
this.$ele.select.setAttribute("disabled", "true");
|
|
1392
1420
|
this.$ele.panelSelect.classList.add("pops-panel-select-disable");
|
|
1393
1421
|
},
|
|
1422
|
+
/**
|
|
1423
|
+
* 取消禁用
|
|
1424
|
+
*/
|
|
1394
1425
|
notDisable() {
|
|
1395
1426
|
this.$ele.select.removeAttribute("disabled");
|
|
1396
1427
|
this.$ele.panelSelect.classList.remove("pops-panel-select-disable");
|
|
1397
1428
|
},
|
|
1429
|
+
/**
|
|
1430
|
+
* 判断是否禁用
|
|
1431
|
+
*/
|
|
1398
1432
|
isDisabled() {
|
|
1399
1433
|
return (
|
|
1400
1434
|
this.$ele.select.hasAttribute("disabled") ||
|
|
@@ -1403,6 +1437,9 @@ export const PanelHandleContentDetails = () => {
|
|
|
1403
1437
|
)
|
|
1404
1438
|
);
|
|
1405
1439
|
},
|
|
1440
|
+
/**
|
|
1441
|
+
* 初始化选项
|
|
1442
|
+
*/
|
|
1406
1443
|
initOption() {
|
|
1407
1444
|
formConfig.data.forEach((dataItem) => {
|
|
1408
1445
|
// 初始化默认选中
|
|
@@ -1417,13 +1454,24 @@ export const PanelHandleContentDetails = () => {
|
|
|
1417
1454
|
this.$eleKey.disable,
|
|
1418
1455
|
dataItem.disable
|
|
1419
1456
|
);
|
|
1457
|
+
this.setNodeValue(
|
|
1458
|
+
optionElement,
|
|
1459
|
+
this.$eleKey.forms,
|
|
1460
|
+
dataItem.forms
|
|
1461
|
+
);
|
|
1420
1462
|
if (dataItem.value === this.$data.defaultValue) {
|
|
1421
|
-
|
|
1463
|
+
this.setOptionSelected(optionElement);
|
|
1422
1464
|
}
|
|
1423
1465
|
optionElement.innerText = dataItem.text;
|
|
1424
1466
|
this.$ele.select.appendChild(optionElement);
|
|
1425
1467
|
});
|
|
1426
1468
|
},
|
|
1469
|
+
/**
|
|
1470
|
+
* 设置选项选中
|
|
1471
|
+
*/
|
|
1472
|
+
setOptionSelected($option: HTMLOptionElement) {
|
|
1473
|
+
$option.setAttribute("selected", "true");
|
|
1474
|
+
},
|
|
1427
1475
|
/** 检测所有option并设置禁用状态 */
|
|
1428
1476
|
setSelectOptionsDisableStatus() {
|
|
1429
1477
|
if (this.$ele.select.options && this.$ele.select.options.length) {
|
|
@@ -1453,9 +1501,14 @@ export const PanelHandleContentDetails = () => {
|
|
|
1453
1501
|
getSelectOptionInfo($option: HTMLOptionElement) {
|
|
1454
1502
|
let optionValue = this.getNodeValue($option, this.$eleKey.value);
|
|
1455
1503
|
let optionText = $option.innerText || $option.textContent!;
|
|
1504
|
+
let optionForms = this.getNodeValue(
|
|
1505
|
+
$option,
|
|
1506
|
+
this.$eleKey.forms
|
|
1507
|
+
) as (typeof formConfig.data)[0]["forms"];
|
|
1456
1508
|
return {
|
|
1457
1509
|
value: optionValue,
|
|
1458
1510
|
text: optionText,
|
|
1511
|
+
forms: optionForms,
|
|
1459
1512
|
$option: $option,
|
|
1460
1513
|
};
|
|
1461
1514
|
},
|
|
@@ -1464,18 +1517,44 @@ export const PanelHandleContentDetails = () => {
|
|
|
1464
1517
|
*/
|
|
1465
1518
|
setChangeEvent() {
|
|
1466
1519
|
popsDOMUtils.on(this.$ele.select, "change", void 0, (event) => {
|
|
1520
|
+
let $isSelectedElement = (event as any).target[
|
|
1521
|
+
(event as any).target.selectedIndex
|
|
1522
|
+
] as HTMLOptionElement;
|
|
1523
|
+
let selectInfo = this.getSelectOptionInfo($isSelectedElement);
|
|
1467
1524
|
this.setSelectOptionsDisableStatus();
|
|
1468
1525
|
if (typeof formConfig.callback === "function") {
|
|
1469
|
-
let $isSelectedElement = (event as any).target[
|
|
1470
|
-
(event as any).target.selectedIndex
|
|
1471
|
-
] as HTMLOptionElement;
|
|
1472
|
-
let selectInfo = this.getSelectOptionInfo($isSelectedElement);
|
|
1473
1526
|
formConfig.callback(
|
|
1474
1527
|
event as any,
|
|
1475
1528
|
selectInfo.value,
|
|
1476
1529
|
selectInfo.text
|
|
1477
1530
|
);
|
|
1478
1531
|
}
|
|
1532
|
+
let forms =
|
|
1533
|
+
typeof selectInfo.forms === "function"
|
|
1534
|
+
? selectInfo.forms()
|
|
1535
|
+
: selectInfo.forms;
|
|
1536
|
+
if (Array.isArray(forms)) {
|
|
1537
|
+
/* 如果成功创建,加入到中间容器中 */
|
|
1538
|
+
let childUListClassName = "pops-panel-select-child-forms";
|
|
1539
|
+
// 移除旧的元素
|
|
1540
|
+
while (liElement.nextElementSibling) {
|
|
1541
|
+
if (
|
|
1542
|
+
liElement.nextElementSibling.classList.contains(
|
|
1543
|
+
childUListClassName
|
|
1544
|
+
)
|
|
1545
|
+
) {
|
|
1546
|
+
liElement.nextElementSibling.remove();
|
|
1547
|
+
} else {
|
|
1548
|
+
break;
|
|
1549
|
+
}
|
|
1550
|
+
}
|
|
1551
|
+
let $childUList = document.createElement("ul");
|
|
1552
|
+
$childUList.className = childUListClassName;
|
|
1553
|
+
popsDOMUtils.after(liElement, $childUList);
|
|
1554
|
+
that.uListContainerAddItem(formConfig as any, {
|
|
1555
|
+
ulElement: $childUList,
|
|
1556
|
+
});
|
|
1557
|
+
}
|
|
1479
1558
|
});
|
|
1480
1559
|
},
|
|
1481
1560
|
/**
|
|
@@ -1513,34 +1592,36 @@ export const PanelHandleContentDetails = () => {
|
|
|
1513
1592
|
if (Boolean(formConfig.description)) {
|
|
1514
1593
|
leftDescriptionText = /*html*/ `<p class="pops-panel-item-left-desc-text">${formConfig.description}</p>`;
|
|
1515
1594
|
}
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
<div class="el-
|
|
1526
|
-
|
|
1595
|
+
PopsSafeUtils.setSafeHTML(
|
|
1596
|
+
liElement,
|
|
1597
|
+
/*html*/ `
|
|
1598
|
+
<div class="pops-panel-item-left-text">
|
|
1599
|
+
<p class="pops-panel-item-left-main-text">${formConfig.text}</p>
|
|
1600
|
+
${leftDescriptionText}
|
|
1601
|
+
</div>
|
|
1602
|
+
<div class="pops-panel-select-multiple">
|
|
1603
|
+
<div class="el-select__wrapper">
|
|
1604
|
+
<div class="el-select__selection">
|
|
1605
|
+
<!-- 这个是用于手动输入的,这里暂不适配 -->
|
|
1606
|
+
<div class="el-select__selected-item el-select__input-wrapper">
|
|
1607
|
+
|
|
1608
|
+
</div>
|
|
1609
|
+
<!-- 这个是placeholder -->
|
|
1610
|
+
<div class="el-select__selected-item el-select__placeholder">
|
|
1611
|
+
</div>
|
|
1527
1612
|
</div>
|
|
1528
|
-
<!--
|
|
1529
|
-
<div class="el-
|
|
1613
|
+
<!-- 下拉箭头 -->
|
|
1614
|
+
<div class="el-select__suffix">
|
|
1615
|
+
<i class="el-icon el-select__caret el-select__icon">
|
|
1616
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1024 1024">
|
|
1617
|
+
<path fill="currentColor" d="M831.872 340.864 512 652.672 192.128 340.864a30.592 30.592 0 0 0-42.752 0 29.12 29.12 0 0 0 0 41.6L489.664 714.24a32 32 0 0 0 44.672 0l340.288-331.712a29.12 29.12 0 0 0 0-41.728 30.592 30.592 0 0 0-42.752 0z"></path>
|
|
1618
|
+
</svg>
|
|
1619
|
+
</i>
|
|
1530
1620
|
</div>
|
|
1531
1621
|
</div>
|
|
1532
|
-
<!-- 下拉箭头 -->
|
|
1533
|
-
<div class="el-select__suffix">
|
|
1534
|
-
<i class="el-icon el-select__caret el-select__icon">
|
|
1535
|
-
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1024 1024">
|
|
1536
|
-
<path fill="currentColor" d="M831.872 340.864 512 652.672 192.128 340.864a30.592 30.592 0 0 0-42.752 0 29.12 29.12 0 0 0 0 41.6L489.664 714.24a32 32 0 0 0 44.672 0l340.288-331.712a29.12 29.12 0 0 0 0-41.728 30.592 30.592 0 0 0-42.752 0z"></path>
|
|
1537
|
-
</svg>
|
|
1538
|
-
</i>
|
|
1539
|
-
</div>
|
|
1540
1622
|
</div>
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1623
|
+
`
|
|
1624
|
+
);
|
|
1544
1625
|
const PopsPanelSelectMultiple = {
|
|
1545
1626
|
[Symbol.toStringTag]: "PopsPanelSelectMultiple",
|
|
1546
1627
|
$el: {
|
|
@@ -1687,7 +1768,7 @@ export const PanelHandleContentDetails = () => {
|
|
|
1687
1768
|
".el-icon.el-tag__close"
|
|
1688
1769
|
)!;
|
|
1689
1770
|
if (data.isHTML) {
|
|
1690
|
-
$tagText
|
|
1771
|
+
PopsSafeUtils.setSafeHTML($tagText, data.text);
|
|
1691
1772
|
} else {
|
|
1692
1773
|
$tagText.innerText = data.text;
|
|
1693
1774
|
}
|
|
@@ -1852,6 +1933,19 @@ export const PanelHandleContentDetails = () => {
|
|
|
1852
1933
|
Reflect.set($item, "data-info", dataInfo);
|
|
1853
1934
|
return $item;
|
|
1854
1935
|
}
|
|
1936
|
+
/**
|
|
1937
|
+
* 设置选择项的禁用状态
|
|
1938
|
+
*/
|
|
1939
|
+
function setSelectItemDisabled($el: HTMLElement) {
|
|
1940
|
+
$el.setAttribute("aria-disabled", "true");
|
|
1941
|
+
}
|
|
1942
|
+
/**
|
|
1943
|
+
* 移除选择项的禁用状态
|
|
1944
|
+
*/
|
|
1945
|
+
function removeSelectItemDisabled($el: HTMLElement) {
|
|
1946
|
+
$el.removeAttribute("aria-disabled");
|
|
1947
|
+
$el.removeAttribute("disabled");
|
|
1948
|
+
}
|
|
1855
1949
|
/**
|
|
1856
1950
|
* 设置选择项的点击事件
|
|
1857
1951
|
*/
|
|
@@ -1861,6 +1955,9 @@ export const PanelHandleContentDetails = () => {
|
|
|
1861
1955
|
"click",
|
|
1862
1956
|
(event) => {
|
|
1863
1957
|
popsDOMUtils.preventEvent(event);
|
|
1958
|
+
if ($ele.hasAttribute("disabled") || $ele.ariaDisabled) {
|
|
1959
|
+
return;
|
|
1960
|
+
}
|
|
1864
1961
|
if (typeof formConfig.clickCallBack === "function") {
|
|
1865
1962
|
let clickResult = formConfig.clickCallBack(
|
|
1866
1963
|
event,
|
|
@@ -1931,7 +2028,6 @@ export const PanelHandleContentDetails = () => {
|
|
|
1931
2028
|
--el-fill-color-light: #f5f7fa;
|
|
1932
2029
|
}
|
|
1933
2030
|
.select-item{
|
|
1934
|
-
cursor: pointer;
|
|
1935
2031
|
cursor: pointer;
|
|
1936
2032
|
font-size: var(--el-font-size-base);
|
|
1937
2033
|
padding: 0 32px 0 20px;
|
|
@@ -1944,6 +2040,12 @@ export const PanelHandleContentDetails = () => {
|
|
|
1944
2040
|
line-height: 34px;
|
|
1945
2041
|
box-sizing: border-box;
|
|
1946
2042
|
}
|
|
2043
|
+
.select-item[aria-disabled],
|
|
2044
|
+
.select-item[disabled]{
|
|
2045
|
+
cursor: not-allowed;
|
|
2046
|
+
color: #a8abb2;
|
|
2047
|
+
background: unset;
|
|
2048
|
+
}
|
|
1947
2049
|
.select-item:hover{
|
|
1948
2050
|
background-color: var(--el-fill-color-light);
|
|
1949
2051
|
}
|
|
@@ -1986,6 +2088,17 @@ export const PanelHandleContentDetails = () => {
|
|
|
1986
2088
|
$selectContainer.appendChild($select);
|
|
1987
2089
|
// 设置每一项的点击事件
|
|
1988
2090
|
setSelectElementClickEvent($select);
|
|
2091
|
+
// 设置禁用状态
|
|
2092
|
+
if (
|
|
2093
|
+
typeof item.disable === "function" &&
|
|
2094
|
+
item.disable(item.value)
|
|
2095
|
+
) {
|
|
2096
|
+
setSelectItemDisabled($select);
|
|
2097
|
+
// 后续不设置元素的选中状态
|
|
2098
|
+
return;
|
|
2099
|
+
}
|
|
2100
|
+
// 移除禁用状态
|
|
2101
|
+
removeSelectItemDisabled($select);
|
|
1989
2102
|
let findValue = selectedInfo.find(
|
|
1990
2103
|
(value) => value.value === item.value
|
|
1991
2104
|
);
|
|
@@ -2109,18 +2222,21 @@ export const PanelHandleContentDetails = () => {
|
|
|
2109
2222
|
if (Boolean(formConfig.description)) {
|
|
2110
2223
|
leftDescriptionText = /*html*/ `<p class="pops-panel-item-left-desc-text">${formConfig.description}</p>`;
|
|
2111
2224
|
}
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
<
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
2225
|
+
PopsSafeUtils.setSafeHTML(
|
|
2226
|
+
liElement,
|
|
2227
|
+
/*html*/ `
|
|
2228
|
+
<div class="pops-panel-item-left-text">
|
|
2229
|
+
<p class="pops-panel-item-left-main-text">${formConfig.text}</p>
|
|
2230
|
+
${leftDescriptionText}
|
|
2231
|
+
</div>
|
|
2232
|
+
<div class="pops-panel-button">
|
|
2233
|
+
<button class="pops-panel-button_inner">
|
|
2234
|
+
<i class="pops-bottom-icon"></i>
|
|
2235
|
+
<span class="pops-panel-button-text"></span>
|
|
2236
|
+
</button>
|
|
2237
|
+
</div>
|
|
2238
|
+
`
|
|
2239
|
+
);
|
|
2124
2240
|
|
|
2125
2241
|
const PopsPanelButton = {
|
|
2126
2242
|
[Symbol.toStringTag]: "PopsPanelButton",
|
|
@@ -2197,7 +2313,7 @@ export const PanelHandleContentDetails = () => {
|
|
|
2197
2313
|
* 设置icon图标的svg
|
|
2198
2314
|
*/
|
|
2199
2315
|
setIconSVG(svgHTML: string) {
|
|
2200
|
-
this.$ele.icon
|
|
2316
|
+
PopsSafeUtils.setSafeHTML(this.$ele.icon, svgHTML);
|
|
2201
2317
|
},
|
|
2202
2318
|
/**
|
|
2203
2319
|
* 设置icon图标是否旋转
|
|
@@ -2236,7 +2352,7 @@ export const PanelHandleContentDetails = () => {
|
|
|
2236
2352
|
* @param text
|
|
2237
2353
|
*/
|
|
2238
2354
|
setButtonText(text: string) {
|
|
2239
|
-
this.$ele.spanText
|
|
2355
|
+
PopsSafeUtils.setSafeHTML(this.$ele.spanText, text);
|
|
2240
2356
|
},
|
|
2241
2357
|
setClickEvent() {
|
|
2242
2358
|
popsDOMUtils.on(this.$ele.button, "click", void 0, (event) => {
|
|
@@ -2284,16 +2400,19 @@ export const PanelHandleContentDetails = () => {
|
|
|
2284
2400
|
if (formConfig.rightText) {
|
|
2285
2401
|
rightText = /*html*/ `<p class="pops-panel-item-right-text">${formConfig.rightText}</p>`;
|
|
2286
2402
|
}
|
|
2287
|
-
|
|
2288
|
-
|
|
2289
|
-
|
|
2290
|
-
|
|
2291
|
-
|
|
2292
|
-
|
|
2293
|
-
|
|
2294
|
-
|
|
2295
|
-
|
|
2296
|
-
|
|
2403
|
+
PopsSafeUtils.setSafeHTML(
|
|
2404
|
+
$li,
|
|
2405
|
+
/*html*/ `
|
|
2406
|
+
<div class="pops-panel-item-left-text">
|
|
2407
|
+
<p class="pops-panel-item-left-main-text">${formConfig.text}</p>
|
|
2408
|
+
${leftDescriptionText}
|
|
2409
|
+
</div>
|
|
2410
|
+
<div class="pops-panel-deepMenu">
|
|
2411
|
+
${rightText}
|
|
2412
|
+
${arrowRightIconHTML}
|
|
2413
|
+
</div>
|
|
2414
|
+
`
|
|
2415
|
+
);
|
|
2297
2416
|
const PopsPanelDeepMenu = {
|
|
2298
2417
|
[Symbol.toStringTag]: "PopsPanelDeepMenu",
|
|
2299
2418
|
$ele: {
|
|
@@ -2330,20 +2449,25 @@ export const PanelHandleContentDetails = () => {
|
|
|
2330
2449
|
let formHeaderDivElement = popsDOMUtils.createElement("div", {
|
|
2331
2450
|
className: "pops-panel-forms-container-item-header-text",
|
|
2332
2451
|
});
|
|
2333
|
-
|
|
2452
|
+
PopsSafeUtils.setSafeHTML(
|
|
2453
|
+
formHeaderDivElement,
|
|
2454
|
+
formConfig_forms["text"]
|
|
2455
|
+
);
|
|
2334
2456
|
|
|
2335
2457
|
if (formConfig_forms.isFold) {
|
|
2336
2458
|
/* 添加第一个 */
|
|
2337
2459
|
/* 加进容器内 */
|
|
2338
|
-
|
|
2460
|
+
PopsSafeUtils.setSafeHTML(
|
|
2461
|
+
formHeaderDivElement,
|
|
2462
|
+
/*html*/ `
|
|
2339
2463
|
<p>${formConfig_forms.text}</p>
|
|
2340
2464
|
<i class="pops-panel-forms-fold-container-icon">
|
|
2341
2465
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1024 1024">
|
|
2342
2466
|
<path d="M340.864 149.312a30.592 30.592 0 0 0 0 42.752L652.736 512 340.864 831.872a30.592 30.592 0 0 0 0 42.752 29.12 29.12 0 0 0 41.728 0L714.24 534.336a32 32 0 0 0 0-44.672L382.592 149.376a29.12 29.12 0 0 0-41.728 0z"></path>
|
|
2343
2467
|
</svg>
|
|
2344
2468
|
</i>
|
|
2345
|
-
|
|
2346
|
-
|
|
2469
|
+
`
|
|
2470
|
+
);
|
|
2347
2471
|
// 添加点击事件
|
|
2348
2472
|
popsDOMUtils.on(formHeaderDivElement, "click", (event) => {
|
|
2349
2473
|
if (formContainerListElement.hasAttribute("data-fold-enable")) {
|
|
@@ -2583,18 +2707,23 @@ export const PanelHandleContentDetails = () => {
|
|
|
2583
2707
|
let formHeaderDivElement = popsDOMUtils.createElement("div", {
|
|
2584
2708
|
className: "pops-panel-forms-container-item-header-text",
|
|
2585
2709
|
});
|
|
2586
|
-
|
|
2710
|
+
PopsSafeUtils.setSafeHTML(
|
|
2711
|
+
formHeaderDivElement,
|
|
2712
|
+
formConfig_forms["text"]
|
|
2713
|
+
);
|
|
2587
2714
|
if (formConfig_forms.isFold) {
|
|
2588
2715
|
/* 加进容器内 */
|
|
2589
|
-
|
|
2716
|
+
PopsSafeUtils.setSafeHTML(
|
|
2717
|
+
formHeaderDivElement,
|
|
2718
|
+
/*html*/ `
|
|
2590
2719
|
<p>${formConfig_forms.text}</p>
|
|
2591
2720
|
<i class="pops-panel-forms-fold-container-icon">
|
|
2592
2721
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1024 1024">
|
|
2593
2722
|
<path d="M340.864 149.312a30.592 30.592 0 0 0 0 42.752L652.736 512 340.864 831.872a30.592 30.592 0 0 0 0 42.752 29.12 29.12 0 0 0 41.728 0L714.24 534.336a32 32 0 0 0 0-44.672L382.592 149.376a29.12 29.12 0 0 0-41.728 0z"></path>
|
|
2594
2723
|
</svg>
|
|
2595
2724
|
</i>
|
|
2596
|
-
|
|
2597
|
-
|
|
2725
|
+
`
|
|
2726
|
+
);
|
|
2598
2727
|
// 添加点击事件
|
|
2599
2728
|
popsDOMUtils.on(formHeaderDivElement, "click", (event) => {
|
|
2600
2729
|
if (formContainerListElement.hasAttribute("data-fold-enable")) {
|
|
@@ -2696,7 +2825,10 @@ export const PanelHandleContentDetails = () => {
|
|
|
2696
2825
|
let containerHeaderTitleLIElement = document.createElement("li");
|
|
2697
2826
|
(containerHeaderTitleLIElement as any)["__asideConfig__"] =
|
|
2698
2827
|
asideConfig;
|
|
2699
|
-
|
|
2828
|
+
PopsSafeUtils.setSafeHTML(
|
|
2829
|
+
containerHeaderTitleLIElement,
|
|
2830
|
+
headerTitleText
|
|
2831
|
+
);
|
|
2700
2832
|
this.sectionContainerHeaderULElement.appendChild(
|
|
2701
2833
|
containerHeaderTitleLIElement
|
|
2702
2834
|
);
|