funda-ui 4.4.15 → 4.5.12
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/Date/index.js +1078 -77
- package/EventCalendar/index.css +114 -114
- package/EventCalendar/index.d.ts +1 -0
- package/EventCalendar/index.js +124 -86
- package/EventCalendarTimeline/index.css +274 -270
- package/EventCalendarTimeline/index.d.ts +3 -0
- package/EventCalendarTimeline/index.js +673 -225
- package/Input/index.d.ts +7 -0
- package/Input/index.js +699 -57
- package/MasonryLayout/index.js +11 -1
- package/MultipleCheckboxes/index.js +11 -11
- package/MultipleSelect/index.d.ts +1 -0
- package/MultipleSelect/index.js +18 -16
- package/NativeSelect/index.js +11 -11
- package/Radio/index.js +11 -11
- package/RangeSlider/index.js +1078 -77
- package/Select/index.js +45 -13
- package/Table/index.css +1 -0
- package/Table/index.js +36 -7
- package/TagInput/index.d.ts +1 -0
- package/TagInput/index.js +20 -2
- package/Textarea/index.d.ts +7 -0
- package/Textarea/index.js +707 -10
- package/Tree/index.js +13 -11
- package/Utils/inputsCalculation.d.ts +18 -1
- package/Utils/inputsCalculation.js +26 -0
- package/Utils/object.js +11 -11
- package/Utils/os.d.ts +2 -0
- package/Utils/os.js +104 -0
- package/lib/cjs/Date/index.js +1078 -77
- package/lib/cjs/EventCalendar/index.d.ts +1 -0
- package/lib/cjs/EventCalendar/index.js +124 -86
- package/lib/cjs/EventCalendarTimeline/index.d.ts +3 -0
- package/lib/cjs/EventCalendarTimeline/index.js +673 -225
- package/lib/cjs/Input/index.d.ts +7 -0
- package/lib/cjs/Input/index.js +699 -57
- package/lib/cjs/MasonryLayout/index.js +11 -1
- package/lib/cjs/MultipleCheckboxes/index.js +11 -11
- package/lib/cjs/MultipleSelect/index.d.ts +1 -0
- package/lib/cjs/MultipleSelect/index.js +18 -16
- package/lib/cjs/NativeSelect/index.js +11 -11
- package/lib/cjs/Radio/index.js +11 -11
- package/lib/cjs/RangeSlider/index.js +1078 -77
- package/lib/cjs/Select/index.js +45 -13
- package/lib/cjs/Table/index.js +36 -7
- package/lib/cjs/TagInput/index.d.ts +1 -0
- package/lib/cjs/TagInput/index.js +20 -2
- package/lib/cjs/Textarea/index.d.ts +7 -0
- package/lib/cjs/Textarea/index.js +707 -10
- package/lib/cjs/Tree/index.js +13 -11
- package/lib/cjs/Utils/inputsCalculation.d.ts +18 -1
- package/lib/cjs/Utils/inputsCalculation.js +26 -0
- package/lib/cjs/Utils/object.js +11 -11
- package/lib/cjs/Utils/os.d.ts +2 -0
- package/lib/cjs/Utils/os.js +104 -0
- package/lib/css/EventCalendar/index.css +114 -114
- package/lib/css/EventCalendarTimeline/index.css +274 -270
- package/lib/css/Table/index.css +1 -0
- package/lib/esm/EventCalendar/index.scss +81 -81
- package/lib/esm/EventCalendar/index.tsx +144 -104
- package/lib/esm/EventCalendarTimeline/index.scss +226 -221
- package/lib/esm/EventCalendarTimeline/index.tsx +791 -517
- package/lib/esm/Input/index.tsx +299 -77
- package/lib/esm/MasonryLayout/index.tsx +9 -2
- package/lib/esm/ModalDialog/index.tsx +0 -1
- package/lib/esm/MultipleSelect/index.tsx +6 -4
- package/lib/esm/Table/Table.tsx +0 -1
- package/lib/esm/Table/index.scss +2 -0
- package/lib/esm/Table/utils/hooks/useTableDraggable.tsx +47 -6
- package/lib/esm/TagInput/index.tsx +23 -1
- package/lib/esm/Textarea/index.tsx +332 -39
- package/lib/esm/Tree/TreeList.tsx +4 -1
- package/lib/esm/Tree/index.tsx +1 -0
- package/lib/esm/Utils/libs/inputsCalculation.ts +60 -31
- package/lib/esm/Utils/libs/object.ts +67 -67
- package/lib/esm/Utils/libs/os.ts +63 -0
- package/package.json +1 -1
package/Select/index.js
CHANGED
|
@@ -1622,12 +1622,35 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
|
|
|
1622
1622
|
__nested_webpack_require_987__.r(__webpack_exports__);
|
|
1623
1623
|
/* harmony export */
|
|
1624
1624
|
__nested_webpack_require_987__.d(__webpack_exports__, {
|
|
1625
|
+
/* harmony export */"actualPropertyValue": function actualPropertyValue() {
|
|
1626
|
+
return (/* binding */_actualPropertyValue
|
|
1627
|
+
);
|
|
1628
|
+
},
|
|
1629
|
+
/* harmony export */"getTextTop": function getTextTop() {
|
|
1630
|
+
return (/* binding */_getTextTop
|
|
1631
|
+
);
|
|
1632
|
+
},
|
|
1625
1633
|
/* harmony export */"getTextWidth": function getTextWidth() {
|
|
1626
1634
|
return (/* binding */_getTextWidth
|
|
1627
1635
|
);
|
|
1628
1636
|
}
|
|
1629
1637
|
/* harmony export */
|
|
1630
1638
|
});
|
|
1639
|
+
/**
|
|
1640
|
+
* Gets the relative upside of the text
|
|
1641
|
+
* @param {Element} el - A DOM node containing one selector to match against.
|
|
1642
|
+
* @returns {Number} - Returns a pure number.
|
|
1643
|
+
*/
|
|
1644
|
+
function _getTextTop(el) {
|
|
1645
|
+
var styles = window.getComputedStyle(el);
|
|
1646
|
+
var fontSize = parseFloat(styles.fontSize);
|
|
1647
|
+
var lineHeight = parseFloat(styles.lineHeight) || fontSize;
|
|
1648
|
+
var paddingTop = parseFloat(styles.paddingTop);
|
|
1649
|
+
var borderWidth = parseFloat(styles.borderWidth);
|
|
1650
|
+
var textTop = paddingTop + (lineHeight - fontSize) / 2 - borderWidth * 2;
|
|
1651
|
+
return textTop;
|
|
1652
|
+
}
|
|
1653
|
+
|
|
1631
1654
|
/**
|
|
1632
1655
|
* Get the actual value with user specific methed
|
|
1633
1656
|
* it can be 'width', 'height', 'outerWidth', 'outerHeight'
|
|
@@ -1638,7 +1661,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
|
|
|
1638
1661
|
takes effect when set to true
|
|
1639
1662
|
* @return {Number} - Returns a pure number.
|
|
1640
1663
|
*/
|
|
1641
|
-
function
|
|
1664
|
+
function _actualPropertyValue(el, prop) {
|
|
1642
1665
|
var config = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : undefined;
|
|
1643
1666
|
if (el === null) return 0;
|
|
1644
1667
|
var style = window.getComputedStyle ? window.getComputedStyle(el) : el.currentStyle,
|
|
@@ -1653,6 +1676,15 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
|
|
|
1653
1676
|
marginWidth = parseFloat(style.marginLeft) + parseFloat(style.marginRight);
|
|
1654
1677
|
marginHeight = parseFloat(style.marginTop) + parseFloat(style.marginBottom);
|
|
1655
1678
|
}
|
|
1679
|
+
if (prop === 'fontSize') {
|
|
1680
|
+
actualVal = parseFloat(style.fontSize);
|
|
1681
|
+
}
|
|
1682
|
+
if (prop === 'fontFamily') {
|
|
1683
|
+
actualVal = style.fontFamily;
|
|
1684
|
+
}
|
|
1685
|
+
if (prop === 'letterSpacing') {
|
|
1686
|
+
actualVal = style.letterSpacing;
|
|
1687
|
+
}
|
|
1656
1688
|
if (prop === 'width') {
|
|
1657
1689
|
maxVal = parseFloat(style.maxWidth);
|
|
1658
1690
|
|
|
@@ -1731,7 +1763,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
|
|
|
1731
1763
|
_faux.style.setProperty(listOfModifiers[i], propertyValue);
|
|
1732
1764
|
}
|
|
1733
1765
|
_faux.textContent = input.value.substring(0, _off).replace(/\s/g, "\xA0");
|
|
1734
|
-
return
|
|
1766
|
+
return _actualPropertyValue(_faux, 'outerWidth');
|
|
1735
1767
|
}
|
|
1736
1768
|
}
|
|
1737
1769
|
|
|
@@ -1842,10 +1874,10 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
|
|
|
1842
1874
|
return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
|
1843
1875
|
}, _typeof(obj);
|
|
1844
1876
|
}
|
|
1845
|
-
/**
|
|
1846
|
-
* Remove Duplicate objects from JSON Array
|
|
1847
|
-
* @param {Array} obj
|
|
1848
|
-
* @param {String} fieldName
|
|
1877
|
+
/**
|
|
1878
|
+
* Remove Duplicate objects from JSON Array
|
|
1879
|
+
* @param {Array} obj
|
|
1880
|
+
* @param {String} fieldName
|
|
1849
1881
|
*/
|
|
1850
1882
|
function _removeArrDuplicateItems(obj, fieldName) {
|
|
1851
1883
|
if (!Array.isArray(obj)) return [];
|
|
@@ -1858,9 +1890,9 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
|
|
|
1858
1890
|
}
|
|
1859
1891
|
;
|
|
1860
1892
|
|
|
1861
|
-
/**
|
|
1862
|
-
* Deep clone
|
|
1863
|
-
* @param {*} obj
|
|
1893
|
+
/**
|
|
1894
|
+
* Deep clone
|
|
1895
|
+
* @param {*} obj
|
|
1864
1896
|
*/
|
|
1865
1897
|
function _deepClone(obj) {
|
|
1866
1898
|
if (Array.isArray(obj)) {
|
|
@@ -1880,10 +1912,10 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
|
|
|
1880
1912
|
}
|
|
1881
1913
|
}
|
|
1882
1914
|
|
|
1883
|
-
/**
|
|
1884
|
-
* Flat Data
|
|
1885
|
-
* @param {*} data
|
|
1886
|
-
* @returns
|
|
1915
|
+
/**
|
|
1916
|
+
* Flat Data
|
|
1917
|
+
* @param {*} data
|
|
1918
|
+
* @returns
|
|
1887
1919
|
*/
|
|
1888
1920
|
function _flatData(data) {
|
|
1889
1921
|
var result = [];
|
package/Table/index.css
CHANGED
package/Table/index.js
CHANGED
|
@@ -808,7 +808,7 @@ function useTableDraggable(_ref, deps) {
|
|
|
808
808
|
var overObj = null;
|
|
809
809
|
var placeholderGenerator = function placeholderGenerator(trHeight) {
|
|
810
810
|
var tbodyRef = getTbody(spyElement);
|
|
811
|
-
if (tbodyRef === null) return;
|
|
811
|
+
if (tbodyRef === null || tbodyRef.querySelector('tr') === null) return;
|
|
812
812
|
|
|
813
813
|
// Insert a row at the "index" of the table
|
|
814
814
|
var newRow = document.createElement('tr');
|
|
@@ -827,7 +827,9 @@ function useTableDraggable(_ref, deps) {
|
|
|
827
827
|
};
|
|
828
828
|
var lastRowGenerator = function lastRowGenerator(trHeight) {
|
|
829
829
|
var tbodyRef = getTbody(spyElement);
|
|
830
|
-
if (tbodyRef === null) return;
|
|
830
|
+
if (tbodyRef === null || tbodyRef.querySelector('tr') === null) return;
|
|
831
|
+
var cloneEl = tbodyRef.querySelector('.row-obj-clonelast');
|
|
832
|
+
if (cloneEl !== null) return;
|
|
831
833
|
|
|
832
834
|
// Insert a row at the "index" of the table
|
|
833
835
|
var newRow = document.createElement('tr');
|
|
@@ -871,7 +873,12 @@ function useTableDraggable(_ref, deps) {
|
|
|
871
873
|
setSortData(listIndexes);
|
|
872
874
|
|
|
873
875
|
//last placeholder
|
|
874
|
-
|
|
876
|
+
if (_allRows.length > 0) {
|
|
877
|
+
var lastEl = lastRowGenerator(_allRows.at(-1).clientHeight);
|
|
878
|
+
if (typeof _allRows.at(-1) !== 'undefined') {
|
|
879
|
+
insertAfter(lastEl, _allRows.at(-1));
|
|
880
|
+
}
|
|
881
|
+
}
|
|
875
882
|
};
|
|
876
883
|
var handleTbodyEnter = function handleTbodyEnter(e) {
|
|
877
884
|
var _table = e.currentTarget.closest('table');
|
|
@@ -904,6 +911,8 @@ function useTableDraggable(_ref, deps) {
|
|
|
904
911
|
}
|
|
905
912
|
}, [sortData]);
|
|
906
913
|
var handleDragStart = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useCallback)(function (e) {
|
|
914
|
+
var tbodyRef = getTbody(spyElement);
|
|
915
|
+
if (tbodyRef === null) return;
|
|
907
916
|
draggedObj = e.currentTarget;
|
|
908
917
|
e.dataTransfer.effectAllowed = 'move';
|
|
909
918
|
e.dataTransfer.setData('text/html', draggedObj);
|
|
@@ -915,6 +924,13 @@ function useTableDraggable(_ref, deps) {
|
|
|
915
924
|
callback.call(null, draggedObj, sortData, sortDataByIndex(sortData, data));
|
|
916
925
|
};
|
|
917
926
|
onRowDrag === null || onRowDrag === void 0 ? void 0 : onRowDrag(dragStart, null);
|
|
927
|
+
|
|
928
|
+
// init clone <tr>
|
|
929
|
+
// !!! It needs to be put at the end of the code to fix the location of the clone element
|
|
930
|
+
var cloneEl = tbodyRef.querySelector('.row-obj-clonelast');
|
|
931
|
+
if (cloneEl !== null) {
|
|
932
|
+
cloneEl.style.display = 'none';
|
|
933
|
+
}
|
|
918
934
|
}, [handledragOver]);
|
|
919
935
|
var handleDragEnd = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useCallback)(function (e) {
|
|
920
936
|
var tbodyRef = getTbody(spyElement);
|
|
@@ -958,10 +974,11 @@ function useTableDraggable(_ref, deps) {
|
|
|
958
974
|
// sort elements
|
|
959
975
|
var categoryItemsArray = allRows(spyElement);
|
|
960
976
|
var sorter = function sorter(a, b) {
|
|
961
|
-
|
|
977
|
+
var txt1 = Number(a.dataset.order),
|
|
978
|
+
txt2 = Number(b.dataset.order);
|
|
979
|
+
return txt2 < txt1 ? -1 : txt2 > txt1 ? 1 : 0;
|
|
962
980
|
};
|
|
963
|
-
|
|
964
|
-
var sorted = categoryItemsArray.sort(sorter);
|
|
981
|
+
var sorted = categoryItemsArray.sort(sorter).reverse();
|
|
965
982
|
sorted.forEach(function (e) {
|
|
966
983
|
return spyElement.querySelector('table').querySelector('tbody').appendChild(e);
|
|
967
984
|
});
|
|
@@ -971,10 +988,22 @@ function useTableDraggable(_ref, deps) {
|
|
|
971
988
|
callback.call(null, draggedObj, newData, sortDataByIndex(newData, data));
|
|
972
989
|
};
|
|
973
990
|
onRowDrag === null || onRowDrag === void 0 ? void 0 : onRowDrag(null, dragEnd);
|
|
991
|
+
|
|
992
|
+
// init clone <tr>
|
|
993
|
+
// !!! It needs to be put at the end of the code to fix the location of the clone element
|
|
994
|
+
var _allRows = allRows(spyElement);
|
|
995
|
+
var cloneEl = tbodyRef.querySelector('.row-obj-clonelast');
|
|
996
|
+
if (cloneEl !== null) {
|
|
997
|
+
if (typeof _allRows.at(-1) !== 'undefined') {
|
|
998
|
+
insertAfter(cloneEl, _allRows.at(-1));
|
|
999
|
+
cloneEl.style.display = 'none';
|
|
1000
|
+
}
|
|
1001
|
+
}
|
|
974
1002
|
}, [sortData]);
|
|
975
1003
|
(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function () {
|
|
976
1004
|
if (enabled) {
|
|
977
|
-
if (Array.isArray(data)) {
|
|
1005
|
+
if (Array.isArray(data) && data.length > 0) {
|
|
1006
|
+
// !!! REQUIRED "data.length > 0" to avoid data-order cannot be assigned when asynchronous data is empty
|
|
978
1007
|
data.forEach(function (item, i) {
|
|
979
1008
|
item.order = i;
|
|
980
1009
|
});
|
package/TagInput/index.d.ts
CHANGED
package/TagInput/index.js
CHANGED
|
@@ -828,7 +828,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
828
828
|
/* harmony import */ var funda_utils_dist_cjs_convert__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(funda_utils_dist_cjs_convert__WEBPACK_IMPORTED_MODULE_3__);
|
|
829
829
|
/* harmony import */ var funda_utils_dist_cjs_cls__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(188);
|
|
830
830
|
/* harmony import */ var funda_utils_dist_cjs_cls__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(funda_utils_dist_cjs_cls__WEBPACK_IMPORTED_MODULE_4__);
|
|
831
|
-
var _excluded = ["wrapperClassName", "maxTags", "disabled", "required", "placeholder", "readOnly", "value", "requiredLabel", "label", "name", "id", "autoComplete", "autoCapitalize", "spellCheck", "extractValueByBrackets", "minLength", "maxLength", "style", "tabIndex", "onChange", "onBlur", "onFocus"];
|
|
831
|
+
var _excluded = ["contentRef", "wrapperClassName", "maxTags", "disabled", "required", "placeholder", "readOnly", "value", "requiredLabel", "label", "name", "id", "autoComplete", "autoCapitalize", "spellCheck", "extractValueByBrackets", "minLength", "maxLength", "style", "tabIndex", "onChange", "onBlur", "onFocus"];
|
|
832
832
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
833
833
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
834
834
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
@@ -844,7 +844,8 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
|
|
|
844
844
|
|
|
845
845
|
|
|
846
846
|
var TagInput = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.forwardRef)(function (props, externalRef) {
|
|
847
|
-
var
|
|
847
|
+
var contentRef = props.contentRef,
|
|
848
|
+
wrapperClassName = props.wrapperClassName,
|
|
848
849
|
maxTags = props.maxTags,
|
|
849
850
|
disabled = props.disabled,
|
|
850
851
|
required = props.required,
|
|
@@ -894,6 +895,23 @@ var TagInput = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.forwardRef)(fu
|
|
|
894
895
|
_useState10 = _slicedToArray(_useState9, 2),
|
|
895
896
|
onComposition = _useState10[0],
|
|
896
897
|
setOnComposition = _useState10[1];
|
|
898
|
+
|
|
899
|
+
// exposes the following methods
|
|
900
|
+
(0,react__WEBPACK_IMPORTED_MODULE_0__.useImperativeHandle)(contentRef, function () {
|
|
901
|
+
return {
|
|
902
|
+
control: function control() {
|
|
903
|
+
return valRef.current;
|
|
904
|
+
},
|
|
905
|
+
clear: function clear(cb) {
|
|
906
|
+
initDefaultValue('');
|
|
907
|
+
cb === null || cb === void 0 ? void 0 : cb();
|
|
908
|
+
},
|
|
909
|
+
set: function set(value, cb) {
|
|
910
|
+
initDefaultValue("".concat(value));
|
|
911
|
+
cb === null || cb === void 0 ? void 0 : cb();
|
|
912
|
+
}
|
|
913
|
+
};
|
|
914
|
+
}, [contentRef]);
|
|
897
915
|
function initDefaultValue(defaultValue) {
|
|
898
916
|
// change the value to trigger component rendering
|
|
899
917
|
if (typeof defaultValue === 'undefined' || defaultValue === '') {
|
package/Textarea/index.d.ts
CHANGED
|
@@ -22,6 +22,13 @@ export declare type TextareaProps = {
|
|
|
22
22
|
autoSize?: boolean;
|
|
23
23
|
iconLeft?: React.ReactNode | string;
|
|
24
24
|
iconRight?: React.ReactNode | string;
|
|
25
|
+
aiPredict?: boolean;
|
|
26
|
+
aiPredictRemainingTextRGB?: number[];
|
|
27
|
+
aiPredictConfirmKey?: Array<string[]>;
|
|
28
|
+
aiPredictFetchFuncAsync?: any;
|
|
29
|
+
aiPredictFetchFuncMethod?: string;
|
|
30
|
+
aiPredictFetchFuncMethodParams?: any[];
|
|
31
|
+
aiPredictFetchCallback?: (data: any) => void;
|
|
25
32
|
/** -- */
|
|
26
33
|
id?: string;
|
|
27
34
|
style?: React.CSSProperties;
|