bkui-vue 2.0.2-beta.76 → 2.0.2-beta.78
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 +28 -28
- package/dist/index.esm.js +5600 -5560
- package/dist/index.umd.js +25 -25
- package/lib/index.js +1 -1
- package/lib/message/index.js +58 -24
- package/lib/message/messageConstructor.d.ts +1 -1
- package/lib/notify/index.js +40 -21
- package/lib/popover/index.d.ts +3 -3
- package/lib/popover/index.js +110 -13
- package/lib/popover/popover.d.ts +1 -1
- package/lib/popover/use-floating.d.ts +2 -2
- package/lib/popover/use-popover-init.d.ts +1 -1
- package/lib/select/common.d.ts +0 -1
- package/lib/select/index.js +9 -32
- package/package.json +1 -1
package/lib/index.js
CHANGED
package/lib/message/index.js
CHANGED
|
@@ -1020,7 +1020,7 @@ function _defineProperty(obj, key, value) {
|
|
|
1020
1020
|
;// CONCATENATED MODULE: external "vue"
|
|
1021
1021
|
var x = y => { var x = {}; __webpack_require__.d(x, y); return x; }
|
|
1022
1022
|
var y = x => () => x
|
|
1023
|
-
const external_vue_namespaceObject = x({ ["Fragment"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.Fragment, ["Transition"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.Transition, ["computed"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.computed, ["createVNode"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.createVNode, ["defineComponent"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.defineComponent, ["isVNode"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.isVNode, ["onMounted"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.onMounted, ["onUnmounted"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.onUnmounted, ["reactive"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.reactive, ["ref"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.ref, ["render"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.render, ["vShow"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.vShow, ["watch"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.watch, ["withDirectives"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.withDirectives });
|
|
1023
|
+
const external_vue_namespaceObject = x({ ["Fragment"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.Fragment, ["Transition"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.Transition, ["computed"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.computed, ["createVNode"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.createVNode, ["defineComponent"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.defineComponent, ["isVNode"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.isVNode, ["nextTick"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.nextTick, ["onMounted"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.onMounted, ["onUnmounted"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.onUnmounted, ["reactive"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.reactive, ["ref"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.ref, ["render"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.render, ["vShow"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.vShow, ["watch"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.watch, ["withDirectives"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.withDirectives });
|
|
1024
1024
|
;// CONCATENATED MODULE: external "../shared"
|
|
1025
1025
|
var shared_x = y => { var x = {}; __webpack_require__.d(x, y); return x; }
|
|
1026
1026
|
var shared_y = x => () => x
|
|
@@ -1063,6 +1063,23 @@ var instances = {
|
|
|
1063
1063
|
'bottom-right': []
|
|
1064
1064
|
};
|
|
1065
1065
|
var seed = 1;
|
|
1066
|
+
// 更新指定位置的所有 Message 实例的位置
|
|
1067
|
+
var updateModalPosition = function updateModalPosition(position, spacing) {
|
|
1068
|
+
var initialOffset = 30;
|
|
1069
|
+
var offsetTop = initialOffset;
|
|
1070
|
+
instances[position].forEach(function (vm) {
|
|
1071
|
+
if (vm.el) {
|
|
1072
|
+
// 获取当前实例的实际高度(包括详情展开后的高度)
|
|
1073
|
+
var currentHeight = vm.el.offsetHeight || 0;
|
|
1074
|
+
// 直接更新 DOM 元素的 top 样式,确保位置立即生效
|
|
1075
|
+
vm.el.style.top = "".concat(offsetTop, "px");
|
|
1076
|
+
// 同时更新 props,保持数据一致性
|
|
1077
|
+
vm.props.offsetY = offsetTop;
|
|
1078
|
+
// 然后累加当前实例的高度和间距,用于计算下一个实例的位置
|
|
1079
|
+
offsetTop += currentHeight + spacing;
|
|
1080
|
+
}
|
|
1081
|
+
});
|
|
1082
|
+
};
|
|
1066
1083
|
var Message = function Message(constructor, options) {
|
|
1067
1084
|
var opts = options;
|
|
1068
1085
|
var position = opts.position || 'top-right';
|
|
@@ -1085,17 +1102,11 @@ var Message = function Message(constructor, options) {
|
|
|
1085
1102
|
opts = _objectSpread(_objectSpread({}, opts), {}, {
|
|
1086
1103
|
offsetX: horizontalOffset,
|
|
1087
1104
|
offsetY: verticalOffset,
|
|
1088
|
-
id: id
|
|
1105
|
+
id: id,
|
|
1106
|
+
spacing: spacing
|
|
1089
1107
|
});
|
|
1090
1108
|
var container = document.createElement('div');
|
|
1091
1109
|
var vm = (0,external_vue_namespaceObject.createVNode)(constructor, opts);
|
|
1092
|
-
// const updateModalPosition = () => {
|
|
1093
|
-
// let offsetTop = 30;
|
|
1094
|
-
// instances[position].forEach((vm) => {
|
|
1095
|
-
// offsetTop += (vm.el.offsetHeight || 0) + spacing;
|
|
1096
|
-
// vm.props.offsetY = offsetTop;
|
|
1097
|
-
// });
|
|
1098
|
-
// };
|
|
1099
1110
|
vm.props.onDestroy = function (id) {
|
|
1100
1111
|
use_message_close(id, position, spacing, userOnClose);
|
|
1101
1112
|
(0,external_vue_namespaceObject.render)(null, container);
|
|
@@ -1104,13 +1115,19 @@ var Message = function Message(constructor, options) {
|
|
|
1104
1115
|
instances[position].forEach(function (item) {
|
|
1105
1116
|
if (item.props.id !== id) {
|
|
1106
1117
|
var _item$component;
|
|
1107
|
-
|
|
1118
|
+
// 关闭其他实例的详情时,传入 shouldEmit = false 避免触发无限循环
|
|
1119
|
+
(_item$component = item.component) === null || _item$component === void 0 || (_item$component = _item$component.exposed) === null || _item$component === void 0 || _item$component.setDetailsShow(null, false, false);
|
|
1108
1120
|
}
|
|
1109
1121
|
});
|
|
1110
|
-
//
|
|
1111
|
-
//
|
|
1112
|
-
//
|
|
1113
|
-
|
|
1122
|
+
// 等待 DOM 更新完成后再更新位置
|
|
1123
|
+
// 详情展开/收起时,DOM 高度会变化,需要等待渲染完成
|
|
1124
|
+
// 由于事件已经在详情内容渲染完成后才 emit,这里只需要等待 Vue 响应式更新和浏览器布局完成
|
|
1125
|
+
var currentSpacing = spacing || 10;
|
|
1126
|
+
(0,external_vue_namespaceObject.nextTick)(function () {
|
|
1127
|
+
requestAnimationFrame(function () {
|
|
1128
|
+
updateModalPosition(position, currentSpacing);
|
|
1129
|
+
});
|
|
1130
|
+
});
|
|
1114
1131
|
};
|
|
1115
1132
|
(0,external_vue_namespaceObject.render)(vm, container);
|
|
1116
1133
|
instances[position].push(vm);
|
|
@@ -1124,21 +1141,23 @@ var Message = function Message(constructor, options) {
|
|
|
1124
1141
|
};
|
|
1125
1142
|
function use_message_close(id, position, spacing, userOnClose) {
|
|
1126
1143
|
userOnClose === null || userOnClose === void 0 || userOnClose();
|
|
1127
|
-
var verticalProperty = position.startsWith('top') ? 'top' : 'bottom';
|
|
1128
1144
|
var instanceIndex = -1;
|
|
1129
1145
|
instances[position].forEach(function (item, index) {
|
|
1130
1146
|
if (item.props.id === id) {
|
|
1131
1147
|
instanceIndex = index;
|
|
1132
1148
|
}
|
|
1133
1149
|
});
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
var len = instances[position].length;
|
|
1137
|
-
for (var i = instanceIndex; i < len; i++) {
|
|
1138
|
-
var pos = parseInt(instances[position][i].el.style[verticalProperty], 10) - removeHeight - spacing;
|
|
1139
|
-
instances[position][i].component.props.offsetY = pos;
|
|
1150
|
+
if (instanceIndex === -1) {
|
|
1151
|
+
return;
|
|
1140
1152
|
}
|
|
1153
|
+
// 移除实例
|
|
1141
1154
|
instances[position].splice(instanceIndex, 1);
|
|
1155
|
+
// 重新计算所有剩余实例的位置
|
|
1156
|
+
// 使用传入的 spacing,如果没有则从第一个实例获取,或使用默认值 10
|
|
1157
|
+
var currentSpacing = spacing || (instances[position].length > 0 ? instances[position][0].props.spacing : 10) || 10;
|
|
1158
|
+
(0,external_vue_namespaceObject.nextTick)(function () {
|
|
1159
|
+
updateModalPosition(position, currentSpacing);
|
|
1160
|
+
});
|
|
1142
1161
|
}
|
|
1143
1162
|
/* harmony default export */ const use_message = (Message);
|
|
1144
1163
|
;// CONCATENATED MODULE: ../../node_modules/@babel/runtime/helpers/esm/arrayLikeToArray.js
|
|
@@ -1445,8 +1464,15 @@ var messageProps = {
|
|
|
1445
1464
|
return targetJson;
|
|
1446
1465
|
};
|
|
1447
1466
|
var setDetailsShow = function setDetailsShow(e, isShow) {
|
|
1467
|
+
var shouldEmit = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
|
1448
1468
|
toolOperation.isDetailShow = isShow !== null && isShow !== void 0 ? isShow : !toolOperation.isDetailShow;
|
|
1449
1469
|
fixMesage(e, toolOperation.isDetailShow);
|
|
1470
|
+
// 用于在详情内容渲染完成后 emit 事件的回调
|
|
1471
|
+
var emitAfterRender = function emitAfterRender() {
|
|
1472
|
+
if (shouldEmit && _typeof(props.message) === 'object' && !(0,external_vue_namespaceObject.isVNode)(props.message)) {
|
|
1473
|
+
emit('detail', toolOperation.isDetailShow, props.id);
|
|
1474
|
+
}
|
|
1475
|
+
};
|
|
1450
1476
|
if (toolOperation.isDetailShow && _typeof(props.message) === 'object' && !(0,external_vue_namespaceObject.isVNode)(props.message)) {
|
|
1451
1477
|
if (props.message.type === MessageContentType.JSON || !props.message.type) {
|
|
1452
1478
|
var targetJson = parseToJson(props.message.details);
|
|
@@ -1457,15 +1483,23 @@ var messageProps = {
|
|
|
1457
1483
|
refJsonContent.value.append(formatter.render());
|
|
1458
1484
|
}
|
|
1459
1485
|
copyMessage();
|
|
1486
|
+
// 详情内容渲染完成后,再 emit 事件以更新位置
|
|
1487
|
+
emitAfterRender();
|
|
1460
1488
|
});
|
|
1461
|
-
}
|
|
1462
|
-
if (props.message.type === MessageContentType.KEY_VALUE) {
|
|
1489
|
+
} else if (props.message.type === MessageContentType.KEY_VALUE) {
|
|
1463
1490
|
setTimeout(function () {
|
|
1464
1491
|
copyMessage();
|
|
1465
1492
|
copyValueItem();
|
|
1493
|
+
// 详情内容渲染完成后,再 emit 事件以更新位置
|
|
1494
|
+
emitAfterRender();
|
|
1466
1495
|
});
|
|
1496
|
+
} else {
|
|
1497
|
+
// 如果没有详情内容需要渲染,立即 emit
|
|
1498
|
+
emitAfterRender();
|
|
1467
1499
|
}
|
|
1468
|
-
|
|
1500
|
+
} else {
|
|
1501
|
+
// 收起详情时,立即 emit 事件
|
|
1502
|
+
emitAfterRender();
|
|
1469
1503
|
}
|
|
1470
1504
|
};
|
|
1471
1505
|
var fixMesage = function fixMesage(_e, isFix) {
|
|
@@ -152,7 +152,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
152
152
|
})>;
|
|
153
153
|
visible: import("vue").Ref<boolean>;
|
|
154
154
|
close: (e: Event) => void;
|
|
155
|
-
setDetailsShow: (e: MouseEvent, isShow?: boolean) => void;
|
|
155
|
+
setDetailsShow: (e: MouseEvent, isShow?: boolean, shouldEmit?: boolean) => void;
|
|
156
156
|
fixMesage: (_e: MouseEvent, isFix?: boolean) => void;
|
|
157
157
|
copyMessage: () => void;
|
|
158
158
|
parseToJson: (value: any) => any;
|
package/lib/notify/index.js
CHANGED
|
@@ -82,7 +82,7 @@ function _defineProperty(obj, key, value) {
|
|
|
82
82
|
;// CONCATENATED MODULE: external "vue"
|
|
83
83
|
var x = y => { var x = {}; __webpack_require__.d(x, y); return x; }
|
|
84
84
|
var y = x => () => x
|
|
85
|
-
const external_vue_namespaceObject = x({ ["Transition"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.Transition, ["computed"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.computed, ["createVNode"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.createVNode, ["defineComponent"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.defineComponent, ["onMounted"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.onMounted, ["onUnmounted"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.onUnmounted, ["ref"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.ref, ["render"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.render, ["vShow"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.vShow, ["watch"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.watch, ["withDirectives"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.withDirectives });
|
|
85
|
+
const external_vue_namespaceObject = x({ ["Transition"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.Transition, ["computed"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.computed, ["createVNode"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.createVNode, ["defineComponent"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.defineComponent, ["nextTick"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.nextTick, ["onMounted"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.onMounted, ["onUnmounted"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.onUnmounted, ["ref"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.ref, ["render"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.render, ["vShow"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.vShow, ["watch"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.watch, ["withDirectives"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.withDirectives });
|
|
86
86
|
;// CONCATENATED MODULE: external "../shared"
|
|
87
87
|
var shared_x = y => { var x = {}; __webpack_require__.d(x, y); return x; }
|
|
88
88
|
var shared_y = x => () => x
|
|
@@ -125,6 +125,23 @@ var instances = {
|
|
|
125
125
|
'bottom-right': []
|
|
126
126
|
};
|
|
127
127
|
var seed = 1;
|
|
128
|
+
// 更新指定位置的所有 Message 实例的位置
|
|
129
|
+
var updateModalPosition = function updateModalPosition(position, spacing) {
|
|
130
|
+
var initialOffset = 30;
|
|
131
|
+
var offsetTop = initialOffset;
|
|
132
|
+
instances[position].forEach(function (vm) {
|
|
133
|
+
if (vm.el) {
|
|
134
|
+
// 获取当前实例的实际高度(包括详情展开后的高度)
|
|
135
|
+
var currentHeight = vm.el.offsetHeight || 0;
|
|
136
|
+
// 直接更新 DOM 元素的 top 样式,确保位置立即生效
|
|
137
|
+
vm.el.style.top = "".concat(offsetTop, "px");
|
|
138
|
+
// 同时更新 props,保持数据一致性
|
|
139
|
+
vm.props.offsetY = offsetTop;
|
|
140
|
+
// 然后累加当前实例的高度和间距,用于计算下一个实例的位置
|
|
141
|
+
offsetTop += currentHeight + spacing;
|
|
142
|
+
}
|
|
143
|
+
});
|
|
144
|
+
};
|
|
128
145
|
var Message = function Message(constructor, options) {
|
|
129
146
|
var opts = options;
|
|
130
147
|
var position = opts.position || 'top-right';
|
|
@@ -147,17 +164,11 @@ var Message = function Message(constructor, options) {
|
|
|
147
164
|
opts = _objectSpread(_objectSpread({}, opts), {}, {
|
|
148
165
|
offsetX: horizontalOffset,
|
|
149
166
|
offsetY: verticalOffset,
|
|
150
|
-
id: id
|
|
167
|
+
id: id,
|
|
168
|
+
spacing: spacing
|
|
151
169
|
});
|
|
152
170
|
var container = document.createElement('div');
|
|
153
171
|
var vm = (0,external_vue_namespaceObject.createVNode)(constructor, opts);
|
|
154
|
-
// const updateModalPosition = () => {
|
|
155
|
-
// let offsetTop = 30;
|
|
156
|
-
// instances[position].forEach((vm) => {
|
|
157
|
-
// offsetTop += (vm.el.offsetHeight || 0) + spacing;
|
|
158
|
-
// vm.props.offsetY = offsetTop;
|
|
159
|
-
// });
|
|
160
|
-
// };
|
|
161
172
|
vm.props.onDestroy = function (id) {
|
|
162
173
|
use_message_close(id, position, spacing, userOnClose);
|
|
163
174
|
(0,external_vue_namespaceObject.render)(null, container);
|
|
@@ -166,13 +177,19 @@ var Message = function Message(constructor, options) {
|
|
|
166
177
|
instances[position].forEach(function (item) {
|
|
167
178
|
if (item.props.id !== id) {
|
|
168
179
|
var _item$component;
|
|
169
|
-
|
|
180
|
+
// 关闭其他实例的详情时,传入 shouldEmit = false 避免触发无限循环
|
|
181
|
+
(_item$component = item.component) === null || _item$component === void 0 || (_item$component = _item$component.exposed) === null || _item$component === void 0 || _item$component.setDetailsShow(null, false, false);
|
|
170
182
|
}
|
|
171
183
|
});
|
|
172
|
-
//
|
|
173
|
-
//
|
|
174
|
-
//
|
|
175
|
-
|
|
184
|
+
// 等待 DOM 更新完成后再更新位置
|
|
185
|
+
// 详情展开/收起时,DOM 高度会变化,需要等待渲染完成
|
|
186
|
+
// 由于事件已经在详情内容渲染完成后才 emit,这里只需要等待 Vue 响应式更新和浏览器布局完成
|
|
187
|
+
var currentSpacing = spacing || 10;
|
|
188
|
+
(0,external_vue_namespaceObject.nextTick)(function () {
|
|
189
|
+
requestAnimationFrame(function () {
|
|
190
|
+
updateModalPosition(position, currentSpacing);
|
|
191
|
+
});
|
|
192
|
+
});
|
|
176
193
|
};
|
|
177
194
|
(0,external_vue_namespaceObject.render)(vm, container);
|
|
178
195
|
instances[position].push(vm);
|
|
@@ -186,21 +203,23 @@ var Message = function Message(constructor, options) {
|
|
|
186
203
|
};
|
|
187
204
|
function use_message_close(id, position, spacing, userOnClose) {
|
|
188
205
|
userOnClose === null || userOnClose === void 0 || userOnClose();
|
|
189
|
-
var verticalProperty = position.startsWith('top') ? 'top' : 'bottom';
|
|
190
206
|
var instanceIndex = -1;
|
|
191
207
|
instances[position].forEach(function (item, index) {
|
|
192
208
|
if (item.props.id === id) {
|
|
193
209
|
instanceIndex = index;
|
|
194
210
|
}
|
|
195
211
|
});
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
var len = instances[position].length;
|
|
199
|
-
for (var i = instanceIndex; i < len; i++) {
|
|
200
|
-
var pos = parseInt(instances[position][i].el.style[verticalProperty], 10) - removeHeight - spacing;
|
|
201
|
-
instances[position][i].component.props.offsetY = pos;
|
|
212
|
+
if (instanceIndex === -1) {
|
|
213
|
+
return;
|
|
202
214
|
}
|
|
215
|
+
// 移除实例
|
|
203
216
|
instances[position].splice(instanceIndex, 1);
|
|
217
|
+
// 重新计算所有剩余实例的位置
|
|
218
|
+
// 使用传入的 spacing,如果没有则从第一个实例获取,或使用默认值 10
|
|
219
|
+
var currentSpacing = spacing || (instances[position].length > 0 ? instances[position][0].props.spacing : 10) || 10;
|
|
220
|
+
(0,external_vue_namespaceObject.nextTick)(function () {
|
|
221
|
+
updateModalPosition(position, currentSpacing);
|
|
222
|
+
});
|
|
204
223
|
}
|
|
205
224
|
/* harmony default export */ const use_message = (Message);
|
|
206
225
|
;// CONCATENATED MODULE: external "vue-types"
|
package/lib/popover/index.d.ts
CHANGED
|
@@ -160,7 +160,7 @@ declare const BkPopover: {
|
|
|
160
160
|
onContentMouseenter?: (e: MouseEvent) => any;
|
|
161
161
|
onContentMouseleave?: (e: MouseEvent) => any;
|
|
162
162
|
}, {
|
|
163
|
-
boundary: import("vue").Ref<
|
|
163
|
+
boundary: import("vue").Ref<string>;
|
|
164
164
|
arrow: boolean;
|
|
165
165
|
refDefaultReference: import("vue").Ref<any>;
|
|
166
166
|
refContent: import("vue").Ref<any>;
|
|
@@ -557,7 +557,7 @@ declare const BkPopover: {
|
|
|
557
557
|
onContentMouseenter?: (e: MouseEvent) => any;
|
|
558
558
|
onContentMouseleave?: (e: MouseEvent) => any;
|
|
559
559
|
}, {
|
|
560
|
-
boundary: import("vue").Ref<
|
|
560
|
+
boundary: import("vue").Ref<string>;
|
|
561
561
|
arrow: boolean;
|
|
562
562
|
refDefaultReference: import("vue").Ref<any>;
|
|
563
563
|
refContent: import("vue").Ref<any>;
|
|
@@ -778,7 +778,7 @@ declare const BkPopover: {
|
|
|
778
778
|
onContentMouseenter?: (e: MouseEvent) => any;
|
|
779
779
|
onContentMouseleave?: (e: MouseEvent) => any;
|
|
780
780
|
}, {
|
|
781
|
-
boundary: import("vue").Ref<
|
|
781
|
+
boundary: import("vue").Ref<string>;
|
|
782
782
|
arrow: boolean;
|
|
783
783
|
refDefaultReference: import("vue").Ref<any>;
|
|
784
784
|
refContent: import("vue").Ref<any>;
|
package/lib/popover/index.js
CHANGED
|
@@ -4176,6 +4176,25 @@ function use_floating_objectSpread(e) { for (var r = 1; r < arguments.length; r+
|
|
|
4176
4176
|
}, {});
|
|
4177
4177
|
var contentClass = "".concat(customThemeCls);
|
|
4178
4178
|
var cleanup = null;
|
|
4179
|
+
// 清理所有定时器的函数
|
|
4180
|
+
var clearAllTimers = function clearAllTimers() {
|
|
4181
|
+
if (popHideTimerId) {
|
|
4182
|
+
clearTimeout(popHideTimerId);
|
|
4183
|
+
popHideTimerId = undefined;
|
|
4184
|
+
}
|
|
4185
|
+
if (popShowTimerId) {
|
|
4186
|
+
clearTimeout(popShowTimerId);
|
|
4187
|
+
popShowTimerId = undefined;
|
|
4188
|
+
}
|
|
4189
|
+
};
|
|
4190
|
+
// 包装 cleanup 函数,确保在清理时也清理定时器
|
|
4191
|
+
var wrappedCleanup = function wrappedCleanup() {
|
|
4192
|
+
clearAllTimers();
|
|
4193
|
+
if (cleanup) {
|
|
4194
|
+
cleanup();
|
|
4195
|
+
cleanup = null;
|
|
4196
|
+
}
|
|
4197
|
+
};
|
|
4179
4198
|
var getRoundPixelVal = function getRoundPixelVal(val) {
|
|
4180
4199
|
var dpr = window.devicePixelRatio || 1;
|
|
4181
4200
|
return Math.round(val * dpr) / dpr || 0;
|
|
@@ -4226,9 +4245,35 @@ function use_floating_objectSpread(e) { for (var r = 1; r < arguments.length; r+
|
|
|
4226
4245
|
}
|
|
4227
4246
|
};
|
|
4228
4247
|
var createPopInstance = function createPopInstance() {
|
|
4248
|
+
var retryCount = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
|
|
4229
4249
|
var _resolvePopElements = resolvePopElements(),
|
|
4230
4250
|
elReference = _resolvePopElements.elReference,
|
|
4231
4251
|
elContent = _resolvePopElements.elContent;
|
|
4252
|
+
// 检查元素是否存在,如果不存在则延迟创建实例
|
|
4253
|
+
// 这通常发生在 renderDirective = 'show' 时,Content 通过 Teleport 渲染,可能还未完全挂载
|
|
4254
|
+
if (!elReference || !elContent) {
|
|
4255
|
+
// 限制重试次数,避免无限循环
|
|
4256
|
+
if (retryCount >= 10) {
|
|
4257
|
+
console.warn('[Popover] Failed to create popover instance: elements not found after retries');
|
|
4258
|
+
return;
|
|
4259
|
+
}
|
|
4260
|
+
// 使用 nextTick 等待 DOM 更新完成,特别是等待 Teleport 完成
|
|
4261
|
+
(0,external_vue_namespaceObject.nextTick)(function () {
|
|
4262
|
+
createPopInstance(retryCount + 1);
|
|
4263
|
+
});
|
|
4264
|
+
return;
|
|
4265
|
+
}
|
|
4266
|
+
// 确保元素已经挂载到 DOM 中(对于 Teleport 渲染的元素很重要)
|
|
4267
|
+
if (!elReference.isConnected || !elContent.isConnected) {
|
|
4268
|
+
if (retryCount >= 10) {
|
|
4269
|
+
console.warn('[Popover] Failed to create popover instance: elements not connected to DOM after retries');
|
|
4270
|
+
return;
|
|
4271
|
+
}
|
|
4272
|
+
(0,external_vue_namespaceObject.nextTick)(function () {
|
|
4273
|
+
createPopInstance(retryCount + 1);
|
|
4274
|
+
});
|
|
4275
|
+
return;
|
|
4276
|
+
}
|
|
4232
4277
|
cleanup = autoUpdate(elReference, elContent, function () {
|
|
4233
4278
|
if (localIsShow.value) {
|
|
4234
4279
|
updatePopover(null, props);
|
|
@@ -4281,6 +4326,10 @@ function use_floating_objectSpread(e) { for (var r = 1; r < arguments.length; r+
|
|
|
4281
4326
|
var delay = resolvePopoverDelay()[0];
|
|
4282
4327
|
// 设置settimeout避免hidePopover导致显示问题
|
|
4283
4328
|
popShowTimerId = setTimeout(function () {
|
|
4329
|
+
// 检查组件是否仍然存在,避免在组件卸载后更新状态
|
|
4330
|
+
if (!refContent.value) {
|
|
4331
|
+
return;
|
|
4332
|
+
}
|
|
4284
4333
|
// if (popHideTimerId) {
|
|
4285
4334
|
// clearTimeout(popHideTimerId);
|
|
4286
4335
|
// }
|
|
@@ -4292,6 +4341,10 @@ function use_floating_objectSpread(e) { for (var r = 1; r < arguments.length; r+
|
|
|
4292
4341
|
var hidePopover = function hidePopover() {
|
|
4293
4342
|
var delay = resolvePopoverDelay()[1];
|
|
4294
4343
|
popHideTimerId = setTimeout(function () {
|
|
4344
|
+
// 检查组件是否仍然存在,避免在组件卸载后更新状态
|
|
4345
|
+
if (!refContent.value) {
|
|
4346
|
+
return;
|
|
4347
|
+
}
|
|
4295
4348
|
popShowTimerId && clearTimeout(popShowTimerId);
|
|
4296
4349
|
isMouseenter = false;
|
|
4297
4350
|
localIsShow.value = false;
|
|
@@ -4300,20 +4353,34 @@ function use_floating_objectSpread(e) { for (var r = 1; r < arguments.length; r+
|
|
|
4300
4353
|
var handlePopoverShow = function handlePopoverShow() {
|
|
4301
4354
|
var _refContent$value2;
|
|
4302
4355
|
var elContent = resolveTargetElement((_refContent$value2 = refContent.value) === null || _refContent$value2 === void 0 ? void 0 : _refContent$value2.$el);
|
|
4356
|
+
// 检查元素是否存在,避免在 null 上访问 style 属性
|
|
4357
|
+
if (!elContent) {
|
|
4358
|
+
return;
|
|
4359
|
+
}
|
|
4303
4360
|
elContent.style.setProperty('display', 'block');
|
|
4304
4361
|
elContent.style.setProperty('z-index', "".concat(props.zIndex ? props.zIndex : shared_namespaceObject.bkZIndexManager.getPopperIndex()));
|
|
4305
4362
|
updatePopover();
|
|
4306
|
-
ctx
|
|
4307
|
-
|
|
4308
|
-
|
|
4363
|
+
// 检查 ctx 是否存在,避免在 null 上调用 emit
|
|
4364
|
+
if (ctx !== null && ctx !== void 0 && ctx.emit) {
|
|
4365
|
+
ctx.emit(EMIT_EVENTS.CONTENT_AfterShow, {
|
|
4366
|
+
isShow: true
|
|
4367
|
+
});
|
|
4368
|
+
}
|
|
4309
4369
|
};
|
|
4310
4370
|
var handlePopoverHide = function handlePopoverHide() {
|
|
4311
4371
|
var _refContent$value3;
|
|
4312
4372
|
var elContent = resolveTargetElement((_refContent$value3 = refContent.value) === null || _refContent$value3 === void 0 ? void 0 : _refContent$value3.$el);
|
|
4373
|
+
// 检查元素是否存在,避免在 null 上访问 style 属性
|
|
4374
|
+
if (!elContent) {
|
|
4375
|
+
return;
|
|
4376
|
+
}
|
|
4313
4377
|
elContent.style.setProperty('display', 'none');
|
|
4314
|
-
ctx
|
|
4315
|
-
|
|
4316
|
-
|
|
4378
|
+
// 检查 ctx 是否存在,避免在 null 上调用 emit
|
|
4379
|
+
if (ctx !== null && ctx !== void 0 && ctx.emit) {
|
|
4380
|
+
ctx.emit(EMIT_EVENTS.CONTENT_AfterHidden, {
|
|
4381
|
+
isShow: false
|
|
4382
|
+
});
|
|
4383
|
+
}
|
|
4317
4384
|
};
|
|
4318
4385
|
var triggerPopover = function triggerPopover() {
|
|
4319
4386
|
if (!localIsShow.value) {
|
|
@@ -4352,13 +4419,17 @@ function use_floating_objectSpread(e) { for (var r = 1; r < arguments.length; r+
|
|
|
4352
4419
|
* 例如:鼠标移入内容区域,则取消弹出内容隐藏操作
|
|
4353
4420
|
*/
|
|
4354
4421
|
var emitPopContentMouseEnter = function emitPopContentMouseEnter(e) {
|
|
4355
|
-
ctx.emit
|
|
4422
|
+
if (ctx !== null && ctx !== void 0 && ctx.emit) {
|
|
4423
|
+
ctx.emit(EMIT_EVENTS.CONTENT_MOUSEENTER, e);
|
|
4424
|
+
}
|
|
4356
4425
|
};
|
|
4357
4426
|
/**
|
|
4358
4427
|
* 弹出内容鼠标移出事件
|
|
4359
4428
|
*/
|
|
4360
4429
|
var emitPopContentMouseLeave = function emitPopContentMouseLeave(e) {
|
|
4361
|
-
ctx.emit
|
|
4430
|
+
if (ctx !== null && ctx !== void 0 && ctx.emit) {
|
|
4431
|
+
ctx.emit(EMIT_EVENTS.CONTENT_MOUSELEAVE, e);
|
|
4432
|
+
}
|
|
4362
4433
|
};
|
|
4363
4434
|
var resolveTriggerEvents = function resolveTriggerEvents() {
|
|
4364
4435
|
var _triggerEvents$props$;
|
|
@@ -4411,7 +4482,7 @@ function use_floating_objectSpread(e) { for (var r = 1; r < arguments.length; r+
|
|
|
4411
4482
|
getFullscreenRoot: getFullscreenRoot,
|
|
4412
4483
|
stopHide: stopHide,
|
|
4413
4484
|
localIsShow: localIsShow,
|
|
4414
|
-
cleanup:
|
|
4485
|
+
cleanup: wrappedCleanup
|
|
4415
4486
|
};
|
|
4416
4487
|
});
|
|
4417
4488
|
;// CONCATENATED MODULE: ../../packages/popover/src/use-popper-id.ts
|
|
@@ -4602,9 +4673,23 @@ var popContainerId = "id_".concat(esm_browser_v4());
|
|
|
4602
4673
|
}
|
|
4603
4674
|
};
|
|
4604
4675
|
var addEventToPopTargetEl = function addEventToPopTargetEl() {
|
|
4676
|
+
var retryCount = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
|
|
4605
4677
|
var _resolvePopElements = resolvePopElements(),
|
|
4606
4678
|
elReference = _resolvePopElements.elReference,
|
|
4607
4679
|
elContent = _resolvePopElements.elContent;
|
|
4680
|
+
// 检查元素是否存在,如果不存在则延迟执行
|
|
4681
|
+
// 这通常发生在 renderDirective = 'show' 时,Content 通过 Teleport 渲染,可能还未完全挂载
|
|
4682
|
+
if (!elReference) {
|
|
4683
|
+
if (retryCount >= 10) {
|
|
4684
|
+
console.warn('[Popover] Failed to add events: reference element not found after retries');
|
|
4685
|
+
return;
|
|
4686
|
+
}
|
|
4687
|
+
// 使用 nextTick 等待 DOM 更新完成
|
|
4688
|
+
(0,external_vue_namespaceObject.nextTick)(function () {
|
|
4689
|
+
addEventToPopTargetEl(retryCount + 1);
|
|
4690
|
+
});
|
|
4691
|
+
return;
|
|
4692
|
+
}
|
|
4608
4693
|
storeEvents = resolveTriggerEvents();
|
|
4609
4694
|
storeEvents.forEach(function (storeEvent) {
|
|
4610
4695
|
if (Array.isArray(storeEvent)) {
|
|
@@ -4613,11 +4698,18 @@ var popContainerId = "id_".concat(esm_browser_v4());
|
|
|
4613
4698
|
var content = storeEvent.content,
|
|
4614
4699
|
reference = storeEvent.reference;
|
|
4615
4700
|
addEventToTargetEl(elReference, reference);
|
|
4616
|
-
|
|
4701
|
+
// elContent 可能为 null(当 renderDirective = 'show' 且 Content 还未挂载时)
|
|
4702
|
+
if (elContent) {
|
|
4703
|
+
addEventToTargetEl(elContent, content);
|
|
4704
|
+
}
|
|
4617
4705
|
}
|
|
4618
4706
|
});
|
|
4619
4707
|
};
|
|
4620
4708
|
var addEventToTargetEl = function addEventToTargetEl(target, evets) {
|
|
4709
|
+
// 检查 target 是否存在,避免在 null 上调用 addEventListener
|
|
4710
|
+
if (!target) {
|
|
4711
|
+
return;
|
|
4712
|
+
}
|
|
4621
4713
|
evets.forEach(function (_ref2) {
|
|
4622
4714
|
var _ref3 = _slicedToArray(_ref2, 2),
|
|
4623
4715
|
event = _ref3[0],
|
|
@@ -4683,10 +4775,14 @@ var popContainerId = "id_".concat(esm_browser_v4());
|
|
|
4683
4775
|
var _fullScreenTarget$val;
|
|
4684
4776
|
var _ref10 = elReference || root || {},
|
|
4685
4777
|
parentNode = _ref10.parentNode;
|
|
4686
|
-
|
|
4778
|
+
var fullscreenBoundary = (_fullScreenTarget$val = fullScreenTarget === null || fullScreenTarget === void 0 ? void 0 : fullScreenTarget.value) !== null && _fullScreenTarget$val !== void 0 ? _fullScreenTarget$val : getClosestFullscreenElement(parentNode);
|
|
4779
|
+
// 确保 boundary 始终有一个有效值,避免 Teleport 的 to 属性为 undefined
|
|
4780
|
+
boundary.value = fullscreenBoundary || 'body';
|
|
4687
4781
|
return;
|
|
4688
4782
|
}
|
|
4689
|
-
|
|
4783
|
+
var resolvedBoundary = getPrefixId(root || elReference);
|
|
4784
|
+
// 确保 boundary 始终有一个有效值,避免 Teleport 的 to 属性为 undefined
|
|
4785
|
+
boundary.value = resolvedBoundary || 'body';
|
|
4690
4786
|
};
|
|
4691
4787
|
var _usePopperId = use_popper_id(props, '#'),
|
|
4692
4788
|
getPrefixId = _usePopperId.getPrefixId,
|
|
@@ -4702,7 +4798,8 @@ var popContainerId = "id_".concat(esm_browser_v4());
|
|
|
4702
4798
|
element === null || element === void 0 || element.removeAttribute('data-fllsrn-id');
|
|
4703
4799
|
});
|
|
4704
4800
|
};
|
|
4705
|
-
|
|
4801
|
+
// 初始化 boundary 为 'body',避免 Teleport 的 to 属性为 undefined
|
|
4802
|
+
var boundary = (0,external_vue_namespaceObject.ref)('body');
|
|
4706
4803
|
var beforeInstanceUnmount = function beforeInstanceUnmount() {
|
|
4707
4804
|
removeEventListener();
|
|
4708
4805
|
};
|
package/lib/popover/popover.d.ts
CHANGED
|
@@ -146,7 +146,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
146
146
|
default: boolean;
|
|
147
147
|
};
|
|
148
148
|
}, {
|
|
149
|
-
boundary: import("vue").Ref<
|
|
149
|
+
boundary: import("vue").Ref<string>;
|
|
150
150
|
arrow: boolean;
|
|
151
151
|
refDefaultReference: import("vue").Ref<any>;
|
|
152
152
|
refContent: import("vue").Ref<any>;
|
|
@@ -24,11 +24,11 @@ declare const _default: (props: PopoverPropTypes, ctx: any, { refReference, refC
|
|
|
24
24
|
};
|
|
25
25
|
isElementFullScreen: () => boolean;
|
|
26
26
|
resolveTargetElement: (target: any) => any;
|
|
27
|
-
createPopInstance: () => void;
|
|
27
|
+
createPopInstance: (retryCount?: number) => void;
|
|
28
28
|
updateFullscreenTarget: (val?: HTMLElement) => void;
|
|
29
29
|
getFullscreenRoot: (selector: any) => any;
|
|
30
30
|
stopHide: () => void;
|
|
31
31
|
localIsShow: import("vue").Ref<boolean>;
|
|
32
|
-
cleanup:
|
|
32
|
+
cleanup: () => void;
|
|
33
33
|
};
|
|
34
34
|
export default _default;
|
|
@@ -18,7 +18,7 @@ declare const _default: (props: any, ctx: any, { refReference, refContent, refAr
|
|
|
18
18
|
hideFn: () => void;
|
|
19
19
|
stopHide: () => void;
|
|
20
20
|
isFullscreen: import("vue").Ref<boolean>;
|
|
21
|
-
boundary: import("vue").Ref<
|
|
21
|
+
boundary: import("vue").Ref<string>;
|
|
22
22
|
localIsShow: import("vue").Ref<boolean>;
|
|
23
23
|
uniqKey: string;
|
|
24
24
|
};
|
package/lib/select/common.d.ts
CHANGED
|
@@ -11,7 +11,6 @@ export declare function useRegistry<T>(data: Ref<Map<PropertyKey, T>>): {
|
|
|
11
11
|
register: (key: string, item: T) => Map<PropertyKey, T>;
|
|
12
12
|
unregister: (key: string, item?: T) => void;
|
|
13
13
|
};
|
|
14
|
-
export declare function useDebouncedRef<T>(value: any, delay?: number): Ref<T>;
|
|
15
14
|
export declare function usePopover(config: IPopoverConfig, triggerRef: Ref<HTMLElement>): {
|
|
16
15
|
isPopoverShow: Ref<boolean>;
|
|
17
16
|
popperWidth: Ref<string | number>;
|