funda-ui 4.1.112 → 4.1.116
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/Accordion/index.js +103 -118
- package/BackToTop/index.js +103 -118
- package/CascadingSelect/index.js +100 -115
- package/CascadingSelectE2E/index.js +100 -115
- package/Date/index.js +100 -115
- package/DigitalClock/index.js +103 -118
- package/DropdownMenu/index.js +103 -118
- package/EventCalendarTimeline/index.js +100 -115
- package/LiveSearch/index.js +100 -115
- package/MasonryLayout/index.js +103 -118
- package/MultiFuncSelect/index.css +1 -1
- package/MultiFuncSelect/index.js +106 -115
- package/MultilevelDropdownMenu/index.js +103 -118
- package/MultipleCheckboxes/index.js +103 -118
- package/MultipleSelect/index.js +103 -118
- package/Radio/index.js +103 -118
- package/Scrollbar/index.js +103 -118
- package/Select/index.js +103 -118
- package/Table/index.js +99 -114
- package/TagInput/index.js +103 -118
- package/Textarea/index.js +103 -118
- package/Tooltip/index.js +103 -118
- package/Tree/index.js +100 -115
- package/Utils/index.d.ts +2 -2
- package/Utils/index.js +100 -115
- package/lib/cjs/Accordion/index.js +103 -118
- package/lib/cjs/BackToTop/index.js +103 -118
- package/lib/cjs/CascadingSelect/index.js +100 -115
- package/lib/cjs/CascadingSelectE2E/index.js +100 -115
- package/lib/cjs/Date/index.js +100 -115
- package/lib/cjs/DigitalClock/index.js +103 -118
- package/lib/cjs/DropdownMenu/index.js +103 -118
- package/lib/cjs/EventCalendarTimeline/index.js +100 -115
- package/lib/cjs/LiveSearch/index.js +100 -115
- package/lib/cjs/MasonryLayout/index.js +103 -118
- package/lib/cjs/MultiFuncSelect/index.js +106 -115
- package/lib/cjs/MultilevelDropdownMenu/index.js +103 -118
- package/lib/cjs/MultipleCheckboxes/index.js +103 -118
- package/lib/cjs/MultipleSelect/index.js +103 -118
- package/lib/cjs/Radio/index.js +103 -118
- package/lib/cjs/Scrollbar/index.js +103 -118
- package/lib/cjs/Select/index.js +103 -118
- package/lib/cjs/Table/index.js +99 -114
- package/lib/cjs/TagInput/index.js +103 -118
- package/lib/cjs/Textarea/index.js +103 -118
- package/lib/cjs/Tooltip/index.js +103 -118
- package/lib/cjs/Tree/index.js +100 -115
- package/lib/cjs/Utils/index.d.ts +2 -2
- package/lib/cjs/Utils/index.js +100 -115
- package/lib/css/MultiFuncSelect/index.css +1 -1
- package/lib/esm/MultiFuncSelect/index.scss +1 -1
- package/lib/esm/MultiFuncSelect/index.tsx +9 -4
- package/lib/esm/Table/TableRow.tsx +1 -1
- package/lib/esm/Utils/index.tsx +2 -2
- package/lib/esm/Utils/libs/inputs-calculation.ts +110 -114
- package/package.json +1 -1
package/Accordion/index.js
CHANGED
|
@@ -434,8 +434,8 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
|
|
|
434
434
|
return (/* reexport */_getSpecifiedDate
|
|
435
435
|
);
|
|
436
436
|
},
|
|
437
|
-
"
|
|
438
|
-
return (/* reexport */
|
|
437
|
+
"getTextWidth": function getTextWidth() {
|
|
438
|
+
return (/* reexport */_getTextWidth
|
|
439
439
|
);
|
|
440
440
|
},
|
|
441
441
|
"getTodayDate": function getTodayDate() {
|
|
@@ -2732,125 +2732,110 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
|
|
|
2732
2732
|
}
|
|
2733
2733
|
; // CONCATENATED MODULE: ./src/libs/inputs-calculation.ts
|
|
2734
2734
|
/**
|
|
2735
|
-
|
|
2736
|
-
|
|
2737
|
-
|
|
2738
|
-
|
|
2739
|
-
|
|
2740
|
-
|
|
2741
|
-
|
|
2742
|
-
|
|
2743
|
-
|
|
2744
|
-
|
|
2745
|
-
|
|
2746
|
-
|
|
2747
|
-
|
|
2748
|
-
|
|
2749
|
-
|
|
2750
|
-
|
|
2751
|
-
|
|
2752
|
-
|
|
2753
|
-
|
|
2754
|
-
|
|
2755
|
-
|
|
2756
|
-
|
|
2757
|
-
|
|
2758
|
-
|
|
2759
|
-
|
|
2760
|
-
|
|
2761
|
-
|
|
2762
|
-
|
|
2763
|
-
|
|
2764
|
-
|
|
2765
|
-
|
|
2766
|
-
|
|
2767
|
-
|
|
2768
|
-
|
|
2769
|
-
|
|
2770
|
-
|
|
2771
|
-
|
|
2772
|
-
|
|
2773
|
-
|
|
2774
|
-
|
|
2775
|
-
|
|
2776
|
-
|
|
2777
|
-
|
|
2735
|
+
* Get the actual value with user specific methed
|
|
2736
|
+
* it can be 'width', 'height', 'outerWidth', 'outerHeight'
|
|
2737
|
+
* @private
|
|
2738
|
+
* @param {Element} el - A DOM node containing one selector to match against.
|
|
2739
|
+
* @param {String} prop - A string naming the property of style.
|
|
2740
|
+
* @param {?Json} config - Whether or not margin is included. The key `includeMargin`
|
|
2741
|
+
takes effect when set to true
|
|
2742
|
+
* @return {Number} - Returns a pure number.
|
|
2743
|
+
*/
|
|
2744
|
+
function actualPropertyValue(el, prop) {
|
|
2745
|
+
var config = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : undefined;
|
|
2746
|
+
if (el === null) return 0;
|
|
2747
|
+
var style = window.getComputedStyle ? window.getComputedStyle(el) : el.currentStyle,
|
|
2748
|
+
display = style.display,
|
|
2749
|
+
position = style.position,
|
|
2750
|
+
visibility = style.visibility;
|
|
2751
|
+
var marginWidth = 0;
|
|
2752
|
+
var marginHeight = 0;
|
|
2753
|
+
var maxVal;
|
|
2754
|
+
var actualVal;
|
|
2755
|
+
if (config && config.includeMargin === true) {
|
|
2756
|
+
marginWidth = parseFloat(style.marginLeft) + parseFloat(style.marginRight);
|
|
2757
|
+
marginHeight = parseFloat(style.marginTop) + parseFloat(style.marginBottom);
|
|
2758
|
+
}
|
|
2759
|
+
if (prop === 'width') {
|
|
2760
|
+
maxVal = parseFloat(style.maxWidth);
|
|
2761
|
+
|
|
2762
|
+
// if its not hidden we just return normal height
|
|
2763
|
+
if (display !== 'none' && maxVal !== 0) {
|
|
2764
|
+
return el.clientWidth;
|
|
2765
|
+
}
|
|
2766
|
+
}
|
|
2767
|
+
if (prop === 'height') {
|
|
2768
|
+
maxVal = parseFloat(style.maxHeight);
|
|
2769
|
+
if (display !== 'none' && maxVal !== 0) {
|
|
2770
|
+
return el.clientHeight;
|
|
2771
|
+
}
|
|
2772
|
+
}
|
|
2773
|
+
if (prop === 'outerWidth') {
|
|
2774
|
+
maxVal = parseFloat(style.maxWidth);
|
|
2775
|
+
if (display !== 'none' && maxVal !== 0) {
|
|
2776
|
+
return el.offsetWidth + marginWidth;
|
|
2777
|
+
}
|
|
2778
|
+
}
|
|
2779
|
+
if (prop === 'outerHeight') {
|
|
2780
|
+
maxVal = parseFloat(style.maxHeight);
|
|
2781
|
+
if (display !== 'none' && maxVal !== 0) {
|
|
2782
|
+
return el.offsetHeight + marginHeight;
|
|
2783
|
+
}
|
|
2784
|
+
}
|
|
2785
|
+
|
|
2786
|
+
// the element is hidden so:
|
|
2787
|
+
// making the el block so we can meassure its height but still be hidden
|
|
2788
|
+
el.style.position = 'absolute';
|
|
2789
|
+
el.style.visibility = 'hidden';
|
|
2790
|
+
el.style.display = 'block';
|
|
2791
|
+
if (prop === 'width') actualVal = el.clientWidth;
|
|
2792
|
+
if (prop === 'height') actualVal = el.clientHeight;
|
|
2793
|
+
if (prop === 'outerWidth') actualVal = el.offsetWidth + marginWidth;
|
|
2794
|
+
if (prop === 'outerHeight') actualVal = el.offsetHeight + marginHeight;
|
|
2795
|
+
|
|
2796
|
+
// reverting to the original values
|
|
2797
|
+
el.style.display = display;
|
|
2798
|
+
el.style.position = position;
|
|
2799
|
+
el.style.visibility = visibility;
|
|
2800
|
+
return actualVal;
|
|
2778
2801
|
}
|
|
2779
|
-
function
|
|
2802
|
+
function getElCSS(input, prop, isNumber) {
|
|
2780
2803
|
var _document$defaultView;
|
|
2781
2804
|
var val = (_document$defaultView = document.defaultView) === null || _document$defaultView === void 0 ? void 0 : _document$defaultView.getComputedStyle(input, null).getPropertyValue(prop);
|
|
2782
|
-
return
|
|
2783
|
-
}
|
|
2784
|
-
|
|
2785
|
-
|
|
2786
|
-
|
|
2787
|
-
|
|
2788
|
-
|
|
2789
|
-
|
|
2790
|
-
|
|
2791
|
-
|
|
2792
|
-
|
|
2793
|
-
|
|
2794
|
-
|
|
2795
|
-
if (
|
|
2796
|
-
|
|
2797
|
-
|
|
2798
|
-
|
|
2799
|
-
|
|
2800
|
-
|
|
2801
|
-
|
|
2802
|
-
|
|
2803
|
-
|
|
2804
|
-
|
|
2805
|
-
|
|
2806
|
-
|
|
2807
|
-
|
|
2808
|
-
|
|
2809
|
-
|
|
2810
|
-
|
|
2811
|
-
|
|
2812
|
-
|
|
2813
|
-
|
|
2814
|
-
|
|
2815
|
-
|
|
2816
|
-
|
|
2817
|
-
// Styles to simulate a node in an input field
|
|
2818
|
-
// use pre-wrap instead of wrap for white-space to support wrapping in textareas
|
|
2819
|
-
var cssDefaultStyles = "white-space:pre-wrap;padding:0;margin:0;",
|
|
2820
|
-
listOfModifiers = ['direction', 'font-family', 'font-size', 'font-size-adjust', 'font-variant', 'font-weight', 'font-style', 'letter-spacing', 'line-height', 'text-align', 'text-indent', 'text-transform', 'word-wrap', 'word-spacing'];
|
|
2821
|
-
topPos += getInputCSS(input, 'padding-top', true);
|
|
2822
|
-
topPos += getInputCSS(input, 'border-top-width', true);
|
|
2823
|
-
leftPos += getInputCSS(input, 'padding-left', true);
|
|
2824
|
-
leftPos += getInputCSS(input, 'border-left-width', true);
|
|
2825
|
-
leftPos += 1; //Seems to be necessary
|
|
2826
|
-
|
|
2827
|
-
for (var i = 0; i < listOfModifiers.length; i++) {
|
|
2828
|
-
var property = listOfModifiers[i];
|
|
2829
|
-
cssDefaultStyles += property + ':' + getInputCSS(input, property, false) + ';';
|
|
2830
|
-
}
|
|
2831
|
-
// End of CSS variable checks
|
|
2832
|
-
|
|
2833
|
-
var text = input.value,
|
|
2834
|
-
textLen = text.length,
|
|
2835
|
-
fakeClone = document.createElement("div");
|
|
2836
|
-
if (selectionStart > 0) appendPart(text, cssDefaultStyles, fakeClone, 0, selectionStart);
|
|
2837
|
-
var fakeRange = appendPart(text, cssDefaultStyles, fakeClone, selectionStart, selectionEnd);
|
|
2838
|
-
if (textLen > selectionEnd) appendPart(text, cssDefaultStyles, fakeClone, selectionEnd, textLen);
|
|
2839
|
-
|
|
2840
|
-
// Styles to inherit the font styles of the element
|
|
2841
|
-
fakeClone.style.cssText = cssDefaultStyles;
|
|
2842
|
-
|
|
2843
|
-
// Styles to position the text node at the desired position
|
|
2844
|
-
fakeClone.style.position = "absolute";
|
|
2845
|
-
fakeClone.style.top = topPos + "px";
|
|
2846
|
-
fakeClone.style.left = leftPos + "px";
|
|
2847
|
-
fakeClone.style.width = width + "px";
|
|
2848
|
-
fakeClone.style.height = height + "px";
|
|
2849
|
-
document.body.appendChild(fakeClone);
|
|
2850
|
-
var returnValue = fakeRange.getBoundingClientRect(); //Get rect
|
|
2851
|
-
|
|
2852
|
-
if (!debug) (_fakeClone$parentNode = fakeClone.parentNode) === null || _fakeClone$parentNode === void 0 ? void 0 : _fakeClone$parentNode.removeChild(fakeClone); //Remove temp
|
|
2853
|
-
return returnValue;
|
|
2805
|
+
return isNumber ? isNaN(parseFloat(val)) ? 0 : parseFloat(val) : val;
|
|
2806
|
+
}
|
|
2807
|
+
|
|
2808
|
+
/**
|
|
2809
|
+
* Get cursor or text position in pixels for input element
|
|
2810
|
+
*
|
|
2811
|
+
* @param {HTMLInputElement} input Required HTMLElement with `value` attribute
|
|
2812
|
+
* @param {HTMLSpanElement} fauxContainer Container of faux.
|
|
2813
|
+
* @param {HTMLElement} rawTextContainer The raw text container for the comparison
|
|
2814
|
+
* @returns {Number}
|
|
2815
|
+
*/
|
|
2816
|
+
|
|
2817
|
+
function _getTextWidth(input, fauxContainer, rawTextContainer) {
|
|
2818
|
+
if (input === null || fauxContainer === null || rawTextContainer === null) return 0;
|
|
2819
|
+
var _off = input.selectionStart;
|
|
2820
|
+
var _faux = fauxContainer;
|
|
2821
|
+
var _fauxContainer = rawTextContainer;
|
|
2822
|
+
if (_faux && _fauxContainer) {
|
|
2823
|
+
// Styles to simulate a node in an input field
|
|
2824
|
+
// use pre-wrap instead of wrap for white-space to support wrapping in textareas
|
|
2825
|
+
var listOfModifiers = ['direction', 'font-family', 'font-size', 'font-size-adjust', 'font-variant', 'font-weight', 'font-style', 'letter-spacing', 'line-height', 'text-align', 'text-indent', 'text-transform', 'word-wrap', 'word-spacing'];
|
|
2826
|
+
|
|
2827
|
+
// default styles
|
|
2828
|
+
_faux.style.setProperty('white-space', 'pre-wrap');
|
|
2829
|
+
_faux.style.setProperty('padding', '0');
|
|
2830
|
+
_faux.style.setProperty('margin', '0');
|
|
2831
|
+
_faux.style.setProperty('display', 'none');
|
|
2832
|
+
for (var i = 0; i < listOfModifiers.length; i++) {
|
|
2833
|
+
var propertyValue = getElCSS(_fauxContainer, listOfModifiers[i], false);
|
|
2834
|
+
_faux.style.setProperty(listOfModifiers[i], propertyValue);
|
|
2835
|
+
}
|
|
2836
|
+
_faux.textContent = input.value.substring(0, _off).replace(/\s/g, "\xA0");
|
|
2837
|
+
return actualPropertyValue(_faux, 'outerWidth');
|
|
2838
|
+
}
|
|
2854
2839
|
}
|
|
2855
2840
|
|
|
2856
2841
|
// EXTERNAL MODULE: external {"root":"React","commonjs2":"react","commonjs":"react","amd":"react"}
|
package/BackToTop/index.js
CHANGED
|
@@ -434,8 +434,8 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
|
|
|
434
434
|
return (/* reexport */_getSpecifiedDate
|
|
435
435
|
);
|
|
436
436
|
},
|
|
437
|
-
"
|
|
438
|
-
return (/* reexport */
|
|
437
|
+
"getTextWidth": function getTextWidth() {
|
|
438
|
+
return (/* reexport */_getTextWidth
|
|
439
439
|
);
|
|
440
440
|
},
|
|
441
441
|
"getTodayDate": function getTodayDate() {
|
|
@@ -2732,125 +2732,110 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
|
|
|
2732
2732
|
}
|
|
2733
2733
|
; // CONCATENATED MODULE: ./src/libs/inputs-calculation.ts
|
|
2734
2734
|
/**
|
|
2735
|
-
|
|
2736
|
-
|
|
2737
|
-
|
|
2738
|
-
|
|
2739
|
-
|
|
2740
|
-
|
|
2741
|
-
|
|
2742
|
-
|
|
2743
|
-
|
|
2744
|
-
|
|
2745
|
-
|
|
2746
|
-
|
|
2747
|
-
|
|
2748
|
-
|
|
2749
|
-
|
|
2750
|
-
|
|
2751
|
-
|
|
2752
|
-
|
|
2753
|
-
|
|
2754
|
-
|
|
2755
|
-
|
|
2756
|
-
|
|
2757
|
-
|
|
2758
|
-
|
|
2759
|
-
|
|
2760
|
-
|
|
2761
|
-
|
|
2762
|
-
|
|
2763
|
-
|
|
2764
|
-
|
|
2765
|
-
|
|
2766
|
-
|
|
2767
|
-
|
|
2768
|
-
|
|
2769
|
-
|
|
2770
|
-
|
|
2771
|
-
|
|
2772
|
-
|
|
2773
|
-
|
|
2774
|
-
|
|
2775
|
-
|
|
2776
|
-
|
|
2777
|
-
|
|
2735
|
+
* Get the actual value with user specific methed
|
|
2736
|
+
* it can be 'width', 'height', 'outerWidth', 'outerHeight'
|
|
2737
|
+
* @private
|
|
2738
|
+
* @param {Element} el - A DOM node containing one selector to match against.
|
|
2739
|
+
* @param {String} prop - A string naming the property of style.
|
|
2740
|
+
* @param {?Json} config - Whether or not margin is included. The key `includeMargin`
|
|
2741
|
+
takes effect when set to true
|
|
2742
|
+
* @return {Number} - Returns a pure number.
|
|
2743
|
+
*/
|
|
2744
|
+
function actualPropertyValue(el, prop) {
|
|
2745
|
+
var config = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : undefined;
|
|
2746
|
+
if (el === null) return 0;
|
|
2747
|
+
var style = window.getComputedStyle ? window.getComputedStyle(el) : el.currentStyle,
|
|
2748
|
+
display = style.display,
|
|
2749
|
+
position = style.position,
|
|
2750
|
+
visibility = style.visibility;
|
|
2751
|
+
var marginWidth = 0;
|
|
2752
|
+
var marginHeight = 0;
|
|
2753
|
+
var maxVal;
|
|
2754
|
+
var actualVal;
|
|
2755
|
+
if (config && config.includeMargin === true) {
|
|
2756
|
+
marginWidth = parseFloat(style.marginLeft) + parseFloat(style.marginRight);
|
|
2757
|
+
marginHeight = parseFloat(style.marginTop) + parseFloat(style.marginBottom);
|
|
2758
|
+
}
|
|
2759
|
+
if (prop === 'width') {
|
|
2760
|
+
maxVal = parseFloat(style.maxWidth);
|
|
2761
|
+
|
|
2762
|
+
// if its not hidden we just return normal height
|
|
2763
|
+
if (display !== 'none' && maxVal !== 0) {
|
|
2764
|
+
return el.clientWidth;
|
|
2765
|
+
}
|
|
2766
|
+
}
|
|
2767
|
+
if (prop === 'height') {
|
|
2768
|
+
maxVal = parseFloat(style.maxHeight);
|
|
2769
|
+
if (display !== 'none' && maxVal !== 0) {
|
|
2770
|
+
return el.clientHeight;
|
|
2771
|
+
}
|
|
2772
|
+
}
|
|
2773
|
+
if (prop === 'outerWidth') {
|
|
2774
|
+
maxVal = parseFloat(style.maxWidth);
|
|
2775
|
+
if (display !== 'none' && maxVal !== 0) {
|
|
2776
|
+
return el.offsetWidth + marginWidth;
|
|
2777
|
+
}
|
|
2778
|
+
}
|
|
2779
|
+
if (prop === 'outerHeight') {
|
|
2780
|
+
maxVal = parseFloat(style.maxHeight);
|
|
2781
|
+
if (display !== 'none' && maxVal !== 0) {
|
|
2782
|
+
return el.offsetHeight + marginHeight;
|
|
2783
|
+
}
|
|
2784
|
+
}
|
|
2785
|
+
|
|
2786
|
+
// the element is hidden so:
|
|
2787
|
+
// making the el block so we can meassure its height but still be hidden
|
|
2788
|
+
el.style.position = 'absolute';
|
|
2789
|
+
el.style.visibility = 'hidden';
|
|
2790
|
+
el.style.display = 'block';
|
|
2791
|
+
if (prop === 'width') actualVal = el.clientWidth;
|
|
2792
|
+
if (prop === 'height') actualVal = el.clientHeight;
|
|
2793
|
+
if (prop === 'outerWidth') actualVal = el.offsetWidth + marginWidth;
|
|
2794
|
+
if (prop === 'outerHeight') actualVal = el.offsetHeight + marginHeight;
|
|
2795
|
+
|
|
2796
|
+
// reverting to the original values
|
|
2797
|
+
el.style.display = display;
|
|
2798
|
+
el.style.position = position;
|
|
2799
|
+
el.style.visibility = visibility;
|
|
2800
|
+
return actualVal;
|
|
2778
2801
|
}
|
|
2779
|
-
function
|
|
2802
|
+
function getElCSS(input, prop, isNumber) {
|
|
2780
2803
|
var _document$defaultView;
|
|
2781
2804
|
var val = (_document$defaultView = document.defaultView) === null || _document$defaultView === void 0 ? void 0 : _document$defaultView.getComputedStyle(input, null).getPropertyValue(prop);
|
|
2782
|
-
return
|
|
2783
|
-
}
|
|
2784
|
-
|
|
2785
|
-
|
|
2786
|
-
|
|
2787
|
-
|
|
2788
|
-
|
|
2789
|
-
|
|
2790
|
-
|
|
2791
|
-
|
|
2792
|
-
|
|
2793
|
-
|
|
2794
|
-
|
|
2795
|
-
if (
|
|
2796
|
-
|
|
2797
|
-
|
|
2798
|
-
|
|
2799
|
-
|
|
2800
|
-
|
|
2801
|
-
|
|
2802
|
-
|
|
2803
|
-
|
|
2804
|
-
|
|
2805
|
-
|
|
2806
|
-
|
|
2807
|
-
|
|
2808
|
-
|
|
2809
|
-
|
|
2810
|
-
|
|
2811
|
-
|
|
2812
|
-
|
|
2813
|
-
|
|
2814
|
-
|
|
2815
|
-
|
|
2816
|
-
|
|
2817
|
-
// Styles to simulate a node in an input field
|
|
2818
|
-
// use pre-wrap instead of wrap for white-space to support wrapping in textareas
|
|
2819
|
-
var cssDefaultStyles = "white-space:pre-wrap;padding:0;margin:0;",
|
|
2820
|
-
listOfModifiers = ['direction', 'font-family', 'font-size', 'font-size-adjust', 'font-variant', 'font-weight', 'font-style', 'letter-spacing', 'line-height', 'text-align', 'text-indent', 'text-transform', 'word-wrap', 'word-spacing'];
|
|
2821
|
-
topPos += getInputCSS(input, 'padding-top', true);
|
|
2822
|
-
topPos += getInputCSS(input, 'border-top-width', true);
|
|
2823
|
-
leftPos += getInputCSS(input, 'padding-left', true);
|
|
2824
|
-
leftPos += getInputCSS(input, 'border-left-width', true);
|
|
2825
|
-
leftPos += 1; //Seems to be necessary
|
|
2826
|
-
|
|
2827
|
-
for (var i = 0; i < listOfModifiers.length; i++) {
|
|
2828
|
-
var property = listOfModifiers[i];
|
|
2829
|
-
cssDefaultStyles += property + ':' + getInputCSS(input, property, false) + ';';
|
|
2830
|
-
}
|
|
2831
|
-
// End of CSS variable checks
|
|
2832
|
-
|
|
2833
|
-
var text = input.value,
|
|
2834
|
-
textLen = text.length,
|
|
2835
|
-
fakeClone = document.createElement("div");
|
|
2836
|
-
if (selectionStart > 0) appendPart(text, cssDefaultStyles, fakeClone, 0, selectionStart);
|
|
2837
|
-
var fakeRange = appendPart(text, cssDefaultStyles, fakeClone, selectionStart, selectionEnd);
|
|
2838
|
-
if (textLen > selectionEnd) appendPart(text, cssDefaultStyles, fakeClone, selectionEnd, textLen);
|
|
2839
|
-
|
|
2840
|
-
// Styles to inherit the font styles of the element
|
|
2841
|
-
fakeClone.style.cssText = cssDefaultStyles;
|
|
2842
|
-
|
|
2843
|
-
// Styles to position the text node at the desired position
|
|
2844
|
-
fakeClone.style.position = "absolute";
|
|
2845
|
-
fakeClone.style.top = topPos + "px";
|
|
2846
|
-
fakeClone.style.left = leftPos + "px";
|
|
2847
|
-
fakeClone.style.width = width + "px";
|
|
2848
|
-
fakeClone.style.height = height + "px";
|
|
2849
|
-
document.body.appendChild(fakeClone);
|
|
2850
|
-
var returnValue = fakeRange.getBoundingClientRect(); //Get rect
|
|
2851
|
-
|
|
2852
|
-
if (!debug) (_fakeClone$parentNode = fakeClone.parentNode) === null || _fakeClone$parentNode === void 0 ? void 0 : _fakeClone$parentNode.removeChild(fakeClone); //Remove temp
|
|
2853
|
-
return returnValue;
|
|
2805
|
+
return isNumber ? isNaN(parseFloat(val)) ? 0 : parseFloat(val) : val;
|
|
2806
|
+
}
|
|
2807
|
+
|
|
2808
|
+
/**
|
|
2809
|
+
* Get cursor or text position in pixels for input element
|
|
2810
|
+
*
|
|
2811
|
+
* @param {HTMLInputElement} input Required HTMLElement with `value` attribute
|
|
2812
|
+
* @param {HTMLSpanElement} fauxContainer Container of faux.
|
|
2813
|
+
* @param {HTMLElement} rawTextContainer The raw text container for the comparison
|
|
2814
|
+
* @returns {Number}
|
|
2815
|
+
*/
|
|
2816
|
+
|
|
2817
|
+
function _getTextWidth(input, fauxContainer, rawTextContainer) {
|
|
2818
|
+
if (input === null || fauxContainer === null || rawTextContainer === null) return 0;
|
|
2819
|
+
var _off = input.selectionStart;
|
|
2820
|
+
var _faux = fauxContainer;
|
|
2821
|
+
var _fauxContainer = rawTextContainer;
|
|
2822
|
+
if (_faux && _fauxContainer) {
|
|
2823
|
+
// Styles to simulate a node in an input field
|
|
2824
|
+
// use pre-wrap instead of wrap for white-space to support wrapping in textareas
|
|
2825
|
+
var listOfModifiers = ['direction', 'font-family', 'font-size', 'font-size-adjust', 'font-variant', 'font-weight', 'font-style', 'letter-spacing', 'line-height', 'text-align', 'text-indent', 'text-transform', 'word-wrap', 'word-spacing'];
|
|
2826
|
+
|
|
2827
|
+
// default styles
|
|
2828
|
+
_faux.style.setProperty('white-space', 'pre-wrap');
|
|
2829
|
+
_faux.style.setProperty('padding', '0');
|
|
2830
|
+
_faux.style.setProperty('margin', '0');
|
|
2831
|
+
_faux.style.setProperty('display', 'none');
|
|
2832
|
+
for (var i = 0; i < listOfModifiers.length; i++) {
|
|
2833
|
+
var propertyValue = getElCSS(_fauxContainer, listOfModifiers[i], false);
|
|
2834
|
+
_faux.style.setProperty(listOfModifiers[i], propertyValue);
|
|
2835
|
+
}
|
|
2836
|
+
_faux.textContent = input.value.substring(0, _off).replace(/\s/g, "\xA0");
|
|
2837
|
+
return actualPropertyValue(_faux, 'outerWidth');
|
|
2838
|
+
}
|
|
2854
2839
|
}
|
|
2855
2840
|
|
|
2856
2841
|
// EXTERNAL MODULE: external {"root":"React","commonjs2":"react","commonjs":"react","amd":"react"}
|