@whitesev/pops 1.9.7 → 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.
@@ -313,6 +313,31 @@ var pops = (function () {
313
313
  }
314
314
  const popsUtils = new PopsUtils();
315
315
 
316
+ const PopsSafeUtils = {
317
+ /**
318
+ * 设置安全的html
319
+ */
320
+ setSafeHTML($el, text) {
321
+ // 创建 TrustedHTML 策略(需 CSP 允许)
322
+ try {
323
+ $el.innerHTML = text;
324
+ }
325
+ catch (error) {
326
+ // @ts-ignore
327
+ if (globalThis.trustedTypes) {
328
+ // @ts-ignore
329
+ const policy = globalThis.trustedTypes.createPolicy("safe-innerHTML", {
330
+ createHTML: (html) => html,
331
+ });
332
+ $el.innerHTML = policy.createHTML(text);
333
+ }
334
+ else {
335
+ throw new Error("trustedTypes is not defined");
336
+ }
337
+ }
338
+ },
339
+ };
340
+
316
341
  class PopsDOMUtilsEvent {
317
342
  on(element, eventType, selector, callback, option) {
318
343
  /**
@@ -1250,7 +1275,7 @@ var pops = (function () {
1250
1275
  attributes) {
1251
1276
  let tempElement = PopsCore.document.createElement(tagName);
1252
1277
  if (typeof property === "string") {
1253
- tempElement.innerHTML = property;
1278
+ PopsSafeUtils.setSafeHTML(tempElement, property);
1254
1279
  return tempElement;
1255
1280
  }
1256
1281
  if (property == null) {
@@ -1261,6 +1286,11 @@ var pops = (function () {
1261
1286
  }
1262
1287
  Object.keys(property).forEach((key) => {
1263
1288
  let value = property[key];
1289
+ if (key === "innerHTML") {
1290
+ PopsSafeUtils.setSafeHTML(tempElement, value);
1291
+ return;
1292
+ }
1293
+ // @ts-ignore
1264
1294
  tempElement[key] = value;
1265
1295
  });
1266
1296
  Object.keys(attributes).forEach((key) => {
@@ -1463,7 +1493,7 @@ var pops = (function () {
1463
1493
  }
1464
1494
  function parseHTMLByCreateDom() {
1465
1495
  let tempDIV = PopsCore.document.createElement("div");
1466
- tempDIV.innerHTML = html;
1496
+ PopsSafeUtils.setSafeHTML(tempDIV, html);
1467
1497
  if (isComplete) {
1468
1498
  return tempDIV;
1469
1499
  }
@@ -4859,26 +4889,29 @@ var pops = (function () {
4859
4889
  fileNameElement.className = "pops-folder-list-table__body-td";
4860
4890
  fileTimeElement.className = "pops-folder-list-table__body-td";
4861
4891
  fileFormatSize.className = "pops-folder-list-table__body-td";
4862
- fileNameElement.innerHTML = `
4863
- <div class="pops-folder-list-file-name cursor-p">
4864
- <div>
4865
- <img src="${fileIcon}" alt="${fileType}" class="pops-folder-list-file-icon u-file-icon u-file-icon--list">
4866
- <a title="${fileName}" class="pops-folder-list-file-name-title-text inline-block-v-middle text-ellip list-name-text">
4867
- ${fileName}
4868
- </a>
4869
- </div>
4870
- </div>
4871
- `;
4872
- fileTimeElement.innerHTML = `
4873
- <div class="pops-folder-list__time">
4874
- <span>${latestTime}</span>
4875
- </div>
4876
- `;
4877
- fileFormatSize.innerHTML = `
4878
- <div class="pops-folder-list-format-size">
4879
- <span>${fileSize}</span>
4880
- </div>
4881
- `;
4892
+ PopsSafeUtils.setSafeHTML(fileNameElement,
4893
+ /*html*/ `
4894
+ <div class="pops-folder-list-file-name cursor-p">
4895
+ <div>
4896
+ <img src="${fileIcon}" alt="${fileType}" class="pops-folder-list-file-icon u-file-icon u-file-icon--list">
4897
+ <a title="${fileName}" class="pops-folder-list-file-name-title-text inline-block-v-middle text-ellip list-name-text">
4898
+ ${fileName}
4899
+ </a>
4900
+ </div>
4901
+ </div>
4902
+ `);
4903
+ PopsSafeUtils.setSafeHTML(fileTimeElement,
4904
+ /*html*/ `
4905
+ <div class="pops-folder-list__time">
4906
+ <span>${latestTime}</span>
4907
+ </div>
4908
+ `);
4909
+ PopsSafeUtils.setSafeHTML(fileFormatSize,
4910
+ /*html*/ `
4911
+ <div class="pops-folder-list-format-size">
4912
+ <span>${fileSize}</span>
4913
+ </div>
4914
+ `);
4882
4915
  /* 存储原来的值 */
4883
4916
  let __value__ = {
4884
4917
  fileName: origin_fileName,
@@ -4939,17 +4972,18 @@ var pops = (function () {
4939
4972
  }
4940
4973
  folderELement.className = "pops-folder-list-table__body-row";
4941
4974
  fileNameElement.className = "pops-folder-list-table__body-td";
4942
- fileNameElement.innerHTML = `
4943
- <div class="pops-folder-list-file-name pops-mobile-folder-list-file-name cursor-p">
4944
- <img src="${fileIcon}" alt="${fileType}" class="pops-folder-list-file-icon u-file-icon u-file-icon--list">
4945
- <div>
4946
- <a title="${fileName}" class="pops-folder-list-file-name-title-text inline-block-v-middle text-ellip list-name-text">
4947
- ${fileName}
4948
- </a>
4949
- <span>${latestTime} ${fileSize}</span>
4950
- </div>
4951
- </div>
4952
- `;
4975
+ PopsSafeUtils.setSafeHTML(fileNameElement,
4976
+ /*html*/ `
4977
+ <div class="pops-folder-list-file-name pops-mobile-folder-list-file-name cursor-p">
4978
+ <img src="${fileIcon}" alt="${fileType}" class="pops-folder-list-file-icon u-file-icon u-file-icon--list">
4979
+ <div>
4980
+ <a title="${fileName}" class="pops-folder-list-file-name-title-text inline-block-v-middle text-ellip list-name-text">
4981
+ ${fileName}
4982
+ </a>
4983
+ <span>${latestTime} ${fileSize}</span>
4984
+ </div>
4985
+ </div>
4986
+ `);
4953
4987
  /* 存储原来的值 */
4954
4988
  let __value__ = {
4955
4989
  fileName: origin_fileName,
@@ -4969,7 +5003,7 @@ var pops = (function () {
4969
5003
  * 清空每行的元素
4970
5004
  */
4971
5005
  function clearFolerRow() {
4972
- folderListBodyElement.innerHTML = "";
5006
+ PopsSafeUtils.setSafeHTML(folderListBodyElement, "");
4973
5007
  }
4974
5008
  function getArrowIconElement() {
4975
5009
  let iconArrowElement = popsDOMUtils.createElement("div", {
@@ -5968,8 +6002,8 @@ var pops = (function () {
5968
6002
  * 清空container容器的元素
5969
6003
  */
5970
6004
  clearContainer() {
5971
- this.sectionContainerHeaderULElement.innerHTML = "";
5972
- this.sectionContainerULElement.innerHTML = "";
6005
+ PopsSafeUtils.setSafeHTML(this.sectionContainerHeaderULElement, "");
6006
+ PopsSafeUtils.setSafeHTML(this.sectionContainerULElement, "");
5973
6007
  this.$el.$content
5974
6008
  ?.querySelectorAll("section.pops-panel-deepMenu-container")
5975
6009
  .forEach((ele) => ele.remove());
@@ -6055,8 +6089,9 @@ var pops = (function () {
6055
6089
  createAsideItem(asideConfig) {
6056
6090
  let liElement = document.createElement("li");
6057
6091
  liElement.id = asideConfig.id;
6092
+ // @ts-ignore
6058
6093
  liElement["__forms__"] = asideConfig.forms;
6059
- liElement.innerHTML = asideConfig.title;
6094
+ PopsSafeUtils.setSafeHTML(liElement, asideConfig.title);
6060
6095
  /* 处理className */
6061
6096
  this.setElementClassName(liElement, asideConfig.className);
6062
6097
  this.setElementAttributes(liElement, asideConfig.attributes);
@@ -6079,18 +6114,19 @@ var pops = (function () {
6079
6114
  if (Boolean(formConfig.description)) {
6080
6115
  leftDescriptionText = /*html*/ `<p class="pops-panel-item-left-desc-text">${formConfig.description}</p>`;
6081
6116
  }
6082
- liElement.innerHTML = /*html*/ `
6083
- <div class="pops-panel-item-left-text">
6084
- <p class="pops-panel-item-left-main-text">${formConfig.text}</p>
6085
- ${leftDescriptionText}
6086
- </div>
6087
- <div class="pops-panel-switch">
6088
- <input class="pops-panel-switch__input" type="checkbox">
6089
- <span class="pops-panel-switch__core">
6090
- <div class="pops-panel-switch__action">
6091
- </div>
6092
- </span>
6093
- </div>`;
6117
+ PopsSafeUtils.setSafeHTML(liElement,
6118
+ /*html*/ `
6119
+ <div class="pops-panel-item-left-text">
6120
+ <p class="pops-panel-item-left-main-text">${formConfig.text}</p>
6121
+ ${leftDescriptionText}
6122
+ </div>
6123
+ <div class="pops-panel-switch">
6124
+ <input class="pops-panel-switch__input" type="checkbox">
6125
+ <span class="pops-panel-switch__core">
6126
+ <div class="pops-panel-switch__action">
6127
+ </div>
6128
+ </span>
6129
+ </div>`);
6094
6130
  const PopsPanelSwitch = {
6095
6131
  [Symbol.toStringTag]: "PopsPanelSwitch",
6096
6132
  $data: {
@@ -6180,14 +6216,16 @@ var pops = (function () {
6180
6216
  if (Boolean(formConfig.description)) {
6181
6217
  leftDescriptionText = `<p class="pops-panel-item-left-desc-text">${formConfig.description}</p>`;
6182
6218
  }
6183
- liElement.innerHTML = `
6184
- <div class="pops-panel-item-left-text">
6185
- <p class="pops-panel-item-left-main-text">${formConfig.text}</p>
6186
- ${leftDescriptionText}
6187
- </div>
6188
- <div class="pops-panel-slider">
6189
- <input type="range" min="${formConfig.min}" max="${formConfig.max}">
6190
- </div>`;
6219
+ PopsSafeUtils.setSafeHTML(liElement,
6220
+ /*html*/ `
6221
+ <div class="pops-panel-item-left-text">
6222
+ <p class="pops-panel-item-left-main-text">${formConfig.text}</p>
6223
+ ${leftDescriptionText}
6224
+ </div>
6225
+ <div class="pops-panel-slider">
6226
+ <input type="range" min="${formConfig.min}" max="${formConfig.max}">
6227
+ </div>
6228
+ `);
6191
6229
  let rangeInputElement = liElement.querySelector(".pops-panel-slider input[type=range]");
6192
6230
  if (formConfig.step) {
6193
6231
  rangeInputElement.setAttribute("step", formConfig.step.toString());
@@ -6243,19 +6281,20 @@ var pops = (function () {
6243
6281
  if (Boolean(formConfig.description)) {
6244
6282
  leftDescriptionText = /*html*/ `<p class="pops-panel-item-left-desc-text">${formConfig.description}</p>`;
6245
6283
  }
6246
- liElement.innerHTML = /*html*/ `
6247
- <div class="pops-panel-item-left-text" style="flex: 1;">
6248
- <p class="pops-panel-item-left-main-text">${formConfig.text}</p>
6249
- ${leftDescriptionText}
6250
- </div>
6251
- <div class="pops-slider pops-slider-width">
6252
- <div class="pops-slider__runway">
6253
- <div class="pops-slider__bar" style="width: 0%; left: 0%"></div>
6254
- <div class="pops-slider__button-wrapper" style="left: 0%">
6255
- <div class="pops-slider__button"></div>
6256
- </div>
6284
+ PopsSafeUtils.setSafeHTML(liElement,
6285
+ /*html*/ `
6286
+ <div class="pops-panel-item-left-text" style="flex: 1;">
6287
+ <p class="pops-panel-item-left-main-text">${formConfig.text}</p>
6288
+ ${leftDescriptionText}
6257
6289
  </div>
6258
- </div>`;
6290
+ <div class="pops-slider pops-slider-width">
6291
+ <div class="pops-slider__runway">
6292
+ <div class="pops-slider__bar" style="width: 0%; left: 0%"></div>
6293
+ <div class="pops-slider__button-wrapper" style="left: 0%">
6294
+ <div class="pops-slider__button"></div>
6295
+ </div>
6296
+ </div>
6297
+ </div>`);
6259
6298
  const PopsPanelSlider = {
6260
6299
  [Symbol.toStringTag]: "PopsPanelSlider",
6261
6300
  /**
@@ -6805,15 +6844,16 @@ var pops = (function () {
6805
6844
  if (Boolean(formConfig.description)) {
6806
6845
  leftDescriptionText = `<p class="pops-panel-item-left-desc-text">${formConfig.description}</p>`;
6807
6846
  }
6808
- liElement.innerHTML = `
6809
- <div class="pops-panel-item-left-text">
6810
- <p class="pops-panel-item-left-main-text">${formConfig.text}</p>
6811
- ${leftDescriptionText}
6812
- </div>
6813
- <div class="pops-panel-input pops-user-select-none">
6814
- <input type="${inputType}" placeholder="${formConfig.placeholder}">
6815
- </div>
6816
- `;
6847
+ PopsSafeUtils.setSafeHTML(liElement,
6848
+ /*html*/ `
6849
+ <div class="pops-panel-item-left-text">
6850
+ <p class="pops-panel-item-left-main-text">${formConfig.text}</p>
6851
+ ${leftDescriptionText}
6852
+ </div>
6853
+ <div class="pops-panel-input pops-user-select-none">
6854
+ <input type="${inputType}" placeholder="${formConfig.placeholder}">
6855
+ </div>
6856
+ `);
6817
6857
  const PopsPanelInput = {
6818
6858
  [Symbol.toStringTag]: "PopsPanelInput",
6819
6859
  $ele: {
@@ -6856,11 +6896,12 @@ var pops = (function () {
6856
6896
  initEle() {
6857
6897
  this.$ele.input.parentElement.insertBefore(this.$ele.inputSpanIcon, this.$ele.input.nextSibling);
6858
6898
  this.$ele.inputSpanIcon.className = "pops-panel-input__suffix";
6859
- this.$ele.inputSpanIcon.innerHTML = `
6860
- <span class="pops-panel-input__suffix-inner">
6861
- <i class="pops-panel-icon"></i>
6862
- </span>
6863
- `;
6899
+ PopsSafeUtils.setSafeHTML(this.$ele.inputSpanIcon,
6900
+ /*html*/ `
6901
+ <span class="pops-panel-input__suffix-inner">
6902
+ <i class="pops-panel-icon"></i>
6903
+ </span>
6904
+ `);
6864
6905
  this.$ele.inputSpanIconInner =
6865
6906
  this.$ele.inputSpanIcon.querySelector(".pops-panel-input__suffix-inner");
6866
6907
  this.$ele.icon =
@@ -6895,7 +6936,7 @@ var pops = (function () {
6895
6936
  },
6896
6937
  /**
6897
6938
  * 设置input元素的type
6898
- * @param {string} [typeValue="text"] type值
6939
+ * @param [typeValue="text"] type值
6899
6940
  */
6900
6941
  setInputType(typeValue = "text") {
6901
6942
  this.$ele.input.setAttribute("type", typeValue);
@@ -6904,14 +6945,14 @@ var pops = (function () {
6904
6945
  * 删除图标按钮
6905
6946
  */
6906
6947
  removeCircleIcon() {
6907
- this.$ele.icon.innerHTML = "";
6948
+ PopsSafeUtils.setSafeHTML(this.$ele.icon, "");
6908
6949
  },
6909
6950
  /**
6910
6951
  * 添加清空图标按钮
6911
- * @param {string} [svgHTML=pops.config.iconSVG.circleClose] svg图标,默认为清空的图标
6952
+ * @param [svgHTML=pops.config.iconSVG.circleClose] svg图标,默认为清空的图标
6912
6953
  */
6913
6954
  setCircleIcon(svgHTML = pops.config.iconSVG.circleClose) {
6914
- this.$ele.icon.innerHTML = svgHTML;
6955
+ PopsSafeUtils.setSafeHTML(this.$ele.icon, svgHTML);
6915
6956
  },
6916
6957
  /**
6917
6958
  * 添加图标按钮的点击事件
@@ -7000,16 +7041,17 @@ var pops = (function () {
7000
7041
  if (Boolean(formConfig.description)) {
7001
7042
  leftDescriptionText = `<p class="pops-panel-item-left-desc-text">${formConfig.description}</p>`;
7002
7043
  }
7003
- liElement.innerHTML = `
7004
- <div class="pops-panel-item-left-text">
7005
- <p class="pops-panel-item-left-main-text">${formConfig.text}</p>
7006
- ${leftDescriptionText}
7007
- </div>
7008
- <div class="pops-panel-textarea">
7009
- <textarea placeholder="${formConfig.placeholder ?? ""}">
7010
- </textarea>
7011
- </div>
7012
- `;
7044
+ PopsSafeUtils.setSafeHTML(liElement,
7045
+ /*html*/ `
7046
+ <div class="pops-panel-item-left-text">
7047
+ <p class="pops-panel-item-left-main-text">${formConfig.text}</p>
7048
+ ${leftDescriptionText}
7049
+ </div>
7050
+ <div class="pops-panel-textarea">
7051
+ <textarea placeholder="${formConfig.placeholder ?? ""}">
7052
+ </textarea>
7053
+ </div>
7054
+ `);
7013
7055
  const PopsPanelTextArea = {
7014
7056
  [Symbol.toStringTag]: "PopsPanelTextArea",
7015
7057
  $ele: {
@@ -7074,15 +7116,16 @@ var pops = (function () {
7074
7116
  if (Boolean(formConfig.description)) {
7075
7117
  leftDescriptionText = /*html*/ `<p class="pops-panel-item-left-desc-text">${formConfig.description}</p>`;
7076
7118
  }
7077
- liElement.innerHTML = /*html*/ `
7078
- <div class="pops-panel-item-left-text">
7079
- <p class="pops-panel-item-left-main-text">${formConfig.text}</p>
7080
- ${leftDescriptionText}
7081
- </div>
7082
- <div class="pops-panel-select pops-user-select-none">
7083
- <select></select>
7084
- </div>
7085
- `;
7119
+ PopsSafeUtils.setSafeHTML(liElement,
7120
+ /*html*/ `
7121
+ <div class="pops-panel-item-left-text">
7122
+ <p class="pops-panel-item-left-main-text">${formConfig.text}</p>
7123
+ ${leftDescriptionText}
7124
+ </div>
7125
+ <div class="pops-panel-select pops-user-select-none">
7126
+ <select></select>
7127
+ </div>
7128
+ `);
7086
7129
  const PopsPanelSelect = {
7087
7130
  [Symbol.toStringTag]: "PopsPanelSelect",
7088
7131
  $ele: {
@@ -7269,33 +7312,34 @@ var pops = (function () {
7269
7312
  if (Boolean(formConfig.description)) {
7270
7313
  leftDescriptionText = /*html*/ `<p class="pops-panel-item-left-desc-text">${formConfig.description}</p>`;
7271
7314
  }
7272
- liElement.innerHTML = /*html*/ `
7273
- <div class="pops-panel-item-left-text">
7274
- <p class="pops-panel-item-left-main-text">${formConfig.text}</p>
7275
- ${leftDescriptionText}
7276
- </div>
7277
- <div class="pops-panel-select-multiple">
7278
- <div class="el-select__wrapper">
7279
- <div class="el-select__selection">
7280
- <!-- 这个是用于手动输入的,这里暂不适配 -->
7281
- <div class="el-select__selected-item el-select__input-wrapper">
7282
-
7315
+ PopsSafeUtils.setSafeHTML(liElement,
7316
+ /*html*/ `
7317
+ <div class="pops-panel-item-left-text">
7318
+ <p class="pops-panel-item-left-main-text">${formConfig.text}</p>
7319
+ ${leftDescriptionText}
7320
+ </div>
7321
+ <div class="pops-panel-select-multiple">
7322
+ <div class="el-select__wrapper">
7323
+ <div class="el-select__selection">
7324
+ <!-- 这个是用于手动输入的,这里暂不适配 -->
7325
+ <div class="el-select__selected-item el-select__input-wrapper">
7326
+
7327
+ </div>
7328
+ <!-- 这个是placeholder -->
7329
+ <div class="el-select__selected-item el-select__placeholder">
7330
+ </div>
7283
7331
  </div>
7284
- <!-- 这个是placeholder -->
7285
- <div class="el-select__selected-item el-select__placeholder">
7332
+ <!-- 下拉箭头 -->
7333
+ <div class="el-select__suffix">
7334
+ <i class="el-icon el-select__caret el-select__icon">
7335
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1024 1024">
7336
+ <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>
7337
+ </svg>
7338
+ </i>
7286
7339
  </div>
7287
7340
  </div>
7288
- <!-- 下拉箭头 -->
7289
- <div class="el-select__suffix">
7290
- <i class="el-icon el-select__caret el-select__icon">
7291
- <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1024 1024">
7292
- <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>
7293
- </svg>
7294
- </i>
7295
- </div>
7296
7341
  </div>
7297
- </div>
7298
- `;
7342
+ `);
7299
7343
  const PopsPanelSelectMultiple = {
7300
7344
  [Symbol.toStringTag]: "PopsPanelSelectMultiple",
7301
7345
  $el: {
@@ -7420,7 +7464,7 @@ var pops = (function () {
7420
7464
  /** 关闭图标 */
7421
7465
  const $closeIcon = $selectedItem.querySelector(".el-icon.el-tag__close");
7422
7466
  if (data.isHTML) {
7423
- $tagText.innerHTML = data.text;
7467
+ PopsSafeUtils.setSafeHTML($tagText, data.text);
7424
7468
  }
7425
7469
  else {
7426
7470
  $tagText.innerText = data.text;
@@ -7827,18 +7871,19 @@ var pops = (function () {
7827
7871
  if (Boolean(formConfig.description)) {
7828
7872
  leftDescriptionText = /*html*/ `<p class="pops-panel-item-left-desc-text">${formConfig.description}</p>`;
7829
7873
  }
7830
- liElement.innerHTML = /*html*/ `
7831
- <div class="pops-panel-item-left-text">
7832
- <p class="pops-panel-item-left-main-text">${formConfig.text}</p>
7833
- ${leftDescriptionText}
7834
- </div>
7835
- <div class="pops-panel-button">
7836
- <button class="pops-panel-button_inner">
7837
- <i class="pops-bottom-icon"></i>
7838
- <span class="pops-panel-button-text"></span>
7839
- </button>
7840
- </div>
7841
- `;
7874
+ PopsSafeUtils.setSafeHTML(liElement,
7875
+ /*html*/ `
7876
+ <div class="pops-panel-item-left-text">
7877
+ <p class="pops-panel-item-left-main-text">${formConfig.text}</p>
7878
+ ${leftDescriptionText}
7879
+ </div>
7880
+ <div class="pops-panel-button">
7881
+ <button class="pops-panel-button_inner">
7882
+ <i class="pops-bottom-icon"></i>
7883
+ <span class="pops-panel-button-text"></span>
7884
+ </button>
7885
+ </div>
7886
+ `);
7842
7887
  const PopsPanelButton = {
7843
7888
  [Symbol.toStringTag]: "PopsPanelButton",
7844
7889
  $ele: {
@@ -7908,7 +7953,7 @@ var pops = (function () {
7908
7953
  * 设置icon图标的svg
7909
7954
  */
7910
7955
  setIconSVG(svgHTML) {
7911
- this.$ele.icon.innerHTML = svgHTML;
7956
+ PopsSafeUtils.setSafeHTML(this.$ele.icon, svgHTML);
7912
7957
  },
7913
7958
  /**
7914
7959
  * 设置icon图标是否旋转
@@ -7947,7 +7992,7 @@ var pops = (function () {
7947
7992
  * @param text
7948
7993
  */
7949
7994
  setButtonText(text) {
7950
- this.$ele.spanText.innerHTML = text;
7995
+ PopsSafeUtils.setSafeHTML(this.$ele.spanText, text);
7951
7996
  },
7952
7997
  setClickEvent() {
7953
7998
  popsDOMUtils.on(this.$ele.button, "click", void 0, (event) => {
@@ -7993,16 +8038,17 @@ var pops = (function () {
7993
8038
  if (formConfig.rightText) {
7994
8039
  rightText = /*html*/ `<p class="pops-panel-item-right-text">${formConfig.rightText}</p>`;
7995
8040
  }
7996
- $li.innerHTML = /*html*/ `
7997
- <div class="pops-panel-item-left-text">
7998
- <p class="pops-panel-item-left-main-text">${formConfig.text}</p>
7999
- ${leftDescriptionText}
8000
- </div>
8001
- <div class="pops-panel-deepMenu">
8002
- ${rightText}
8003
- ${arrowRightIconHTML}
8004
- </div>
8005
- `;
8041
+ PopsSafeUtils.setSafeHTML($li,
8042
+ /*html*/ `
8043
+ <div class="pops-panel-item-left-text">
8044
+ <p class="pops-panel-item-left-main-text">${formConfig.text}</p>
8045
+ ${leftDescriptionText}
8046
+ </div>
8047
+ <div class="pops-panel-deepMenu">
8048
+ ${rightText}
8049
+ ${arrowRightIconHTML}
8050
+ </div>
8051
+ `);
8006
8052
  const PopsPanelDeepMenu = {
8007
8053
  [Symbol.toStringTag]: "PopsPanelDeepMenu",
8008
8054
  $ele: {
@@ -8032,19 +8078,19 @@ var pops = (function () {
8032
8078
  let formHeaderDivElement = popsDOMUtils.createElement("div", {
8033
8079
  className: "pops-panel-forms-container-item-header-text",
8034
8080
  });
8035
- formHeaderDivElement.innerHTML = formConfig_forms["text"];
8081
+ PopsSafeUtils.setSafeHTML(formHeaderDivElement, formConfig_forms["text"]);
8036
8082
  if (formConfig_forms.isFold) {
8037
8083
  /* 添加第一个 */
8038
8084
  /* 加进容器内 */
8039
- formHeaderDivElement.innerHTML = /*html*/ `
8085
+ PopsSafeUtils.setSafeHTML(formHeaderDivElement,
8086
+ /*html*/ `
8040
8087
  <p>${formConfig_forms.text}</p>
8041
8088
  <i class="pops-panel-forms-fold-container-icon">
8042
8089
  <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1024 1024">
8043
8090
  <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>
8044
8091
  </svg>
8045
8092
  </i>
8046
-
8047
- `;
8093
+ `);
8048
8094
  // 添加点击事件
8049
8095
  popsDOMUtils.on(formHeaderDivElement, "click", (event) => {
8050
8096
  if (formContainerListElement.hasAttribute("data-fold-enable")) {
@@ -8242,18 +8288,18 @@ var pops = (function () {
8242
8288
  let formHeaderDivElement = popsDOMUtils.createElement("div", {
8243
8289
  className: "pops-panel-forms-container-item-header-text",
8244
8290
  });
8245
- formHeaderDivElement.innerHTML = formConfig_forms["text"];
8291
+ PopsSafeUtils.setSafeHTML(formHeaderDivElement, formConfig_forms["text"]);
8246
8292
  if (formConfig_forms.isFold) {
8247
8293
  /* 加进容器内 */
8248
- formHeaderDivElement.innerHTML = /*html*/ `
8294
+ PopsSafeUtils.setSafeHTML(formHeaderDivElement,
8295
+ /*html*/ `
8249
8296
  <p>${formConfig_forms.text}</p>
8250
8297
  <i class="pops-panel-forms-fold-container-icon">
8251
8298
  <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1024 1024">
8252
8299
  <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>
8253
8300
  </svg>
8254
8301
  </i>
8255
-
8256
- `;
8302
+ `);
8257
8303
  // 添加点击事件
8258
8304
  popsDOMUtils.on(formHeaderDivElement, "click", (event) => {
8259
8305
  if (formContainerListElement.hasAttribute("data-fold-enable")) {
@@ -8339,7 +8385,7 @@ var pops = (function () {
8339
8385
  let containerHeaderTitleLIElement = document.createElement("li");
8340
8386
  containerHeaderTitleLIElement["__asideConfig__"] =
8341
8387
  asideConfig;
8342
- containerHeaderTitleLIElement.innerHTML = headerTitleText;
8388
+ PopsSafeUtils.setSafeHTML(containerHeaderTitleLIElement, headerTitleText);
8343
8389
  this.sectionContainerHeaderULElement.appendChild(containerHeaderTitleLIElement);
8344
8390
  }
8345
8391
  let __forms__ = asideLiElement["__forms__"];
@@ -8628,9 +8674,11 @@ var pops = (function () {
8628
8674
  pops.config.cssText.rightClickMenu,
8629
8675
  ]);
8630
8676
  if (config.style != null) {
8631
- let cssNode = document.createElement("style");
8632
- cssNode.setAttribute("type", "text/css");
8633
- cssNode.innerHTML = config.style;
8677
+ let cssNode = popsDOMUtils.createElement("style", {
8678
+ innerHTML: config.style,
8679
+ }, {
8680
+ type: "text/css",
8681
+ });
8634
8682
  $shadowRoot.appendChild(cssNode);
8635
8683
  }
8636
8684
  const PopsContextMenu = {
@@ -9112,8 +9160,11 @@ var pops = (function () {
9112
9160
  ]);
9113
9161
  if (config.style != null) {
9114
9162
  let cssNode = document.createElement("style");
9115
- cssNode.setAttribute("type", "text/css");
9116
- cssNode.innerHTML = config.style;
9163
+ popsDOMUtils.createElement("style", {
9164
+ innerHTML: config.style,
9165
+ }, {
9166
+ type: "text/css",
9167
+ });
9117
9168
  $shadowRoot.appendChild(cssNode);
9118
9169
  }
9119
9170
  const SearchSuggestion = {
@@ -9490,7 +9541,7 @@ var pops = (function () {
9490
9541
  * 清空所有的搜索结果
9491
9542
  */
9492
9543
  clearAllSearchItemLi() {
9493
- SearchSuggestion.$el.$hintULContainer.innerHTML = "";
9544
+ PopsSafeUtils.setSafeHTML(SearchSuggestion.$el.$hintULContainer, "");
9494
9545
  },
9495
9546
  /**
9496
9547
  * 更新搜索建议框的位置(top、left)
@@ -9572,7 +9623,8 @@ var pops = (function () {
9572
9623
  * 动态更新CSS
9573
9624
  */
9574
9625
  updateDynamicCSS() {
9575
- this.$el.$dynamicCSS.innerHTML = this.getDynamicCSS();
9626
+ let cssText = this.getDynamicCSS();
9627
+ PopsSafeUtils.setSafeHTML(this.$el.$dynamicCSS, cssText);
9576
9628
  },
9577
9629
  /**
9578
9630
  * 更新页面显示的搜索结果
@@ -9762,7 +9814,7 @@ var pops = (function () {
9762
9814
  if (text == null) {
9763
9815
  text = this.getContent();
9764
9816
  }
9765
- this.$el.$content.innerHTML = text;
9817
+ PopsSafeUtils.setSafeHTML(this.$el.$content, text);
9766
9818
  }
9767
9819
  /**
9768
9820
  * 获取z-index
@@ -10134,7 +10186,7 @@ var pops = (function () {
10134
10186
  /** 配置 */
10135
10187
  config = {
10136
10188
  /** 版本号 */
10137
- version: "2025.1.1",
10189
+ version: "2025.3.2",
10138
10190
  cssText: {
10139
10191
  /** 主CSS */
10140
10192
  index: indexCSS,
@@ -10239,7 +10291,7 @@ var pops = (function () {
10239
10291
  /* 处理获取当前所有的动画名 */
10240
10292
  this.config.isInit = true;
10241
10293
  let animationStyle = document.createElement("style");
10242
- animationStyle.innerHTML = this.config.cssText.anim;
10294
+ PopsSafeUtils.setSafeHTML(animationStyle, this.config.cssText.anim);
10243
10295
  popsDOMUtils.appendHead(animationStyle);
10244
10296
  this.config.animation = null;
10245
10297
  this.config.animation = PopsInstanceUtils.getKeyFrames(animationStyle.sheet);