raise-common-lib 0.0.215 → 0.0.216

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.
@@ -1076,57 +1076,10 @@ class FloatBoxComponent {
1076
1076
  * @return {?}
1077
1077
  */
1078
1078
  setFixedContentPosition() {
1079
- const { top: y, left: x, width, height, } = this.rootElement.nativeElement.getBoundingClientRect();
1080
- // 临时显示内容以获取尺寸
1081
- /** @type {?} */
1082
- const wasVisible = this.contentElement.nativeElement.style.display !== "none";
1083
- this.contentElement.nativeElement.style.visibility = "hidden";
1084
- this.contentElement.nativeElement.style.display = "block";
1085
- /** @type {?} */
1086
- const contentRect = this.contentElement.nativeElement.getBoundingClientRect();
1087
- /** @type {?} */
1088
- const contentWidth = contentRect.width;
1089
- /** @type {?} */
1090
- const contentHeight = contentRect.height;
1091
- // 获取视口尺寸
1092
- /** @type {?} */
1093
- const viewportWidth = window.innerWidth;
1094
- /** @type {?} */
1095
- const viewportHeight = window.innerHeight;
1096
- /** @type {?} */
1097
- const SAFE_MARGIN = 12;
1098
- // 边界检测:计算最佳 placement
1099
- /** @type {?} */
1100
- let finalPlacement = this.placement;
1101
- if (this.placement === "top" && y < contentHeight + SAFE_MARGIN) {
1102
- if (viewportHeight - (y + height) >= contentHeight + SAFE_MARGIN) {
1103
- finalPlacement = "bottom";
1104
- }
1105
- }
1106
- else if (this.placement === "bottom" && viewportHeight - (y + height) < contentHeight + SAFE_MARGIN) {
1107
- if (y >= contentHeight + SAFE_MARGIN) {
1108
- finalPlacement = "top";
1109
- }
1110
- }
1111
- else if (this.placement === "left" && x < contentWidth + SAFE_MARGIN) {
1112
- if (viewportWidth - (x + width) >= contentWidth + SAFE_MARGIN) {
1113
- finalPlacement = "right";
1114
- }
1115
- }
1116
- else if (this.placement === "right" && viewportWidth - (x + width) < contentWidth + SAFE_MARGIN) {
1117
- if (x >= contentWidth + SAFE_MARGIN) {
1118
- finalPlacement = "left";
1119
- }
1120
- }
1121
- // 保存调整后的 placement
1122
- this.actualPlacement = finalPlacement;
1123
- // 对于 fixed="no" 的情况,只更新 data-placement,让 CSS 处理
1124
1079
  if (this.fixed === "no") {
1125
- this.contentElement.nativeElement.style.visibility = "";
1126
- this.contentElement.nativeElement.style.display = wasVisible ? "" : "none";
1127
1080
  return;
1128
1081
  }
1129
- // 对于 fixed="yes" 的情况,计算具体位置
1082
+ const { top: y, left: x, width, height, } = this.rootElement.nativeElement.getBoundingClientRect();
1130
1083
  /** @type {?} */
1131
1084
  let top = "0";
1132
1085
  /** @type {?} */
@@ -1135,7 +1088,7 @@ class FloatBoxComponent {
1135
1088
  let translateX = "0";
1136
1089
  /** @type {?} */
1137
1090
  let translateY = "0";
1138
- switch (finalPlacement + "_" + this.position) {
1091
+ switch (this.placement + "_" + this.position) {
1139
1092
  case "top_start":
1140
1093
  top = y + "px";
1141
1094
  left = x - 8 + "px";
@@ -1199,49 +1152,9 @@ class FloatBoxComponent {
1199
1152
  translateX = "-100%";
1200
1153
  break;
1201
1154
  }
1202
- // 计算实际渲染位置(考虑 transform)进行边界调整
1203
- /** @type {?} */
1204
- let actualLeft = parseFloat(left) || 0;
1205
- /** @type {?} */
1206
- let actualTop = parseFloat(top) || 0;
1207
- if (translateX === "-50%") {
1208
- actualLeft = actualLeft - contentWidth / 2;
1209
- }
1210
- else if (translateX === "-100%") {
1211
- actualLeft = actualLeft - contentWidth;
1212
- }
1213
- if (translateY === "-50%") {
1214
- actualTop = actualTop - contentHeight / 2;
1215
- }
1216
- else if (translateY === "-100%") {
1217
- actualTop = actualTop - contentHeight;
1218
- }
1219
- // 水平边界调整
1220
- if (finalPlacement === "top" || finalPlacement === "bottom") {
1221
- if (actualLeft < SAFE_MARGIN) {
1222
- left = (x + SAFE_MARGIN) + "px";
1223
- translateX = "0";
1224
- }
1225
- else if (actualLeft + contentWidth > viewportWidth - SAFE_MARGIN) {
1226
- left = (viewportWidth - contentWidth - SAFE_MARGIN) + "px";
1227
- translateX = "0";
1228
- }
1229
- }
1230
- // 垂直边界调整
1231
- else {
1232
- if (actualTop < SAFE_MARGIN) {
1233
- top = (y + SAFE_MARGIN) + "px";
1234
- translateY = "0";
1235
- }
1236
- else if (actualTop + contentHeight > viewportHeight - SAFE_MARGIN) {
1237
- top = (viewportHeight - contentHeight - SAFE_MARGIN) + "px";
1238
- translateY = "0";
1239
- }
1240
- }
1241
1155
  this.contentElement.nativeElement.style.top = top;
1242
1156
  this.contentElement.nativeElement.style.left = left;
1243
1157
  this.contentElement.nativeElement.style.transform = `translate(${translateX}, ${translateY})`;
1244
- this.contentElement.nativeElement.style.visibility = "visible";
1245
1158
  }
1246
1159
  /**
1247
1160
  * @return {?}
@@ -1259,15 +1172,13 @@ class FloatBoxComponent {
1259
1172
  * @return {?}
1260
1173
  */
1261
1174
  onMouseEnter() {
1262
- if (this.trigger !== "hover") {
1175
+ if (this.fixed === "no" || this.trigger !== "hover") {
1263
1176
  return;
1264
1177
  }
1265
1178
  this.opened = "yes";
1266
1179
  this.openChange.emit(true);
1267
1180
  this.setFixedContentPosition();
1268
- if (this.fixed === "yes") {
1269
- window.addEventListener("mousemove", this.onMoveOutside);
1270
- }
1181
+ window.addEventListener("mousemove", this.onMoveOutside);
1271
1182
  }
1272
1183
  /**
1273
1184
  * @return {?}
@@ -1287,7 +1198,7 @@ class FloatBoxComponent {
1287
1198
  FloatBoxComponent.decorators = [
1288
1199
  { type: Component, args: [{
1289
1200
  selector: "rs-float-box",
1290
- template: "<div\r\n #element\r\n class=\"float-box-container\"\r\n [attr.data-trigger]=\"trigger\"\r\n (click)=\"onClickContainer()\"\r\n (mouseenter)=\"onMouseEnter()\"\r\n>\r\n <ng-content></ng-content>\r\n <div\r\n #content\r\n class=\"float-box-content\"\r\n [attr.data-placement]=\"actualPlacement || placement\"\r\n [attr.data-position]=\"position\"\r\n [attr.data-animation]=\"animation\"\r\n [attr.data-fixed]=\"fixed\"\r\n [attr.data-opened]=\"opened\"\r\n >\r\n <div class=\"float-box-show-content\">\r\n <ng-content select=\"[float-content]\"></ng-content>\r\n </div>\r\n </div>\r\n</div>\r\n",
1201
+ template: "<div\r\n #element\r\n class=\"float-box-container\"\r\n [attr.data-trigger]=\"trigger\"\r\n (click)=\"onClickContainer()\"\r\n (mouseenter)=\"onMouseEnter()\"\r\n>\r\n <ng-content></ng-content>\r\n <div\r\n #content\r\n class=\"float-box-content\"\r\n [attr.data-placement]=\"placement\"\r\n [attr.data-position]=\"position\"\r\n [attr.data-animation]=\"animation\"\r\n [attr.data-fixed]=\"fixed\"\r\n [attr.data-opened]=\"opened\"\r\n >\r\n <div class=\"float-box-show-content\">\r\n <ng-content select=\"[float-content]\"></ng-content>\r\n </div>\r\n </div>\r\n</div>\r\n",
1291
1202
  styles: [".float-box-container{position:relative}.float-box-container[data-trigger=click]>.float-box-content[data-opened=no],.float-box-container[data-trigger=hover]:not(:hover)>.float-box-content{display:none}.float-box-container>.float-box-content[data-fixed=no]{padding:8px;--top:0;--left:0;--translate-x:0;--translate-y:0;position:absolute;top:var(--top);left:var(--left);transform:translate(var(--translate-x),var(--translate-y));z-index:10}.float-box-container>.float-box-content[data-fixed=no][data-animation=yes]{-webkit-animation:.25s ease-in-out;animation:.25s ease-in-out}.float-box-container>.float-box-content[data-fixed=no][data-placement=top]{--translate-y:-100%}.float-box-container>.float-box-content[data-fixed=no][data-placement=top][data-animation=true]{-webkit-animation-name:open-from-top;animation-name:open-from-top}.float-box-container>.float-box-content[data-fixed=no][data-placement=left]{--translate-x:-100%}.float-box-container>.float-box-content[data-fixed=no][data-placement=right]{--left:100%}.float-box-container>.float-box-content[data-fixed=no][data-placement=bottom]{--top:100%}.float-box-container>.float-box-content[data-fixed=no][data-placement=bottom][data-animation=yes]{-webkit-animation-name:open-from-bottom;animation-name:open-from-bottom}.float-box-container>.float-box-content[data-fixed=no][data-placement=bottom][data-position=start],.float-box-container>.float-box-content[data-fixed=no][data-placement=top][data-position=start]{--left:-8px}.float-box-container>.float-box-content[data-fixed=no][data-placement=bottom][data-position=center],.float-box-container>.float-box-content[data-fixed=no][data-placement=top][data-position=center]{--left:50%;--translate-x:-50%}.float-box-container>.float-box-content[data-fixed=no][data-placement=bottom][data-position=end],.float-box-container>.float-box-content[data-fixed=no][data-placement=top][data-position=end]{--left:calc(100% + 8px);--translate-x:-100%}.float-box-container>.float-box-content[data-fixed=no][data-placement=left][data-position=start],.float-box-container>.float-box-content[data-fixed=no][data-placement=right][data-position=start]{--top:-8px}.float-box-container>.float-box-content[data-fixed=no][data-placement=left][data-position=start][data-animation=yes],.float-box-container>.float-box-content[data-fixed=no][data-placement=right][data-position=start][data-animation=yes]{-webkit-animation-name:open-from-bottom;animation-name:open-from-bottom}.float-box-container>.float-box-content[data-fixed=no][data-placement=left][data-position=center],.float-box-container>.float-box-content[data-fixed=no][data-placement=right][data-position=center]{--top:50%;--translate-y:-50%}.float-box-container>.float-box-content[data-fixed=no][data-placement=left][data-position=center][data-animation=yes],.float-box-container>.float-box-content[data-fixed=no][data-placement=right][data-position=center][data-animation=yes]{-webkit-animation-name:open-from-bottom;animation-name:open-from-bottom}.float-box-container>.float-box-content[data-fixed=no][data-placement=left][data-position=end],.float-box-container>.float-box-content[data-fixed=no][data-placement=right][data-position=end]{--top:calc(100% + 8px);--translate-y:-100%}.float-box-container>.float-box-content[data-fixed=no][data-placement=left][data-position=end][data-animation=yes],.float-box-container>.float-box-content[data-fixed=no][data-placement=right][data-position=end][data-animation=yes]{-webkit-animation-name:open-from-top;animation-name:open-from-top}@-webkit-keyframes open-from-top{from{margin-top:-8px;opacity:.4}to{margin:0;opacity:1}}@keyframes open-from-top{from{margin-top:-8px;opacity:.4}to{margin:0;opacity:1}}@-webkit-keyframes open-from-bottom{from{margin-top:8px;opacity:.4}to{margin:0;opacity:1}}@keyframes open-from-bottom{from{margin-top:8px;opacity:.4}to{margin:0;opacity:1}}::ng-deep #kt-float-box-fixed-container{width:0;height:0;z-index:100000}::ng-deep #kt-float-box-fixed-container .float-box-content[data-fixed=yes]{padding:8px;position:fixed;z-index:10}::ng-deep #kt-float-box-fixed-container .float-box-content[data-fixed=yes][data-opened=no]{display:none}.float-box-show-content{padding:8px 8px 12px;border-radius:8px;background:#fff;box-shadow:0 0 8px 0 rgba(0,0,0,.25)}"]
1292
1203
  }] }
1293
1204
  ];
@@ -1317,8 +1228,6 @@ if (false) {
1317
1228
  /** @type {?} */
1318
1229
  FloatBoxComponent.prototype._fixed;
1319
1230
  /** @type {?} */
1320
- FloatBoxComponent.prototype.actualPlacement;
1321
- /** @type {?} */
1322
1231
  FloatBoxComponent.prototype.openChange;
1323
1232
  /** @type {?} */
1324
1233
  FloatBoxComponent.prototype.rootElement;