funda-ui 4.7.517 → 4.7.533
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/CascadingSelect/index.css +105 -88
- package/CascadingSelect/index.js +25 -24
- package/CascadingSelectE2E/index.css +105 -88
- package/CascadingSelectE2E/index.js +26 -25
- package/Date/index.js +3 -1
- package/DropdownMenu/index.js +3 -1
- package/LiveSearch/index.js +2 -1
- package/Select/index.d.ts +1 -0
- package/Select/index.js +70 -14
- package/Tooltip/index.css +69 -68
- package/Tooltip/index.d.ts +15 -1
- package/Tooltip/index.js +153 -57
- package/lib/cjs/CascadingSelect/index.js +25 -24
- package/lib/cjs/CascadingSelectE2E/index.js +26 -25
- package/lib/cjs/Date/index.js +3 -1
- package/lib/cjs/DropdownMenu/index.js +3 -1
- package/lib/cjs/LiveSearch/index.js +2 -1
- package/lib/cjs/Select/index.d.ts +1 -0
- package/lib/cjs/Select/index.js +70 -14
- package/lib/cjs/Tooltip/index.d.ts +15 -1
- package/lib/cjs/Tooltip/index.js +153 -57
- package/lib/css/CascadingSelect/index.css +105 -88
- package/lib/css/CascadingSelectE2E/index.css +105 -88
- package/lib/css/Tooltip/index.css +69 -68
- package/lib/esm/CascadingSelect/Group.tsx +3 -5
- package/lib/esm/CascadingSelect/index.scss +89 -68
- package/lib/esm/CascadingSelect/index.tsx +23 -21
- package/lib/esm/CascadingSelectE2E/Group.tsx +4 -3
- package/lib/esm/CascadingSelectE2E/index.scss +83 -63
- package/lib/esm/CascadingSelectE2E/index.tsx +24 -22
- package/lib/esm/Date/index.tsx +4 -1
- package/lib/esm/DropdownMenu/index.tsx +2 -1
- package/lib/esm/LiveSearch/index.tsx +2 -1
- package/lib/esm/Select/index.tsx +75 -17
- package/lib/esm/Tooltip/index.scss +63 -60
- package/lib/esm/Tooltip/index.tsx +143 -44
- package/package.json +1 -1
|
@@ -2540,7 +2540,7 @@ function Group(props) {
|
|
|
2540
2540
|
"data-value": JSON.stringify(item),
|
|
2541
2541
|
"data-level": level,
|
|
2542
2542
|
"data-query": item.queryId,
|
|
2543
|
-
className: (0,cls.combinedCls)('casc-
|
|
2543
|
+
className: (0,cls.combinedCls)('casc-menu-e2e__opt', {
|
|
2544
2544
|
'active': item.current
|
|
2545
2545
|
}),
|
|
2546
2546
|
dangerouslySetInnerHTML: {
|
|
@@ -2554,13 +2554,13 @@ function Group(props) {
|
|
|
2554
2554
|
} else {
|
|
2555
2555
|
return columnTitle[level] === '' || perColumnHeadersShow === false ? null : /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("h3", {
|
|
2556
2556
|
key: index,
|
|
2557
|
-
className: "casc-
|
|
2557
|
+
className: "casc-menu-e2e__opt-header"
|
|
2558
2558
|
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("span", {
|
|
2559
2559
|
dangerouslySetInnerHTML: {
|
|
2560
2560
|
__html: columnTitle[level]
|
|
2561
2561
|
}
|
|
2562
2562
|
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
|
|
2563
|
-
className: "casc-
|
|
2563
|
+
className: "casc-menu-e2e__opt-header__clean"
|
|
2564
2564
|
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("a", {
|
|
2565
2565
|
tabIndex: -1,
|
|
2566
2566
|
href: "#",
|
|
@@ -2679,6 +2679,7 @@ var CascadingSelectE2E = /*#__PURE__*/(0,external_root_React_commonjs2_react_com
|
|
|
2679
2679
|
var rootRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(null);
|
|
2680
2680
|
var inputRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(null);
|
|
2681
2681
|
var listRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(null);
|
|
2682
|
+
var MIN_SPACE_FOR_DROPDOWN = 200; // Minimum space needed to show dropdown below trigger
|
|
2682
2683
|
|
|
2683
2684
|
// searchable
|
|
2684
2685
|
var _useState = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)([]),
|
|
@@ -2798,7 +2799,7 @@ var CascadingSelectE2E = /*#__PURE__*/(0,external_root_React_commonjs2_react_com
|
|
|
2798
2799
|
if (rootRef.current === null || inputRef.current === null) return;
|
|
2799
2800
|
|
|
2800
2801
|
// update modal position
|
|
2801
|
-
var _modalRef = document.querySelector("#casc-
|
|
2802
|
+
var _modalRef = document.querySelector("#casc-menu-e2e__items-wrapper-".concat(idRes));
|
|
2802
2803
|
var _triggerRef = inputRef.current;
|
|
2803
2804
|
|
|
2804
2805
|
// console.log(getAbsolutePositionOfStage(_triggerRef));
|
|
@@ -2821,7 +2822,7 @@ var CascadingSelectE2E = /*#__PURE__*/(0,external_root_React_commonjs2_react_com
|
|
|
2821
2822
|
// STEP 2:
|
|
2822
2823
|
//-----------
|
|
2823
2824
|
// Detect position
|
|
2824
|
-
if (window.innerHeight - _triggerBox.top >
|
|
2825
|
+
if (window.innerHeight - _triggerBox.top > MIN_SPACE_FOR_DROPDOWN) {
|
|
2825
2826
|
targetPos = 'bottom';
|
|
2826
2827
|
} else {
|
|
2827
2828
|
targetPos = 'top';
|
|
@@ -2870,7 +2871,7 @@ var CascadingSelectE2E = /*#__PURE__*/(0,external_root_React_commonjs2_react_com
|
|
|
2870
2871
|
}
|
|
2871
2872
|
|
|
2872
2873
|
function popwinPosHide() {
|
|
2873
|
-
var _modalRef = document.querySelector("#casc-
|
|
2874
|
+
var _modalRef = document.querySelector("#casc-menu-e2e__items-wrapper-".concat(idRes));
|
|
2874
2875
|
if (_modalRef !== null) {
|
|
2875
2876
|
// remove classnames and styles
|
|
2876
2877
|
_modalRef.classList.remove('active');
|
|
@@ -2881,9 +2882,9 @@ var CascadingSelectE2E = /*#__PURE__*/(0,external_root_React_commonjs2_react_com
|
|
|
2881
2882
|
var level = arguments.length > 2 ? arguments[2] : undefined;
|
|
2882
2883
|
if (listRef.current === null) return;
|
|
2883
2884
|
var latestDisplayColIndex = 0;
|
|
2884
|
-
var currentItemsInner = listRef.current.querySelector('.casc-
|
|
2885
|
+
var currentItemsInner = listRef.current.querySelector('.casc-menu-e2e__items-inner');
|
|
2885
2886
|
if (currentItemsInner !== null) {
|
|
2886
|
-
var colItemsWrapper = [].slice.call(currentItemsInner.querySelectorAll('.casc-
|
|
2887
|
+
var colItemsWrapper = [].slice.call(currentItemsInner.querySelectorAll('.casc-menu-e2e__items-col'));
|
|
2887
2888
|
colItemsWrapper.forEach(function (perCol) {
|
|
2888
2889
|
perCol.classList.remove('hide-col');
|
|
2889
2890
|
});
|
|
@@ -3204,10 +3205,10 @@ var CascadingSelectE2E = /*#__PURE__*/(0,external_root_React_commonjs2_react_com
|
|
|
3204
3205
|
|
|
3205
3206
|
// active current option with DOM
|
|
3206
3207
|
//////////////////////////////////////////
|
|
3207
|
-
var currentItemsInner = e.currentTarget.closest('.casc-
|
|
3208
|
+
var currentItemsInner = e.currentTarget.closest('.casc-menu-e2e__items-inner');
|
|
3208
3209
|
if (currentItemsInner !== null) {
|
|
3209
3210
|
curData.forEach(function (v, col) {
|
|
3210
|
-
var colItemsWrapper = currentItemsInner.querySelectorAll('.casc-
|
|
3211
|
+
var colItemsWrapper = currentItemsInner.querySelectorAll('.casc-menu-e2e__items-col');
|
|
3211
3212
|
colItemsWrapper.forEach(function (perCol) {
|
|
3212
3213
|
var _col = Number(perCol.dataset.col);
|
|
3213
3214
|
if (_col >= level) {
|
|
@@ -3743,9 +3744,9 @@ var CascadingSelectE2E = /*#__PURE__*/(0,external_root_React_commonjs2_react_com
|
|
|
3743
3744
|
};
|
|
3744
3745
|
}, []);
|
|
3745
3746
|
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement((external_root_React_commonjs2_react_commonjs_react_amd_react_default()).Fragment, null, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
|
|
3746
|
-
className: (0,cls.clsWrite)(wrapperClassName, 'casc-
|
|
3747
|
+
className: (0,cls.clsWrite)(wrapperClassName, 'casc-menu-e2e__wrapper mb-3 position-relative', "casc-menu-e2e__wrapper ".concat(wrapperClassName)),
|
|
3747
3748
|
ref: rootRef,
|
|
3748
|
-
"data-overlay-id": "casc-
|
|
3749
|
+
"data-overlay-id": "casc-menu-e2e__items-wrapper-".concat(idRes)
|
|
3749
3750
|
}, label ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement((external_root_React_commonjs2_react_commonjs_react_amd_react_default()).Fragment, null, typeof label === 'string' ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("label", {
|
|
3750
3751
|
htmlFor: idRes,
|
|
3751
3752
|
className: "form-label",
|
|
@@ -3756,23 +3757,23 @@ var CascadingSelectE2E = /*#__PURE__*/(0,external_root_React_commonjs2_react_com
|
|
|
3756
3757
|
htmlFor: idRes,
|
|
3757
3758
|
className: "form-label"
|
|
3758
3759
|
}, label)) : null, triggerContent ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement((external_root_React_commonjs2_react_commonjs_react_amd_react_default()).Fragment, null, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
|
|
3759
|
-
className: (0,cls.clsWrite)(triggerClassName, 'casc-
|
|
3760
|
+
className: (0,cls.clsWrite)(triggerClassName, 'casc-menu-e2e__trigger d-inline w-auto', "casc-menu-e2e__trigger ".concat(triggerClassName)),
|
|
3760
3761
|
onClick: handleDisplayOptions
|
|
3761
3762
|
}, triggerContent)) : null, !hasErr ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement((cjs_default()), {
|
|
3762
3763
|
show: true,
|
|
3763
3764
|
containerClassName: "CascadingSelectE2E"
|
|
3764
3765
|
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
|
|
3765
3766
|
ref: listRef,
|
|
3766
|
-
id: "casc-
|
|
3767
|
-
className: "casc-
|
|
3767
|
+
id: "casc-menu-e2e__items-wrapper-".concat(idRes),
|
|
3768
|
+
className: "casc-menu-e2e__items-wrapper position-absolute border shadow small",
|
|
3768
3769
|
style: {
|
|
3769
3770
|
zIndex: DEPTH,
|
|
3770
3771
|
display: 'none'
|
|
3771
3772
|
}
|
|
3772
3773
|
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("ul", {
|
|
3773
|
-
className: "casc-
|
|
3774
|
+
className: "casc-menu-e2e__items-inner"
|
|
3774
3775
|
}, loading ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement((external_root_React_commonjs2_react_commonjs_react_amd_react_default()).Fragment, null, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
|
|
3775
|
-
className: "casc-
|
|
3776
|
+
className: "casc-menu-e2e__items-loader"
|
|
3776
3777
|
}, loader || /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("svg", {
|
|
3777
3778
|
height: "12px",
|
|
3778
3779
|
width: "12px",
|
|
@@ -3808,7 +3809,7 @@ var CascadingSelectE2E = /*#__PURE__*/(0,external_root_React_commonjs2_react_com
|
|
|
3808
3809
|
e.preventDefault();
|
|
3809
3810
|
cancel();
|
|
3810
3811
|
},
|
|
3811
|
-
className: "casc-
|
|
3812
|
+
className: "casc-menu-e2e__close position-absolute top-0 end-0 mt-0 mx-1"
|
|
3812
3813
|
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("svg", {
|
|
3813
3814
|
width: "10px",
|
|
3814
3815
|
height: "10px",
|
|
@@ -3829,9 +3830,9 @@ var CascadingSelectE2E = /*#__PURE__*/(0,external_root_React_commonjs2_react_com
|
|
|
3829
3830
|
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("li", {
|
|
3830
3831
|
key: level,
|
|
3831
3832
|
"data-col": level,
|
|
3832
|
-
className: "casc-
|
|
3833
|
+
className: "casc-menu-e2e__items-col"
|
|
3833
3834
|
}, searchable && /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
|
|
3834
|
-
className: "casc-
|
|
3835
|
+
className: "casc-menu-e2e__items-col-searchbox"
|
|
3835
3836
|
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("input", {
|
|
3836
3837
|
type: "text",
|
|
3837
3838
|
placeholder: searchPlaceholder,
|
|
@@ -3857,7 +3858,7 @@ var CascadingSelectE2E = /*#__PURE__*/(0,external_root_React_commonjs2_react_com
|
|
|
3857
3858
|
return null;
|
|
3858
3859
|
}
|
|
3859
3860
|
})))) : null, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
|
|
3860
|
-
className: (0,cls.combinedCls)('casc-
|
|
3861
|
+
className: (0,cls.combinedCls)('casc-menu-e2e__val', {
|
|
3861
3862
|
'inputable': inputable
|
|
3862
3863
|
}),
|
|
3863
3864
|
onClick: handleDisplayOptions
|
|
@@ -3880,7 +3881,7 @@ var CascadingSelectE2E = /*#__PURE__*/(0,external_root_React_commonjs2_react_com
|
|
|
3880
3881
|
}
|
|
3881
3882
|
},
|
|
3882
3883
|
id: idRes,
|
|
3883
|
-
"data-overlay-id": "casc-
|
|
3884
|
+
"data-overlay-id": "casc-menu-e2e__items-wrapper-".concat(idRes),
|
|
3884
3885
|
name: name,
|
|
3885
3886
|
className: (0,cls.combinedCls)((0,cls.clsWrite)(controlClassName, 'form-control'), controlExClassName, {
|
|
3886
3887
|
'rounded': !propExist(iconLeft) && !propExist(iconRight) && !propExist(units),
|
|
@@ -3938,9 +3939,9 @@ var CascadingSelectE2E = /*#__PURE__*/(0,external_root_React_commonjs2_react_com
|
|
|
3938
3939
|
}
|
|
3939
3940
|
} : undefined
|
|
3940
3941
|
}, attributes)), destroyParentIdMatch ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement((external_root_React_commonjs2_react_commonjs_react_amd_react_default()).Fragment, null, !inputable ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
|
|
3941
|
-
className: "casc-
|
|
3942
|
+
className: "casc-menu-e2e__result"
|
|
3942
3943
|
}, displayInfo(true)) : null) : /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement((external_root_React_commonjs2_react_commonjs_react_amd_react_default()).Fragment, null, !inputable ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
|
|
3943
|
-
className: "casc-
|
|
3944
|
+
className: "casc-menu-e2e__result"
|
|
3944
3945
|
}, displayInfo(false)) : null), required ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement((external_root_React_commonjs2_react_commonjs_react_amd_react_default()).Fragment, null, requiredLabel || requiredLabel === '' ? requiredLabel : /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("span", {
|
|
3945
3946
|
className: "position-absolute end-0 top-0 my-2 mx-2 pe-3"
|
|
3946
3947
|
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("span", {
|
|
@@ -3950,7 +3951,7 @@ var CascadingSelectE2E = /*#__PURE__*/(0,external_root_React_commonjs2_react_com
|
|
|
3950
3951
|
}, units)) : null, propExist(iconRight) ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement((external_root_React_commonjs2_react_commonjs_react_amd_react_default()).Fragment, null, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("span", {
|
|
3951
3952
|
className: (0,cls.clsWrite)(controlGroupTextClassName, 'input-group-text')
|
|
3952
3953
|
}, iconRight)) : null), isShow ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
|
|
3953
|
-
className: "casc-
|
|
3954
|
+
className: "casc-menu-e2e__closemask",
|
|
3954
3955
|
onClick: function onClick(e) {
|
|
3955
3956
|
e.preventDefault();
|
|
3956
3957
|
cancel();
|
package/lib/cjs/Date/index.js
CHANGED
|
@@ -5034,6 +5034,8 @@ var src_Date = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_reac
|
|
|
5034
5034
|
langToday = props.langToday,
|
|
5035
5035
|
attributes = _objectWithoutProperties(props, _excluded);
|
|
5036
5036
|
var DEPTH = depth || 1055; // the default value same as bootstrap
|
|
5037
|
+
var MIN_SPACE_FOR_DROPDOWN = 200; // Minimum space needed to show dropdown below trigger
|
|
5038
|
+
|
|
5037
5039
|
var defaultValueIsEmpty = function defaultValueIsEmpty(s) {
|
|
5038
5040
|
return typeof s === 'undefined' || s === null || s === 'null' || s === '';
|
|
5039
5041
|
};
|
|
@@ -5328,7 +5330,7 @@ var src_Date = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_reac
|
|
|
5328
5330
|
// STEP 1:
|
|
5329
5331
|
//-----------
|
|
5330
5332
|
// Detect position
|
|
5331
|
-
if (window.innerHeight - _triggerBox.top >
|
|
5333
|
+
if (window.innerHeight - _triggerBox.top > MIN_SPACE_FOR_DROPDOWN) {
|
|
5332
5334
|
targetPos = 'bottom';
|
|
5333
5335
|
} else {
|
|
5334
5336
|
targetPos = 'top';
|
|
@@ -1285,6 +1285,8 @@ var DropdownMenu = function DropdownMenu(props) {
|
|
|
1285
1285
|
selected = _useState4[0],
|
|
1286
1286
|
setSelected = _useState4[1];
|
|
1287
1287
|
var _hoverDelay = !isNaN(hoverDelay) && typeof hoverDelay !== 'undefined' ? hoverDelay : 150;
|
|
1288
|
+
var MIN_SPACE_FOR_DROPDOWN = 200; // Minimum space needed to show dropdown below trigger
|
|
1289
|
+
|
|
1288
1290
|
var defaultLabel = triggerContent === undefined ? '' : triggerContent;
|
|
1289
1291
|
var selectedLabel = triggerSwitchActive ? selected ? selected.label : defaultLabel : defaultLabel;
|
|
1290
1292
|
var selectOptionsListPresentation = options === null || options === void 0 ? void 0 : options.map(function (selectOption, index) {
|
|
@@ -1375,7 +1377,7 @@ var DropdownMenu = function DropdownMenu(props) {
|
|
|
1375
1377
|
// STEP 2:
|
|
1376
1378
|
//-----------
|
|
1377
1379
|
// Detect position
|
|
1378
|
-
if (window.innerHeight - _triggerBox.top >
|
|
1380
|
+
if (window.innerHeight - _triggerBox.top > MIN_SPACE_FOR_DROPDOWN) {
|
|
1379
1381
|
targetPos = 'bottom';
|
|
1380
1382
|
} else {
|
|
1381
1383
|
targetPos = 'top';
|
|
@@ -2892,6 +2892,7 @@ var LiveSearch = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.forwardRef)(
|
|
|
2892
2892
|
var EXCEEDED_SIDE_POS_OFFSET = Number(exceededSidePosOffset) || 15;
|
|
2893
2893
|
var AUTO_SHOW_OPTIONS = typeof autoShowOptions !== 'undefined' && autoShowOptions === true ? true : false;
|
|
2894
2894
|
var MANUAL_REQ = typeof fetchTrigger !== 'undefined' && fetchTrigger === true ? true : false; // Manual requests
|
|
2895
|
+
var MIN_SPACE_FOR_DROPDOWN = 200; // Minimum space needed to show dropdown below trigger
|
|
2895
2896
|
|
|
2896
2897
|
var NO_MATCH_POPUP = typeof noMatchPopup === 'undefined' ? true : noMatchPopup;
|
|
2897
2898
|
var WIN_WIDTH = typeof winWidth === 'function' ? winWidth() : winWidth ? winWidth : 'auto';
|
|
@@ -3052,7 +3053,7 @@ var LiveSearch = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.forwardRef)(
|
|
|
3052
3053
|
// STEP 2:
|
|
3053
3054
|
//-----------
|
|
3054
3055
|
// Detect position
|
|
3055
|
-
if (window.innerHeight - _triggerBox.top >
|
|
3056
|
+
if (window.innerHeight - _triggerBox.top > MIN_SPACE_FOR_DROPDOWN) {
|
|
3056
3057
|
targetPos = 'bottom';
|
|
3057
3058
|
} else {
|
|
3058
3059
|
targetPos = 'top';
|
|
@@ -47,6 +47,7 @@ export declare type SelectProps = {
|
|
|
47
47
|
controlClassName?: string;
|
|
48
48
|
controlExClassName?: string;
|
|
49
49
|
optionsExClassName?: string;
|
|
50
|
+
customScrollContainer?: string | HTMLElement | React.RefObject<HTMLElement>;
|
|
50
51
|
exceededSidePosOffset?: number;
|
|
51
52
|
clearIcon?: boolean;
|
|
52
53
|
renderOption?: (optionData: OptionConfig, index: number) => React.ReactNode;
|
package/lib/cjs/Select/index.js
CHANGED
|
@@ -3578,7 +3578,7 @@ var format_string = __webpack_require__(933);
|
|
|
3578
3578
|
// EXTERNAL MODULE: ../Utils/dist/cjs/cls.js
|
|
3579
3579
|
var cls = __webpack_require__(188);
|
|
3580
3580
|
;// CONCATENATED MODULE: ./src/index.tsx
|
|
3581
|
-
var _excluded = ["contentRef", "popupRef", "wrapperClassName", "controlClassName", "controlExClassName", "optionsExClassName", "exceededSidePosOffset", "clearIcon", "renderOption", "multiSelect", "multiSelectEntireAreaTrigger", "multiSelectSelectedItemOnlyStatus", "renderSelectedValue", "disabled", "required", "defaultValue", "value", "label", "name", "readOnly", "placeholder", "id", "autoComplete", "autoCapitalize", "spellCheck", "options", "clearTrigger", "loader", "lockBodyScroll", "hierarchical", "indentation", "doubleIndent", "style", "depth", "controlArrow", "winWidth", "tabIndex", "firstRequestAutoExec", "fetchTrigger", "fetchNoneInfo", "fetchUpdate", "fetchFuncAsync", "fetchFuncMethod", "fetchFuncMethodParams", "data", "extractValueByBrackets", "fetchCallback", "onFetch", "onLoad", "onSelect", "onChange", "onBlur", "onFocus", "onKeyPressed"];
|
|
3581
|
+
var _excluded = ["contentRef", "popupRef", "wrapperClassName", "controlClassName", "controlExClassName", "optionsExClassName", "customScrollContainer", "exceededSidePosOffset", "clearIcon", "renderOption", "multiSelect", "multiSelectEntireAreaTrigger", "multiSelectSelectedItemOnlyStatus", "renderSelectedValue", "disabled", "required", "defaultValue", "value", "label", "name", "readOnly", "placeholder", "id", "autoComplete", "autoCapitalize", "spellCheck", "options", "clearTrigger", "loader", "lockBodyScroll", "hierarchical", "indentation", "doubleIndent", "style", "depth", "controlArrow", "winWidth", "tabIndex", "firstRequestAutoExec", "fetchTrigger", "fetchNoneInfo", "fetchUpdate", "fetchFuncAsync", "fetchFuncMethod", "fetchFuncMethodParams", "data", "extractValueByBrackets", "fetchCallback", "onFetch", "onLoad", "onSelect", "onChange", "onBlur", "onFocus", "onKeyPressed"];
|
|
3582
3582
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
3583
3583
|
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
3584
3584
|
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
@@ -3626,6 +3626,7 @@ var Select = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_react_
|
|
|
3626
3626
|
controlClassName = props.controlClassName,
|
|
3627
3627
|
controlExClassName = props.controlExClassName,
|
|
3628
3628
|
optionsExClassName = props.optionsExClassName,
|
|
3629
|
+
customScrollContainer = props.customScrollContainer,
|
|
3629
3630
|
exceededSidePosOffset = props.exceededSidePosOffset,
|
|
3630
3631
|
clearIcon = props.clearIcon,
|
|
3631
3632
|
renderOption = props.renderOption,
|
|
@@ -3701,6 +3702,8 @@ var Select = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_react_
|
|
|
3701
3702
|
var listContentRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(null);
|
|
3702
3703
|
var optionsRes = options ? (0,validate.isJSON)(options) ? JSON.parse(options) : options : [];
|
|
3703
3704
|
var LIST_CONTAINER_MAX_HEIGHT = 300;
|
|
3705
|
+
var MIN_SPACE_FOR_DROPDOWN = 200; // Minimum space needed to show dropdown below trigger
|
|
3706
|
+
|
|
3704
3707
|
var keyboardSelectedItem = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(null);
|
|
3705
3708
|
|
|
3706
3709
|
// loading
|
|
@@ -4321,8 +4324,36 @@ var Select = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_react_
|
|
|
4321
4324
|
_contentOldHeight = listContainerHeightLimit(_contentOldHeight);
|
|
4322
4325
|
|
|
4323
4326
|
// You need to wait for the height of the pop-up container to be set
|
|
4324
|
-
// Detect position
|
|
4325
|
-
|
|
4327
|
+
// Detect position
|
|
4328
|
+
var containerHeight = window.innerHeight;
|
|
4329
|
+
var containerTop = 0;
|
|
4330
|
+
|
|
4331
|
+
// If custom scroll container is specified, use it instead of window
|
|
4332
|
+
if (customScrollContainer) {
|
|
4333
|
+
var customContainer = null;
|
|
4334
|
+
if (typeof customScrollContainer === 'string') {
|
|
4335
|
+
// Handle selector string
|
|
4336
|
+
customContainer = document.querySelector(customScrollContainer);
|
|
4337
|
+
} else if (customScrollContainer instanceof HTMLElement) {
|
|
4338
|
+
// Handle DOM element directly
|
|
4339
|
+
customContainer = customScrollContainer;
|
|
4340
|
+
} else if (customScrollContainer && 'current' in customScrollContainer) {
|
|
4341
|
+
// Handle React ref
|
|
4342
|
+
customContainer = customScrollContainer.current;
|
|
4343
|
+
}
|
|
4344
|
+
if (customContainer) {
|
|
4345
|
+
var containerRect = customContainer.getBoundingClientRect();
|
|
4346
|
+
containerHeight = containerRect.height;
|
|
4347
|
+
containerTop = containerRect.top;
|
|
4348
|
+
}
|
|
4349
|
+
}
|
|
4350
|
+
|
|
4351
|
+
// Calculate available space below the trigger
|
|
4352
|
+
var availableSpaceBelow = containerHeight - (_triggerBox.top - containerTop);
|
|
4353
|
+
|
|
4354
|
+
// Use a more reasonable threshold for position decision
|
|
4355
|
+
// Consider the minimum space needed for a usable dropdown
|
|
4356
|
+
if (availableSpaceBelow > MIN_SPACE_FOR_DROPDOWN) {
|
|
4326
4357
|
targetPos = 'bottom';
|
|
4327
4358
|
} else {
|
|
4328
4359
|
targetPos = 'top';
|
|
@@ -4333,7 +4364,9 @@ var Select = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_react_
|
|
|
4333
4364
|
//-----------
|
|
4334
4365
|
// Set the pop-up height
|
|
4335
4366
|
if (targetPos === 'top') {
|
|
4336
|
-
|
|
4367
|
+
// Calculate available space above the trigger
|
|
4368
|
+
var availableSpaceAbove = _triggerBox.top - containerTop;
|
|
4369
|
+
contentMaxHeight = availableSpaceAbove;
|
|
4337
4370
|
|
|
4338
4371
|
// height restrictions
|
|
4339
4372
|
contentMaxHeight = listContainerHeightLimit(contentMaxHeight);
|
|
@@ -4354,7 +4387,9 @@ var Select = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_react_
|
|
|
4354
4387
|
}
|
|
4355
4388
|
}
|
|
4356
4389
|
if (targetPos === 'bottom') {
|
|
4357
|
-
|
|
4390
|
+
// Calculate available space below the trigger
|
|
4391
|
+
var _availableSpaceBelow = containerHeight - (_triggerBox.bottom - containerTop);
|
|
4392
|
+
contentMaxHeight = _availableSpaceBelow;
|
|
4358
4393
|
|
|
4359
4394
|
// height restrictions
|
|
4360
4395
|
contentMaxHeight = listContainerHeightLimit(contentMaxHeight);
|
|
@@ -4380,17 +4415,16 @@ var Select = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_react_
|
|
|
4380
4415
|
// Adjust position
|
|
4381
4416
|
if (targetPos === 'top') {
|
|
4382
4417
|
_modalRef.style.left = x + 'px';
|
|
4383
|
-
|
|
4384
|
-
|
|
4385
|
-
|
|
4386
|
-
_modalRef.style.
|
|
4418
|
+
_modalRef.style.bottom = 'auto';
|
|
4419
|
+
// Position the popup above the trigger without overlapping
|
|
4420
|
+
var topPosition = y - POS_OFFSET - listContentRef.current.clientHeight - 2;
|
|
4421
|
+
_modalRef.style.top = topPosition + 'px';
|
|
4387
4422
|
_modalRef.classList.add('pos-top');
|
|
4388
4423
|
}
|
|
4389
4424
|
if (targetPos === 'bottom') {
|
|
4390
4425
|
_modalRef.style.left = x + 'px';
|
|
4391
4426
|
_modalRef.style.bottom = 'auto';
|
|
4392
4427
|
_modalRef.style.top = y + height + POS_OFFSET + 'px';
|
|
4393
|
-
_modalRef.style.setProperty('position', 'absolute', 'important');
|
|
4394
4428
|
_modalRef.classList.remove('pos-top');
|
|
4395
4429
|
}
|
|
4396
4430
|
|
|
@@ -4400,16 +4434,38 @@ var Select = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_react_
|
|
|
4400
4434
|
var _modalContent = _modalRef;
|
|
4401
4435
|
var _modalBox = _modalContent.getBoundingClientRect();
|
|
4402
4436
|
if (typeof _modalContent.dataset.offset === 'undefined' && _modalBox.left > 0) {
|
|
4437
|
+
// Get container width for boundary checking
|
|
4438
|
+
var containerWidth = window.innerWidth;
|
|
4439
|
+
var containerLeft = 0;
|
|
4440
|
+
if (customScrollContainer) {
|
|
4441
|
+
var _customContainer = null;
|
|
4442
|
+
if (typeof customScrollContainer === 'string') {
|
|
4443
|
+
// Handle selector string
|
|
4444
|
+
_customContainer = document.querySelector(customScrollContainer);
|
|
4445
|
+
} else if (customScrollContainer instanceof HTMLElement) {
|
|
4446
|
+
// Handle DOM element directly
|
|
4447
|
+
_customContainer = customScrollContainer;
|
|
4448
|
+
} else if (customScrollContainer && 'current' in customScrollContainer) {
|
|
4449
|
+
// Handle React ref
|
|
4450
|
+
_customContainer = customScrollContainer.current;
|
|
4451
|
+
}
|
|
4452
|
+
if (_customContainer) {
|
|
4453
|
+
var _containerRect = _customContainer.getBoundingClientRect();
|
|
4454
|
+
containerWidth = _containerRect.width;
|
|
4455
|
+
containerLeft = _containerRect.left;
|
|
4456
|
+
}
|
|
4457
|
+
}
|
|
4458
|
+
|
|
4403
4459
|
// 10 pixels is used to account for some bias in mobile devices
|
|
4404
|
-
if (_modalBox.right + 10 >
|
|
4405
|
-
var _modalOffsetPosition = _modalBox.right -
|
|
4460
|
+
if (_modalBox.right + 10 > containerLeft + containerWidth) {
|
|
4461
|
+
var _modalOffsetPosition = _modalBox.right - (containerLeft + containerWidth) + EXCEEDED_SIDE_POS_OFFSET;
|
|
4406
4462
|
_modalContent.dataset.offset = _modalOffsetPosition;
|
|
4407
4463
|
_modalContent.style.marginLeft = "-".concat(_modalOffsetPosition, "px");
|
|
4408
4464
|
// console.log('_modalPosition: ', _modalOffsetPosition)
|
|
4409
4465
|
}
|
|
4410
4466
|
|
|
4411
|
-
if (_modalBox.left - 10 <
|
|
4412
|
-
var _modalOffsetPosition2 = Math.abs(_modalBox.left) + EXCEEDED_SIDE_POS_OFFSET;
|
|
4467
|
+
if (_modalBox.left - 10 < containerLeft) {
|
|
4468
|
+
var _modalOffsetPosition2 = Math.abs(_modalBox.left - containerLeft) + EXCEEDED_SIDE_POS_OFFSET;
|
|
4413
4469
|
_modalContent.dataset.offset = _modalOffsetPosition2;
|
|
4414
4470
|
_modalContent.style.marginLeft = "".concat(_modalOffsetPosition2, "px");
|
|
4415
4471
|
// console.log('_modalPosition: ', _modalOffsetPosition)
|
|
@@ -16,9 +16,23 @@ export declare type TooltipProps = {
|
|
|
16
16
|
mouseOutDelay?: number;
|
|
17
17
|
/** Set a piece of text or HTML code */
|
|
18
18
|
content?: React.ReactNode;
|
|
19
|
+
/** If true, Tooltip is controlled by parent via ref, not by mouse events */
|
|
20
|
+
controlled?: boolean;
|
|
21
|
+
/** Custom color for the popup arrow */
|
|
22
|
+
popupArrowColor?: number[];
|
|
23
|
+
/** Custom style for the popup content */
|
|
24
|
+
popupContentStyle?: React.CSSProperties;
|
|
25
|
+
/** If true, tooltip closes only if mouse does not enter wrapper within timeout after leaving trigger */
|
|
26
|
+
delayedClose?: boolean;
|
|
27
|
+
/** Timeout in ms for delayed close (ms) */
|
|
28
|
+
delayedCloseTimeout?: number;
|
|
29
|
+
/** Called when mouse enters the tooltip wrapper */
|
|
30
|
+
onContentMouseEnter?: (event: React.MouseEvent<HTMLDivElement>) => void;
|
|
31
|
+
/** Called when mouse leaves the tooltip wrapper */
|
|
32
|
+
onContentMouseLeave?: (event: React.MouseEvent<HTMLDivElement>) => void;
|
|
19
33
|
/** -- */
|
|
20
34
|
id?: string;
|
|
21
35
|
children: React.ReactNode;
|
|
22
36
|
};
|
|
23
|
-
declare const Tooltip:
|
|
37
|
+
declare const Tooltip: React.ForwardRefExoticComponent<TooltipProps & React.RefAttributes<any>>;
|
|
24
38
|
export default Tooltip;
|