@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.
@@ -1,4 +1,6 @@
1
1
  import type { PopsPanelCommonDetails } from "./commonType";
2
+ import type { PopsPanelFormsDetails } from "./formsType";
3
+ import type { PopsPanelFormsTotalDetails } from "./indexType";
2
4
  /**
3
5
  * pops.panel的 select
4
6
  */
@@ -71,5 +73,9 @@ export interface PopsPanelSelectDetails<T = any> extends PopsPanelCommonDetails<
71
73
  * + select元素触发change事件
72
74
  */
73
75
  disable?(value: T): boolean;
76
+ /**
77
+ * 子配置,跟随切换改变
78
+ */
79
+ forms?: (PopsPanelFormsDetails | PopsPanelFormsTotalDetails)[] | (() => (PopsPanelFormsDetails | PopsPanelFormsTotalDetails)[]);
74
80
  }[];
75
81
  }
@@ -0,0 +1,6 @@
1
+ export declare const PopsSafeUtils: {
2
+ /**
3
+ * 设置安全的html
4
+ */
5
+ setSafeHTML($el: Element, text: string): void;
6
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@whitesev/pops",
3
- "version": "1.9.6",
3
+ "version": "2.0.0",
4
4
  "description": "弹窗库",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.esm.js",
package/src/Pops.ts CHANGED
@@ -78,12 +78,13 @@ import { PopsMathFloatUtils } from "./utils/PopsMathUtils";
78
78
  import { PanelHandleContentDetails } from "./components/panel/PanelHandleContentDetails";
79
79
  import { GlobalConfig } from "./GlobalConfig";
80
80
  import { PopsTooltip, type PopsTooltipResult } from "./components/tooltip";
81
+ import { PopsSafeUtils } from "./utils/PopsSafeUtils";
81
82
 
82
83
  class Pops {
83
84
  /** 配置 */
84
85
  config = {
85
86
  /** 版本号 */
86
- version: "2024.12.19",
87
+ version: "2025.3.2",
87
88
  cssText: {
88
89
  /** 主CSS */
89
90
  index: indexCSS,
@@ -194,7 +195,7 @@ class Pops {
194
195
  /* 处理获取当前所有的动画名 */
195
196
  this.config.isInit = true;
196
197
  let animationStyle = document.createElement("style");
197
- animationStyle.innerHTML = this.config.cssText.anim;
198
+ PopsSafeUtils.setSafeHTML(animationStyle, this.config.cssText.anim);
198
199
  popsDOMUtils.appendHead(animationStyle);
199
200
  this.config.animation = null as any;
200
201
  this.config.animation = PopsInstanceUtils.getKeyFrames(
@@ -283,7 +284,7 @@ class Pops {
283
284
  * 提示框
284
285
  * @param details 配置
285
286
  */
286
- tooltip = <T extends PopsToolTipDetails=PopsToolTipDetails>(details: T) => {
287
+ tooltip = <T extends PopsToolTipDetails = PopsToolTipDetails>(details: T) => {
287
288
  let popsTooltip = new PopsTooltip(details) as PopsTooltipResult<T>;
288
289
  return popsTooltip;
289
290
  };
@@ -4,6 +4,7 @@ import { PopsHandler } from "../../handler/PopsHandler";
4
4
  import { pops } from "../../Pops";
5
5
  import { popsDOMUtils } from "../../utils/PopsDOMUtils";
6
6
  import { PopsInstanceUtils } from "../../utils/PopsInstanceUtils";
7
+ import { PopsSafeUtils } from "../../utils/PopsSafeUtils";
7
8
  import { popsUtils } from "../../utils/PopsUtils";
8
9
  import { PopsFolderConfig } from "./config";
9
10
  import { Folder_ICON } from "./folderIcon";
@@ -387,27 +388,36 @@ export class PopsFolder {
387
388
  fileNameElement.className = "pops-folder-list-table__body-td";
388
389
  fileTimeElement.className = "pops-folder-list-table__body-td";
389
390
  fileFormatSize.className = "pops-folder-list-table__body-td";
390
- fileNameElement.innerHTML = `
391
- <div class="pops-folder-list-file-name cursor-p">
392
- <div>
393
- <img src="${fileIcon}" alt="${fileType}" class="pops-folder-list-file-icon u-file-icon u-file-icon--list">
394
- <a title="${fileName}" class="pops-folder-list-file-name-title-text inline-block-v-middle text-ellip list-name-text">
395
- ${fileName}
396
- </a>
397
- </div>
398
- </div>
399
- `;
400
- fileTimeElement.innerHTML = `
401
- <div class="pops-folder-list__time">
402
- <span>${latestTime}</span>
403
- </div>
404
- `;
391
+ PopsSafeUtils.setSafeHTML(
392
+ fileNameElement,
393
+ /*html*/ `
394
+ <div class="pops-folder-list-file-name cursor-p">
395
+ <div>
396
+ <img src="${fileIcon}" alt="${fileType}" class="pops-folder-list-file-icon u-file-icon u-file-icon--list">
397
+ <a title="${fileName}" class="pops-folder-list-file-name-title-text inline-block-v-middle text-ellip list-name-text">
398
+ ${fileName}
399
+ </a>
400
+ </div>
401
+ </div>
402
+ `
403
+ );
404
+ PopsSafeUtils.setSafeHTML(
405
+ fileTimeElement,
406
+ /*html*/ `
407
+ <div class="pops-folder-list__time">
408
+ <span>${latestTime}</span>
409
+ </div>
410
+ `
411
+ );
412
+ PopsSafeUtils.setSafeHTML(
413
+ fileFormatSize,
414
+ /*html*/ `
415
+ <div class="pops-folder-list-format-size">
416
+ <span>${fileSize}</span>
417
+ </div>
418
+ `
419
+ );
405
420
 
406
- fileFormatSize.innerHTML = `
407
- <div class="pops-folder-list-format-size">
408
- <span>${fileSize}</span>
409
- </div>
410
- `;
411
421
  /* 存储原来的值 */
412
422
  let __value__ = {
413
423
  fileName: origin_fileName,
@@ -479,17 +489,20 @@ export class PopsFolder {
479
489
  }
480
490
  folderELement.className = "pops-folder-list-table__body-row";
481
491
  fileNameElement.className = "pops-folder-list-table__body-td";
482
- fileNameElement.innerHTML = `
483
- <div class="pops-folder-list-file-name pops-mobile-folder-list-file-name cursor-p">
484
- <img src="${fileIcon}" alt="${fileType}" class="pops-folder-list-file-icon u-file-icon u-file-icon--list">
485
- <div>
486
- <a title="${fileName}" class="pops-folder-list-file-name-title-text inline-block-v-middle text-ellip list-name-text">
487
- ${fileName}
488
- </a>
489
- <span>${latestTime} ${fileSize}</span>
490
- </div>
491
- </div>
492
- `;
492
+ PopsSafeUtils.setSafeHTML(
493
+ fileNameElement,
494
+ /*html*/ `
495
+ <div class="pops-folder-list-file-name pops-mobile-folder-list-file-name cursor-p">
496
+ <img src="${fileIcon}" alt="${fileType}" class="pops-folder-list-file-icon u-file-icon u-file-icon--list">
497
+ <div>
498
+ <a title="${fileName}" class="pops-folder-list-file-name-title-text inline-block-v-middle text-ellip list-name-text">
499
+ ${fileName}
500
+ </a>
501
+ <span>${latestTime} ${fileSize}</span>
502
+ </div>
503
+ </div>
504
+ `
505
+ );
493
506
  /* 存储原来的值 */
494
507
  let __value__ = {
495
508
  fileName: origin_fileName,
@@ -511,7 +524,7 @@ export class PopsFolder {
511
524
  * 清空每行的元素
512
525
  */
513
526
  function clearFolerRow() {
514
- folderListBodyElement.innerHTML = "";
527
+ PopsSafeUtils.setSafeHTML(folderListBodyElement, "");
515
528
  }
516
529
  function getArrowIconElement() {
517
530
  let iconArrowElement = popsDOMUtils.createElement("div", {