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