@whitesev/pops 1.4.0 → 1.5.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.
Files changed (105) hide show
  1. package/dist/index.amd.js.map +1 -1
  2. package/dist/index.cjs.js.map +1 -1
  3. package/dist/index.esm.js.map +1 -1
  4. package/dist/index.iife.js.map +1 -1
  5. package/dist/index.system.js.map +1 -1
  6. package/dist/index.umd.js.map +1 -1
  7. package/package.json +50 -48
  8. package/src/Config.ts +3 -0
  9. package/src/Core.ts +45 -0
  10. package/src/Pops.ts +340 -0
  11. package/src/components/alert/index.css +45 -0
  12. package/src/components/alert/index.ts +216 -0
  13. package/src/components/alert/indexType.ts +30 -0
  14. package/src/components/confirm/index.css +45 -0
  15. package/src/components/confirm/index.ts +264 -0
  16. package/src/components/confirm/indexType.ts +17 -0
  17. package/src/components/drawer/index.css +47 -0
  18. package/src/components/drawer/index.ts +338 -0
  19. package/src/components/drawer/indexType.ts +53 -0
  20. package/src/components/folder/folderIcon.ts +28 -0
  21. package/src/components/folder/index.css +291 -0
  22. package/src/components/folder/index.ts +1111 -0
  23. package/src/components/folder/indexType.ts +87 -0
  24. package/src/components/iframe/index.css +90 -0
  25. package/src/components/iframe/index.ts +415 -0
  26. package/src/components/iframe/indexType.ts +144 -0
  27. package/src/components/loading/index.css +60 -0
  28. package/src/components/loading/index.ts +123 -0
  29. package/src/components/loading/indexType.ts +31 -0
  30. package/src/components/panel/buttonType.ts +60 -0
  31. package/src/components/panel/commonType.ts +50 -0
  32. package/src/components/panel/deepMenuType.ts +59 -0
  33. package/src/components/panel/formsType.ts +32 -0
  34. package/src/components/panel/index.css +754 -0
  35. package/src/components/panel/index.ts +2435 -0
  36. package/src/components/panel/indexType.ts +107 -0
  37. package/src/components/panel/inputType.ts +65 -0
  38. package/src/components/panel/ownType.ts +28 -0
  39. package/src/components/panel/selectType.ts +80 -0
  40. package/src/components/panel/sliderType.ts +59 -0
  41. package/src/components/panel/switchType.ts +43 -0
  42. package/src/components/panel/textareaType.ts +54 -0
  43. package/src/components/prompt/index.css +60 -0
  44. package/src/components/prompt/index.ts +293 -0
  45. package/src/components/prompt/indexType.ts +47 -0
  46. package/src/components/rightClickMenu/index.ts +729 -0
  47. package/src/components/rightClickMenu/indexType.ts +89 -0
  48. package/src/components/searchSuggestion/index.css +0 -0
  49. package/src/components/searchSuggestion/index.ts +656 -0
  50. package/src/components/searchSuggestion/indexType.ts +238 -0
  51. package/src/components/tooltip/index.css +171 -0
  52. package/src/components/tooltip/index.ts +358 -0
  53. package/src/components/tooltip/indexType.ts +95 -0
  54. package/src/css/animation.css +2240 -0
  55. package/src/css/button.css +290 -0
  56. package/src/css/common.css +24 -0
  57. package/src/css/index.css +135 -0
  58. package/src/css/ninePalaceGridPosition.css +50 -0
  59. package/src/css/scrollbar.css +18 -0
  60. package/src/handler/PopsElementHandler.ts +353 -0
  61. package/src/handler/PopsHandler.ts +659 -0
  62. package/src/svg/arrowLeft.svg +4 -0
  63. package/src/svg/arrowRight.svg +4 -0
  64. package/src/svg/chromeFilled.svg +14 -0
  65. package/src/svg/circleClose.svg +8 -0
  66. package/src/svg/close.svg +5 -0
  67. package/src/svg/cpu.svg +8 -0
  68. package/src/svg/delete.svg +5 -0
  69. package/src/svg/documentCopy.svg +5 -0
  70. package/src/svg/edit.svg +8 -0
  71. package/src/svg/eleme.svg +5 -0
  72. package/src/svg/elemePlus.svg +5 -0
  73. package/src/svg/headset.svg +5 -0
  74. package/src/svg/hide.svg +8 -0
  75. package/src/svg/keyboard.svg +8 -0
  76. package/src/svg/loading.svg +5 -0
  77. package/src/svg/max.svg +5 -0
  78. package/src/svg/min.svg +5 -0
  79. package/src/svg/mise.svg +5 -0
  80. package/src/svg/monitor.svg +5 -0
  81. package/src/svg/next.svg +5 -0
  82. package/src/svg/picture.svg +8 -0
  83. package/src/svg/prev.svg +5 -0
  84. package/src/svg/search.svg +5 -0
  85. package/src/svg/share.svg +5 -0
  86. package/src/svg/upload.svg +5 -0
  87. package/src/svg/videoPause.svg +5 -0
  88. package/src/svg/videoPlay.svg +5 -0
  89. package/src/svg/view.svg +5 -0
  90. package/src/types/PopsDOMUtilsEventType.d.ts +246 -0
  91. package/src/types/animation.d.ts +19 -0
  92. package/src/types/button.d.ts +226 -0
  93. package/src/types/components.d.ts +197 -0
  94. package/src/types/event.d.ts +62 -0
  95. package/src/types/global.d.ts +11 -0
  96. package/src/types/icon.d.ts +32 -0
  97. package/src/types/layer.d.ts +20 -0
  98. package/src/types/main.d.ts +136 -0
  99. package/src/types/mask.d.ts +35 -0
  100. package/src/types/position.d.ts +60 -0
  101. package/src/utils/AnyTouch.js +1394 -0
  102. package/src/utils/PopsDOMUtils.ts +2013 -0
  103. package/src/utils/PopsInstanceUtils.ts +685 -0
  104. package/src/utils/PopsMathUtils.ts +77 -0
  105. package/src/utils/PopsUtils.ts +380 -0
