@whitesev/pops 2.0.6 → 2.0.8

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.
Files changed (62) hide show
  1. package/dist/index.amd.js +506 -128
  2. package/dist/index.amd.js.map +1 -1
  3. package/dist/index.cjs.js +506 -128
  4. package/dist/index.cjs.js.map +1 -1
  5. package/dist/index.esm.js +506 -128
  6. package/dist/index.esm.js.map +1 -1
  7. package/dist/index.iife.js +506 -128
  8. package/dist/index.iife.js.map +1 -1
  9. package/dist/index.system.js +506 -128
  10. package/dist/index.system.js.map +1 -1
  11. package/dist/index.umd.js +506 -128
  12. package/dist/index.umd.js.map +1 -1
  13. package/dist/types/src/Pops.d.ts +20761 -15
  14. package/dist/types/src/components/alert/index.d.ts +3 -3
  15. package/dist/types/src/components/confirm/index.d.ts +3 -3
  16. package/dist/types/src/components/drawer/index.d.ts +3 -3
  17. package/dist/types/src/components/drawer/indexType.d.ts +10 -2
  18. package/dist/types/src/components/folder/index.d.ts +3 -3
  19. package/dist/types/src/components/folder/indexType.d.ts +4 -1
  20. package/dist/types/src/components/iframe/index.d.ts +6 -3
  21. package/dist/types/src/components/iframe/indexType.d.ts +2 -0
  22. package/dist/types/src/components/loading/index.d.ts +3 -3
  23. package/dist/types/src/components/loading/indexType.d.ts +3 -1
  24. package/dist/types/src/components/panel/index.d.ts +3 -3
  25. package/dist/types/src/components/panel/indexType.d.ts +1 -0
  26. package/dist/types/src/components/panel/sliderType.d.ts +14 -4
  27. package/dist/types/src/components/prompt/index.d.ts +3 -3
  28. package/dist/types/src/components/prompt/indexType.d.ts +1 -0
  29. package/dist/types/src/components/rightClickMenu/index.d.ts +20661 -3
  30. package/dist/types/src/components/rightClickMenu/indexType.d.ts +6 -2
  31. package/dist/types/src/components/searchSuggestion/index.d.ts +141 -3
  32. package/dist/types/src/components/searchSuggestion/indexType.d.ts +0 -108
  33. package/dist/types/src/components/tooltip/index.d.ts +60 -5
  34. package/dist/types/src/components/tooltip/indexType.d.ts +6 -4
  35. package/dist/types/src/utils/PopsUtils.d.ts +16 -0
  36. package/package.json +6 -5
  37. package/src/Pops.ts +26 -25
  38. package/src/components/alert/index.ts +6 -5
  39. package/src/components/confirm/index.ts +6 -5
  40. package/src/components/drawer/index.ts +8 -7
  41. package/src/components/drawer/indexType.ts +10 -2
  42. package/src/components/folder/index.ts +8 -7
  43. package/src/components/folder/indexType.ts +4 -1
  44. package/src/components/iframe/index.ts +5 -5
  45. package/src/components/iframe/indexType.ts +2 -0
  46. package/src/components/loading/index.ts +6 -5
  47. package/src/components/loading/indexType.ts +3 -1
  48. package/src/components/panel/PanelHandleContentDetails.ts +71 -38
  49. package/src/components/panel/index.ts +6 -5
  50. package/src/components/panel/indexType.ts +1 -0
  51. package/src/components/panel/sliderType.ts +14 -4
  52. package/src/components/prompt/index.ts +6 -5
  53. package/src/components/prompt/indexType.ts +1 -0
  54. package/src/components/rightClickMenu/index.ts +5 -6
  55. package/src/components/rightClickMenu/indexType.ts +6 -7
  56. package/src/components/searchSuggestion/index.ts +6 -6
  57. package/src/components/searchSuggestion/indexType.ts +0 -109
  58. package/src/components/tooltip/index.ts +65 -25
  59. package/src/components/tooltip/indexType.ts +11 -4
  60. package/src/utils/PopsDOMUtils.ts +1 -1
  61. package/src/utils/PopsInstanceUtils.ts +6 -6
  62. package/src/utils/PopsUtils.ts +53 -1
