bkui-vue 2.0.2-beta.85 → 2.0.2-beta.87
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.cjs.js +25 -25
- package/dist/index.esm.js +2476 -2438
- package/dist/index.umd.js +31 -31
- package/lib/index.js +1 -1
- package/lib/popover/index.js +69 -2
- package/lib/tag/index.d.ts +23 -0
- package/lib/tag/index.js +8 -3
- package/lib/tag/tag.d.ts +11 -0
- package/package.json +1 -1
package/lib/index.js
CHANGED
package/lib/popover/index.js
CHANGED
|
@@ -4817,6 +4817,8 @@ var popContainerId = "id_".concat(esm_browser_v4());
|
|
|
4817
4817
|
updateBoundary();
|
|
4818
4818
|
updatePopover(null, props);
|
|
4819
4819
|
};
|
|
4820
|
+
// 监听父元素(Modal/Dialog)的可见性变化
|
|
4821
|
+
var parentVisibilityObserver = null;
|
|
4820
4822
|
var onMountedFn = function onMountedFn() {
|
|
4821
4823
|
if (props.disabled) {
|
|
4822
4824
|
return;
|
|
@@ -4831,20 +4833,78 @@ var popContainerId = "id_".concat(esm_browser_v4());
|
|
|
4831
4833
|
initPopInstance();
|
|
4832
4834
|
document.body.addEventListener('fullscreenchange', handleFullscreenChange);
|
|
4833
4835
|
document.addEventListener('click', handleClickOutside);
|
|
4836
|
+
// 监听父元素的可见性变化
|
|
4837
|
+
var _resolvePopElements4 = resolvePopElements(),
|
|
4838
|
+
elReference = _resolvePopElements4.elReference,
|
|
4839
|
+
root = _resolvePopElements4.root;
|
|
4840
|
+
var element = elReference || root;
|
|
4841
|
+
if (element) {
|
|
4842
|
+
var targetNode = element.closest('.bk-modal, .bk-dialog');
|
|
4843
|
+
if (targetNode) {
|
|
4844
|
+
parentVisibilityObserver = new MutationObserver(function () {
|
|
4845
|
+
if (checkParentVisibility() && localIsShow.value) {
|
|
4846
|
+
hideFn();
|
|
4847
|
+
}
|
|
4848
|
+
});
|
|
4849
|
+
parentVisibilityObserver.observe(targetNode, {
|
|
4850
|
+
attributes: true,
|
|
4851
|
+
attributeFilter: ['style', 'class'],
|
|
4852
|
+
subtree: true
|
|
4853
|
+
});
|
|
4854
|
+
}
|
|
4855
|
+
}
|
|
4834
4856
|
};
|
|
4835
4857
|
var onUnmountedFn = function onUnmountedFn() {
|
|
4836
4858
|
beforeInstanceUnmount();
|
|
4837
4859
|
// 清理父节点上的 data-pnode-id 属性
|
|
4838
|
-
var
|
|
4839
|
-
root =
|
|
4860
|
+
var _resolvePopElements5 = resolvePopElements(),
|
|
4861
|
+
root = _resolvePopElements5.root;
|
|
4840
4862
|
clearParentNodeId(root);
|
|
4841
4863
|
document.body.removeEventListener('fullscreenchange', handleFullscreenChange);
|
|
4842
4864
|
document.removeEventListener('click', handleClickOutside);
|
|
4865
|
+
// 清理父元素可见性监听器
|
|
4866
|
+
if (parentVisibilityObserver) {
|
|
4867
|
+
parentVisibilityObserver.disconnect();
|
|
4868
|
+
parentVisibilityObserver = null;
|
|
4869
|
+
}
|
|
4843
4870
|
};
|
|
4844
4871
|
var isClickInside = function isClickInside(target) {
|
|
4845
4872
|
var _refContent$value$$el, _refContent$value, _refContent$value$con;
|
|
4846
4873
|
return (_refContent$value$$el = (_refContent$value = refContent.value) === null || _refContent$value === void 0 || (_refContent$value = _refContent$value.$el) === null || _refContent$value === void 0 || (_refContent$value$con = _refContent$value.contains) === null || _refContent$value$con === void 0 ? void 0 : _refContent$value$con.call(_refContent$value, target)) !== null && _refContent$value$$el !== void 0 ? _refContent$value$$el : false;
|
|
4847
4874
|
};
|
|
4875
|
+
/**
|
|
4876
|
+
* 检查父元素(Modal/Dialog)是否被隐藏
|
|
4877
|
+
* 如果父元素被隐藏,应该关闭 Popover
|
|
4878
|
+
*/
|
|
4879
|
+
var checkParentVisibility = function checkParentVisibility() {
|
|
4880
|
+
if (!localIsShow.value) return false;
|
|
4881
|
+
var _resolvePopElements6 = resolvePopElements(),
|
|
4882
|
+
elReference = _resolvePopElements6.elReference,
|
|
4883
|
+
root = _resolvePopElements6.root;
|
|
4884
|
+
var element = elReference || root;
|
|
4885
|
+
if (!element) return false;
|
|
4886
|
+
// 查找最近的 Modal 或 Dialog 父元素
|
|
4887
|
+
var parent = element.parentElement;
|
|
4888
|
+
while (parent && parent !== document.body) {
|
|
4889
|
+
if (parent.classList.contains('bk-modal') || parent.classList.contains('bk-dialog')) {
|
|
4890
|
+
// 检查 Modal wrapper 是否被隐藏(Dialog 关闭时 wrapper 会被 v-show 隐藏)
|
|
4891
|
+
var wrapper = parent.querySelector('.bk-modal-wrapper');
|
|
4892
|
+
if (wrapper) {
|
|
4893
|
+
var wrapperStyle = window.getComputedStyle(wrapper);
|
|
4894
|
+
if (wrapperStyle.display === 'none' || wrapperStyle.visibility === 'hidden') {
|
|
4895
|
+
return true; // 父元素被隐藏
|
|
4896
|
+
}
|
|
4897
|
+
}
|
|
4898
|
+
// 检查父元素本身是否被隐藏
|
|
4899
|
+
var style = window.getComputedStyle(parent);
|
|
4900
|
+
if (style.display === 'none' || style.visibility === 'hidden') {
|
|
4901
|
+
return true; // 父元素被隐藏
|
|
4902
|
+
}
|
|
4903
|
+
}
|
|
4904
|
+
parent = parent.parentElement;
|
|
4905
|
+
}
|
|
4906
|
+
return false;
|
|
4907
|
+
};
|
|
4848
4908
|
/**
|
|
4849
4909
|
* 处理点击外部区域的事件
|
|
4850
4910
|
* @param e - 事件对象
|
|
@@ -4859,6 +4919,13 @@ var popContainerId = "id_".concat(esm_browser_v4());
|
|
|
4859
4919
|
e.stopImmediatePropagation();
|
|
4860
4920
|
return;
|
|
4861
4921
|
}
|
|
4922
|
+
// 检查父元素(Modal/Dialog)是否被隐藏,如果隐藏则关闭 Popover
|
|
4923
|
+
if (checkParentVisibility()) {
|
|
4924
|
+
if (localIsShow.value) {
|
|
4925
|
+
hideFn();
|
|
4926
|
+
}
|
|
4927
|
+
return;
|
|
4928
|
+
}
|
|
4862
4929
|
var commonFunc = function commonFunc() {
|
|
4863
4930
|
ctx.emit(EMIT_EVENTS.CLICK_OUTSIDE, {
|
|
4864
4931
|
isShow: localIsShow.value,
|
package/lib/tag/index.d.ts
CHANGED
|
@@ -27,6 +27,11 @@ declare const BkTag: {
|
|
|
27
27
|
default: string;
|
|
28
28
|
};
|
|
29
29
|
size: import("vue-types").VueTypeDef<"default" | "small" | "large" | "huge">;
|
|
30
|
+
stopPropagation: import("vue-types").VueTypeValidableDef<boolean> & {
|
|
31
|
+
default: boolean;
|
|
32
|
+
} & {
|
|
33
|
+
default: boolean;
|
|
34
|
+
};
|
|
30
35
|
}>> & {
|
|
31
36
|
onChange?: (...args: any[]) => any;
|
|
32
37
|
onClose?: (...args: any[]) => any;
|
|
@@ -65,6 +70,11 @@ declare const BkTag: {
|
|
|
65
70
|
default: string;
|
|
66
71
|
};
|
|
67
72
|
size: import("vue-types").VueTypeDef<"default" | "small" | "large" | "huge">;
|
|
73
|
+
stopPropagation: import("vue-types").VueTypeValidableDef<boolean> & {
|
|
74
|
+
default: boolean;
|
|
75
|
+
} & {
|
|
76
|
+
default: boolean;
|
|
77
|
+
};
|
|
68
78
|
}>> & {
|
|
69
79
|
onChange?: (...args: any[]) => any;
|
|
70
80
|
onClose?: (...args: any[]) => any;
|
|
@@ -73,6 +83,7 @@ declare const BkTag: {
|
|
|
73
83
|
theme: "" | "danger" | "success" | "warning" | "info";
|
|
74
84
|
closable: boolean;
|
|
75
85
|
radius: string;
|
|
86
|
+
stopPropagation: boolean;
|
|
76
87
|
checked: boolean;
|
|
77
88
|
checkable: boolean;
|
|
78
89
|
}, true, {}, import("vue").SlotsType<{
|
|
@@ -113,6 +124,11 @@ declare const BkTag: {
|
|
|
113
124
|
default: string;
|
|
114
125
|
};
|
|
115
126
|
size: import("vue-types").VueTypeDef<"default" | "small" | "large" | "huge">;
|
|
127
|
+
stopPropagation: import("vue-types").VueTypeValidableDef<boolean> & {
|
|
128
|
+
default: boolean;
|
|
129
|
+
} & {
|
|
130
|
+
default: boolean;
|
|
131
|
+
};
|
|
116
132
|
}>> & {
|
|
117
133
|
onChange?: (...args: any[]) => any;
|
|
118
134
|
onClose?: (...args: any[]) => any;
|
|
@@ -128,6 +144,7 @@ declare const BkTag: {
|
|
|
128
144
|
theme: "" | "danger" | "success" | "warning" | "info";
|
|
129
145
|
closable: boolean;
|
|
130
146
|
radius: string;
|
|
147
|
+
stopPropagation: boolean;
|
|
131
148
|
checked: boolean;
|
|
132
149
|
checkable: boolean;
|
|
133
150
|
}>;
|
|
@@ -162,6 +179,11 @@ declare const BkTag: {
|
|
|
162
179
|
default: string;
|
|
163
180
|
};
|
|
164
181
|
size: import("vue-types").VueTypeDef<"default" | "small" | "large" | "huge">;
|
|
182
|
+
stopPropagation: import("vue-types").VueTypeValidableDef<boolean> & {
|
|
183
|
+
default: boolean;
|
|
184
|
+
} & {
|
|
185
|
+
default: boolean;
|
|
186
|
+
};
|
|
165
187
|
}>> & {
|
|
166
188
|
onChange?: (...args: any[]) => any;
|
|
167
189
|
onClose?: (...args: any[]) => any;
|
|
@@ -177,6 +199,7 @@ declare const BkTag: {
|
|
|
177
199
|
theme: "" | "danger" | "success" | "warning" | "info";
|
|
178
200
|
closable: boolean;
|
|
179
201
|
radius: string;
|
|
202
|
+
stopPropagation: boolean;
|
|
180
203
|
checked: boolean;
|
|
181
204
|
checkable: boolean;
|
|
182
205
|
}, {}, string, import("vue").SlotsType<{
|
package/lib/tag/index.js
CHANGED
|
@@ -147,7 +147,8 @@ var TagStrokeType;
|
|
|
147
147
|
checkable: shared_namespaceObject.PropTypes.bool.def(false),
|
|
148
148
|
checked: shared_namespaceObject.PropTypes.bool.def(false),
|
|
149
149
|
radius: shared_namespaceObject.PropTypes.string.def('2px'),
|
|
150
|
-
size: shared_namespaceObject.PropTypes.size()
|
|
150
|
+
size: shared_namespaceObject.PropTypes.size(),
|
|
151
|
+
stopPropagation: shared_namespaceObject.PropTypes.bool.def(true)
|
|
151
152
|
},
|
|
152
153
|
emits: ['change', 'close'],
|
|
153
154
|
slots: Object,
|
|
@@ -162,12 +163,16 @@ var TagStrokeType;
|
|
|
162
163
|
});
|
|
163
164
|
var handleClose = function handleClose(e) {
|
|
164
165
|
e.preventDefault();
|
|
165
|
-
|
|
166
|
+
if (props.stopPropagation) {
|
|
167
|
+
e.stopPropagation();
|
|
168
|
+
}
|
|
166
169
|
emit('close', e);
|
|
167
170
|
};
|
|
168
171
|
var handleClick = function handleClick(e) {
|
|
169
172
|
e.preventDefault();
|
|
170
|
-
|
|
173
|
+
if (props.stopPropagation) {
|
|
174
|
+
e.stopPropagation();
|
|
175
|
+
}
|
|
171
176
|
if (props.checkable) {
|
|
172
177
|
emit('change', !props.checked);
|
|
173
178
|
}
|
package/lib/tag/tag.d.ts
CHANGED
|
@@ -27,6 +27,11 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
27
27
|
default: string;
|
|
28
28
|
};
|
|
29
29
|
size: import("vue-types").VueTypeDef<"default" | "small" | "large" | "huge">;
|
|
30
|
+
stopPropagation: import("vue-types").VueTypeValidableDef<boolean> & {
|
|
31
|
+
default: boolean;
|
|
32
|
+
} & {
|
|
33
|
+
default: boolean;
|
|
34
|
+
};
|
|
30
35
|
}, {
|
|
31
36
|
wrapperStyle: import("vue").ComputedRef<{
|
|
32
37
|
borderRadius: string;
|
|
@@ -62,6 +67,11 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
62
67
|
default: string;
|
|
63
68
|
};
|
|
64
69
|
size: import("vue-types").VueTypeDef<"default" | "small" | "large" | "huge">;
|
|
70
|
+
stopPropagation: import("vue-types").VueTypeValidableDef<boolean> & {
|
|
71
|
+
default: boolean;
|
|
72
|
+
} & {
|
|
73
|
+
default: boolean;
|
|
74
|
+
};
|
|
65
75
|
}>> & {
|
|
66
76
|
onChange?: (...args: any[]) => any;
|
|
67
77
|
onClose?: (...args: any[]) => any;
|
|
@@ -70,6 +80,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
70
80
|
theme: "" | "danger" | "success" | "warning" | "info";
|
|
71
81
|
closable: boolean;
|
|
72
82
|
radius: string;
|
|
83
|
+
stopPropagation: boolean;
|
|
73
84
|
checked: boolean;
|
|
74
85
|
checkable: boolean;
|
|
75
86
|
}, SlotsType<{
|