@whitesev/pops 2.0.6 → 2.0.7
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 +127 -74
- package/dist/index.amd.js.map +1 -1
- package/dist/index.cjs.js +127 -74
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +127 -74
- package/dist/index.esm.js.map +1 -1
- package/dist/index.iife.js +127 -74
- package/dist/index.iife.js.map +1 -1
- package/dist/index.system.js +127 -74
- package/dist/index.system.js.map +1 -1
- package/dist/index.umd.js +127 -74
- package/dist/index.umd.js.map +1 -1
- package/dist/types/src/Pops.d.ts +20411 -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 +20315 -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 +51 -3
- package/package.json +1 -1
- package/src/Pops.ts +25 -24
- package/src/components/alert/index.ts +6 -5
- package/src/components/confirm/index.ts +6 -5
- package/src/components/drawer/index.ts +6 -5
- package/src/components/drawer/indexType.ts +10 -2
- package/src/components/folder/index.ts +6 -5
- package/src/components/folder/indexType.ts +4 -1
- package/src/components/iframe/index.ts +4 -4
- 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 +62 -29
- 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 +4 -5
- package/src/components/rightClickMenu/indexType.ts +6 -7
- package/src/components/searchSuggestion/index.ts +4 -4
- package/src/components/searchSuggestion/indexType.ts +0 -109
- package/src/components/tooltip/index.ts +9 -9
|
@@ -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) {
|
|
@@ -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
|
},
|
|
@@ -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";
|
|
@@ -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
|
}
|
|
@@ -7,8 +7,8 @@ import { GlobalConfig } from "../../GlobalConfig";
|
|
|
7
7
|
import { PopsSafeUtils } from "../../utils/PopsSafeUtils";
|
|
8
8
|
import type { PopsSearchSuggestionDetails } from "./indexType";
|
|
9
9
|
|
|
10
|
-
export
|
|
11
|
-
|
|
10
|
+
export const PopsSearchSuggestion = {
|
|
11
|
+
init(details: PopsSearchSuggestionDetails) {
|
|
12
12
|
const guid = popsUtils.getRandomGUID();
|
|
13
13
|
// 设置当前类型
|
|
14
14
|
const PopsType = "searchSuggestion";
|
|
@@ -675,5 +675,5 @@ export class PopsSearchSuggestion {
|
|
|
675
675
|
},
|
|
676
676
|
};
|
|
677
677
|
return SearchSuggestion;
|
|
678
|
-
}
|
|
679
|
-
}
|
|
678
|
+
},
|
|
679
|
+
};
|
|
@@ -145,112 +145,3 @@ export interface PopsSearchSuggestionDetails<T = any>
|
|
|
145
145
|
data: T
|
|
146
146
|
) => void;
|
|
147
147
|
}
|
|
148
|
-
|
|
149
|
-
/**
|
|
150
|
-
* pops.searchSuggestion的函数返回值
|
|
151
|
-
*/
|
|
152
|
-
export interface PopsSearchSuggestionResult<T = any> {
|
|
153
|
-
$el: {
|
|
154
|
-
/** 根元素 */
|
|
155
|
-
root: HTMLElement;
|
|
156
|
-
/** ul元素 */
|
|
157
|
-
$hintULContainer: HTMLUListElement;
|
|
158
|
-
/** 动态更新CSS */
|
|
159
|
-
$dynamicCSS: HTMLStyleElement;
|
|
160
|
-
};
|
|
161
|
-
/**
|
|
162
|
-
* 初始化
|
|
163
|
-
*/
|
|
164
|
-
init: () => void;
|
|
165
|
-
/**
|
|
166
|
-
* 获取显示出搜索建议框的html
|
|
167
|
-
*/
|
|
168
|
-
getSearchSelectElement: () => HTMLElement;
|
|
169
|
-
/**
|
|
170
|
-
* 获取显示出搜索建议框的每一项的html
|
|
171
|
-
*/
|
|
172
|
-
getSearchItemLiElement: (data: T, index: number) => HTMLElement;
|
|
173
|
-
/**
|
|
174
|
-
* 获取data-value值
|
|
175
|
-
*/
|
|
176
|
-
getItemDataValue: (data: T) => T;
|
|
177
|
-
/**
|
|
178
|
-
* 设置搜索建议框每一项的点击事件
|
|
179
|
-
*/
|
|
180
|
-
setSearchItemClickEvent: (liElement: HTMLLIElement) => void;
|
|
181
|
-
/**
|
|
182
|
-
* 监听输入框内容改变
|
|
183
|
-
*/
|
|
184
|
-
setInputChangeEvent: (option?: AddEventListenerOptions) => void;
|
|
185
|
-
/**
|
|
186
|
-
* 移除输入框内容改变的监听
|
|
187
|
-
*/
|
|
188
|
-
removeInputChangeEvent: (option?: AddEventListenerOptions) => void;
|
|
189
|
-
/**
|
|
190
|
-
* 设置显示搜索建议框的事件
|
|
191
|
-
*/
|
|
192
|
-
setShowEvent: (option?: AddEventListenerOptions) => void;
|
|
193
|
-
/**
|
|
194
|
-
* 移除显示搜索建议框的事件
|
|
195
|
-
*/
|
|
196
|
-
removeShowEvent: (option?: AddEventListenerOptions) => void;
|
|
197
|
-
/**
|
|
198
|
-
* 设置隐藏搜索建议框的事件
|
|
199
|
-
*/
|
|
200
|
-
setHideEvent: (option?: AddEventListenerOptions) => void;
|
|
201
|
-
/**
|
|
202
|
-
* 移除隐藏搜索建议框的事件
|
|
203
|
-
*/
|
|
204
|
-
removeHideEvent: (option?: AddEventListenerOptions) => void;
|
|
205
|
-
/**
|
|
206
|
-
* 设置所有监听
|
|
207
|
-
*/
|
|
208
|
-
setAllEvent: (option?: AddEventListenerOptions) => void;
|
|
209
|
-
/**
|
|
210
|
-
* 移除所有监听
|
|
211
|
-
*/
|
|
212
|
-
removeAllEvent: (option?: AddEventListenerOptions) => void;
|
|
213
|
-
/**
|
|
214
|
-
* 获取删除按钮的html
|
|
215
|
-
*/
|
|
216
|
-
getDeleteIconHTML: (size: number, fill: string) => void;
|
|
217
|
-
/**
|
|
218
|
-
* 设置当前正在搜索中的提示
|
|
219
|
-
*/
|
|
220
|
-
setPromptsInSearch: () => void;
|
|
221
|
-
/**
|
|
222
|
-
* 移除正在搜索中的提示
|
|
223
|
-
*/
|
|
224
|
-
removePromptsInSearch: () => void;
|
|
225
|
-
/**
|
|
226
|
-
* 清空所有的搜索结果
|
|
227
|
-
*/
|
|
228
|
-
clearAllSearchItemLi: () => void;
|
|
229
|
-
/**
|
|
230
|
-
* 修改搜索建议框的位置(top、left)
|
|
231
|
-
* 因为目标元素可能是动态隐藏的
|
|
232
|
-
*/
|
|
233
|
-
changeHintULElementPosition: () => void;
|
|
234
|
-
/**
|
|
235
|
-
* 修改搜索建议框的width
|
|
236
|
-
* 因为目标元素可能是动态隐藏的
|
|
237
|
-
*/
|
|
238
|
-
changeHintULElementWidth: () => void;
|
|
239
|
-
updateDynamicCSS: () => void;
|
|
240
|
-
/**
|
|
241
|
-
* 更新页面显示的搜索结果
|
|
242
|
-
*/
|
|
243
|
-
update: (data: T[]) => void;
|
|
244
|
-
/**
|
|
245
|
-
* 清空当前的搜索结果并显示无结果
|
|
246
|
-
*/
|
|
247
|
-
clear: () => void;
|
|
248
|
-
/**
|
|
249
|
-
* 隐藏搜索建议框
|
|
250
|
-
*/
|
|
251
|
-
hide: () => void;
|
|
252
|
-
/**
|
|
253
|
-
* 显示搜索建议框
|
|
254
|
-
*/
|
|
255
|
-
show: () => void;
|
|
256
|
-
}
|
|
@@ -544,8 +544,8 @@ export type PopsTooltipResult<T extends PopsToolTipDetails> = {
|
|
|
544
544
|
toolTip: typeof ToolTip.prototype;
|
|
545
545
|
};
|
|
546
546
|
|
|
547
|
-
export
|
|
548
|
-
|
|
547
|
+
export const PopsTooltip = {
|
|
548
|
+
init(details: PopsToolTipDetails) {
|
|
549
549
|
const guid = popsUtils.getRandomGUID();
|
|
550
550
|
// 设置当前类型
|
|
551
551
|
const PopsType = "tooltip";
|
|
@@ -579,11 +579,11 @@ export class PopsTooltip {
|
|
|
579
579
|
}
|
|
580
580
|
|
|
581
581
|
return {
|
|
582
|
-
guid
|
|
583
|
-
config
|
|
584
|
-
$shadowContainer
|
|
585
|
-
$shadowRoot
|
|
586
|
-
toolTip
|
|
582
|
+
guid,
|
|
583
|
+
config,
|
|
584
|
+
$shadowContainer,
|
|
585
|
+
$shadowRoot,
|
|
586
|
+
toolTip,
|
|
587
587
|
};
|
|
588
|
-
}
|
|
589
|
-
}
|
|
588
|
+
},
|
|
589
|
+
};
|