@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.
- package/dist/index.amd.js +506 -128
- package/dist/index.amd.js.map +1 -1
- package/dist/index.cjs.js +506 -128
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +506 -128
- package/dist/index.esm.js.map +1 -1
- package/dist/index.iife.js +506 -128
- package/dist/index.iife.js.map +1 -1
- package/dist/index.system.js +506 -128
- package/dist/index.system.js.map +1 -1
- package/dist/index.umd.js +506 -128
- package/dist/index.umd.js.map +1 -1
- package/dist/types/src/Pops.d.ts +20761 -15
- package/dist/types/src/components/alert/index.d.ts +3 -3
- package/dist/types/src/components/confirm/index.d.ts +3 -3
- package/dist/types/src/components/drawer/index.d.ts +3 -3
- package/dist/types/src/components/drawer/indexType.d.ts +10 -2
- package/dist/types/src/components/folder/index.d.ts +3 -3
- package/dist/types/src/components/folder/indexType.d.ts +4 -1
- package/dist/types/src/components/iframe/index.d.ts +6 -3
- package/dist/types/src/components/iframe/indexType.d.ts +2 -0
- package/dist/types/src/components/loading/index.d.ts +3 -3
- package/dist/types/src/components/loading/indexType.d.ts +3 -1
- package/dist/types/src/components/panel/index.d.ts +3 -3
- package/dist/types/src/components/panel/indexType.d.ts +1 -0
- package/dist/types/src/components/panel/sliderType.d.ts +14 -4
- package/dist/types/src/components/prompt/index.d.ts +3 -3
- package/dist/types/src/components/prompt/indexType.d.ts +1 -0
- package/dist/types/src/components/rightClickMenu/index.d.ts +20661 -3
- package/dist/types/src/components/rightClickMenu/indexType.d.ts +6 -2
- package/dist/types/src/components/searchSuggestion/index.d.ts +141 -3
- package/dist/types/src/components/searchSuggestion/indexType.d.ts +0 -108
- package/dist/types/src/components/tooltip/index.d.ts +60 -5
- package/dist/types/src/components/tooltip/indexType.d.ts +6 -4
- package/dist/types/src/utils/PopsUtils.d.ts +16 -0
- package/package.json +6 -5
- package/src/Pops.ts +26 -25
- package/src/components/alert/index.ts +6 -5
- package/src/components/confirm/index.ts +6 -5
- package/src/components/drawer/index.ts +8 -7
- package/src/components/drawer/indexType.ts +10 -2
- package/src/components/folder/index.ts +8 -7
- package/src/components/folder/indexType.ts +4 -1
- package/src/components/iframe/index.ts +5 -5
- package/src/components/iframe/indexType.ts +2 -0
- package/src/components/loading/index.ts +6 -5
- package/src/components/loading/indexType.ts +3 -1
- package/src/components/panel/PanelHandleContentDetails.ts +71 -38
- package/src/components/panel/index.ts +6 -5
- package/src/components/panel/indexType.ts +1 -0
- package/src/components/panel/sliderType.ts +14 -4
- package/src/components/prompt/index.ts +6 -5
- package/src/components/prompt/indexType.ts +1 -0
- package/src/components/rightClickMenu/index.ts +5 -6
- package/src/components/rightClickMenu/indexType.ts +6 -7
- package/src/components/searchSuggestion/index.ts +6 -6
- package/src/components/searchSuggestion/indexType.ts +0 -109
- package/src/components/tooltip/index.ts +65 -25
- package/src/components/tooltip/indexType.ts +11 -4
- package/src/utils/PopsDOMUtils.ts +1 -1
- package/src/utils/PopsInstanceUtils.ts +6 -6
- 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
|
|
11
|
-
|
|
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
|
-
|
|
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
|
-
*
|
|
21
|
+
* 是否启用
|
|
22
|
+
* @default true
|
|
22
23
|
*/
|
|
23
24
|
enable: boolean;
|
|
24
25
|
};
|
|
25
26
|
/**
|
|
26
|
-
*
|
|
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
|
|
14
|
-
|
|
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
|
-
|
|
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
|
-
*
|
|
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
|
|
14
|
-
|
|
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
|
|
11
|
-
|
|
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
|
-
|
|
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
|
|
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 {
|
|
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
|
-
|
|
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
|
|
536
|
+
tooltip: null as any as ReturnType<typeof PopsTooltip.init>,
|
|
537
537
|
},
|
|
538
538
|
$ele: {
|
|
539
|
-
slider: liElement.querySelector<
|
|
540
|
-
runAway: liElement.querySelector<
|
|
539
|
+
slider: liElement.querySelector<HTMLElement>(".pops-slider")!,
|
|
540
|
+
runAway: liElement.querySelector<HTMLElement>(
|
|
541
541
|
".pops-slider__runway"
|
|
542
542
|
)!,
|
|
543
|
-
bar: liElement.querySelector<
|
|
544
|
-
buttonWrapper: liElement.querySelector<
|
|
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<
|
|
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 (
|
|
561
|
+
if (this.isFormConfigDisabledDrag()) {
|
|
562
562
|
this.disableDrag();
|
|
563
563
|
}
|
|
564
564
|
},
|
|
565
565
|
/**
|
|
566
566
|
* 10s内循环获取slider的宽度等信息
|
|
567
567
|
* 获取到了就可以初始化left的值
|
|
568
|
-
* @param
|
|
569
|
-
* @param
|
|
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
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
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
|
|
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.
|
|
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
|
|
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
|
|
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
|
|
13
|
-
|
|
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
|
-
|
|
170
|
-
|
|
171
|
-
}
|
|
169
|
+
let result = PopsHandler.handleResultDetails(eventDetails);
|
|
170
|
+
return result;
|
|
171
|
+
},
|
|
172
|
+
};
|
|
@@ -6,17 +6,18 @@ import type { PopsPanelCommonDetails } from "./commonType";
|
|
|
6
6
|
export interface PopsPanelSliderDetails
|
|
7
7
|
extends PopsPanelCommonDetails<PopsPanelSliderDetails> {
|
|
8
8
|
/**
|
|
9
|
-
*
|
|
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?:
|
|
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
|
|
12
|
-
|
|
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
|
-
|
|
198
|
-
|
|
199
|
-
}
|
|
197
|
+
let result = PopsHandler.handleResultDetails(eventDetails);
|
|
198
|
+
return result;
|
|
199
|
+
},
|
|
200
|
+
};
|
|
@@ -12,8 +12,8 @@ import type {
|
|
|
12
12
|
PopsRightClickMenuDetails,
|
|
13
13
|
} from "./indexType";
|
|
14
14
|
|
|
15
|
-
export
|
|
16
|
-
|
|
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
|
-
*
|
|
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
|
}
|