@@ -0,0 +1,107 @@
1
+ import type {
2
+ PopsTitleConfig,
3
+ PopsDragConfig,
4
+ PopsCommonConfig,
5
+ } from "../../types/components";
6
+ import type { PopsPanelFormsDetails } from "./formsType";
7
+ import type { PopsPanelSwitchDetails } from "./switchType";
8
+ import type { PopsPanelSliderDetails } from "./sliderType";
9
+ import type { PopsPanelInputDetails } from "./inputType";
10
+ import type { PopsPanelTextAreaDetails } from "./textareaType";
11
+ import type { PopsPanelSelectDetails } from "./selectType";
12
+ import type { PopsPanelButtonDetails } from "./buttonType";
13
+ import type { PopsPanelDeepMenuDetails } from "./deepMenuType";
14
+ import type { PopsPanelOwnDetails } from "./ownType";
15
+ import type { PopsHeaderCloseButtonDetails } from "../../types/button";
16
+
17
+ /** panel的各种类型的配置项 */
18
+ export type PopsPanelFormsTotalDetails =
19
+ | PopsPanelSwitchDetails
20
+ | PopsPanelSliderDetails
21
+ | PopsPanelInputDetails
22
+ | PopsPanelTextAreaDetails
23
+ | PopsPanelSelectDetails<any>
24
+ | PopsPanelButtonDetails
25
+ | PopsPanelDeepMenuDetails
26
+ | PopsPanelOwnDetails;
27
+ /**
28
+ * pops.panel的content配置信息
29
+ */
30
+ export interface PopsPanelContentConfig {
31
+ /**
32
+ * 元素属性id
33
+ */
34
+ id: string;
35
+ /**
36
+ * 左侧的标题
37
+ */
38
+ title: string;
39
+ /**
40
+ * (可选)中间顶部的标题
41
+ */
42
+ headerTitle?: string;
43
+ /**
44
+ * (可选)内容高度是否自动适应(与headerTitle的高度有关)
45
+ */
46
+ autoAdaptionContentHeight?: string;
47
+ /**
48
+ * (可选)是否是默认的,指打开弹窗的先显示出来的内容
49
+ */
50
+ isDefault?: boolean | (() => boolean);
51
+ /**
52
+ * (可选)是否自动滚动到默认的项
53
+ */
54
+ scrollToDefaultView?: boolean;
55
+ /**
56
+ * (可选)自定义元素属性
57
+ */
58
+ attributes?: any;
59
+ /**
60
+ * (可选)自定义属性
61
+ */
62
+ props?: HTMLElement;
63
+ /**
64
+ * 子配置
65
+ */
66
+ forms: (PopsPanelFormsDetails | PopsPanelFormsTotalDetails)[];
67
+ /**
68
+ * 左侧容器的点击回调
69
+ */
70
+ callback?: (
71
+ event: MouseEvent | PointerEvent,
72
+ rightHeaderElement: HTMLUListElement,
73
+ rightContainerElement: HTMLUListElement
74
+ ) => void;
75
+ }
76
+
77
+ /**
78
+ * pops.panel
79
+ */
80
+ export interface PopsPanelDetails
81
+ extends PopsTitleConfig,
82
+ PopsDragConfig,
83
+ PopsCommonConfig {
84
+ /**
85
+ * 内容配置
86
+ */
87
+ content: PopsPanelContentConfig[];
88
+ /**
89
+ * 按钮配置
90
+ */
91
+ btn?: {
92
+ /**
93
+ * 右上角的关闭按钮
94
+ */
95
+ close?: PopsHeaderCloseButtonDetails;
96
+ };
97
+ /**
98
+ * 移动端适配的的className,默认为pops-panel-is-mobile
99
+ */
100
+ mobileClassName?: string;
101
+ /**
102
+ * 是否强制是移动端,默认false
103
+ * + true 强制为移动端
104
+ * + false 自动根据UA判断是否是移动端
105
+ */
106
+ isMobile?: boolean;
107
+ }
@@ -0,0 +1,65 @@
1
+ import type { PopsPanelCommonDetails } from "./commonType";
2
+
3
+ /**
4
+ * pops.panel的 input
5
+ */
6
+ export interface PopsPanelInputDetails extends PopsPanelCommonDetails {
7
+ /**
8
+ * (可选)className属性
9
+ */
10
+ className?: string;
11
+ /**
12
+ * (可选)自定义元素属性
13
+ */
14
+ attributes?: any;
15
+ /**
16
+ * (可选)自定义属性
17
+ */
18
+ props?: HTMLElement;
19
+ /**
20
+ * 显示在左边的文字
21
+ */
22
+ text: string;
23
+ /**
24
+ * (可选)左边的文字下面的描述
25
+ */
26
+ description?: string;
27
+ /**
28
+ * 类型
29
+ */
30
+ type: "input";
31
+ /**
32
+ * (可选)是否禁用
33
+ */
34
+ disabled?: boolean;
35
+ /**
36
+ * 获取该项的值的回调函数
37
+ */
38
+ getValue(): string;
39
+ /**
40
+ * 输入框的值改变触发的回调函数
41
+ * @param event 输入事件
42
+ * @param value 输入框的值
43
+ * @param valueAsNumber 当isNumber为true时,有该值,它可能是NaN
44
+ */
45
+ callback(event: InputEvent, value: string, valueAsNumber?: number): void;
46
+ /**
47
+ * (可选)输入框内的提示
48
+ */
49
+ placeholder?: string;
50
+ /**
51
+ * (可选)是否是密码框
52
+ */
53
+ isPassword?: boolean;
54
+ /**
55
+ * (可选)是否是数字框
56
+ */
57
+ isNumber?: boolean;
58
+ /**
59
+ * (可选)自己调用的处理回调函数
60
+ */
61
+ handlerCallBack?(
62
+ liElement: HTMLLIElement,
63
+ inputElement: HTMLInputElement
64
+ ): void;
65
+ }
@@ -0,0 +1,28 @@
1
+ import type { PopsPanelCommonDetails } from "./commonType";
2
+
3
+ /**
4
+ * pops.panel的 own
5
+ * 自定义的
6
+ */
7
+ export interface PopsPanelOwnDetails extends PopsPanelCommonDetails {
8
+ /**
9
+ * (可选)className属性
10
+ */
11
+ className?: string;
12
+ /**
13
+ * (可选)自定义元素属性
14
+ */
15
+ attributes?: any;
16
+ /**
17
+ * (可选)自定义属性
18
+ */
19
+ props?: HTMLElement;
20
+ /**
21
+ * 类型
22
+ */
23
+ type: "own";
24
+ /**
25
+ * 获取自定义<li>标签元素
26
+ */
27
+ getLiElementCallBack: (liElement: HTMLLIElement) => HTMLLIElement;
28
+ }
@@ -0,0 +1,80 @@
1
+ import type { PopsPanelCommonDetails } from "./commonType";
2
+
3
+ /**
4
+ * pops.panel的 select
5
+ */
6
+ export interface PopsPanelSelectDetails<T = any>
7
+ extends PopsPanelCommonDetails {
8
+ /**
9
+ * (可选)className属性
10
+ */
11
+ className?: string;
12
+ /**
13
+ * (可选)自定义元素属性
14
+ */
15
+ attributes?: any;
16
+ /**
17
+ * (可选)自定义属性
18
+ */
19
+ props?: HTMLElement;
20
+ /**
21
+ * 显示在左边的文字
22
+ */
23
+ text: string;
24
+ /**
25
+ * (可选)左边的文字下面的描述
26
+ */
27
+ description?: string;
28
+ /**
29
+ * 类型
30
+ */
31
+ type: "select";
32
+ /**
33
+ * (可选)是否禁用
34
+ */
35
+ disabled?: boolean;
36
+ /**
37
+ * 获取该项的值的回调函数
38
+ */
39
+ getValue(): T;
40
+ /**
41
+ * 选择器的值改变触发的回调函数
42
+ * @param event 事件
43
+ * @param isSelectedValue 当前选中的值,也就是元素属性上的__value__
44
+ * @param isSelectedText 当前选中的文本
45
+ */
46
+ callback?(
47
+ event: PointerEvent | TouchEvent,
48
+ isSelectedValue: T,
49
+ isSelectedText: string
50
+ ): void;
51
+ /**
52
+ * 点击select元素触发该回调
53
+ * @param event 点击事件
54
+ * @param selectElement 当前的select元素
55
+ */
56
+ clickCallBack?(
57
+ event: PointerEvent | MouseEvent,
58
+ selectElement: HTMLSelectElement
59
+ ): void;
60
+ /**
61
+ * 选择器内的数据组
62
+ */
63
+ data: {
64
+ /**
65
+ * 真正的值
66
+ */
67
+ value: T;
68
+ /**
69
+ * 显示的文字
70
+ */
71
+ text: string;
72
+ /**
73
+ * (可选)是否禁用项
74
+ * 触发条件:
75
+ * + 点击select元素
76
+ * + select元素触发change事件
77
+ */
78
+ disable?(value: T): boolean;
79
+ }[];
80
+ }
@@ -0,0 +1,59 @@
1
+ import type { PopsPanelCommonDetails } from "./commonType";
2
+
3
+ /**
4
+ * pops.panel的 slider
5
+ */
6
+ export interface PopsPanelSliderDetails extends PopsPanelCommonDetails {
7
+ /**
8
+ * (可选)className属性
9
+ */
10
+ className?: string;
11
+ /**
12
+ * (可选)自定义元素属性
13
+ */
14
+ attributes?: any;
15
+ /**
16
+ * (可选)自定义属性
17
+ */
18
+ props?: HTMLElement;
19
+ /**
20
+ * 显示在左边的文字
21
+ */
22
+ text: string;
23
+ /**
24
+ * (可选)左边的文字下面的描述
25
+ */
26
+ description?: string;
27
+ /**
28
+ * 类型
29
+ */
30
+ type: "slider";
31
+ /**
32
+ * (可选)是否禁用
33
+ */
34
+ disabled?: false;
35
+ /**
36
+ * 获取该项的值的回调函数
37
+ */
38
+ getValue(): number;
39
+ /**
40
+ * 滑块的值改变触发的回调函数
41
+ */
42
+ callback(event: InputEvent, value: number): void;
43
+ /**
44
+ * 获取tooltip的提示内容,可自定义,默认为slider的值
45
+ */
46
+ getToolTipContent?: (value: number) => string;
47
+ /**
48
+ * 滑块的最小值
49
+ */
50
+ min: number;
51
+ /**
52
+ * 滑块的最大值
53
+ */
54
+ max: number;
55
+ /**
56
+ * (可选)每次滑动的间隔值
57
+ */
58
+ step?: number;
59
+ }
@@ -0,0 +1,43 @@
1
+ import type { PopsPanelCommonDetails } from "./commonType";
2
+
3
+ /**
4
+ * pops.panel的 switch
5
+ */
6
+ export interface PopsPanelSwitchDetails extends PopsPanelCommonDetails {
7
+ /**
8
+ * (可选)className属性
9
+ */
10
+ className?: string;
11
+ /**
12
+ * (可选)自定义元素属性
13
+ */
14
+ attributes?: any;
15
+ /**
16
+ * (可选)自定义属性
17
+ */
18
+ props?: HTMLElement;
19
+ /**
20
+ * 显示在左边的文字
21
+ */
22
+ text: string;
23
+ /**
24
+ * (可选)左边的文字下面的描述
25
+ */
26
+ description?: string;
27
+ /**
28
+ * 类型
29
+ */
30
+ type: "switch";
31
+ /**
32
+ * (可选)是否禁用
33
+ */
34
+ disabled?: false;
35
+ /**
36
+ * 获取该项的值的回调函数
37
+ */
38
+ getValue(): boolean;
39
+ /**
40
+ * switch开启/关闭触发的回调函数
41
+ */
42
+ callback(event: MouseEvent | PointerEvent, value: boolean): void;
43
+ }
@@ -0,0 +1,54 @@
1
+ import type { PopsPanelCommonDetails } from "./commonType";
2
+
3
+ /**
4
+ * pops.panel的 textarea
5
+ */
6
+ export interface PopsPanelTextAreaDetails extends PopsPanelCommonDetails {
7
+ /**
8
+ * (可选)className属性
9
+ */
10
+ className?: string;
11
+ /**
12
+ * (可选)自定义元素属性
13
+ */
14
+ attributes?: any;
15
+ /**
16
+ * (可选)自定义属性
17
+ */
18
+ props?: HTMLElement;
19
+ /**
20
+ * 显示在左边的文字
21
+ */
22
+ text: string;
23
+ /**
24
+ * (可选)左边的文字下面的描述
25
+ */
26
+ description?: string;
27
+ /**
28
+ * 类型
29
+ */
30
+ type: "textarea";
31
+ /**
32
+ * (可选)是否禁用
33
+ */
34
+ disabled?: boolean;
35
+ /**
36
+ * 获取该项的值的回调函数
37
+ */
38
+ getValue(): string;
39
+ /**
40
+ * textarea输入框的值改变触发的回调函数
41
+ * @param event 事件
42
+ * @param value 当前的textarea内的值
43
+ */
44
+ callback(
45
+ event: InputEvent & {
46
+ target: HTMLTextAreaElement;
47
+ },
48
+ value: string
49
+ ): void;
50
+ /**
51
+ * 输入框内的提示
52
+ */
53
+ placeholder: string;
54
+ }
@@ -0,0 +1,60 @@
1
+ .pops[type-value] .pops-prompt-title {
2
+ display: flex;
3
+ align-items: center;
4
+ justify-content: space-between;
5
+ }
6
+ .pops[type-value="prompt"] .pops-prompt-title {
7
+ width: 100%;
8
+ height: var(--container-title-height);
9
+ border-bottom: 1px solid rgb(229, 229, 229, var(--pops-bd-opacity));
10
+ }
11
+ .pops[type-value="prompt"] .pops-prompt-title p[pops] {
12
+ width: 100%;
13
+ overflow: hidden;
14
+ color: rgb(51, 51, 51);
15
+ text-indent: 15px;
16
+ text-overflow: ellipsis;
17
+ white-space: nowrap;
18
+ font-weight: 500;
19
+ line-height: var(--container-title-height);
20
+ }
21
+ .pops[type-value="prompt"] .pops-prompt-content p[pops] {
22
+ padding: 5px 10px;
23
+ color: rgb(51, 51, 51);
24
+ text-indent: 15px;
25
+ }
26
+ .pops[type-value="prompt"] .pops-prompt-content {
27
+ width: 100%;
28
+ height: calc(
29
+ 100% - var(--container-title-height) - var(--container-bottom-btn-height)
30
+ );
31
+ overflow: auto;
32
+ word-break: break-word;
33
+ }
34
+ .pops[type-value="prompt"] .pops-prompt-btn {
35
+ position: absolute;
36
+ bottom: 0;
37
+ display: flex;
38
+ padding: 10px 10px 10px 10px;
39
+ width: 100%;
40
+ height: var(--container-bottom-btn-height);
41
+ border-top: 1px solid rgb(229, 229, 229, var(--pops-bd-opacity));
42
+ text-align: right;
43
+ line-height: var(--container-bottom-btn-height);
44
+ align-items: center;
45
+ }
46
+ .pops[type-value="prompt"] input[pops] {
47
+ padding: 5px 10px;
48
+ }
49
+ .pops[type-value="prompt"] textarea[pops] {
50
+ padding: 5px 10px;
51
+ resize: none;
52
+ }
53
+ .pops[type-value="prompt"] input[pops],
54
+ .pops[type-value="prompt"] textarea[pops] {
55
+ width: 100%;
56
+ height: 100%;
57
+ outline: 0;
58
+ border: 0;
59
+ color: rgb(51, 51, 51);
60
+ }