@whitesev/pops 3.1.3 → 3.2.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 +230 -133
- 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 +230 -133
- 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 +230 -133
- 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 +230 -133
- 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 +230 -133
- 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 +230 -133
- 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 +10 -10
- package/dist/types/src/components/panel/index.d.ts +2 -2
- package/dist/types/src/components/rightClickMenu/index.d.ts +1 -1
- package/dist/types/src/components/rightClickMenu/types/index.d.ts +8 -1
- package/dist/types/src/components/tooltip/index.d.ts +5 -5
- package/dist/types/src/components/tooltip/types/index.d.ts +15 -14
- package/dist/types/src/handler/PopsHandler.d.ts +4 -4
- package/dist/types/src/types/PopsDOMUtilsEventType.d.ts +39 -0
- package/dist/types/src/types/components.d.ts +2 -1
- package/dist/types/src/types/event.d.ts +13 -3
- package/dist/types/src/types/inst.d.ts +4 -0
- package/dist/types/src/utils/PopsDOMUtils.d.ts +10 -12
- package/dist/types/src/utils/PopsInstanceUtils.d.ts +2 -2
- package/package.json +2 -2
- package/src/components/alert/index.ts +3 -1
- package/src/components/confirm/index.ts +3 -1
- package/src/components/drawer/index.ts +3 -1
- package/src/components/folder/index.ts +3 -1
- package/src/components/iframe/index.ts +6 -4
- package/src/components/panel/handlerComponents.ts +26 -26
- package/src/components/panel/index.ts +3 -1
- package/src/components/prompt/index.ts +3 -1
- package/src/components/rightClickMenu/defaultConfig.ts +1 -0
- package/src/components/rightClickMenu/index.ts +18 -7
- package/src/components/rightClickMenu/types/index.ts +8 -1
- package/src/components/searchSuggestion/index.ts +7 -19
- package/src/components/tooltip/defaultConfig.ts +1 -1
- package/src/components/tooltip/index.ts +26 -17
- package/src/components/tooltip/types/index.ts +15 -14
- package/src/handler/PopsHandler.ts +22 -19
- package/src/types/PopsDOMUtilsEventType.d.ts +39 -0
- package/src/types/components.d.ts +2 -1
- package/src/types/event.d.ts +13 -3
- package/src/types/inst.d.ts +4 -0
- package/src/utils/PopsDOMUtils.ts +71 -40
- package/src/utils/PopsInstanceUtils.ts +62 -30
- package/src/utils/PopsUtils.ts +1 -1
package/dist/index.umd.js
CHANGED
|
@@ -520,7 +520,7 @@
|
|
|
520
520
|
* @param propName
|
|
521
521
|
*/
|
|
522
522
|
delete(target, propName) {
|
|
523
|
-
if (typeof Reflect === "object" && Reflect.deleteProperty) {
|
|
523
|
+
if (typeof Reflect === "object" && typeof Reflect.deleteProperty === "function") {
|
|
524
524
|
Reflect.deleteProperty(target, propName);
|
|
525
525
|
}
|
|
526
526
|
else {
|
|
@@ -1026,13 +1026,13 @@
|
|
|
1026
1026
|
if (element == null) {
|
|
1027
1027
|
return;
|
|
1028
1028
|
}
|
|
1029
|
-
let
|
|
1029
|
+
let $elList = [];
|
|
1030
1030
|
if (element instanceof NodeList || Array.isArray(element)) {
|
|
1031
1031
|
element = element;
|
|
1032
|
-
|
|
1032
|
+
$elList = $elList.concat(element);
|
|
1033
1033
|
}
|
|
1034
1034
|
else {
|
|
1035
|
-
|
|
1035
|
+
$elList.push(element);
|
|
1036
1036
|
}
|
|
1037
1037
|
let eventTypeList = [];
|
|
1038
1038
|
if (Array.isArray(eventType)) {
|
|
@@ -1083,7 +1083,7 @@
|
|
|
1083
1083
|
// 目标函数、事件名、回调函数、事件配置、过滤函数
|
|
1084
1084
|
filter = option;
|
|
1085
1085
|
}
|
|
1086
|
-
|
|
1086
|
+
$elList.forEach((elementItem) => {
|
|
1087
1087
|
// 获取对象上的事件
|
|
1088
1088
|
const elementEvents = Reflect.get(elementItem, SymbolEvents) || {};
|
|
1089
1089
|
eventTypeList.forEach((eventName) => {
|
|
@@ -1130,18 +1130,19 @@
|
|
|
1130
1130
|
* @param eventType (可选)需要取消监听的事件
|
|
1131
1131
|
*/
|
|
1132
1132
|
offAll(element, eventType) {
|
|
1133
|
+
const that = this;
|
|
1133
1134
|
if (typeof element === "string") {
|
|
1134
|
-
element =
|
|
1135
|
+
element = that.selectorAll(element);
|
|
1135
1136
|
}
|
|
1136
1137
|
if (element == null) {
|
|
1137
1138
|
return;
|
|
1138
1139
|
}
|
|
1139
|
-
let
|
|
1140
|
+
let $elList = [];
|
|
1140
1141
|
if (element instanceof NodeList || Array.isArray(element)) {
|
|
1141
|
-
|
|
1142
|
+
$elList = $elList.concat(Array.from(element));
|
|
1142
1143
|
}
|
|
1143
1144
|
else {
|
|
1144
|
-
|
|
1145
|
+
$elList.push(element);
|
|
1145
1146
|
}
|
|
1146
1147
|
let eventTypeList = [];
|
|
1147
1148
|
if (Array.isArray(eventType)) {
|
|
@@ -1150,12 +1151,13 @@
|
|
|
1150
1151
|
else if (typeof eventType === "string") {
|
|
1151
1152
|
eventTypeList = eventTypeList.concat(eventType.split(" "));
|
|
1152
1153
|
}
|
|
1153
|
-
|
|
1154
|
-
Object.getOwnPropertySymbols(
|
|
1155
|
-
|
|
1154
|
+
$elList.forEach(($elItem) => {
|
|
1155
|
+
const symbolList = [...new Set([...Object.getOwnPropertySymbols($elItem), SymbolEvents])];
|
|
1156
|
+
symbolList.forEach((symbolItem) => {
|
|
1157
|
+
if (!symbolItem.toString().startsWith("Symbol(events_")) {
|
|
1156
1158
|
return;
|
|
1157
1159
|
}
|
|
1158
|
-
const elementEvents =
|
|
1160
|
+
const elementEvents = Reflect.get($elItem, symbolItem) || {};
|
|
1159
1161
|
const iterEventNameList = eventTypeList.length ? eventTypeList : Object.keys(elementEvents);
|
|
1160
1162
|
iterEventNameList.forEach((eventName) => {
|
|
1161
1163
|
const handlers = elementEvents[eventName];
|
|
@@ -1163,11 +1165,12 @@
|
|
|
1163
1165
|
return;
|
|
1164
1166
|
}
|
|
1165
1167
|
for (const handler of handlers) {
|
|
1166
|
-
|
|
1168
|
+
$elItem.removeEventListener(eventName, handler.callback, {
|
|
1167
1169
|
capture: handler["option"]["capture"],
|
|
1168
1170
|
});
|
|
1169
1171
|
}
|
|
1170
|
-
|
|
1172
|
+
const events = Reflect.get($elItem, symbolItem);
|
|
1173
|
+
popsUtils.delete(events, eventName);
|
|
1171
1174
|
});
|
|
1172
1175
|
});
|
|
1173
1176
|
});
|
|
@@ -1910,7 +1913,8 @@
|
|
|
1910
1913
|
}
|
|
1911
1914
|
return $el.classList.contains(className);
|
|
1912
1915
|
}
|
|
1913
|
-
css(
|
|
1916
|
+
css($el, property, value) {
|
|
1917
|
+
const that = this;
|
|
1914
1918
|
/**
|
|
1915
1919
|
* 把纯数字没有px的加上
|
|
1916
1920
|
*/
|
|
@@ -1924,10 +1928,33 @@
|
|
|
1924
1928
|
}
|
|
1925
1929
|
return propertyValue;
|
|
1926
1930
|
}
|
|
1927
|
-
if (typeof
|
|
1928
|
-
|
|
1931
|
+
if (typeof $el === "string") {
|
|
1932
|
+
$el = that.selectorAll($el);
|
|
1929
1933
|
}
|
|
1930
|
-
if (
|
|
1934
|
+
if ($el == null) {
|
|
1935
|
+
return;
|
|
1936
|
+
}
|
|
1937
|
+
if (Array.isArray($el) || $el instanceof NodeList) {
|
|
1938
|
+
if (typeof property === "string") {
|
|
1939
|
+
if (value == null) {
|
|
1940
|
+
// 获取属性
|
|
1941
|
+
return that.css($el[0], property);
|
|
1942
|
+
}
|
|
1943
|
+
else {
|
|
1944
|
+
// 设置属性
|
|
1945
|
+
$el.forEach(($elItem) => {
|
|
1946
|
+
that.css($elItem, property);
|
|
1947
|
+
});
|
|
1948
|
+
return;
|
|
1949
|
+
}
|
|
1950
|
+
}
|
|
1951
|
+
else if (typeof property === "object") {
|
|
1952
|
+
// 设置属性
|
|
1953
|
+
$el.forEach(($elItem) => {
|
|
1954
|
+
that.css($elItem, property);
|
|
1955
|
+
});
|
|
1956
|
+
return;
|
|
1957
|
+
}
|
|
1931
1958
|
return;
|
|
1932
1959
|
}
|
|
1933
1960
|
const setStyleProperty = (propertyName, propertyValue) => {
|
|
@@ -1936,16 +1963,16 @@
|
|
|
1936
1963
|
.trim()
|
|
1937
1964
|
.replace(/!important$/gi, "")
|
|
1938
1965
|
.trim();
|
|
1939
|
-
|
|
1966
|
+
$el.style.setProperty(propertyName, propertyValue, "important");
|
|
1940
1967
|
}
|
|
1941
1968
|
else {
|
|
1942
1969
|
propertyValue = handlePixe(propertyName, propertyValue);
|
|
1943
|
-
|
|
1970
|
+
$el.style.setProperty(propertyName, propertyValue);
|
|
1944
1971
|
}
|
|
1945
1972
|
};
|
|
1946
1973
|
if (typeof property === "string") {
|
|
1947
1974
|
if (value == null) {
|
|
1948
|
-
return getComputedStyle(
|
|
1975
|
+
return PopsCore.globalThis.getComputedStyle($el).getPropertyValue(property);
|
|
1949
1976
|
}
|
|
1950
1977
|
else {
|
|
1951
1978
|
setStyleProperty(property, value);
|
|
@@ -1957,6 +1984,10 @@
|
|
|
1957
1984
|
setStyleProperty(prop, value);
|
|
1958
1985
|
}
|
|
1959
1986
|
}
|
|
1987
|
+
else {
|
|
1988
|
+
// 其他情况
|
|
1989
|
+
throw new TypeError("property must be string or object");
|
|
1990
|
+
}
|
|
1960
1991
|
}
|
|
1961
1992
|
/**
|
|
1962
1993
|
* 创建元素
|
|
@@ -3091,16 +3122,16 @@
|
|
|
3091
3122
|
},
|
|
3092
3123
|
/**
|
|
3093
3124
|
* 删除配置中对应的对象
|
|
3094
|
-
* @param
|
|
3125
|
+
* @param totalInstConfigList 配置实例列表
|
|
3095
3126
|
* @param guid 唯一标识
|
|
3096
3127
|
* @param isAll 是否全部删除
|
|
3097
3128
|
*/
|
|
3098
|
-
removeInstance(
|
|
3129
|
+
async removeInstance(totalInstConfigList, guid, isAll = false) {
|
|
3099
3130
|
/**
|
|
3100
3131
|
* 移除元素实例
|
|
3101
3132
|
* @param instCommonConfig
|
|
3102
3133
|
*/
|
|
3103
|
-
function
|
|
3134
|
+
const removeInst = function (instCommonConfig) {
|
|
3104
3135
|
if (typeof instCommonConfig.beforeRemoveCallBack === "function") {
|
|
3105
3136
|
// 调用移除签的回调
|
|
3106
3137
|
instCommonConfig.beforeRemoveCallBack(instCommonConfig);
|
|
@@ -3109,39 +3140,44 @@
|
|
|
3109
3140
|
instCommonConfig?.$pops?.remove();
|
|
3110
3141
|
instCommonConfig?.$mask?.remove();
|
|
3111
3142
|
instCommonConfig?.$shadowContainer?.remove();
|
|
3112
|
-
}
|
|
3143
|
+
};
|
|
3144
|
+
const asyncInstTask = [];
|
|
3113
3145
|
// [ inst[], inst[],...]
|
|
3114
|
-
|
|
3146
|
+
totalInstConfigList.forEach((instConfigList) => {
|
|
3115
3147
|
// inst[]
|
|
3116
|
-
instConfigList.forEach((instConfigItem, index) => {
|
|
3148
|
+
instConfigList.forEach(async (instConfigItem, index) => {
|
|
3117
3149
|
// 移除全部或者guid相同
|
|
3118
|
-
if (isAll ||
|
|
3150
|
+
if (isAll || (typeof guid === "string" && instConfigItem.guid === guid)) {
|
|
3119
3151
|
// 判断是否有动画
|
|
3120
3152
|
const animName = instConfigItem.$anim.getAttribute("anim");
|
|
3121
3153
|
if (PopsAnimation.hasAnim(animName)) {
|
|
3122
3154
|
const reverseAnimName = animName + "-reverse";
|
|
3123
|
-
instConfigItem.$anim
|
|
3124
|
-
instConfigItem.$anim
|
|
3125
|
-
instConfigItem.$anim
|
|
3126
|
-
if (PopsAnimation.hasAnim(instConfigItem.$anim
|
|
3127
|
-
|
|
3128
|
-
|
|
3129
|
-
|
|
3130
|
-
|
|
3131
|
-
|
|
3155
|
+
popsDOMUtils.css(instConfigItem.$anim, "width", "100%");
|
|
3156
|
+
popsDOMUtils.css(instConfigItem.$anim, "height", "100%");
|
|
3157
|
+
popsDOMUtils.css(instConfigItem.$anim, "animation-name", reverseAnimName);
|
|
3158
|
+
if (PopsAnimation.hasAnim(popsDOMUtils.css(instConfigItem.$anim, "animation-name"))) {
|
|
3159
|
+
asyncInstTask.push(new Promise((resolve) => {
|
|
3160
|
+
popsDOMUtils.on(instConfigItem.$anim, popsDOMUtils.getAnimationEndNameList(), function () {
|
|
3161
|
+
removeInst(instConfigItem);
|
|
3162
|
+
resolve();
|
|
3163
|
+
}, {
|
|
3164
|
+
capture: true,
|
|
3165
|
+
});
|
|
3166
|
+
}));
|
|
3132
3167
|
}
|
|
3133
3168
|
else {
|
|
3134
|
-
|
|
3169
|
+
removeInst(instConfigItem);
|
|
3135
3170
|
}
|
|
3136
3171
|
}
|
|
3137
3172
|
else {
|
|
3138
|
-
|
|
3173
|
+
removeInst(instConfigItem);
|
|
3139
3174
|
}
|
|
3140
3175
|
instConfigList.splice(index, 1);
|
|
3141
3176
|
}
|
|
3142
3177
|
});
|
|
3143
3178
|
});
|
|
3144
|
-
|
|
3179
|
+
await Promise.all(asyncInstTask);
|
|
3180
|
+
return totalInstConfigList;
|
|
3145
3181
|
},
|
|
3146
3182
|
/**
|
|
3147
3183
|
* 隐藏
|
|
@@ -3286,8 +3322,9 @@
|
|
|
3286
3322
|
* @param config
|
|
3287
3323
|
* @param $anim
|
|
3288
3324
|
*/
|
|
3289
|
-
close(config, popsType, instConfigList, guid, $anim) {
|
|
3290
|
-
|
|
3325
|
+
async close(config, popsType, instConfigList, guid, $anim) {
|
|
3326
|
+
// eslint-disable-next-line no-async-promise-executor
|
|
3327
|
+
await new Promise(async (resolve) => {
|
|
3291
3328
|
const $pops = $anim.querySelector(".pops[type-value]");
|
|
3292
3329
|
const drawerConfig = config;
|
|
3293
3330
|
/**
|
|
@@ -3297,12 +3334,12 @@
|
|
|
3297
3334
|
/**
|
|
3298
3335
|
* 弹窗已关闭的回调
|
|
3299
3336
|
*/
|
|
3300
|
-
function closeCallBack(event) {
|
|
3337
|
+
async function closeCallBack(event) {
|
|
3301
3338
|
if (event.propertyName !== "transform") {
|
|
3302
3339
|
return;
|
|
3303
3340
|
}
|
|
3304
|
-
popsDOMUtils.off($pops, popsDOMUtils.getTransitionEndNameList(),
|
|
3305
|
-
PopsInstanceUtils.removeInstance([instConfigList], guid);
|
|
3341
|
+
popsDOMUtils.off($pops, popsDOMUtils.getTransitionEndNameList(), closeCallBack);
|
|
3342
|
+
await PopsInstanceUtils.removeInstance([instConfigList], guid);
|
|
3306
3343
|
resolve();
|
|
3307
3344
|
}
|
|
3308
3345
|
// 监听过渡结束
|
|
@@ -3334,10 +3371,32 @@
|
|
|
3334
3371
|
}, drawerConfig.closeDelay);
|
|
3335
3372
|
}
|
|
3336
3373
|
else {
|
|
3337
|
-
PopsInstanceUtils.removeInstance([instConfigList], guid);
|
|
3374
|
+
await PopsInstanceUtils.removeInstance([instConfigList], guid);
|
|
3338
3375
|
resolve();
|
|
3339
3376
|
}
|
|
3340
3377
|
});
|
|
3378
|
+
// 判断组件内是否有rightClickMenu、tooltip、searchSuggestion组件
|
|
3379
|
+
// 有的话也需要关闭
|
|
3380
|
+
PopsInstData.rightClickMenu.forEach((itemConfig) => {
|
|
3381
|
+
const config = itemConfig.config;
|
|
3382
|
+
if (config.$target instanceof HTMLElement) {
|
|
3383
|
+
const $root = config.$target.getRootNode();
|
|
3384
|
+
if ($root instanceof HTMLElement && $root.parentElement == null) {
|
|
3385
|
+
// 触发销毁元素
|
|
3386
|
+
itemConfig.destory();
|
|
3387
|
+
}
|
|
3388
|
+
}
|
|
3389
|
+
});
|
|
3390
|
+
PopsInstData.tooltip.forEach((itemConfig) => {
|
|
3391
|
+
const config = itemConfig.config;
|
|
3392
|
+
if (config.$target instanceof HTMLElement) {
|
|
3393
|
+
const $root = config.$target.getRootNode();
|
|
3394
|
+
if ($root instanceof HTMLElement && $root.parentElement == null) {
|
|
3395
|
+
// 触发销毁元素
|
|
3396
|
+
itemConfig.destory();
|
|
3397
|
+
}
|
|
3398
|
+
}
|
|
3399
|
+
});
|
|
3341
3400
|
},
|
|
3342
3401
|
/**
|
|
3343
3402
|
* 拖拽元素
|
|
@@ -3676,12 +3735,12 @@
|
|
|
3676
3735
|
element.hasAttribute("anim"));
|
|
3677
3736
|
}
|
|
3678
3737
|
// 判断按下的元素是否是pops-anim
|
|
3679
|
-
popsDOMUtils.on(config.animElement, ["touchstart", "mousedown"],
|
|
3738
|
+
popsDOMUtils.on(config.animElement, ["touchstart", "mousedown"], (event) => {
|
|
3680
3739
|
const $click = event.composedPath()[0];
|
|
3681
3740
|
isMaskClick = isAnimElement($click);
|
|
3682
3741
|
});
|
|
3683
3742
|
// 如果有动画层,在动画层上监听点击事件
|
|
3684
|
-
popsDOMUtils.on(config.animElement, "click",
|
|
3743
|
+
popsDOMUtils.on(config.animElement, "click", (event) => {
|
|
3685
3744
|
const $click = event.composedPath()[0];
|
|
3686
3745
|
if (isAnimElement($click) && isMaskClick) {
|
|
3687
3746
|
return clickEvent(event);
|
|
@@ -3689,7 +3748,7 @@
|
|
|
3689
3748
|
});
|
|
3690
3749
|
// 在遮罩层监听点击事件
|
|
3691
3750
|
// 如果有动画层,那么该点击事件触发不了
|
|
3692
|
-
popsDOMUtils.on(result.maskElement, "click",
|
|
3751
|
+
popsDOMUtils.on(result.maskElement, "click", (event) => {
|
|
3693
3752
|
isMaskClick = true;
|
|
3694
3753
|
clickEvent(event);
|
|
3695
3754
|
});
|
|
@@ -3832,13 +3891,13 @@
|
|
|
3832
3891
|
* @param guid
|
|
3833
3892
|
* @param $shadowContainer
|
|
3834
3893
|
* @param $shadowRoot
|
|
3835
|
-
* @param
|
|
3894
|
+
* @param type 当前弹窗类型
|
|
3836
3895
|
* @param $anim 动画层
|
|
3837
3896
|
* @param $pops 主元素
|
|
3838
3897
|
* @param $mask 遮罩层
|
|
3839
3898
|
* @param config 当前配置
|
|
3840
3899
|
*/
|
|
3841
|
-
handleEventConfig(config, guid, $shadowContainer, $shadowRoot,
|
|
3900
|
+
handleEventConfig(config, guid, $shadowContainer, $shadowRoot, type, $anim, $pops, $mask) {
|
|
3842
3901
|
return {
|
|
3843
3902
|
$shadowContainer: $shadowContainer,
|
|
3844
3903
|
$shadowRoot: $shadowRoot,
|
|
@@ -3846,44 +3905,47 @@
|
|
|
3846
3905
|
$anim: $anim,
|
|
3847
3906
|
$pops: $pops,
|
|
3848
3907
|
$mask: $mask,
|
|
3849
|
-
mode:
|
|
3908
|
+
mode: type,
|
|
3850
3909
|
guid: guid,
|
|
3851
3910
|
close() {
|
|
3852
|
-
return PopsInstanceUtils.close(config,
|
|
3911
|
+
return PopsInstanceUtils.close(config, type, PopsInstData[type], guid, $anim);
|
|
3853
3912
|
},
|
|
3854
3913
|
hide() {
|
|
3855
|
-
return PopsInstanceUtils.hide(config,
|
|
3914
|
+
return PopsInstanceUtils.hide(config, type, PopsInstData[type], guid, $anim, $mask);
|
|
3856
3915
|
},
|
|
3857
|
-
show() {
|
|
3858
|
-
|
|
3916
|
+
show($parent) {
|
|
3917
|
+
if ($parent) {
|
|
3918
|
+
$parent.appendChild(PopsInstData[type][0].$shadowRoot);
|
|
3919
|
+
}
|
|
3920
|
+
return PopsInstanceUtils.show(config, type, PopsInstData[type], guid, $anim, $mask);
|
|
3859
3921
|
},
|
|
3860
3922
|
};
|
|
3861
3923
|
},
|
|
3862
3924
|
/**
|
|
3863
3925
|
* 获取loading的事件配置
|
|
3864
3926
|
* @param guid
|
|
3865
|
-
* @param
|
|
3927
|
+
* @param type 当前弹窗类型
|
|
3866
3928
|
* @param $anim 动画层
|
|
3867
3929
|
* @param $pops 主元素
|
|
3868
3930
|
* @param $mask 遮罩层
|
|
3869
3931
|
* @param config 当前配置
|
|
3870
3932
|
*/
|
|
3871
|
-
handleLoadingEventConfig(config, guid,
|
|
3933
|
+
handleLoadingEventConfig(config, guid, type, $anim, $pops, $mask) {
|
|
3872
3934
|
return {
|
|
3873
3935
|
$el: $anim,
|
|
3874
3936
|
$anim: $anim,
|
|
3875
3937
|
$pops: $pops,
|
|
3876
3938
|
$mask: $mask,
|
|
3877
|
-
mode:
|
|
3939
|
+
mode: type,
|
|
3878
3940
|
guid: guid,
|
|
3879
3941
|
close() {
|
|
3880
|
-
return PopsInstanceUtils.close(config,
|
|
3942
|
+
return PopsInstanceUtils.close(config, type, PopsInstData[type], guid, $anim);
|
|
3881
3943
|
},
|
|
3882
3944
|
hide() {
|
|
3883
|
-
return PopsInstanceUtils.hide(config,
|
|
3945
|
+
return PopsInstanceUtils.hide(config, type, PopsInstData[type], guid, $anim, $mask);
|
|
3884
3946
|
},
|
|
3885
3947
|
show() {
|
|
3886
|
-
return PopsInstanceUtils.show(config,
|
|
3948
|
+
return PopsInstanceUtils.show(config, type, PopsInstData[type], guid, $anim, $mask);
|
|
3887
3949
|
},
|
|
3888
3950
|
};
|
|
3889
3951
|
},
|
|
@@ -3996,8 +4058,8 @@
|
|
|
3996
4058
|
handleOnly(type, config) {
|
|
3997
4059
|
if (config.only) {
|
|
3998
4060
|
// .loading
|
|
3999
|
-
// .tooltip
|
|
4000
4061
|
// .rightClickMenu
|
|
4062
|
+
// .tooltip
|
|
4001
4063
|
// 单独处理
|
|
4002
4064
|
if (type === "loading" || type === "tooltip" || type === "rightClickMenu") {
|
|
4003
4065
|
const inst = PopsInstData[type];
|
|
@@ -4009,11 +4071,11 @@
|
|
|
4009
4071
|
PopsInstanceUtils.removeInstance([
|
|
4010
4072
|
PopsInstData.alert,
|
|
4011
4073
|
PopsInstData.confirm,
|
|
4012
|
-
PopsInstData.prompt,
|
|
4013
|
-
PopsInstData.iframe,
|
|
4014
4074
|
PopsInstData.drawer,
|
|
4015
4075
|
PopsInstData.folder,
|
|
4076
|
+
PopsInstData.iframe,
|
|
4016
4077
|
PopsInstData.panel,
|
|
4078
|
+
PopsInstData.prompt,
|
|
4017
4079
|
], "", true);
|
|
4018
4080
|
}
|
|
4019
4081
|
}
|
|
@@ -4177,6 +4239,7 @@
|
|
|
4177
4239
|
}
|
|
4178
4240
|
// 处理返回的配置
|
|
4179
4241
|
const evtConfig = PopsHandler.handleEventConfig(config, guid, $shadowContainer, $shadowRoot, popsType, $anim, $pops, $mask);
|
|
4242
|
+
const result = PopsHandler.handleResultConfig(evtConfig);
|
|
4180
4243
|
// 为顶部右边的关闭按钮添加点击事件
|
|
4181
4244
|
PopsHandler.handleClickEvent("close", $headerCloseBtn, evtConfig, config.btn.close?.callback);
|
|
4182
4245
|
// 为底部ok按钮添加点击事件
|
|
@@ -4199,6 +4262,8 @@
|
|
|
4199
4262
|
$mask: $mask,
|
|
4200
4263
|
$shadowContainer: $shadowContainer,
|
|
4201
4264
|
$shadowRoot: $shadowRoot,
|
|
4265
|
+
config: config,
|
|
4266
|
+
destory: result.close,
|
|
4202
4267
|
});
|
|
4203
4268
|
// 拖拽
|
|
4204
4269
|
if (config.drag) {
|
|
@@ -4210,7 +4275,6 @@
|
|
|
4210
4275
|
endCallBack: config.dragEndCallBack,
|
|
4211
4276
|
});
|
|
4212
4277
|
}
|
|
4213
|
-
const result = PopsHandler.handleResultConfig(evtConfig);
|
|
4214
4278
|
return result;
|
|
4215
4279
|
},
|
|
4216
4280
|
};
|
|
@@ -4384,6 +4448,7 @@
|
|
|
4384
4448
|
$elList.push($mask);
|
|
4385
4449
|
}
|
|
4386
4450
|
const evtConfig = PopsHandler.handleEventConfig(config, guid, $shadowContainer, $shadowRoot, popsType, $anim, $pops, $mask);
|
|
4451
|
+
const result = PopsHandler.handleResultConfig(evtConfig);
|
|
4387
4452
|
PopsHandler.handleClickEvent("close", $btnClose, evtConfig, config.btn.close.callback);
|
|
4388
4453
|
PopsHandler.handleClickEvent("ok", $btnOk, evtConfig, config.btn.ok.callback);
|
|
4389
4454
|
PopsHandler.handleClickEvent("cancel", $btnCancel, evtConfig, config.btn.cancel.callback);
|
|
@@ -4404,6 +4469,8 @@
|
|
|
4404
4469
|
$mask: $mask,
|
|
4405
4470
|
$shadowContainer: $shadowContainer,
|
|
4406
4471
|
$shadowRoot: $shadowRoot,
|
|
4472
|
+
config: config,
|
|
4473
|
+
destory: result.close,
|
|
4407
4474
|
});
|
|
4408
4475
|
// 拖拽
|
|
4409
4476
|
if (config.drag) {
|
|
@@ -4415,7 +4482,6 @@
|
|
|
4415
4482
|
endCallBack: config.dragEndCallBack,
|
|
4416
4483
|
});
|
|
4417
4484
|
}
|
|
4418
|
-
const result = PopsHandler.handleResultConfig(evtConfig);
|
|
4419
4485
|
return result;
|
|
4420
4486
|
},
|
|
4421
4487
|
};
|
|
@@ -4594,6 +4660,7 @@
|
|
|
4594
4660
|
$elList.push($mask);
|
|
4595
4661
|
}
|
|
4596
4662
|
const evtConfig = PopsHandler.handleEventConfig(config, guid, $shadowContainer, $shadowRoot, popsType, $anim, $pops, $mask);
|
|
4663
|
+
const result = PopsHandler.handleResultConfig(evtConfig);
|
|
4597
4664
|
// 处理方向
|
|
4598
4665
|
$pops.setAttribute("direction", config.direction);
|
|
4599
4666
|
// 处理border-radius
|
|
@@ -4689,8 +4756,9 @@
|
|
|
4689
4756
|
$mask: $mask,
|
|
4690
4757
|
$shadowContainer: $shadowContainer,
|
|
4691
4758
|
$shadowRoot: $shadowRoot,
|
|
4759
|
+
config: config,
|
|
4760
|
+
destory: result.close,
|
|
4692
4761
|
});
|
|
4693
|
-
const result = PopsHandler.handleResultConfig(evtConfig);
|
|
4694
4762
|
return result;
|
|
4695
4763
|
},
|
|
4696
4764
|
};
|
|
@@ -5199,6 +5267,7 @@
|
|
|
5199
5267
|
}
|
|
5200
5268
|
// 事件
|
|
5201
5269
|
const evtConfig = PopsHandler.handleEventConfig(config, guid, $shadowContainer, $shadowRoot, popsType, $anim, $pops, $mask);
|
|
5270
|
+
const result = PopsHandler.handleResultConfig(evtConfig);
|
|
5202
5271
|
PopsHandler.handleClickEvent("close", $btnCloseBtn, evtConfig, config.btn.close.callback);
|
|
5203
5272
|
PopsHandler.handleClickEvent("ok", btnOkElement, evtConfig, config.btn.ok.callback);
|
|
5204
5273
|
PopsHandler.handleClickEvent("cancel", btnCancelElement, evtConfig, config.btn.cancel.callback);
|
|
@@ -5778,8 +5847,9 @@
|
|
|
5778
5847
|
$mask: $mask,
|
|
5779
5848
|
$shadowContainer: $shadowContainer,
|
|
5780
5849
|
$shadowRoot: $shadowRoot,
|
|
5850
|
+
config: config,
|
|
5851
|
+
destory: result.close,
|
|
5781
5852
|
});
|
|
5782
|
-
const result = PopsHandler.handleResultConfig(evtConfig);
|
|
5783
5853
|
return result;
|
|
5784
5854
|
},
|
|
5785
5855
|
};
|
|
@@ -5935,6 +6005,7 @@
|
|
|
5935
6005
|
const evtConfig = PopsHandler.handleEventConfig(config, guid, $shadowContainer, $shadowRoot, popsType, $anim, $pops, $mask);
|
|
5936
6006
|
// 赋值额外的$iframe参数
|
|
5937
6007
|
evtConfig.$iframe = $iframe;
|
|
6008
|
+
const result = PopsHandler.handleResultConfig(evtConfig);
|
|
5938
6009
|
popsDOMUtils.on($anim, popsDOMUtils.getAnimationEndNameList(), function () {
|
|
5939
6010
|
// 动画加载完毕
|
|
5940
6011
|
$anim.style.width = "0%";
|
|
@@ -6066,10 +6137,10 @@
|
|
|
6066
6137
|
capture: true,
|
|
6067
6138
|
});
|
|
6068
6139
|
// 关闭按钮点击事件
|
|
6069
|
-
popsDOMUtils.on(headerCloseBtnElement, "click", (event) => {
|
|
6140
|
+
popsDOMUtils.on(headerCloseBtnElement, "click", async (event) => {
|
|
6070
6141
|
event.preventDefault();
|
|
6071
6142
|
event.stopPropagation();
|
|
6072
|
-
PopsInstanceUtils.removeInstance([PopsInstData.iframe], guid, false);
|
|
6143
|
+
await PopsInstanceUtils.removeInstance([PopsInstData.iframe], guid, false);
|
|
6073
6144
|
if (typeof config?.btn?.close?.callback === "function") {
|
|
6074
6145
|
config.btn.close.callback(evtConfig, event);
|
|
6075
6146
|
}
|
|
@@ -6083,8 +6154,9 @@
|
|
|
6083
6154
|
$mask: $mask,
|
|
6084
6155
|
$shadowContainer: $shadowContainer,
|
|
6085
6156
|
$shadowRoot: $shadowRoot,
|
|
6157
|
+
config: config,
|
|
6158
|
+
destory: result.close,
|
|
6086
6159
|
});
|
|
6087
|
-
const result = PopsHandler.handleResultConfig(evtConfig);
|
|
6088
6160
|
return result;
|
|
6089
6161
|
},
|
|
6090
6162
|
};
|
|
@@ -7050,7 +7122,7 @@
|
|
|
7050
7122
|
isFixed: false,
|
|
7051
7123
|
alwaysShow: false,
|
|
7052
7124
|
onShowEventName: "mouseenter touchstart",
|
|
7053
|
-
onCloseEventName: "mouseleave touchend",
|
|
7125
|
+
onCloseEventName: "mouseleave touchend touchcancel",
|
|
7054
7126
|
zIndex: 10000,
|
|
7055
7127
|
only: false,
|
|
7056
7128
|
eventOption: {
|
|
@@ -7276,12 +7348,12 @@
|
|
|
7276
7348
|
changePosition(event) {
|
|
7277
7349
|
const positionInfo = this.calcToolTipPosition(this.$data.config.$target, this.$data.config.arrowDistance, this.$data.config.otherDistance, event);
|
|
7278
7350
|
const positionKey = this.$data.config.position.toUpperCase();
|
|
7279
|
-
const
|
|
7280
|
-
if (
|
|
7281
|
-
this.$el.$toolTip.style.left =
|
|
7282
|
-
this.$el.$toolTip.style.top =
|
|
7283
|
-
this.$el.$toolTip.setAttribute("data-motion",
|
|
7284
|
-
this.$el.$arrow.setAttribute("data-position",
|
|
7351
|
+
const position = positionInfo[positionKey];
|
|
7352
|
+
if (position) {
|
|
7353
|
+
this.$el.$toolTip.style.left = position.left + "px";
|
|
7354
|
+
this.$el.$toolTip.style.top = position.top + "px";
|
|
7355
|
+
this.$el.$toolTip.setAttribute("data-motion", position.motion);
|
|
7356
|
+
this.$el.$arrow.setAttribute("data-position", position.arrow);
|
|
7285
7357
|
}
|
|
7286
7358
|
else {
|
|
7287
7359
|
console.error("不存在该位置", this.$data.config.position);
|
|
@@ -7453,13 +7525,13 @@
|
|
|
7453
7525
|
*/
|
|
7454
7526
|
destory() {
|
|
7455
7527
|
if (this.$el.$toolTip) {
|
|
7456
|
-
this.$el.$
|
|
7528
|
+
this.$el.$toolTip.remove();
|
|
7457
7529
|
}
|
|
7458
|
-
// @ts-
|
|
7530
|
+
// @ts-expect-error
|
|
7459
7531
|
this.$el.$toolTip = null;
|
|
7460
|
-
// @ts-
|
|
7532
|
+
// @ts-expect-error
|
|
7461
7533
|
this.$el.$arrow = null;
|
|
7462
|
-
// @ts-
|
|
7534
|
+
// @ts-expect-error
|
|
7463
7535
|
this.$el.$content = null;
|
|
7464
7536
|
}
|
|
7465
7537
|
/**
|
|
@@ -7507,29 +7579,29 @@
|
|
|
7507
7579
|
popsDOMUtils.on(this.$el.$toolTip, "mouseenter touchstart", this.toolTipMouseEnterEvent, this.$data.config.eventOption);
|
|
7508
7580
|
}
|
|
7509
7581
|
/**
|
|
7510
|
-
*
|
|
7582
|
+
* 取消监听事件 - 鼠标|触摸
|
|
7511
7583
|
*/
|
|
7512
7584
|
offToolTipMouseEnterEvent() {
|
|
7513
7585
|
popsDOMUtils.off(this.$el.$toolTip, "mouseenter touchstart", this.toolTipMouseEnterEvent, this.$data.config.eventOption);
|
|
7514
7586
|
}
|
|
7515
7587
|
/**
|
|
7516
|
-
*
|
|
7588
|
+
* 离开事件 - 鼠标|触摸
|
|
7517
7589
|
*/
|
|
7518
7590
|
toolTipMouseLeaveEvent(event) {
|
|
7519
7591
|
this.close(event);
|
|
7520
7592
|
// this.$el.$toolTip.style.animationPlayState = "running";
|
|
7521
7593
|
}
|
|
7522
7594
|
/**
|
|
7523
|
-
*
|
|
7595
|
+
* 监听离开事件 - 鼠标|触摸
|
|
7524
7596
|
*/
|
|
7525
7597
|
onToolTipMouseLeaveEvent() {
|
|
7526
|
-
popsDOMUtils.on(this.$el.$toolTip, "mouseleave touchend", this.toolTipMouseLeaveEvent, this.$data.config.eventOption);
|
|
7598
|
+
popsDOMUtils.on(this.$el.$toolTip, "mouseleave touchend touchcancel", this.toolTipMouseLeaveEvent, this.$data.config.eventOption);
|
|
7527
7599
|
}
|
|
7528
7600
|
/**
|
|
7529
|
-
*
|
|
7601
|
+
* 取消监听离开事件 - 鼠标|触摸
|
|
7530
7602
|
*/
|
|
7531
7603
|
offToolTipMouseLeaveEvent() {
|
|
7532
|
-
popsDOMUtils.off(this.$el.$toolTip, "mouseleave touchend", this.toolTipMouseLeaveEvent, this.$data.config.eventOption);
|
|
7604
|
+
popsDOMUtils.off(this.$el.$toolTip, "mouseleave touchend touchcancel", this.toolTipMouseLeaveEvent, this.$data.config.eventOption);
|
|
7533
7605
|
}
|
|
7534
7606
|
}
|
|
7535
7607
|
const PopsTooltip = {
|
|
@@ -7544,6 +7616,15 @@
|
|
|
7544
7616
|
throw new TypeError("config.target 必须是HTMLElement类型");
|
|
7545
7617
|
}
|
|
7546
7618
|
config = PopsHandler.handleOnly(popsType, config);
|
|
7619
|
+
if (config.position === "follow") {
|
|
7620
|
+
config.onShowEventName = config.onShowEventName.trim();
|
|
7621
|
+
const showEventNameSplit = config.onShowEventName.split(" ");
|
|
7622
|
+
["mousemove", "touchmove"].forEach((it) => {
|
|
7623
|
+
if (showEventNameSplit.includes(it))
|
|
7624
|
+
return;
|
|
7625
|
+
config.onShowEventName += ` ${it}`;
|
|
7626
|
+
});
|
|
7627
|
+
}
|
|
7547
7628
|
const { $shadowContainer, $shadowRoot } = PopsHandler.handlerShadow(config);
|
|
7548
7629
|
PopsHandler.handleInit($shadowRoot, [
|
|
7549
7630
|
{
|
|
@@ -8808,7 +8889,7 @@
|
|
|
8808
8889
|
* 监听输入框内容改变
|
|
8809
8890
|
*/
|
|
8810
8891
|
onValueChange() {
|
|
8811
|
-
popsDOMUtils.on(this.$el.input, ["input", "propertychange"],
|
|
8892
|
+
popsDOMUtils.on(this.$el.input, ["input", "propertychange"], (event) => {
|
|
8812
8893
|
this.$data.value = this.$el.input.value;
|
|
8813
8894
|
if (inputType !== "password") {
|
|
8814
8895
|
// 不是密码框
|
|
@@ -9181,7 +9262,7 @@
|
|
|
9181
9262
|
* 监听点击事件
|
|
9182
9263
|
*/
|
|
9183
9264
|
onClick() {
|
|
9184
|
-
popsDOMUtils.on(this.$el.$select, "click",
|
|
9265
|
+
popsDOMUtils.on(this.$el.$select, "click", (event) => {
|
|
9185
9266
|
this.setSelectOptionsDisableStatus();
|
|
9186
9267
|
if (typeof viewConfig.clickCallBack === "function") {
|
|
9187
9268
|
const $isSelectedElement = this.$el.$select[this.$el.$select.selectedIndex];
|
|
@@ -10948,7 +11029,7 @@
|
|
|
10948
11029
|
* 设置按钮的点击事件
|
|
10949
11030
|
*/
|
|
10950
11031
|
onButtonClick() {
|
|
10951
|
-
popsDOMUtils.on(this.$ele.button, "click",
|
|
11032
|
+
popsDOMUtils.on(this.$ele.button, "click", (event) => {
|
|
10952
11033
|
if (typeof viewConfig.callback === "function") {
|
|
10953
11034
|
viewConfig.callback(event);
|
|
10954
11035
|
}
|
|
@@ -11017,13 +11098,13 @@
|
|
|
11017
11098
|
initContainerItem($container, formItemConfig) {
|
|
11018
11099
|
const containerViewConfig = formItemConfig;
|
|
11019
11100
|
if (containerViewConfig.type === "container") {
|
|
11020
|
-
const
|
|
11101
|
+
const childViewConfig = containerViewConfig["views"];
|
|
11021
11102
|
// 每一项<li>元素
|
|
11022
|
-
const
|
|
11103
|
+
const $itemLi = popsDOMUtils.createElement("li");
|
|
11023
11104
|
// 每一项<li>内的子<ul>元素
|
|
11024
|
-
const
|
|
11025
|
-
|
|
11026
|
-
|
|
11105
|
+
const $itemUL = popsDOMUtils.createElement("ul");
|
|
11106
|
+
$itemUL.classList.add("pops-panel-forms-container-item-formlist");
|
|
11107
|
+
$itemLi.classList.add("pops-panel-forms-container-item");
|
|
11027
11108
|
// 区域头部的文字
|
|
11028
11109
|
const formHeaderDivElement = popsDOMUtils.createElement("div", {
|
|
11029
11110
|
className: "pops-panel-forms-container-item-header-text",
|
|
@@ -11043,42 +11124,42 @@
|
|
|
11043
11124
|
`);
|
|
11044
11125
|
// 添加点击事件
|
|
11045
11126
|
popsDOMUtils.on(formHeaderDivElement, "click", () => {
|
|
11046
|
-
if (
|
|
11047
|
-
|
|
11127
|
+
if ($itemLi.hasAttribute("data-fold-enable")) {
|
|
11128
|
+
$itemLi.removeAttribute("data-fold-enable");
|
|
11048
11129
|
}
|
|
11049
11130
|
else {
|
|
11050
|
-
|
|
11131
|
+
$itemLi.setAttribute("data-fold-enable", "");
|
|
11051
11132
|
}
|
|
11052
11133
|
});
|
|
11053
11134
|
popsDOMUtils.addClassName(formHeaderDivElement, "pops-panel-forms-fold-container");
|
|
11054
11135
|
popsDOMUtils.addClassName(formHeaderDivElement, PopsCommonCSSClassName.userSelectNone);
|
|
11055
|
-
|
|
11136
|
+
$itemLi.setAttribute("data-fold-enable", "");
|
|
11056
11137
|
popsDOMUtils.addClassName(formHeaderDivElement, "pops-panel-forms-fold");
|
|
11057
|
-
|
|
11138
|
+
$itemLi.appendChild(formHeaderDivElement);
|
|
11058
11139
|
}
|
|
11059
11140
|
else {
|
|
11060
11141
|
// 加进容器内
|
|
11061
|
-
|
|
11142
|
+
$itemLi.appendChild(formHeaderDivElement);
|
|
11062
11143
|
}
|
|
11063
|
-
that.setElementClassName(
|
|
11064
|
-
that.setElementAttributes(
|
|
11065
|
-
that.setElementProps(
|
|
11066
|
-
|
|
11144
|
+
that.setElementClassName($itemLi, formItemConfig.className);
|
|
11145
|
+
that.setElementAttributes($itemLi, formItemConfig.attributes);
|
|
11146
|
+
that.setElementProps($itemLi, formItemConfig.props);
|
|
11147
|
+
$itemLi.appendChild($itemUL);
|
|
11148
|
+
$container.appendChild($itemLi);
|
|
11149
|
+
childViewConfig.forEach((childViewConfig) => {
|
|
11067
11150
|
that.uListContainerAddItem(childViewConfig, {
|
|
11068
|
-
ulElement:
|
|
11151
|
+
ulElement: $itemUL,
|
|
11069
11152
|
sectionContainerULElement: that.sectionContainerULElement,
|
|
11070
|
-
formContainerListElement:
|
|
11153
|
+
formContainerListElement: $itemLi,
|
|
11071
11154
|
formHeaderDivElement: formHeaderDivElement,
|
|
11072
11155
|
});
|
|
11073
11156
|
});
|
|
11074
|
-
formContainerListElement.appendChild(formContainerULElement);
|
|
11075
|
-
$container.appendChild(formContainerListElement);
|
|
11076
11157
|
if (typeof containerViewConfig.afterAddToUListCallBack === "function") {
|
|
11077
11158
|
containerViewConfig.afterAddToUListCallBack(viewConfig, {
|
|
11078
|
-
target:
|
|
11079
|
-
ulElement:
|
|
11159
|
+
target: $itemLi,
|
|
11160
|
+
ulElement: $itemUL,
|
|
11080
11161
|
sectionContainerULElement: that.sectionContainerULElement,
|
|
11081
|
-
formContainerListElement:
|
|
11162
|
+
formContainerListElement: $itemLi,
|
|
11082
11163
|
formHeaderDivElement: formHeaderDivElement,
|
|
11083
11164
|
});
|
|
11084
11165
|
}
|
|
@@ -11217,7 +11298,7 @@
|
|
|
11217
11298
|
},
|
|
11218
11299
|
/** 设置项的点击事件 */
|
|
11219
11300
|
onLiClick() {
|
|
11220
|
-
popsDOMUtils.on($li, "click",
|
|
11301
|
+
popsDOMUtils.on($li, "click", async (event) => {
|
|
11221
11302
|
if (typeof viewConfig.clickCallBack === "function") {
|
|
11222
11303
|
const result = await viewConfig.clickCallBack(event, viewConfig);
|
|
11223
11304
|
if (result) {
|
|
@@ -11545,6 +11626,7 @@
|
|
|
11545
11626
|
}
|
|
11546
11627
|
// 处理返回的配置
|
|
11547
11628
|
const evtConfig = PopsHandler.handleEventConfig(config, guid, $shadowContainer, $shadowRoot, popsType, $anim, $pops, $mask);
|
|
11629
|
+
const result = PopsHandler.handleResultConfig(evtConfig);
|
|
11548
11630
|
// 为顶部右边的关闭按钮添加点击事件
|
|
11549
11631
|
PopsHandler.handleClickEvent("close", $headerBtnClose, evtConfig, config.btn?.close?.callback);
|
|
11550
11632
|
// 创建到页面中
|
|
@@ -11582,6 +11664,8 @@
|
|
|
11582
11664
|
$mask: $mask,
|
|
11583
11665
|
$shadowContainer: $shadowContainer,
|
|
11584
11666
|
$shadowRoot: $shadowRoot,
|
|
11667
|
+
config: config,
|
|
11668
|
+
destory: result.close,
|
|
11585
11669
|
});
|
|
11586
11670
|
// 拖拽
|
|
11587
11671
|
if (config.drag) {
|
|
@@ -11593,7 +11677,6 @@
|
|
|
11593
11677
|
endCallBack: config.dragEndCallBack,
|
|
11594
11678
|
});
|
|
11595
11679
|
}
|
|
11596
|
-
const result = PopsHandler.handleResultConfig(evtConfig);
|
|
11597
11680
|
return {
|
|
11598
11681
|
...result,
|
|
11599
11682
|
addEventListener: (event, listener, options) => {
|
|
@@ -11785,6 +11868,7 @@
|
|
|
11785
11868
|
$elList.push($mask);
|
|
11786
11869
|
}
|
|
11787
11870
|
const evtConfig = PopsHandler.handleEventConfig(config, guid, $shadowContainer, $shadowRoot, popsType, $anim, $pops, $mask);
|
|
11871
|
+
const result = PopsHandler.handleResultConfig(evtConfig);
|
|
11788
11872
|
// 输入框赋值初始值
|
|
11789
11873
|
$input.value = config.content.text;
|
|
11790
11874
|
PopsHandler.handlePromptClickEvent("close", $input, $btnClose, evtConfig, config.btn.close.callback);
|
|
@@ -11807,6 +11891,8 @@
|
|
|
11807
11891
|
$mask: $mask,
|
|
11808
11892
|
$shadowContainer: $shadowContainer,
|
|
11809
11893
|
$shadowRoot: $shadowRoot,
|
|
11894
|
+
config: config,
|
|
11895
|
+
destory: result.close,
|
|
11810
11896
|
});
|
|
11811
11897
|
// 拖拽
|
|
11812
11898
|
if (config.drag) {
|
|
@@ -11826,7 +11912,6 @@
|
|
|
11826
11912
|
if (config.content.select) {
|
|
11827
11913
|
$input.select();
|
|
11828
11914
|
}
|
|
11829
|
-
const result = PopsHandler.handleResultConfig(evtConfig);
|
|
11830
11915
|
return result;
|
|
11831
11916
|
},
|
|
11832
11917
|
};
|
|
@@ -11928,6 +12013,7 @@
|
|
|
11928
12013
|
beforeAppendToPageCallBack() { },
|
|
11929
12014
|
limitPositionXInView: true,
|
|
11930
12015
|
limitPositionYInView: true,
|
|
12016
|
+
beforeShowCallBack() { },
|
|
11931
12017
|
};
|
|
11932
12018
|
};
|
|
11933
12019
|
|
|
@@ -11987,6 +12073,8 @@
|
|
|
11987
12073
|
return;
|
|
11988
12074
|
}
|
|
11989
12075
|
if ($click.className && $click.className === "pops-shadow-container" && $click.shadowRoot != null) {
|
|
12076
|
+
// pops的shadow-container
|
|
12077
|
+
PopsContextMenu.shadowRootCheckClickEvent(event);
|
|
11990
12078
|
return;
|
|
11991
12079
|
}
|
|
11992
12080
|
PopsContextMenu.closeAllMenu(PopsContextMenu.$el.$root);
|
|
@@ -11999,7 +12087,7 @@
|
|
|
11999
12087
|
if (!PopsContextMenu.$el.$root) {
|
|
12000
12088
|
return;
|
|
12001
12089
|
}
|
|
12002
|
-
const $click = event.
|
|
12090
|
+
const $click = event.composedPath()[0];
|
|
12003
12091
|
if ($click.closest(`.pops-${popsType}`)) {
|
|
12004
12092
|
return;
|
|
12005
12093
|
}
|
|
@@ -12009,13 +12097,13 @@
|
|
|
12009
12097
|
* 添加全局点击检测事件
|
|
12010
12098
|
*/
|
|
12011
12099
|
addWindowCheckClickListener() {
|
|
12012
|
-
popsDOMUtils.on(globalThis, "click touchstart",
|
|
12100
|
+
popsDOMUtils.on(globalThis, "click touchstart", PopsContextMenu.windowCheckClickEvent, {
|
|
12013
12101
|
capture: true,
|
|
12014
12102
|
});
|
|
12015
12103
|
if (config.$target instanceof Node) {
|
|
12016
12104
|
const $shadowRoot = config.$target.getRootNode();
|
|
12017
12105
|
if ($shadowRoot instanceof ShadowRoot) {
|
|
12018
|
-
popsDOMUtils.on($shadowRoot, "click touchstart",
|
|
12106
|
+
popsDOMUtils.on($shadowRoot, "click touchstart", PopsContextMenu.shadowRootCheckClickEvent, {
|
|
12019
12107
|
capture: true,
|
|
12020
12108
|
});
|
|
12021
12109
|
}
|
|
@@ -12025,13 +12113,13 @@
|
|
|
12025
12113
|
* 移除全局点击检测事件
|
|
12026
12114
|
*/
|
|
12027
12115
|
removeWindowCheckClickListener() {
|
|
12028
|
-
popsDOMUtils.off(globalThis, "click touchstart",
|
|
12116
|
+
popsDOMUtils.off(globalThis, "click touchstart", PopsContextMenu.windowCheckClickEvent, {
|
|
12029
12117
|
capture: true,
|
|
12030
12118
|
});
|
|
12031
12119
|
if (config.$target instanceof Node) {
|
|
12032
12120
|
const $shadowRoot = config.$target.getRootNode();
|
|
12033
12121
|
if ($shadowRoot instanceof ShadowRoot) {
|
|
12034
|
-
popsDOMUtils.off($shadowRoot, "click touchstart",
|
|
12122
|
+
popsDOMUtils.off($shadowRoot, "click touchstart", PopsContextMenu.windowCheckClickEvent, {
|
|
12035
12123
|
capture: true,
|
|
12036
12124
|
});
|
|
12037
12125
|
}
|
|
@@ -12042,7 +12130,7 @@
|
|
|
12042
12130
|
* @param event
|
|
12043
12131
|
* @param selectorTarget
|
|
12044
12132
|
*/
|
|
12045
|
-
contextMenuEvent(event, selectorTarget) {
|
|
12133
|
+
async contextMenuEvent(event, selectorTarget) {
|
|
12046
12134
|
if (config.preventDefault) {
|
|
12047
12135
|
popsDOMUtils.preventEvent(event);
|
|
12048
12136
|
}
|
|
@@ -12051,6 +12139,10 @@
|
|
|
12051
12139
|
PopsContextMenu.closeAllMenu(PopsContextMenu.$el.$root);
|
|
12052
12140
|
}
|
|
12053
12141
|
selectorTarget = selectorTarget ?? config.$target;
|
|
12142
|
+
const beforeShowCallBackResult = await config?.beforeShowCallBack(event);
|
|
12143
|
+
if (typeof beforeShowCallBackResult === "boolean" && !beforeShowCallBackResult) {
|
|
12144
|
+
return;
|
|
12145
|
+
}
|
|
12054
12146
|
const rootElement = PopsContextMenu.showMenu(event, config.data, selectorTarget);
|
|
12055
12147
|
PopsContextMenu.$el.$root = rootElement;
|
|
12056
12148
|
if (config.only) {
|
|
@@ -12063,6 +12155,10 @@
|
|
|
12063
12155
|
beforeRemoveCallBack(instCommonConfig) {
|
|
12064
12156
|
PopsContextMenu.closeAllMenu(instCommonConfig.$pops);
|
|
12065
12157
|
},
|
|
12158
|
+
config: config,
|
|
12159
|
+
destory: () => {
|
|
12160
|
+
PopsContextMenu.closeAllMenu(rootElement);
|
|
12161
|
+
},
|
|
12066
12162
|
});
|
|
12067
12163
|
}
|
|
12068
12164
|
},
|
|
@@ -12366,7 +12462,8 @@
|
|
|
12366
12462
|
menuLiElement.appendChild(iconElement);
|
|
12367
12463
|
}
|
|
12368
12464
|
// 插入文字
|
|
12369
|
-
|
|
12465
|
+
const text = typeof item.text === "function" ? item.text() : item.text;
|
|
12466
|
+
menuLiElement.insertAdjacentHTML("beforeend", PopsSafeUtils.getSafeHTML(`<span>${text}</span>`));
|
|
12370
12467
|
// 如果存在子数据,显示
|
|
12371
12468
|
if (item.item && Array.isArray(item.item)) {
|
|
12372
12469
|
popsDOMUtils.addClassName(menuLiElement, `pops-${popsType}-item`);
|
|
@@ -13005,10 +13102,10 @@
|
|
|
13005
13102
|
setShowEvent(option = defaultListenerOption) {
|
|
13006
13103
|
/* 焦点|点击事件*/
|
|
13007
13104
|
if (config.followPosition === "target") {
|
|
13008
|
-
popsDOMUtils.on([config.$target], ["focus", "click"],
|
|
13105
|
+
popsDOMUtils.on([config.$target], ["focus", "click"], SearchSuggestion.showEvent, option);
|
|
13009
13106
|
}
|
|
13010
13107
|
else if (config.followPosition === "input") {
|
|
13011
|
-
popsDOMUtils.on([config.$inputTarget], ["focus", "click"],
|
|
13108
|
+
popsDOMUtils.on([config.$inputTarget], ["focus", "click"], SearchSuggestion.showEvent, option);
|
|
13012
13109
|
}
|
|
13013
13110
|
else if (config.followPosition === "inputCursor") {
|
|
13014
13111
|
popsDOMUtils.on([config.$inputTarget], ["focus", "click", "input"], SearchSuggestion.showEvent, option);
|
|
@@ -13022,9 +13119,9 @@
|
|
|
13022
13119
|
*/
|
|
13023
13120
|
removeShowEvent(option = defaultListenerOption) {
|
|
13024
13121
|
/* 焦点|点击事件*/
|
|
13025
|
-
popsDOMUtils.off([config.$target, config.$inputTarget], ["focus", "click"],
|
|
13122
|
+
popsDOMUtils.off([config.$target, config.$inputTarget], ["focus", "click"], SearchSuggestion.showEvent, option);
|
|
13026
13123
|
// 内容改变事件
|
|
13027
|
-
popsDOMUtils.off([config.$inputTarget], ["input"],
|
|
13124
|
+
popsDOMUtils.off([config.$inputTarget], ["input"], SearchSuggestion.showEvent, option);
|
|
13028
13125
|
},
|
|
13029
13126
|
/**
|
|
13030
13127
|
* 隐藏搜索建议框的事件
|
|
@@ -13055,7 +13152,7 @@
|
|
|
13055
13152
|
// 全局触摸屏点击事件
|
|
13056
13153
|
if (Array.isArray(SearchSuggestion.selfDocument)) {
|
|
13057
13154
|
SearchSuggestion.selfDocument.forEach(($checkParent) => {
|
|
13058
|
-
popsDOMUtils.on($checkParent, ["click", "touchstart"],
|
|
13155
|
+
popsDOMUtils.on($checkParent, ["click", "touchstart"], SearchSuggestion.hideEvent, option);
|
|
13059
13156
|
});
|
|
13060
13157
|
}
|
|
13061
13158
|
else {
|
|
@@ -13068,11 +13165,11 @@
|
|
|
13068
13165
|
removeHideEvent(option = defaultListenerOption) {
|
|
13069
13166
|
if (Array.isArray(SearchSuggestion.selfDocument)) {
|
|
13070
13167
|
SearchSuggestion.selfDocument.forEach(($checkParent) => {
|
|
13071
|
-
popsDOMUtils.off($checkParent, ["click", "touchstart"],
|
|
13168
|
+
popsDOMUtils.off($checkParent, ["click", "touchstart"], SearchSuggestion.hideEvent, option);
|
|
13072
13169
|
});
|
|
13073
13170
|
}
|
|
13074
13171
|
else {
|
|
13075
|
-
popsDOMUtils.off(SearchSuggestion.selfDocument, ["click", "touchstart"],
|
|
13172
|
+
popsDOMUtils.off(SearchSuggestion.selfDocument, ["click", "touchstart"], SearchSuggestion.hideEvent, option);
|
|
13076
13173
|
}
|
|
13077
13174
|
},
|
|
13078
13175
|
/**
|
|
@@ -13333,7 +13430,7 @@
|
|
|
13333
13430
|
},
|
|
13334
13431
|
};
|
|
13335
13432
|
|
|
13336
|
-
const version = "3.
|
|
13433
|
+
const version = "3.2.0";
|
|
13337
13434
|
|
|
13338
13435
|
class Pops {
|
|
13339
13436
|
/** 配置 */
|