@gingkoo/pandora-metabase 1.0.83 → 1.0.85
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/lib/cjs/components/dialog/expression/index.js +1 -0
- package/lib/cjs/components/dialog/select-list/index.js +9 -3
- package/lib/cjs/components/popup.d.ts +1 -0
- package/lib/cjs/components/popup.js +37 -4
- package/lib/es/components/dialog/expression/index.js +1 -0
- package/lib/es/components/dialog/select-list/index.js +10 -4
- package/lib/es/components/popup.d.ts +1 -0
- package/lib/es/components/popup.js +37 -4
- package/package.json +1 -1
|
@@ -549,6 +549,7 @@ var SelectFilterColumn = function SelectFilterColumn(_ref) {
|
|
|
549
549
|
var options = firstVal ? firstVal.split(',') : [];
|
|
550
550
|
return (0, _jsxRuntime.jsx)("div", {
|
|
551
551
|
children: (0, _jsxRuntime.jsx)(_pandora.Select, {
|
|
552
|
+
maxWidth: '500px',
|
|
552
553
|
size: 'large',
|
|
553
554
|
placeholder: "\u53EF\u8F93\u5165\u56DE\u8F66\u65B0\u589E\u4E0B\u62C9\u9009\u9879",
|
|
554
555
|
allowCreate: true,
|
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports["default"] = void 0;
|
|
8
8
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
9
|
+
var _pandora = require("@gingkoo/pandora");
|
|
9
10
|
require("./index.less");
|
|
10
11
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
11
12
|
var SelectList = function SelectList(_ref) {
|
|
@@ -19,9 +20,14 @@ var SelectList = function SelectList(_ref) {
|
|
|
19
20
|
className = _ref$className === void 0 ? '' : _ref$className;
|
|
20
21
|
return (0, _jsxRuntime.jsx)("div", {
|
|
21
22
|
className: (0, _classnames["default"])("Sqb-SelectColumns--box ", className),
|
|
22
|
-
children: (0, _jsxRuntime.
|
|
23
|
+
children: (0, _jsxRuntime.jsxs)("div", {
|
|
23
24
|
className: 'p-2',
|
|
24
|
-
children: list.
|
|
25
|
+
children: [list.length === 0 && (0, _jsxRuntime.jsx)("div", {
|
|
26
|
+
className: 'Sqb-SelectColumns--empty',
|
|
27
|
+
children: (0, _jsxRuntime.jsx)(_pandora.Empty, {
|
|
28
|
+
content: '暂无数据'
|
|
29
|
+
})
|
|
30
|
+
}), list.map(function (v, i) {
|
|
25
31
|
return (0, _jsxRuntime.jsxs)("div", {
|
|
26
32
|
className: (0, _classnames["default"])("Sqb-List-item p-2", {
|
|
27
33
|
active: value === v.value,
|
|
@@ -32,7 +38,7 @@ var SelectList = function SelectList(_ref) {
|
|
|
32
38
|
},
|
|
33
39
|
children: [v.icon, v.label]
|
|
34
40
|
}, v.value);
|
|
35
|
-
})
|
|
41
|
+
})]
|
|
36
42
|
})
|
|
37
43
|
});
|
|
38
44
|
};
|
|
@@ -176,15 +176,24 @@ var TriggerInternal = /*#__PURE__*/function (_React$Component) {
|
|
|
176
176
|
var _this$props = _this.props,
|
|
177
177
|
node = _this$props.node,
|
|
178
178
|
_this$props$innerSpac = _this$props.innerSpacing,
|
|
179
|
-
innerSpacing = _this$props$innerSpac === void 0 ? 10 : _this$props$innerSpac
|
|
179
|
+
innerSpacing = _this$props$innerSpac === void 0 ? 10 : _this$props$innerSpac,
|
|
180
|
+
_this$props$outSpacin = _this$props.outSpacing,
|
|
181
|
+
outSpacing = _this$props$outSpacin === void 0 ? 5 : _this$props$outSpacin;
|
|
182
|
+
// 假设 outSpacing 也是 props 或者常量,这里保持与你原代码一致,若未定义请确保其存在
|
|
183
|
+
// const outSpacing = this.props.outSpacing || 0;
|
|
180
184
|
var rect = node.getBoundingClientRect();
|
|
185
|
+
// --- 垂直方向逻辑 (保持原样) ---
|
|
181
186
|
var triggerTop = rect.top + window.scrollY;
|
|
182
|
-
var triggerLeft = rect.left + window.scrollX;
|
|
187
|
+
var triggerLeft = rect.left + window.scrollX; // 基准左侧位置
|
|
183
188
|
var triggerHeight = rect.height;
|
|
184
189
|
var popupContent = _this.ref.current;
|
|
185
190
|
var realHeight = popupContent.scrollHeight;
|
|
191
|
+
// 获取弹窗的实际宽度,用于水平碰撞检测
|
|
192
|
+
// 注意:此时 popupContent 可能还没有被渲染到最终位置,但 scrollWidth 通常能反映内容宽度
|
|
193
|
+
var realWidth = popupContent.scrollWidth;
|
|
186
194
|
var _getWindowSize = (0, _helperDom.getWindowSize)(),
|
|
187
|
-
viewportHeight = _getWindowSize.height
|
|
195
|
+
viewportHeight = _getWindowSize.height,
|
|
196
|
+
viewportWidth = _getWindowSize.width;
|
|
188
197
|
var spaceBelow = viewportHeight - rect.bottom;
|
|
189
198
|
var spaceAbove = rect.top;
|
|
190
199
|
var topPosition;
|
|
@@ -196,8 +205,32 @@ var TriggerInternal = /*#__PURE__*/function (_React$Component) {
|
|
|
196
205
|
maxHeight = Math.min(realHeight, spaceAbove - innerSpacing - outSpacing);
|
|
197
206
|
topPosition = triggerTop - innerSpacing - maxHeight;
|
|
198
207
|
}
|
|
199
|
-
|
|
208
|
+
// --- 水平方向逻辑 (新增) ---
|
|
209
|
+
var leftPosition = triggerLeft;
|
|
210
|
+
// 1. 检查是否超出右侧边界
|
|
211
|
+
if (leftPosition + realWidth > viewportWidth) {
|
|
212
|
+
// 如果超出,尝试向左移动,使弹窗右边缘对齐屏幕右边缘
|
|
213
|
+
leftPosition = viewportWidth - realWidth;
|
|
214
|
+
}
|
|
215
|
+
// 2. 检查是否超出左侧边界 (兜底策略)
|
|
216
|
+
// 如果弹窗太宽,或者触发点太靠左导致上面的计算结果小于0
|
|
217
|
+
if (leftPosition < 0) {
|
|
218
|
+
leftPosition = 0;
|
|
219
|
+
// 可选:如果弹窗比屏幕还宽,你可能希望限制它的最大宽度为屏幕宽度
|
|
220
|
+
// 此时需要重新计算 realWidth 或者直接限制样式
|
|
221
|
+
// 这里我们通过 CSS 的 maxWidth 来配合,或者在这里强制限制 width
|
|
222
|
+
// 如果必须通过 JS 控制宽度:
|
|
223
|
+
// popupContent.style.width = `${viewportWidth}px`;
|
|
224
|
+
// leftPosition = 0;
|
|
225
|
+
}
|
|
226
|
+
// --- 应用样式 ---
|
|
227
|
+
// 使用 transform 进行定位
|
|
228
|
+
_this.popupContainer.style.transform = "translate(".concat(leftPosition, "px, ").concat(topPosition, "px)");
|
|
229
|
+
// 设置最大高度
|
|
200
230
|
popupContent.style.maxHeight = "".concat(maxHeight, "px");
|
|
231
|
+
// 【重要】为了防止第2步中弹窗过宽超出屏幕,建议同时限制 popupContent 的最大宽度
|
|
232
|
+
// 这样即使 leftPosition=0,内容也不会撑破屏幕
|
|
233
|
+
popupContent.style.maxWidth = "".concat(viewportWidth - outSpacing * 2, "px");
|
|
201
234
|
});
|
|
202
235
|
_this.state = {
|
|
203
236
|
popupRefreshKey: 1
|
|
@@ -540,6 +540,7 @@ var SelectFilterColumn = function SelectFilterColumn(_ref) {
|
|
|
540
540
|
var options = firstVal ? firstVal.split(',') : [];
|
|
541
541
|
return _jsx("div", {
|
|
542
542
|
children: _jsx(Select, {
|
|
543
|
+
maxWidth: '500px',
|
|
543
544
|
size: 'large',
|
|
544
545
|
placeholder: "\u53EF\u8F93\u5165\u56DE\u8F66\u65B0\u589E\u4E0B\u62C9\u9009\u9879",
|
|
545
546
|
allowCreate: true,
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Empty } from '@gingkoo/pandora';
|
|
2
3
|
import './index.less';
|
|
3
4
|
import cx from 'classnames';
|
|
4
5
|
var SelectList = function SelectList(_ref) {
|
|
@@ -12,9 +13,14 @@ var SelectList = function SelectList(_ref) {
|
|
|
12
13
|
className = _ref$className === void 0 ? '' : _ref$className;
|
|
13
14
|
return _jsx("div", {
|
|
14
15
|
className: cx("Sqb-SelectColumns--box ", className),
|
|
15
|
-
children:
|
|
16
|
+
children: _jsxs("div", {
|
|
16
17
|
className: 'p-2',
|
|
17
|
-
children: list.
|
|
18
|
+
children: [list.length === 0 && _jsx("div", {
|
|
19
|
+
className: 'Sqb-SelectColumns--empty',
|
|
20
|
+
children: _jsx(Empty, {
|
|
21
|
+
content: '暂无数据'
|
|
22
|
+
})
|
|
23
|
+
}), list.map(function (v, i) {
|
|
18
24
|
return _jsxs("div", {
|
|
19
25
|
className: cx("Sqb-List-item p-2", {
|
|
20
26
|
active: value === v.value,
|
|
@@ -25,7 +31,7 @@ var SelectList = function SelectList(_ref) {
|
|
|
25
31
|
},
|
|
26
32
|
children: [v.icon, v.label]
|
|
27
33
|
}, v.value);
|
|
28
|
-
})
|
|
34
|
+
})]
|
|
29
35
|
})
|
|
30
36
|
});
|
|
31
37
|
};
|
|
@@ -166,15 +166,24 @@ var TriggerInternal = /*#__PURE__*/function (_React$Component) {
|
|
|
166
166
|
var _this$props = _this.props,
|
|
167
167
|
node = _this$props.node,
|
|
168
168
|
_this$props$innerSpac = _this$props.innerSpacing,
|
|
169
|
-
innerSpacing = _this$props$innerSpac === void 0 ? 10 : _this$props$innerSpac
|
|
169
|
+
innerSpacing = _this$props$innerSpac === void 0 ? 10 : _this$props$innerSpac,
|
|
170
|
+
_this$props$outSpacin = _this$props.outSpacing,
|
|
171
|
+
outSpacing = _this$props$outSpacin === void 0 ? 5 : _this$props$outSpacin;
|
|
172
|
+
// 假设 outSpacing 也是 props 或者常量,这里保持与你原代码一致,若未定义请确保其存在
|
|
173
|
+
// const outSpacing = this.props.outSpacing || 0;
|
|
170
174
|
var rect = node.getBoundingClientRect();
|
|
175
|
+
// --- 垂直方向逻辑 (保持原样) ---
|
|
171
176
|
var triggerTop = rect.top + window.scrollY;
|
|
172
|
-
var triggerLeft = rect.left + window.scrollX;
|
|
177
|
+
var triggerLeft = rect.left + window.scrollX; // 基准左侧位置
|
|
173
178
|
var triggerHeight = rect.height;
|
|
174
179
|
var popupContent = _this.ref.current;
|
|
175
180
|
var realHeight = popupContent.scrollHeight;
|
|
181
|
+
// 获取弹窗的实际宽度,用于水平碰撞检测
|
|
182
|
+
// 注意:此时 popupContent 可能还没有被渲染到最终位置,但 scrollWidth 通常能反映内容宽度
|
|
183
|
+
var realWidth = popupContent.scrollWidth;
|
|
176
184
|
var _getWindowSize = getWindowSize(),
|
|
177
|
-
viewportHeight = _getWindowSize.height
|
|
185
|
+
viewportHeight = _getWindowSize.height,
|
|
186
|
+
viewportWidth = _getWindowSize.width;
|
|
178
187
|
var spaceBelow = viewportHeight - rect.bottom;
|
|
179
188
|
var spaceAbove = rect.top;
|
|
180
189
|
var topPosition;
|
|
@@ -186,8 +195,32 @@ var TriggerInternal = /*#__PURE__*/function (_React$Component) {
|
|
|
186
195
|
maxHeight = Math.min(realHeight, spaceAbove - innerSpacing - outSpacing);
|
|
187
196
|
topPosition = triggerTop - innerSpacing - maxHeight;
|
|
188
197
|
}
|
|
189
|
-
|
|
198
|
+
// --- 水平方向逻辑 (新增) ---
|
|
199
|
+
var leftPosition = triggerLeft;
|
|
200
|
+
// 1. 检查是否超出右侧边界
|
|
201
|
+
if (leftPosition + realWidth > viewportWidth) {
|
|
202
|
+
// 如果超出,尝试向左移动,使弹窗右边缘对齐屏幕右边缘
|
|
203
|
+
leftPosition = viewportWidth - realWidth;
|
|
204
|
+
}
|
|
205
|
+
// 2. 检查是否超出左侧边界 (兜底策略)
|
|
206
|
+
// 如果弹窗太宽,或者触发点太靠左导致上面的计算结果小于0
|
|
207
|
+
if (leftPosition < 0) {
|
|
208
|
+
leftPosition = 0;
|
|
209
|
+
// 可选:如果弹窗比屏幕还宽,你可能希望限制它的最大宽度为屏幕宽度
|
|
210
|
+
// 此时需要重新计算 realWidth 或者直接限制样式
|
|
211
|
+
// 这里我们通过 CSS 的 maxWidth 来配合,或者在这里强制限制 width
|
|
212
|
+
// 如果必须通过 JS 控制宽度:
|
|
213
|
+
// popupContent.style.width = `${viewportWidth}px`;
|
|
214
|
+
// leftPosition = 0;
|
|
215
|
+
}
|
|
216
|
+
// --- 应用样式 ---
|
|
217
|
+
// 使用 transform 进行定位
|
|
218
|
+
_this.popupContainer.style.transform = "translate(".concat(leftPosition, "px, ").concat(topPosition, "px)");
|
|
219
|
+
// 设置最大高度
|
|
190
220
|
popupContent.style.maxHeight = "".concat(maxHeight, "px");
|
|
221
|
+
// 【重要】为了防止第2步中弹窗过宽超出屏幕,建议同时限制 popupContent 的最大宽度
|
|
222
|
+
// 这样即使 leftPosition=0,内容也不会撑破屏幕
|
|
223
|
+
popupContent.style.maxWidth = "".concat(viewportWidth - outSpacing * 2, "px");
|
|
191
224
|
});
|
|
192
225
|
_this.state = {
|
|
193
226
|
popupRefreshKey: 1
|