@whitesev/pops 3.0.1 → 3.1.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.
- package/dist/index.amd.js +974 -546
- package/dist/index.amd.js.map +1 -1
- package/dist/index.amd.min.js +1 -1
- package/dist/index.amd.min.js.map +1 -1
- package/dist/index.cjs.js +974 -546
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.cjs.min.js +1 -1
- package/dist/index.cjs.min.js.map +1 -1
- package/dist/index.esm.js +974 -546
- package/dist/index.esm.js.map +1 -1
- package/dist/index.esm.min.js +1 -1
- package/dist/index.esm.min.js.map +1 -1
- package/dist/index.iife.js +974 -546
- package/dist/index.iife.js.map +1 -1
- package/dist/index.iife.min.js +1 -1
- package/dist/index.iife.min.js.map +1 -1
- package/dist/index.system.js +974 -546
- package/dist/index.system.js.map +1 -1
- package/dist/index.system.min.js +1 -1
- package/dist/index.system.min.js.map +1 -1
- package/dist/index.umd.js +974 -546
- package/dist/index.umd.js.map +1 -1
- package/dist/index.umd.min.js +1 -1
- package/dist/index.umd.min.js.map +1 -1
- package/dist/types/src/Pops.d.ts +89 -49
- package/dist/types/src/components/panel/handlerComponents.d.ts +205 -60
- package/dist/types/src/components/panel/index.d.ts +1 -1
- package/dist/types/src/components/panel/types/components-select.d.ts +42 -5
- package/dist/types/src/components/tooltip/index.d.ts +2 -2
- package/dist/types/src/components/tooltip/types/index.d.ts +3 -3
- package/dist/types/src/types/PopsDOMUtilsEventType.d.ts +22 -0
- package/dist/types/src/utils/PopsDOMUtils.d.ts +29 -29
- package/dist/types/src/utils/PopsInstanceUtils.d.ts +1 -1
- package/package.json +4 -4
- package/src/components/folder/index.ts +3 -3
- package/src/components/panel/defaultConfig.ts +278 -228
- package/src/components/panel/handlerComponents.ts +558 -206
- package/src/components/panel/index.css +67 -12
- package/src/components/panel/types/components-select.ts +42 -5
- package/src/components/rightClickMenu/index.css +1 -1
- package/src/components/rightClickMenu/index.ts +3 -3
- package/src/components/tooltip/defaultConfig.ts +2 -2
- package/src/components/tooltip/index.ts +4 -4
- package/src/components/tooltip/types/index.ts +3 -3
- package/src/css/common.css +4 -4
- package/src/types/PopsDOMUtilsEventType.d.ts +22 -0
- package/src/utils/PopsDOMUtils.ts +90 -59
- package/src/utils/PopsInstanceUtils.ts +5 -5
|
@@ -278,13 +278,17 @@ section.pops-panel-container .pops-panel-forms-fold .pops-panel-forms-container-
|
|
|
278
278
|
.pops[type-value="panel"] section.pops-panel-container > ul > li div:nth-child(2) {
|
|
279
279
|
max-width: 55%;
|
|
280
280
|
}
|
|
281
|
+
.pops[type-value="panel"] .pops-panel-select .el-select__selected-item.el-select__placeholder {
|
|
282
|
+
max-width: -moz-available;
|
|
283
|
+
max-width: -webkit-fill-available;
|
|
284
|
+
}
|
|
281
285
|
.pops[type-value="panel"] section.pops-panel-container > ul > li .pops-panel-input span.pops-panel-input__suffix {
|
|
282
286
|
padding: 0 4px;
|
|
283
287
|
}
|
|
284
288
|
.pops[type-value="panel"] section.pops-panel-container .pops-panel-select select {
|
|
285
289
|
min-width: 88px !important;
|
|
286
|
-
width: -webkit-fill-available;
|
|
287
290
|
width: -moz-available;
|
|
291
|
+
width: -webkit-fill-available;
|
|
288
292
|
}
|
|
289
293
|
.pops[type-value="panel"] section.pops-panel-container .pops-panel-container-header-ul li {
|
|
290
294
|
font-size: 16px;
|
|
@@ -750,8 +754,8 @@ section.pops-panel-container .pops-panel-slider input[type="range"]::-moz-range-
|
|
|
750
754
|
flex-shrink: 0;
|
|
751
755
|
flex-wrap: nowrap;
|
|
752
756
|
height: 100%;
|
|
753
|
-
height: -webkit-fill-available;
|
|
754
757
|
height: -moz-available;
|
|
758
|
+
height: -webkit-fill-available;
|
|
755
759
|
text-align: center;
|
|
756
760
|
color: var(--pops-panel-components-input-suffix-color);
|
|
757
761
|
background: var(--pops-panel-components-input-suffix-bg-color);
|
|
@@ -893,6 +897,7 @@ section.pops-panel-container .pops-panel-slider input[type="range"]::-moz-range-
|
|
|
893
897
|
|
|
894
898
|
/* select的CSS */
|
|
895
899
|
.pops-panel-select {
|
|
900
|
+
--pops-panel-components-select-disabled-text-color: #a8abb2;
|
|
896
901
|
--pops-panel-components-select-text-color: #000000;
|
|
897
902
|
--pops-panel-components-select-bd-color: rgb(184, 184, 184, var(--pops-bd-opacity));
|
|
898
903
|
--pops-panel-components-select-hover-bd-color: rgb(184, 184, 184, var(--pops-bd-opacity));
|
|
@@ -934,10 +939,60 @@ section.pops-panel-container .pops-panel-slider input[type="range"]::-moz-range-
|
|
|
934
939
|
}
|
|
935
940
|
/* select的CSS */
|
|
936
941
|
|
|
937
|
-
/* select
|
|
938
|
-
.pops-panel-select {
|
|
942
|
+
/* select dialog 的CSS */
|
|
943
|
+
.pops-panel-select[data-mode="dialog"] {
|
|
939
944
|
}
|
|
940
|
-
/* select
|
|
945
|
+
/* select dialog 的CSS */
|
|
946
|
+
|
|
947
|
+
/* select horizontal 的CSS */
|
|
948
|
+
.pops-panel-select[data-mode="horizontal"] {
|
|
949
|
+
--pops-panel-components-select-horizontal-selected-text-color: #626aef;
|
|
950
|
+
--pops-panel-components-select-horizontal-selected-bg-color: #eff0fd;
|
|
951
|
+
}
|
|
952
|
+
.pops-panel-select[data-mode="horizontal"] .el-select__wrapper {
|
|
953
|
+
padding: 0;
|
|
954
|
+
gap: 0;
|
|
955
|
+
border: 0;
|
|
956
|
+
}
|
|
957
|
+
.pops-panel-select[data-mode="horizontal"] .select-item {
|
|
958
|
+
flex: 1;
|
|
959
|
+
display: flex;
|
|
960
|
+
justify-content: center;
|
|
961
|
+
align-items: center;
|
|
962
|
+
border: 1px solid var(--el-border-color);
|
|
963
|
+
height: -moz-available;
|
|
964
|
+
height: -webkit-fill-available;
|
|
965
|
+
border-left: 0;
|
|
966
|
+
}
|
|
967
|
+
.pops-panel-select[data-mode="horizontal"] .select-item:hover {
|
|
968
|
+
color: var(--el-color-primary);
|
|
969
|
+
}
|
|
970
|
+
.pops-panel-select[data-mode="horizontal"] .select-item:first-child {
|
|
971
|
+
border-left: 1px solid var(--el-border-color);
|
|
972
|
+
border-top-left-radius: var(--el-border-radius-base);
|
|
973
|
+
border-bottom-left-radius: var(--el-border-radius-base);
|
|
974
|
+
}
|
|
975
|
+
.pops-panel-select[data-mode="horizontal"] .select-item:last-child {
|
|
976
|
+
border-top-right-radius: var(--el-border-radius-base);
|
|
977
|
+
border-bottom-right-radius: var(--el-border-radius-base);
|
|
978
|
+
}
|
|
979
|
+
.pops-panel-select[data-mode="horizontal"] .select-item.select__selected-item {
|
|
980
|
+
color: var(--pops-panel-components-select-horizontal-selected-text-color);
|
|
981
|
+
background-color: var(--pops-panel-components-select-horizontal-selected-bg-color);
|
|
982
|
+
border-color: var(--pops-panel-components-select-horizontal-selected-bg-color);
|
|
983
|
+
}
|
|
984
|
+
.pops-panel-select[data-mode="horizontal"] .select-item:has(+ .select__selected-item) {
|
|
985
|
+
border-right: 0;
|
|
986
|
+
}
|
|
987
|
+
.pops-panel-select[data-mode="horizontal"] .select-item[disabled] {
|
|
988
|
+
color: var(--pops-panel-components-select-disabled-text-color);
|
|
989
|
+
--pops-panel-components-select-horizontal-selected-text-color: var(
|
|
990
|
+
--pops-panel-components-select-disabled-text-color
|
|
991
|
+
);
|
|
992
|
+
cursor: not-allowed;
|
|
993
|
+
background: unset;
|
|
994
|
+
}
|
|
995
|
+
/* select horizontal 的CSS */
|
|
941
996
|
|
|
942
997
|
/* select-multiple的CSS*/
|
|
943
998
|
.pops-panel-select-multiple,
|
|
@@ -1165,19 +1220,19 @@ section.pops-panel-container .pops-panel-slider input[type="range"]::-moz-range-
|
|
|
1165
1220
|
white-space: nowrap;
|
|
1166
1221
|
}
|
|
1167
1222
|
/* 禁用样式 */
|
|
1168
|
-
.pops-panel-select-
|
|
1223
|
+
.pops-panel-select-disable {
|
|
1169
1224
|
--el-fill-color-blank: #f5f7fa;
|
|
1170
1225
|
--color: #a8abb2;
|
|
1171
1226
|
--el-border-color: #cbcbcb;
|
|
1172
1227
|
}
|
|
1173
|
-
.pops-panel-select-
|
|
1228
|
+
.pops-panel-select-disable .el-tag.el-tag--info {
|
|
1174
1229
|
--el-tag-bg-color: #e7e7e7;
|
|
1175
1230
|
--el-tag-text-color: var(--pops-components-is-disabled-text-color);
|
|
1176
1231
|
}
|
|
1177
|
-
.pops-panel-select-
|
|
1178
|
-
.pops-panel-select-
|
|
1179
|
-
.pops-panel-select-
|
|
1180
|
-
.pops-panel-select-
|
|
1232
|
+
.pops-panel-select-disable .el-select__selection .el-tag,
|
|
1233
|
+
.pops-panel-select-disable .el-tag .el-tag__close:hover,
|
|
1234
|
+
.pops-panel-select-disable .el-select__wrapper,
|
|
1235
|
+
.pops-panel-select-disable .el-select__caret {
|
|
1181
1236
|
cursor: not-allowed;
|
|
1182
1237
|
}
|
|
1183
1238
|
/* select-multiple的CSS*/
|
|
@@ -1226,8 +1281,8 @@ section.pops-panel-container .pops-panel-forms-container-item ul li.pops-panel-d
|
|
|
1226
1281
|
section.pops-panel-deepMenu-container .pops-panel-container-header-ul li.pops-panel-deepMenu-container-header {
|
|
1227
1282
|
display: flex;
|
|
1228
1283
|
align-items: center;
|
|
1229
|
-
width: -webkit-fill-available;
|
|
1230
1284
|
width: -moz-available;
|
|
1285
|
+
width: -webkit-fill-available;
|
|
1231
1286
|
padding: var(--pops-panel-forms-header-padding-top-bottom)
|
|
1232
1287
|
calc(
|
|
1233
1288
|
var(--pops-panel-forms-margin-left-right) + var(--pops-panel-forms-container-li-padding-left-right) -
|
|
@@ -2,8 +2,38 @@ import type { PopsPanelGeneralConfig } from "./components-common";
|
|
|
2
2
|
import type { PopsPanelContainerConfig } from "./components-container";
|
|
3
3
|
import type { PopsPanelViewConfig } from ".";
|
|
4
4
|
import type { PopsAlertConfig } from "../../alert/types";
|
|
5
|
+
export type PopsPanelSelectMode = "native" | "dialog" | "horizontal";
|
|
5
6
|
|
|
6
|
-
|
|
7
|
+
/**
|
|
8
|
+
* 分组配置
|
|
9
|
+
*
|
|
10
|
+
* 用在mode="dialog"里
|
|
11
|
+
*/
|
|
12
|
+
export type PopsPanelSelectDialogGroupOption<T> = {
|
|
13
|
+
/**
|
|
14
|
+
* 是否是分组
|
|
15
|
+
* @default false
|
|
16
|
+
*
|
|
17
|
+
* + true 这时候text的值是显示的分组名,value是可以忽略的
|
|
18
|
+
*/
|
|
19
|
+
isGroup?: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* 分组内部选择是否是单选
|
|
22
|
+
* @default false
|
|
23
|
+
*/
|
|
24
|
+
isSingleSelect?: boolean;
|
|
25
|
+
/**
|
|
26
|
+
* 分组数据列表
|
|
27
|
+
*
|
|
28
|
+
* 该数据仅在mode === "dialog"下生效
|
|
29
|
+
* @default []
|
|
30
|
+
*/
|
|
31
|
+
groupDataOptions?: IFunction<Omit<PopsPanelSelectDataOption<T>, keyof PopsPanelSelectDialogGroupOption<T>>[]>;
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* 选择项的配置数据
|
|
35
|
+
*/
|
|
36
|
+
export type PopsPanelSelectDataOption<T> = {
|
|
7
37
|
/**
|
|
8
38
|
* 真正的值
|
|
9
39
|
*/
|
|
@@ -63,7 +93,7 @@ export interface PopsPanelSelectDataOption<T> {
|
|
|
63
93
|
valid: boolean;
|
|
64
94
|
message?: string;
|
|
65
95
|
};
|
|
66
|
-
}
|
|
96
|
+
};
|
|
67
97
|
/**
|
|
68
98
|
* pops.panel的 select
|
|
69
99
|
*/
|
|
@@ -110,6 +140,8 @@ export interface PopsPanelSelectConfig<T = any> extends PopsPanelGeneralConfig<P
|
|
|
110
140
|
* 点击select元素触发该回调
|
|
111
141
|
* @param event 点击事件
|
|
112
142
|
* @param selectElement 当前的select元素
|
|
143
|
+
* @returns
|
|
144
|
+
* + false 阻止更新状态
|
|
113
145
|
*/
|
|
114
146
|
clickCallBack?(
|
|
115
147
|
event: PointerEvent | MouseEvent,
|
|
@@ -121,10 +153,15 @@ export interface PopsPanelSelectConfig<T = any> extends PopsPanelGeneralConfig<P
|
|
|
121
153
|
*/
|
|
122
154
|
data: IFunction<PopsPanelSelectDataOption<T>[]>;
|
|
123
155
|
/**
|
|
124
|
-
*
|
|
125
|
-
* @default
|
|
156
|
+
* 显示模式
|
|
157
|
+
* @default "native"
|
|
158
|
+
*/
|
|
159
|
+
mode?: PopsPanelSelectMode;
|
|
160
|
+
/**
|
|
161
|
+
* 宽度
|
|
162
|
+
* @default "200px"
|
|
126
163
|
*/
|
|
127
|
-
|
|
164
|
+
width?: number | string;
|
|
128
165
|
/**
|
|
129
166
|
* 弹出的下拉列表弹窗的配置
|
|
130
167
|
*/
|
|
@@ -93,8 +93,8 @@ i.pops-rightClickMenu-icon[is-loading="true"] {
|
|
|
93
93
|
margin: 5px 5px;
|
|
94
94
|
border-radius: var(--pops-right-context-menu-row-bd-radius);
|
|
95
95
|
display: flex;
|
|
96
|
-
width: -webkit-fill-available;
|
|
97
96
|
width: -moz-available;
|
|
97
|
+
width: -webkit-fill-available;
|
|
98
98
|
text-align: left;
|
|
99
99
|
align-items: center;
|
|
100
100
|
-webkit-user-select: none;
|
|
@@ -513,15 +513,15 @@ export const PopsRightClickMenu = {
|
|
|
513
513
|
}
|
|
514
514
|
// 鼠标|触摸 移入事件
|
|
515
515
|
// 在移动端会先触发touchstart再然后mouseenter
|
|
516
|
-
let
|
|
516
|
+
let isEmitTouchEvent = false;
|
|
517
517
|
/**
|
|
518
518
|
* 鼠标|触摸 移入事件
|
|
519
519
|
*/
|
|
520
520
|
function liElementHoverEvent(event: MouseEvent | TouchEvent) {
|
|
521
521
|
if (event.type === "touchstart") {
|
|
522
|
-
|
|
522
|
+
isEmitTouchEvent = true;
|
|
523
523
|
}
|
|
524
|
-
if (
|
|
524
|
+
if (isEmitTouchEvent && event.type === "mouseenter") {
|
|
525
525
|
return;
|
|
526
526
|
}
|
|
527
527
|
Array.from(menuULElement.children as any as HTMLLIElement[]).forEach((liElement) => {
|
|
@@ -10,8 +10,8 @@ export const PopsTooltipDefaultConfig = (): DeepRequired<PopsToolTipConfig> => {
|
|
|
10
10
|
className: "",
|
|
11
11
|
isFixed: false,
|
|
12
12
|
alwaysShow: false,
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
onShowEventName: "mouseenter touchstart",
|
|
14
|
+
onCloseEventName: "mouseleave touchend",
|
|
15
15
|
zIndex: 10000,
|
|
16
16
|
only: false,
|
|
17
17
|
eventOption: {
|
|
@@ -349,7 +349,7 @@ export class ToolTip {
|
|
|
349
349
|
onShowEvent() {
|
|
350
350
|
popsDOMUtils.on(
|
|
351
351
|
this.$data.config.$target,
|
|
352
|
-
this.$data.config.
|
|
352
|
+
this.$data.config.onShowEventName,
|
|
353
353
|
this.show,
|
|
354
354
|
this.$data.config.eventOption
|
|
355
355
|
);
|
|
@@ -358,7 +358,7 @@ export class ToolTip {
|
|
|
358
358
|
* 取消绑定 显示事件
|
|
359
359
|
*/
|
|
360
360
|
offShowEvent() {
|
|
361
|
-
popsDOMUtils.off(this.$data.config.$target, this.$data.config.
|
|
361
|
+
popsDOMUtils.off(this.$data.config.$target, this.$data.config.onShowEventName, this.show, {
|
|
362
362
|
capture: true,
|
|
363
363
|
});
|
|
364
364
|
}
|
|
@@ -419,7 +419,7 @@ export class ToolTip {
|
|
|
419
419
|
onCloseEvent() {
|
|
420
420
|
popsDOMUtils.on(
|
|
421
421
|
this.$data.config.$target,
|
|
422
|
-
this.$data.config.
|
|
422
|
+
this.$data.config.onCloseEventName,
|
|
423
423
|
this.close,
|
|
424
424
|
this.$data.config.eventOption
|
|
425
425
|
);
|
|
@@ -428,7 +428,7 @@ export class ToolTip {
|
|
|
428
428
|
* 取消绑定 关闭事件
|
|
429
429
|
*/
|
|
430
430
|
offCloseEvent() {
|
|
431
|
-
popsDOMUtils.off(this.$data.config.$target, this.$data.config.
|
|
431
|
+
popsDOMUtils.off(this.$data.config.$target, this.$data.config.onCloseEventName, this.close, {
|
|
432
432
|
capture: true,
|
|
433
433
|
});
|
|
434
434
|
}
|
|
@@ -45,7 +45,7 @@ export interface PopsToolTipConfig
|
|
|
45
45
|
isFixed?: boolean;
|
|
46
46
|
/**
|
|
47
47
|
* 是否总是显示,默认为false
|
|
48
|
-
* + true 设置的
|
|
48
|
+
* + true 设置的onShowEventName、onCloseEventName将无效
|
|
49
49
|
* 返回提供show和close函数,取消on和off
|
|
50
50
|
* + false 事件触发才显示
|
|
51
51
|
*/
|
|
@@ -59,12 +59,12 @@ export interface PopsToolTipConfig
|
|
|
59
59
|
* 触发显示事件的名称,默认mouseenter touchstart,如果是多个事件,按空格分割
|
|
60
60
|
* @default "mouseenter touchstart"
|
|
61
61
|
*/
|
|
62
|
-
|
|
62
|
+
onShowEventName?: string;
|
|
63
63
|
/**
|
|
64
64
|
* 触发关闭事件的名称,默认mouseleave touchend,如果是多个事件,按空格分割
|
|
65
65
|
* @default "mouseleave touchend"
|
|
66
66
|
*/
|
|
67
|
-
|
|
67
|
+
onCloseEventName?: string;
|
|
68
68
|
/**
|
|
69
69
|
* 监听的事件配置
|
|
70
70
|
*/
|
package/src/css/common.css
CHANGED
|
@@ -34,21 +34,21 @@
|
|
|
34
34
|
}
|
|
35
35
|
.pops-width-fill {
|
|
36
36
|
width: 100%;
|
|
37
|
-
width: -webkit-fill-available;
|
|
38
37
|
width: -moz-available;
|
|
38
|
+
width: -webkit-fill-available;
|
|
39
39
|
}
|
|
40
40
|
.pops-height-fill {
|
|
41
41
|
height: 100%;
|
|
42
|
-
height: -webkit-fill-available;
|
|
43
42
|
height: -moz-available;
|
|
43
|
+
height: -webkit-fill-available;
|
|
44
44
|
}
|
|
45
45
|
.pops-text-is-disabled {
|
|
46
46
|
--pops-text-is-disabled-color: #a8abb2;
|
|
47
|
-
color: var(--pops-text-is-disabled-color);
|
|
48
47
|
--pops-panel-forms-container-item-left-desc-text-color: var(--pops-text-is-disabled-color);
|
|
48
|
+
color: var(--pops-text-is-disabled-color);
|
|
49
49
|
}
|
|
50
50
|
.pops-text-is-disabled-important {
|
|
51
51
|
--pops-text-is-disabled-color: #a8abb2;
|
|
52
|
-
color: var(--pops-text-is-disabled-color) !important;
|
|
53
52
|
--pops-panel-forms-container-item-left-desc-text-color: var(--pops-text-is-disabled-color) !important;
|
|
53
|
+
color: var(--pops-text-is-disabled-color) !important;
|
|
54
54
|
}
|
|
@@ -237,6 +237,28 @@ export type PopsDOMUtilsElementEventType =
|
|
|
237
237
|
| ChildNode
|
|
238
238
|
| Node;
|
|
239
239
|
|
|
240
|
+
/**
|
|
241
|
+
* 通过.on执行后的返回值
|
|
242
|
+
*/
|
|
243
|
+
export declare interface PopsDOMUtilsAddEventListenerResult {
|
|
244
|
+
/**
|
|
245
|
+
* 取消绑定的监听事件
|
|
246
|
+
* @param filter (可选)过滤函数,对元素属性上的事件进行过滤出想要删除的事件
|
|
247
|
+
*/
|
|
248
|
+
off(
|
|
249
|
+
filter?: (
|
|
250
|
+
value: PopsDOMUtilsEventListenerOptionsAttribute,
|
|
251
|
+
index: number,
|
|
252
|
+
array: PopsDOMUtilsEventListenerOptionsAttribute[]
|
|
253
|
+
) => boolean
|
|
254
|
+
): void;
|
|
255
|
+
/**
|
|
256
|
+
* 主动触发事件
|
|
257
|
+
* @param details 赋予触发的Event的额外属性,如果是Event类型,那么将自动代替默认new的Event对象
|
|
258
|
+
* @param useDispatchToEmit 是否使用dispatchEvent来触发事件,默认true,如果为false,则直接调用callback,但是这种会让使用了selectorTarget的没有值
|
|
259
|
+
*/
|
|
260
|
+
emit(details?: object, useDispatchToEmit?: boolean): void;
|
|
261
|
+
}
|
|
240
262
|
export type ParseHTMLReturnType<T1, T2> = T1 extends true ? (T2 extends true ? Document : HTMLElement) : HTMLElement;
|
|
241
263
|
|
|
242
264
|
/**
|