@@ -7,8 +7,8 @@ import { popsUtils } from "../../utils/PopsUtils";
7
7
  import { PopsDrawerConfig } from "./config";
8
8
  import type { PopsDrawerDetails } from "./indexType";
9
9
 
10
- export class PopsDrawer {
11
- constructor(details: PopsDrawerDetails) {
10
+ export const PopsDrawer = {
11
+ init(details: PopsDrawerDetails) {
12
12
  const guid = popsUtils.getRandomGUID();
13
13
  // 设置当前类型
14
14
  const PopsType = "drawer";
@@ -215,8 +215,8 @@ export class PopsDrawer {
215
215
  }
216
216
 
217
217
  popsDOMUtils.appendBody($shadowContainer);
218
- setTimeout(() => {
219
- setTimeout(() => {
218
+ popsUtils.setTimeout(() => {
219
+ popsUtils.setTimeout(() => {
220
220
  $pops.style.setProperty("transform", "");
221
221
  }, config.openDelay);
222
222
  }, 50);
@@ -233,6 +233,7 @@ export class PopsDrawer {
233
233
  $shadowContainer: $shadowContainer,
234
234
  $shadowRoot: $shadowRoot,
235
235
  });
236
- return PopsHandler.handleResultDetails(eventDetails);
237
- }
238
- }
236
+ let result = PopsHandler.handleResultDetails(eventDetails);
237
+ return result;
238
+ },
239
+ };
@@ -18,36 +18,44 @@ export interface PopsDrawerDetails
18
18
  */
19
19
  title?: Partial<PopsTitleConfig["title"]> & {
20
20
  /**
21
- * 是否启用,默认true
21
+ * 是否启用
22
+ * @default true
22
23
  */
23
24
  enable: boolean;
24
25
  };
25
26
  /**
26
- * 打开的方向,默认为right
27
+ * 打开的方向
28
+ * @default "right"
27
29
  */
28
30
  direction?: "top" | "bottom" | "left" | "right";
29
31
  /**
30
32
  * 窗体的大小; 当使用 number 类型时; 以像素为单位,默认为30%
33
+ * @default "30%"
31
34
  */
32
35
  size?: string | number;
33
36
  /**
34
37
  * 是否在 Drawer 出现时将 body 滚动锁定,默认为false
38
+ * @default false
35
39
  */
36
40
  lockScroll?: boolean;
37
41
  /**
38
42
  * 是否可以通过按下 ESC 关闭 Drawer,默认为true
43
+ * @default true'
39
44
  */
40
45
  closeOnPressEscape?: boolean;
41
46
  /**
42
47
  * 打开的延时时间,单位毫秒,默认为0
48
+ * @default 0
43
49
  */
44
50
  openDelay?: number;
45
51
  /**
46
52
  * 关闭的延时时间,单位毫秒,默认为0
53
+ * @default 0
47
54
  */
48
55
  closeDelay?: number;
49
56
  /**
50
57
  * border-radius,根据direction自动适应,默认为5
58
+ * @default 5
51
59
  */
52
60
  borderRadius?: number;
53
61
  }
@@ -10,8 +10,8 @@ import { PopsFolderConfig } from "./config";
10
10
  import { Folder_ICON } from "./folderIcon";
11
11
  import type { PopsFolderDataConfig, PopsFolderDetails } from "./indexType";
12
12
 
13
- export class PopsFolder {
14
- constructor(details: PopsFolderDetails) {
13
+ export const PopsFolder = {
14
+ init(details: PopsFolderDetails) {
15
15
  const guid = popsUtils.getRandomGUID();
16
16
  // 设置当前类型
17
17
  const PopsType = "folder";
@@ -713,12 +713,12 @@ export class PopsFolder {
713
713
 
714
714
  downloadIframeLinkElement.src = downloadInfo.url;
715
715
  downloadIframeLinkElement.onload = function () {
716
- setTimeout(() => {
716
+ popsUtils.setTimeout(() => {
717
717
  downloadIframeLinkElement.remove();
718
718
  }, 1000);
719
719
  };
720
720
  $shadowRoot.appendChild(downloadIframeLinkElement);
721
- setTimeout(() => {
721
+ popsUtils.setTimeout(() => {
722
722
  downloadIframeLinkElement.remove();
723
723
  }, 3 * 60 * 1000);
724
724
  } else {
@@ -1034,6 +1034,7 @@ export class PopsFolder {
1034
1034
  $shadowContainer: $shadowContainer,
1035
1035
  $shadowRoot: $shadowRoot,
1036
1036
  });
1037
- return PopsHandler.handleResultDetails(eventDetails);
1038
- }
1039
- }
1037
+ let result = PopsHandler.handleResultDetails(eventDetails);
1038
+ return result;
1039
+ },
1040
+ };
@@ -79,10 +79,13 @@ export interface PopsFolderDetails
79
79
  name: "fileName" | "fileSize" | "latestTime";
80
80
  /**
81
81
  * 是否降序,默认false(升序)
82
+ * @default false
82
83
  */
83
84
  isDesc: boolean;
84
85
  /**
85
- * 触发排序的回调,如果返回true,则中止内部的排序
86
+ * 触发排序的回调
87
+ * @returns
88
+ * + true 中止内部的排序
86
89
  */
87
90
  callback?: (
88
91
  targert: HTMLElement,
@@ -10,8 +10,8 @@ import { popsUtils } from "../../utils/PopsUtils";
10
10
  import { PopsIframeConfig } from "./config";
11
11
  import type { PopsIframeDetails } from "./indexType";
12
12
 
13
- export class PopsIframe {
14
- constructor(details: PopsIframeDetails) {
13
+ export const PopsIframe = {
14
+ init(details: PopsIframeDetails) {
15
15
  const guid = popsUtils.getRandomGUID();
16
16
  // 设置当前类型
17
17
  const PopsType = "iframe";
@@ -20,7 +20,7 @@ export class PopsIframe {
20
20
  config = popsUtils.assign(config, GlobalConfig.getGlobalConfig());
21
21
  config = popsUtils.assign(config, details);
22
22
  if (config.url == null) {
23
- throw "config.url不能为空";
23
+ throw new Error("config.url不能为空");
24
24
  }
25
25
  config = PopsHandler.handleOnly(PopsType, config);
26
26
 
@@ -331,5 +331,5 @@ export class PopsIframe {
331
331
 
332
332
  let result = PopsHandler.handleResultDetails(eventDetails);
333
333
  return result;
334
- }
335
- }
334
+ },
335
+ };
@@ -123,6 +123,7 @@ export interface PopsIframeDetails
123
123
  };
124
124
  /**
125
125
  * 加载的地址,默认为window.location.href
126
+ * @default window.location.href
126
127
  */
127
128
  url?: string;
128
129
  /**
@@ -131,6 +132,7 @@ export interface PopsIframeDetails
131
132
  topRightButton: "min|max|mise|close";
132
133
  /**
133
134
  * 是否启用沙箱,默认false
135
+ * @default false
134
136
  */
135
137
  sandbox?: boolean;
136
138
  /**
@@ -7,8 +7,8 @@ import { popsUtils } from "../../utils/PopsUtils";
7
7
  import { PopsLoadingConfig } from "./config";
8
8
  import type { PopsLoadingDetails } from "./indexType";
9
9
 
10
- export class PopsLoading {
11
- constructor(details: PopsLoadingDetails) {
10
+ export const PopsLoading = {
11
+ init(details: PopsLoadingDetails) {
12
12
  let config = PopsLoadingConfig();
13
13
  config = popsUtils.assign(config, GlobalConfig.getGlobalConfig());
14
14
  config = popsUtils.assign(config, details);
@@ -106,6 +106,7 @@ export class PopsLoading {
106
106
  popsDOMUtils.css($anim, "position", "absolute !important");
107
107
  $mask && popsDOMUtils.css($mask, "position", "absolute !important");
108
108
  }
109
- return PopsHandler.handleResultDetails(eventDetails);
110
- }
111
- }
109
+ let result = PopsHandler.handleResultDetails(eventDetails);
110
+ return result;
111
+ },
112
+ };
@@ -13,8 +13,9 @@ export interface PopsLoadingDetails
13
13
  > {
14
14
  /**
15
15
  * 父元素,默认为document.body
16
+ * @default document.body
16
17
  */
17
- parent: HTMLElement;
18
+ parent?: HTMLElement;
18
19
  /**
19
20
  * 内容配置
20
21
  */
@@ -26,6 +27,7 @@ export interface PopsLoadingDetails
26
27
  };
27
28
  /**
28
29
  * (可选)添加主CSS,默认为true,当页面中存在anim覆盖时,可能会有一些样式问题,取消添加该CSS即可解决
30
+ * @default true
29
31
  */
30
32
  addIndexCSS?: boolean;
31
33
  /**
@@ -5,8 +5,7 @@ import { PopsMathFloatUtils } from "../../utils/PopsMathUtils";
5
5
  import { PopsSafeUtils } from "../../utils/PopsSafeUtils";
6
6
  import { popsUtils } from "../../utils/PopsUtils";
7
7
  import type { PopsAlertDetails } from "../alert/indexType";
8
- import type { PopsTooltipResult } from "../tooltip";
9
- import type { PopsToolTipDetails } from "../tooltip/indexType";
8
+ import type { PopsTooltip } from "../tooltip";
10
9
  import type { PopsPanelButtonDetails } from "./buttonType";
11
10
  import type { PopsPanelRightAsideContainerOptions } from "./commonType";
12
11
  import type { PopsPanelDeepMenuDetails } from "./deepMenuType";
@@ -441,7 +440,8 @@ export const PanelHandleContentDetails = () => {
441
440
  */
442
441
  createSectionContainerItem_slider_new(formConfig: PopsPanelSliderDetails) {
443
442
  let liElement = document.createElement("li");
444
- (liElement as any)["__formConfig__"] = formConfig;
443
+ // @ts-ignore
444
+ liElement["__formConfig__"] = formConfig;
445
445
  this.setElementClassName(liElement, formConfig.className);
446
446
  this.setElementAttributes(liElement, formConfig.attributes);
447
447
  this.setElementProps(liElement, formConfig.props);
@@ -533,40 +533,40 @@ export const PanelHandleContentDetails = () => {
533
533
  percent: number;
534
534
  }
535
535
  >(),
536
- tooltip: null as any as PopsTooltipResult<PopsToolTipDetails>,
536
+ tooltip: null as any as ReturnType<typeof PopsTooltip.init>,
537
537
  },
538
538
  $ele: {
539
- slider: liElement.querySelector<HTMLDivElement>(".pops-slider")!,
540
- runAway: liElement.querySelector<HTMLDivElement>(
539
+ slider: liElement.querySelector<HTMLElement>(".pops-slider")!,
540
+ runAway: liElement.querySelector<HTMLElement>(
541
541
  ".pops-slider__runway"
542
542
  )!,
543
- bar: liElement.querySelector<HTMLDivElement>(".pops-slider__bar")!,
544
- buttonWrapper: liElement.querySelector<HTMLDivElement>(
543
+ bar: liElement.querySelector<HTMLElement>(".pops-slider__bar")!,
544
+ buttonWrapper: liElement.querySelector<HTMLElement>(
545
545
  ".pops-slider__button-wrapper"
546
546
  )!,
547
- button: liElement.querySelector<HTMLDivElement>(
548
- ".pops-slider__button"
549
- )!,
547
+ button: liElement.querySelector<HTMLElement>(".pops-slider__button")!,
550
548
  },
551
549
  $interval: {
552
550
  isCheck: false,
553
551
  },
554
- $tooltip: null as any,
552
+ $tooltip: null as any as ReturnType<
553
+ typeof popsUtils.AnyTouch
554
+ >["prototype"],
555
555
  init() {
556
556
  this.initEleData();
557
557
  this.setToolTipEvent();
558
558
  this.setPanEvent();
559
559
  this.setRunAwayClickEvent();
560
560
  this.intervalInit();
561
- if (formConfig.disabled) {
561
+ if (this.isFormConfigDisabledDrag()) {
562
562
  this.disableDrag();
563
563
  }
564
564
  },
565
565
  /**
566
566
  * 10s内循环获取slider的宽度等信息
567
567
  * 获取到了就可以初始化left的值
568
- * @param {number} [checkStepTime=200] 每次检测的间隔时间
569
- * @param {number} [maxTime=10000] 最大的检测时间
568
+ * @param [checkStepTime=200] 每次检测的间隔时间
569
+ * @param [maxTime=10000] 最大的检测时间
570
570
  */
571
571
  intervalInit(checkStepTime = 200, maxTime = 10000) {
572
572
  if (this.$interval.isCheck) {
@@ -576,11 +576,11 @@ export const PanelHandleContentDetails = () => {
576
576
  let isSuccess = false;
577
577
  let oldTotalWidth = this.$data.totalWidth;
578
578
  let timer: number | undefined = void 0;
579
- let interval = setInterval(() => {
579
+ let interval = popsUtils.setInterval(() => {
580
580
  if (isSuccess) {
581
581
  this.$interval.isCheck = false;
582
- clearTimeout(timer);
583
- clearInterval(interval);
582
+ popsUtils.clearTimeout(timer);
583
+ popsUtils.clearInterval(interval);
584
584
  } else {
585
585
  this.initTotalWidth();
586
586
  if (this.$data.totalWidth !== 0) {
@@ -598,8 +598,8 @@ export const PanelHandleContentDetails = () => {
598
598
  }
599
599
  }, checkStepTime);
600
600
  /* 最长检测时间是10s */
601
- timer = setTimeout(() => {
602
- clearInterval(interval);
601
+ timer = popsUtils.setTimeout(() => {
602
+ popsUtils.clearInterval(interval);
603
603
  }, maxTime);
604
604
  },
605
605
  /**
@@ -610,10 +610,14 @@ export const PanelHandleContentDetails = () => {
610
610
  this.$ele.slider.setAttribute("data-max", this.max.toString());
611
611
  this.$ele.slider.setAttribute("data-value", this.value.toString());
612
612
  this.$ele.slider.setAttribute("data-step", this.step.toString());
613
- (this.$ele.slider as any)["data-min"] = this.min;
614
- (this.$ele.slider as any)["data-max"] = this.max;
615
- (this.$ele.slider as any)["data-value"] = this.value;
616
- (this.$ele.slider as any)["data-step"] = this.step;
613
+ // @ts-ignore
614
+ this.$ele.slider["data-min"] = this.min;
615
+ // @ts-ignore
616
+ this.$ele.slider["data-max"] = this.max;
617
+ // @ts-ignore
618
+ this.$ele.slider["data-value"] = this.value;
619
+ // @ts-ignore
620
+ this.$ele.slider["data-step"] = this.step;
617
621
  },
618
622
  /**
619
623
  * 初始化滑块的总长度的数据(px)
@@ -733,7 +737,6 @@ export const PanelHandleContentDetails = () => {
733
737
  /**
734
738
  * 判断数字是否是浮点数
735
739
  * @param num
736
- * @returns
737
740
  */
738
741
  isFloat(num: number) {
739
742
  return Number(num) === num && num % 1 !== 0;
@@ -750,6 +753,7 @@ export const PanelHandleContentDetails = () => {
750
753
  },
751
754
  /**
752
755
  * 根据拖拽距离获取滑块应该在的区间和值
756
+ * @param dragX
753
757
  */
754
758
  getDragInfo(dragX: number) {
755
759
  let result = this.$data.stepBlockMap.get(0);
@@ -766,7 +770,7 @@ export const PanelHandleContentDetails = () => {
766
770
  },
767
771
  /**
768
772
  * 获取滑块的当前脱拖拽占据的百分比
769
- * @param {number} dragWidth
773
+ * @param dragWidth
770
774
  */
771
775
  getSliderPositonPercent(dragWidth: number) {
772
776
  return dragWidth / this.$data.totalWidth;
@@ -819,6 +823,23 @@ export const PanelHandleContentDetails = () => {
819
823
  "pops-slider-is-disabled"
820
824
  );
821
825
  },
826
+ /**
827
+ * 判断当前滑块是否被禁用(配置中判断)
828
+ */
829
+ isFormConfigDisabledDrag() {
830
+ if (
831
+ typeof formConfig.disabled === "function" ||
832
+ typeof formConfig.disabled === "boolean"
833
+ ) {
834
+ let isDisabled =
835
+ typeof formConfig.disabled === "function"
836
+ ? formConfig.disabled()
837
+ : formConfig.disabled;
838
+ return isDisabled;
839
+ } else {
840
+ return false;
841
+ }
842
+ },
822
843
  /**
823
844
  * 设置进度条点击定位的事件
824
845
  */
@@ -849,8 +870,15 @@ export const PanelHandleContentDetails = () => {
849
870
  */
850
871
  dragStartCallBack() {
851
872
  if (!this.$data.isMove) {
852
- if (this.isDisabledDrag()) {
873
+ if (this.isFormConfigDisabledDrag()) {
874
+ // 禁止
875
+ this.disableDrag();
853
876
  return false;
877
+ } else {
878
+ // 允许
879
+ if (this.isDisabledDrag()) {
880
+ this.allowDrag();
881
+ }
854
882
  }
855
883
  this.$data.isMove = true;
856
884
  }
@@ -862,11 +890,7 @@ export const PanelHandleContentDetails = () => {
862
890
  * @param dragX 当前拖拽的距离
863
891
  * @param oldValue 旧的值
864
892
  */
865
- dragMoveCallBack(
866
- event: MouseEvent | TouchEvent,
867
- dragX: number,
868
- oldValue: number
869
- ) {
893
+ dragMoveCallBack(event: any, dragX: number, oldValue: number) {
870
894
  let dragPercent = 0;
871
895
  if (dragX <= 0) {
872
896
  dragPercent = 0;
@@ -915,7 +939,7 @@ export const PanelHandleContentDetails = () => {
915
939
  */
916
940
  let currentDragX = 0;
917
941
  /* 监听拖拽 */
918
- this.$tooltip.on("at:move", (event: any) => {
942
+ this.$tooltip.on("at:move", (event) => {
919
943
  if (!this.dragStartCallBack()) {
920
944
  return;
921
945
  }
@@ -933,7 +957,7 @@ export const PanelHandleContentDetails = () => {
933
957
  this.dragMoveCallBack(event, currentDragX, oldValue);
934
958
  });
935
959
  /* 监听触点离开,处理某些情况下,拖拽松开,但是未触发pan事件,可以通过设置这个来关闭tooltip */
936
- this.$tooltip.on("at:end", (event: any) => {
960
+ this.$tooltip.on("at:end", (event) => {
937
961
  this.dragEndCallBack(currentDragX);
938
962
  });
939
963
  },
@@ -957,16 +981,16 @@ export const PanelHandleContentDetails = () => {
957
981
  return;
958
982
  }
959
983
  this.$data.isCheckingStopDragMove = true;
960
- let interval = setInterval(() => {
984
+ let interval = popsUtils.setInterval(() => {
961
985
  if (!this.$data.isMove) {
962
986
  this.$data.isCheckingStopDragMove = false;
963
987
  this.closeToolTip();
964
- clearInterval(interval);
988
+ popsUtils.clearInterval(interval);
965
989
  }
966
990
  }, 200);
967
- setTimeout(() => {
991
+ popsUtils.setTimeout(() => {
968
992
  this.$data.isCheckingStopDragMove = false;
969
- clearInterval(interval);
993
+ popsUtils.clearInterval(interval);
970
994
  }, 2000);
971
995
  },
972
996
  /**
@@ -998,6 +1022,15 @@ export const PanelHandleContentDetails = () => {
998
1022
  passive: true,
999
1023
  },
1000
1024
  showBeforeCallBack: () => {
1025
+ let isShowHoverTip =
1026
+ typeof formConfig.isShowHoverTip === "function"
1027
+ ? formConfig.isShowHoverTip()
1028
+ : typeof formConfig.isShowHoverTip === "boolean"
1029
+ ? formConfig.isShowHoverTip
1030
+ : true;
1031
+ if (!isShowHoverTip) {
1032
+ return false;
1033
+ }
1001
1034
  this.intervalInit();
1002
1035
  },
1003
1036
  showAfterCallBack: (toolTipNode) => {
@@ -9,8 +9,8 @@ import { PopsPanelConfig } from "./config";
9
9
  import { PanelHandleContentDetails } from "./PanelHandleContentDetails";
10
10
  import { GlobalConfig } from "../../GlobalConfig";
11
11
 
12
- export class PopsPanel {
13
- constructor(details: PopsPanelDetails) {
12
+ export const PopsPanel = {
13
+ init(details: PopsPanelDetails) {
14
14
  const guid = popsUtils.getRandomGUID();
15
15
  // 设置当前类型
16
16
  const PopsType = "panel";
@@ -166,6 +166,7 @@ export class PopsPanel {
166
166
  endCallBack: config.dragEndCallBack,
167
167
  });
168
168
  }
169
- return PopsHandler.handleResultDetails(eventDetails);
170
- }
171
- }
169
+ let result = PopsHandler.handleResultDetails(eventDetails);
170
+ return result;
171
+ },
172
+ };
@@ -123,6 +123,7 @@ export interface PopsPanelDetails
123
123
  * 是否强制是移动端,默认false
124
124
  * + true 强制为移动端
125
125
  * + false 自动根据UA判断是否是移动端
126
+ * @default false
126
127
  */
127
128
  isMobile?: boolean;
128
129
  }
@@ -6,17 +6,18 @@ import type { PopsPanelCommonDetails } from "./commonType";
6
6
  export interface PopsPanelSliderDetails
7
7
  extends PopsPanelCommonDetails<PopsPanelSliderDetails> {
8
8
  /**
9
- * (可选)className属性
9
+ * className属性
10
+ * @default ""
10
11
  */
11
12
  className?: string;
12
13
  /**
13
- * (可选)自定义元素属性
14
+ * 自定义元素属性
14
15
  */
15
16
  attributes?: {
16
17
  [key: string]: any;
17
18
  };
18
19
  /**
19
- * (可选)自定义属性
20
+ * 自定义属性
20
21
  */
21
22
  props?: {
22
23
  [K in keyof HTMLElement]?: HTMLElement[K];
@@ -27,16 +28,24 @@ export interface PopsPanelSliderDetails
27
28
  text: string;
28
29
  /**
29
30
  * (可选)左边的文字下面的描述
31
+ * @default ""
30
32
  */
31
33
  description?: string;
32
34
  /**
33
35
  * 类型
36
+ * @default "slider"
34
37
  */
35
38
  type: "slider";
36
39
  /**
37
40
  * (可选)是否禁用
41
+ * @default false
38
42
  */
39
- disabled?: false;
43
+ disabled?: boolean | (() => boolean);
44
+ /**
45
+ * 是否显示滑块的hover提示
46
+ * @default true
47
+ */
48
+ isShowHoverTip?: boolean | (() => boolean);
40
49
  /**
41
50
  * 获取该项的值的回调函数
42
51
  */
@@ -59,6 +68,7 @@ export interface PopsPanelSliderDetails
59
68
  max: number;
60
69
  /**
61
70
  * (可选)每次滑动的间隔值
71
+ * @default 1
62
72
  */
63
73
  step?: number;
64
74
  }
@@ -8,8 +8,8 @@ import { popsUtils } from "../../utils/PopsUtils";
8
8
  import { PopsPromptConfig } from "./config";
9
9
  import type { PopsPromptDetails } from "./indexType";
10
10
 
11
- export class PopsPrompt {
12
- constructor(details: PopsPromptDetails) {
11
+ export const PopsPrompt = {
12
+ init(details: PopsPromptDetails) {
13
13
  const guid = popsUtils.getRandomGUID();
14
14
  // 设置当前类型
15
15
  const PopsType = "prompt";
@@ -194,6 +194,7 @@ export class PopsPrompt {
194
194
  if (config.content.select) {
195
195
  $input.select();
196
196
  }
197
- return PopsHandler.handleResultDetails(eventDetails);
198
- }
199
- }
197
+ let result = PopsHandler.handleResultDetails(eventDetails);
198
+ return result;
199
+ },
200
+ };
@@ -44,6 +44,7 @@ export interface PopsPromptDetails
44
44
  select?: boolean;
45
45
  /**
46
46
  * 输入框内的提示文字
47
+ * @default ""
47
48
  */
48
49
  placeholder?: string;
49
50
  /**
@@ -12,8 +12,8 @@ import type {
12
12
  PopsRightClickMenuDetails,
13
13
  } from "./indexType";
14
14
 
15
- export class PopsRightClickMenu {
16
- constructor(details: PopsRightClickMenuDetails) {
15
+ export const PopsRightClickMenu = {
16
+ init(details: PopsRightClickMenuDetails) {
17
17
  const guid = popsUtils.getRandomGUID();
18
18
  // 设置当前类型
19
19
  const PopsType = "rightClickMenu";
@@ -23,7 +23,7 @@ export class PopsRightClickMenu {
23
23
  config = popsUtils.assign(config, details);
24
24
  config = PopsHandler.handleOnly(PopsType, config);
25
25
  if (config.target == null) {
26
- throw "config.target 不能为空";
26
+ throw new Error("config.target 不能为空");
27
27
  }
28
28
  if (details.data) {
29
29
  // @ts-ignore
@@ -570,7 +570,6 @@ export class PopsRightClickMenu {
570
570
  PopsContextMenu.addContextMenuEvent(config.target, config.targetSelector!);
571
571
  // 添加全局点击检测
572
572
  PopsContextMenu.addWindowCheckClickListener();
573
-
574
573
  return {
575
574
  guid: guid,
576
575
  config: config,
@@ -580,5 +579,5 @@ export class PopsRightClickMenu {
580
579
  removeContextMenuEvent: PopsContextMenu.removeContextMenuEvent,
581
580
  addContextMenuEvent: PopsContextMenu.addContextMenuEvent,
582
581
  };
583
- }
584
- }
582
+ },
583
+ };
@@ -47,14 +47,10 @@ export interface PopsRightClickMenuDetails
47
47
  "useShadowRoot" | "beforeAppendToPageCallBack" | "zIndex" | "style" | "only"
48
48
  > {
49
49
  /**
50
- * 目标,默认为document.documentElement G
50
+ * 目标元素
51
+ * @default document.documentElement
51
52
  */
52
- target?:
53
- | HTMLElement
54
- | (typeof globalThis & Window)
55
- | Window
56
- | EventTarget
57
- | Node;
53
+ target?: HTMLElement | Window | EventTarget | Node;
58
54
  /**
59
55
  * 目标的子元素选择器,默认为空
60
56
  */
@@ -65,14 +61,17 @@ export interface PopsRightClickMenuDetails
65
61
  data: PopsRightClickMenuDataDetails[];
66
62
  /**
67
63
  * 自定义className,默认为空
64
+ * @default ""
68
65
  */
69
66
  className?: string;
70
67
  /**
71
68
  * 是否启用动画,默认true
69
+ * @default true
72
70
  */
73
71
  isAnimation?: boolean;
74
72
  /**
75
73
  * 是否阻止默认contextmenu事件
74
+ * @default false
76
75
  */
77
76
  preventDefault?: boolean;
78
77
  }