@dev-fastn-ai/react-core 2.3.2 → 2.3.4
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/dist/index.cjs.js +17 -689
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +17 -689
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -1736,666 +1736,6 @@ const useConnectors = () => {
|
|
|
1736
1736
|
return query;
|
|
1737
1737
|
};
|
|
1738
1738
|
|
|
1739
|
-
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
1740
|
-
|
|
1741
|
-
function getDefaultExportFromCjs (x) {
|
|
1742
|
-
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
1743
|
-
}
|
|
1744
|
-
|
|
1745
|
-
/**
|
|
1746
|
-
* Checks if `value` is the
|
|
1747
|
-
* [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
|
|
1748
|
-
* of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
|
|
1749
|
-
*
|
|
1750
|
-
* @static
|
|
1751
|
-
* @memberOf _
|
|
1752
|
-
* @since 0.1.0
|
|
1753
|
-
* @category Lang
|
|
1754
|
-
* @param {*} value The value to check.
|
|
1755
|
-
* @returns {boolean} Returns `true` if `value` is an object, else `false`.
|
|
1756
|
-
* @example
|
|
1757
|
-
*
|
|
1758
|
-
* _.isObject({});
|
|
1759
|
-
* // => true
|
|
1760
|
-
*
|
|
1761
|
-
* _.isObject([1, 2, 3]);
|
|
1762
|
-
* // => true
|
|
1763
|
-
*
|
|
1764
|
-
* _.isObject(_.noop);
|
|
1765
|
-
* // => true
|
|
1766
|
-
*
|
|
1767
|
-
* _.isObject(null);
|
|
1768
|
-
* // => false
|
|
1769
|
-
*/
|
|
1770
|
-
|
|
1771
|
-
var isObject_1;
|
|
1772
|
-
var hasRequiredIsObject;
|
|
1773
|
-
|
|
1774
|
-
function requireIsObject () {
|
|
1775
|
-
if (hasRequiredIsObject) return isObject_1;
|
|
1776
|
-
hasRequiredIsObject = 1;
|
|
1777
|
-
function isObject(value) {
|
|
1778
|
-
var type = typeof value;
|
|
1779
|
-
return value != null && (type == 'object' || type == 'function');
|
|
1780
|
-
}
|
|
1781
|
-
|
|
1782
|
-
isObject_1 = isObject;
|
|
1783
|
-
return isObject_1;
|
|
1784
|
-
}
|
|
1785
|
-
|
|
1786
|
-
/** Detect free variable `global` from Node.js. */
|
|
1787
|
-
|
|
1788
|
-
var _freeGlobal;
|
|
1789
|
-
var hasRequired_freeGlobal;
|
|
1790
|
-
|
|
1791
|
-
function require_freeGlobal () {
|
|
1792
|
-
if (hasRequired_freeGlobal) return _freeGlobal;
|
|
1793
|
-
hasRequired_freeGlobal = 1;
|
|
1794
|
-
var freeGlobal = typeof commonjsGlobal == 'object' && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;
|
|
1795
|
-
|
|
1796
|
-
_freeGlobal = freeGlobal;
|
|
1797
|
-
return _freeGlobal;
|
|
1798
|
-
}
|
|
1799
|
-
|
|
1800
|
-
var _root;
|
|
1801
|
-
var hasRequired_root;
|
|
1802
|
-
|
|
1803
|
-
function require_root () {
|
|
1804
|
-
if (hasRequired_root) return _root;
|
|
1805
|
-
hasRequired_root = 1;
|
|
1806
|
-
var freeGlobal = require_freeGlobal();
|
|
1807
|
-
|
|
1808
|
-
/** Detect free variable `self`. */
|
|
1809
|
-
var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
|
|
1810
|
-
|
|
1811
|
-
/** Used as a reference to the global object. */
|
|
1812
|
-
var root = freeGlobal || freeSelf || Function('return this')();
|
|
1813
|
-
|
|
1814
|
-
_root = root;
|
|
1815
|
-
return _root;
|
|
1816
|
-
}
|
|
1817
|
-
|
|
1818
|
-
var now_1;
|
|
1819
|
-
var hasRequiredNow;
|
|
1820
|
-
|
|
1821
|
-
function requireNow () {
|
|
1822
|
-
if (hasRequiredNow) return now_1;
|
|
1823
|
-
hasRequiredNow = 1;
|
|
1824
|
-
var root = require_root();
|
|
1825
|
-
|
|
1826
|
-
/**
|
|
1827
|
-
* Gets the timestamp of the number of milliseconds that have elapsed since
|
|
1828
|
-
* the Unix epoch (1 January 1970 00:00:00 UTC).
|
|
1829
|
-
*
|
|
1830
|
-
* @static
|
|
1831
|
-
* @memberOf _
|
|
1832
|
-
* @since 2.4.0
|
|
1833
|
-
* @category Date
|
|
1834
|
-
* @returns {number} Returns the timestamp.
|
|
1835
|
-
* @example
|
|
1836
|
-
*
|
|
1837
|
-
* _.defer(function(stamp) {
|
|
1838
|
-
* console.log(_.now() - stamp);
|
|
1839
|
-
* }, _.now());
|
|
1840
|
-
* // => Logs the number of milliseconds it took for the deferred invocation.
|
|
1841
|
-
*/
|
|
1842
|
-
var now = function() {
|
|
1843
|
-
return root.Date.now();
|
|
1844
|
-
};
|
|
1845
|
-
|
|
1846
|
-
now_1 = now;
|
|
1847
|
-
return now_1;
|
|
1848
|
-
}
|
|
1849
|
-
|
|
1850
|
-
/** Used to match a single whitespace character. */
|
|
1851
|
-
|
|
1852
|
-
var _trimmedEndIndex;
|
|
1853
|
-
var hasRequired_trimmedEndIndex;
|
|
1854
|
-
|
|
1855
|
-
function require_trimmedEndIndex () {
|
|
1856
|
-
if (hasRequired_trimmedEndIndex) return _trimmedEndIndex;
|
|
1857
|
-
hasRequired_trimmedEndIndex = 1;
|
|
1858
|
-
var reWhitespace = /\s/;
|
|
1859
|
-
|
|
1860
|
-
/**
|
|
1861
|
-
* Used by `_.trim` and `_.trimEnd` to get the index of the last non-whitespace
|
|
1862
|
-
* character of `string`.
|
|
1863
|
-
*
|
|
1864
|
-
* @private
|
|
1865
|
-
* @param {string} string The string to inspect.
|
|
1866
|
-
* @returns {number} Returns the index of the last non-whitespace character.
|
|
1867
|
-
*/
|
|
1868
|
-
function trimmedEndIndex(string) {
|
|
1869
|
-
var index = string.length;
|
|
1870
|
-
|
|
1871
|
-
while (index-- && reWhitespace.test(string.charAt(index))) {}
|
|
1872
|
-
return index;
|
|
1873
|
-
}
|
|
1874
|
-
|
|
1875
|
-
_trimmedEndIndex = trimmedEndIndex;
|
|
1876
|
-
return _trimmedEndIndex;
|
|
1877
|
-
}
|
|
1878
|
-
|
|
1879
|
-
var _baseTrim;
|
|
1880
|
-
var hasRequired_baseTrim;
|
|
1881
|
-
|
|
1882
|
-
function require_baseTrim () {
|
|
1883
|
-
if (hasRequired_baseTrim) return _baseTrim;
|
|
1884
|
-
hasRequired_baseTrim = 1;
|
|
1885
|
-
var trimmedEndIndex = require_trimmedEndIndex();
|
|
1886
|
-
|
|
1887
|
-
/** Used to match leading whitespace. */
|
|
1888
|
-
var reTrimStart = /^\s+/;
|
|
1889
|
-
|
|
1890
|
-
/**
|
|
1891
|
-
* The base implementation of `_.trim`.
|
|
1892
|
-
*
|
|
1893
|
-
* @private
|
|
1894
|
-
* @param {string} string The string to trim.
|
|
1895
|
-
* @returns {string} Returns the trimmed string.
|
|
1896
|
-
*/
|
|
1897
|
-
function baseTrim(string) {
|
|
1898
|
-
return string
|
|
1899
|
-
? string.slice(0, trimmedEndIndex(string) + 1).replace(reTrimStart, '')
|
|
1900
|
-
: string;
|
|
1901
|
-
}
|
|
1902
|
-
|
|
1903
|
-
_baseTrim = baseTrim;
|
|
1904
|
-
return _baseTrim;
|
|
1905
|
-
}
|
|
1906
|
-
|
|
1907
|
-
var _Symbol;
|
|
1908
|
-
var hasRequired_Symbol;
|
|
1909
|
-
|
|
1910
|
-
function require_Symbol () {
|
|
1911
|
-
if (hasRequired_Symbol) return _Symbol;
|
|
1912
|
-
hasRequired_Symbol = 1;
|
|
1913
|
-
var root = require_root();
|
|
1914
|
-
|
|
1915
|
-
/** Built-in value references. */
|
|
1916
|
-
var Symbol = root.Symbol;
|
|
1917
|
-
|
|
1918
|
-
_Symbol = Symbol;
|
|
1919
|
-
return _Symbol;
|
|
1920
|
-
}
|
|
1921
|
-
|
|
1922
|
-
var _getRawTag;
|
|
1923
|
-
var hasRequired_getRawTag;
|
|
1924
|
-
|
|
1925
|
-
function require_getRawTag () {
|
|
1926
|
-
if (hasRequired_getRawTag) return _getRawTag;
|
|
1927
|
-
hasRequired_getRawTag = 1;
|
|
1928
|
-
var Symbol = require_Symbol();
|
|
1929
|
-
|
|
1930
|
-
/** Used for built-in method references. */
|
|
1931
|
-
var objectProto = Object.prototype;
|
|
1932
|
-
|
|
1933
|
-
/** Used to check objects for own properties. */
|
|
1934
|
-
var hasOwnProperty = objectProto.hasOwnProperty;
|
|
1935
|
-
|
|
1936
|
-
/**
|
|
1937
|
-
* Used to resolve the
|
|
1938
|
-
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
|
|
1939
|
-
* of values.
|
|
1940
|
-
*/
|
|
1941
|
-
var nativeObjectToString = objectProto.toString;
|
|
1942
|
-
|
|
1943
|
-
/** Built-in value references. */
|
|
1944
|
-
var symToStringTag = Symbol ? Symbol.toStringTag : undefined;
|
|
1945
|
-
|
|
1946
|
-
/**
|
|
1947
|
-
* A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
|
|
1948
|
-
*
|
|
1949
|
-
* @private
|
|
1950
|
-
* @param {*} value The value to query.
|
|
1951
|
-
* @returns {string} Returns the raw `toStringTag`.
|
|
1952
|
-
*/
|
|
1953
|
-
function getRawTag(value) {
|
|
1954
|
-
var isOwn = hasOwnProperty.call(value, symToStringTag),
|
|
1955
|
-
tag = value[symToStringTag];
|
|
1956
|
-
|
|
1957
|
-
try {
|
|
1958
|
-
value[symToStringTag] = undefined;
|
|
1959
|
-
var unmasked = true;
|
|
1960
|
-
} catch (e) {}
|
|
1961
|
-
|
|
1962
|
-
var result = nativeObjectToString.call(value);
|
|
1963
|
-
if (unmasked) {
|
|
1964
|
-
if (isOwn) {
|
|
1965
|
-
value[symToStringTag] = tag;
|
|
1966
|
-
} else {
|
|
1967
|
-
delete value[symToStringTag];
|
|
1968
|
-
}
|
|
1969
|
-
}
|
|
1970
|
-
return result;
|
|
1971
|
-
}
|
|
1972
|
-
|
|
1973
|
-
_getRawTag = getRawTag;
|
|
1974
|
-
return _getRawTag;
|
|
1975
|
-
}
|
|
1976
|
-
|
|
1977
|
-
/** Used for built-in method references. */
|
|
1978
|
-
|
|
1979
|
-
var _objectToString;
|
|
1980
|
-
var hasRequired_objectToString;
|
|
1981
|
-
|
|
1982
|
-
function require_objectToString () {
|
|
1983
|
-
if (hasRequired_objectToString) return _objectToString;
|
|
1984
|
-
hasRequired_objectToString = 1;
|
|
1985
|
-
var objectProto = Object.prototype;
|
|
1986
|
-
|
|
1987
|
-
/**
|
|
1988
|
-
* Used to resolve the
|
|
1989
|
-
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
|
|
1990
|
-
* of values.
|
|
1991
|
-
*/
|
|
1992
|
-
var nativeObjectToString = objectProto.toString;
|
|
1993
|
-
|
|
1994
|
-
/**
|
|
1995
|
-
* Converts `value` to a string using `Object.prototype.toString`.
|
|
1996
|
-
*
|
|
1997
|
-
* @private
|
|
1998
|
-
* @param {*} value The value to convert.
|
|
1999
|
-
* @returns {string} Returns the converted string.
|
|
2000
|
-
*/
|
|
2001
|
-
function objectToString(value) {
|
|
2002
|
-
return nativeObjectToString.call(value);
|
|
2003
|
-
}
|
|
2004
|
-
|
|
2005
|
-
_objectToString = objectToString;
|
|
2006
|
-
return _objectToString;
|
|
2007
|
-
}
|
|
2008
|
-
|
|
2009
|
-
var _baseGetTag;
|
|
2010
|
-
var hasRequired_baseGetTag;
|
|
2011
|
-
|
|
2012
|
-
function require_baseGetTag () {
|
|
2013
|
-
if (hasRequired_baseGetTag) return _baseGetTag;
|
|
2014
|
-
hasRequired_baseGetTag = 1;
|
|
2015
|
-
var Symbol = require_Symbol(),
|
|
2016
|
-
getRawTag = require_getRawTag(),
|
|
2017
|
-
objectToString = require_objectToString();
|
|
2018
|
-
|
|
2019
|
-
/** `Object#toString` result references. */
|
|
2020
|
-
var nullTag = '[object Null]',
|
|
2021
|
-
undefinedTag = '[object Undefined]';
|
|
2022
|
-
|
|
2023
|
-
/** Built-in value references. */
|
|
2024
|
-
var symToStringTag = Symbol ? Symbol.toStringTag : undefined;
|
|
2025
|
-
|
|
2026
|
-
/**
|
|
2027
|
-
* The base implementation of `getTag` without fallbacks for buggy environments.
|
|
2028
|
-
*
|
|
2029
|
-
* @private
|
|
2030
|
-
* @param {*} value The value to query.
|
|
2031
|
-
* @returns {string} Returns the `toStringTag`.
|
|
2032
|
-
*/
|
|
2033
|
-
function baseGetTag(value) {
|
|
2034
|
-
if (value == null) {
|
|
2035
|
-
return value === undefined ? undefinedTag : nullTag;
|
|
2036
|
-
}
|
|
2037
|
-
return (symToStringTag && symToStringTag in Object(value))
|
|
2038
|
-
? getRawTag(value)
|
|
2039
|
-
: objectToString(value);
|
|
2040
|
-
}
|
|
2041
|
-
|
|
2042
|
-
_baseGetTag = baseGetTag;
|
|
2043
|
-
return _baseGetTag;
|
|
2044
|
-
}
|
|
2045
|
-
|
|
2046
|
-
/**
|
|
2047
|
-
* Checks if `value` is object-like. A value is object-like if it's not `null`
|
|
2048
|
-
* and has a `typeof` result of "object".
|
|
2049
|
-
*
|
|
2050
|
-
* @static
|
|
2051
|
-
* @memberOf _
|
|
2052
|
-
* @since 4.0.0
|
|
2053
|
-
* @category Lang
|
|
2054
|
-
* @param {*} value The value to check.
|
|
2055
|
-
* @returns {boolean} Returns `true` if `value` is object-like, else `false`.
|
|
2056
|
-
* @example
|
|
2057
|
-
*
|
|
2058
|
-
* _.isObjectLike({});
|
|
2059
|
-
* // => true
|
|
2060
|
-
*
|
|
2061
|
-
* _.isObjectLike([1, 2, 3]);
|
|
2062
|
-
* // => true
|
|
2063
|
-
*
|
|
2064
|
-
* _.isObjectLike(_.noop);
|
|
2065
|
-
* // => false
|
|
2066
|
-
*
|
|
2067
|
-
* _.isObjectLike(null);
|
|
2068
|
-
* // => false
|
|
2069
|
-
*/
|
|
2070
|
-
|
|
2071
|
-
var isObjectLike_1;
|
|
2072
|
-
var hasRequiredIsObjectLike;
|
|
2073
|
-
|
|
2074
|
-
function requireIsObjectLike () {
|
|
2075
|
-
if (hasRequiredIsObjectLike) return isObjectLike_1;
|
|
2076
|
-
hasRequiredIsObjectLike = 1;
|
|
2077
|
-
function isObjectLike(value) {
|
|
2078
|
-
return value != null && typeof value == 'object';
|
|
2079
|
-
}
|
|
2080
|
-
|
|
2081
|
-
isObjectLike_1 = isObjectLike;
|
|
2082
|
-
return isObjectLike_1;
|
|
2083
|
-
}
|
|
2084
|
-
|
|
2085
|
-
var isSymbol_1;
|
|
2086
|
-
var hasRequiredIsSymbol;
|
|
2087
|
-
|
|
2088
|
-
function requireIsSymbol () {
|
|
2089
|
-
if (hasRequiredIsSymbol) return isSymbol_1;
|
|
2090
|
-
hasRequiredIsSymbol = 1;
|
|
2091
|
-
var baseGetTag = require_baseGetTag(),
|
|
2092
|
-
isObjectLike = requireIsObjectLike();
|
|
2093
|
-
|
|
2094
|
-
/** `Object#toString` result references. */
|
|
2095
|
-
var symbolTag = '[object Symbol]';
|
|
2096
|
-
|
|
2097
|
-
/**
|
|
2098
|
-
* Checks if `value` is classified as a `Symbol` primitive or object.
|
|
2099
|
-
*
|
|
2100
|
-
* @static
|
|
2101
|
-
* @memberOf _
|
|
2102
|
-
* @since 4.0.0
|
|
2103
|
-
* @category Lang
|
|
2104
|
-
* @param {*} value The value to check.
|
|
2105
|
-
* @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
|
|
2106
|
-
* @example
|
|
2107
|
-
*
|
|
2108
|
-
* _.isSymbol(Symbol.iterator);
|
|
2109
|
-
* // => true
|
|
2110
|
-
*
|
|
2111
|
-
* _.isSymbol('abc');
|
|
2112
|
-
* // => false
|
|
2113
|
-
*/
|
|
2114
|
-
function isSymbol(value) {
|
|
2115
|
-
return typeof value == 'symbol' ||
|
|
2116
|
-
(isObjectLike(value) && baseGetTag(value) == symbolTag);
|
|
2117
|
-
}
|
|
2118
|
-
|
|
2119
|
-
isSymbol_1 = isSymbol;
|
|
2120
|
-
return isSymbol_1;
|
|
2121
|
-
}
|
|
2122
|
-
|
|
2123
|
-
var toNumber_1;
|
|
2124
|
-
var hasRequiredToNumber;
|
|
2125
|
-
|
|
2126
|
-
function requireToNumber () {
|
|
2127
|
-
if (hasRequiredToNumber) return toNumber_1;
|
|
2128
|
-
hasRequiredToNumber = 1;
|
|
2129
|
-
var baseTrim = require_baseTrim(),
|
|
2130
|
-
isObject = requireIsObject(),
|
|
2131
|
-
isSymbol = requireIsSymbol();
|
|
2132
|
-
|
|
2133
|
-
/** Used as references for various `Number` constants. */
|
|
2134
|
-
var NAN = 0 / 0;
|
|
2135
|
-
|
|
2136
|
-
/** Used to detect bad signed hexadecimal string values. */
|
|
2137
|
-
var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
|
|
2138
|
-
|
|
2139
|
-
/** Used to detect binary string values. */
|
|
2140
|
-
var reIsBinary = /^0b[01]+$/i;
|
|
2141
|
-
|
|
2142
|
-
/** Used to detect octal string values. */
|
|
2143
|
-
var reIsOctal = /^0o[0-7]+$/i;
|
|
2144
|
-
|
|
2145
|
-
/** Built-in method references without a dependency on `root`. */
|
|
2146
|
-
var freeParseInt = parseInt;
|
|
2147
|
-
|
|
2148
|
-
/**
|
|
2149
|
-
* Converts `value` to a number.
|
|
2150
|
-
*
|
|
2151
|
-
* @static
|
|
2152
|
-
* @memberOf _
|
|
2153
|
-
* @since 4.0.0
|
|
2154
|
-
* @category Lang
|
|
2155
|
-
* @param {*} value The value to process.
|
|
2156
|
-
* @returns {number} Returns the number.
|
|
2157
|
-
* @example
|
|
2158
|
-
*
|
|
2159
|
-
* _.toNumber(3.2);
|
|
2160
|
-
* // => 3.2
|
|
2161
|
-
*
|
|
2162
|
-
* _.toNumber(Number.MIN_VALUE);
|
|
2163
|
-
* // => 5e-324
|
|
2164
|
-
*
|
|
2165
|
-
* _.toNumber(Infinity);
|
|
2166
|
-
* // => Infinity
|
|
2167
|
-
*
|
|
2168
|
-
* _.toNumber('3.2');
|
|
2169
|
-
* // => 3.2
|
|
2170
|
-
*/
|
|
2171
|
-
function toNumber(value) {
|
|
2172
|
-
if (typeof value == 'number') {
|
|
2173
|
-
return value;
|
|
2174
|
-
}
|
|
2175
|
-
if (isSymbol(value)) {
|
|
2176
|
-
return NAN;
|
|
2177
|
-
}
|
|
2178
|
-
if (isObject(value)) {
|
|
2179
|
-
var other = typeof value.valueOf == 'function' ? value.valueOf() : value;
|
|
2180
|
-
value = isObject(other) ? (other + '') : other;
|
|
2181
|
-
}
|
|
2182
|
-
if (typeof value != 'string') {
|
|
2183
|
-
return value === 0 ? value : +value;
|
|
2184
|
-
}
|
|
2185
|
-
value = baseTrim(value);
|
|
2186
|
-
var isBinary = reIsBinary.test(value);
|
|
2187
|
-
return (isBinary || reIsOctal.test(value))
|
|
2188
|
-
? freeParseInt(value.slice(2), isBinary ? 2 : 8)
|
|
2189
|
-
: (reIsBadHex.test(value) ? NAN : +value);
|
|
2190
|
-
}
|
|
2191
|
-
|
|
2192
|
-
toNumber_1 = toNumber;
|
|
2193
|
-
return toNumber_1;
|
|
2194
|
-
}
|
|
2195
|
-
|
|
2196
|
-
var debounce_1;
|
|
2197
|
-
var hasRequiredDebounce;
|
|
2198
|
-
|
|
2199
|
-
function requireDebounce () {
|
|
2200
|
-
if (hasRequiredDebounce) return debounce_1;
|
|
2201
|
-
hasRequiredDebounce = 1;
|
|
2202
|
-
var isObject = requireIsObject(),
|
|
2203
|
-
now = requireNow(),
|
|
2204
|
-
toNumber = requireToNumber();
|
|
2205
|
-
|
|
2206
|
-
/** Error message constants. */
|
|
2207
|
-
var FUNC_ERROR_TEXT = 'Expected a function';
|
|
2208
|
-
|
|
2209
|
-
/* Built-in method references for those with the same name as other `lodash` methods. */
|
|
2210
|
-
var nativeMax = Math.max,
|
|
2211
|
-
nativeMin = Math.min;
|
|
2212
|
-
|
|
2213
|
-
/**
|
|
2214
|
-
* Creates a debounced function that delays invoking `func` until after `wait`
|
|
2215
|
-
* milliseconds have elapsed since the last time the debounced function was
|
|
2216
|
-
* invoked. The debounced function comes with a `cancel` method to cancel
|
|
2217
|
-
* delayed `func` invocations and a `flush` method to immediately invoke them.
|
|
2218
|
-
* Provide `options` to indicate whether `func` should be invoked on the
|
|
2219
|
-
* leading and/or trailing edge of the `wait` timeout. The `func` is invoked
|
|
2220
|
-
* with the last arguments provided to the debounced function. Subsequent
|
|
2221
|
-
* calls to the debounced function return the result of the last `func`
|
|
2222
|
-
* invocation.
|
|
2223
|
-
*
|
|
2224
|
-
* **Note:** If `leading` and `trailing` options are `true`, `func` is
|
|
2225
|
-
* invoked on the trailing edge of the timeout only if the debounced function
|
|
2226
|
-
* is invoked more than once during the `wait` timeout.
|
|
2227
|
-
*
|
|
2228
|
-
* If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
|
|
2229
|
-
* until to the next tick, similar to `setTimeout` with a timeout of `0`.
|
|
2230
|
-
*
|
|
2231
|
-
* See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
|
|
2232
|
-
* for details over the differences between `_.debounce` and `_.throttle`.
|
|
2233
|
-
*
|
|
2234
|
-
* @static
|
|
2235
|
-
* @memberOf _
|
|
2236
|
-
* @since 0.1.0
|
|
2237
|
-
* @category Function
|
|
2238
|
-
* @param {Function} func The function to debounce.
|
|
2239
|
-
* @param {number} [wait=0] The number of milliseconds to delay.
|
|
2240
|
-
* @param {Object} [options={}] The options object.
|
|
2241
|
-
* @param {boolean} [options.leading=false]
|
|
2242
|
-
* Specify invoking on the leading edge of the timeout.
|
|
2243
|
-
* @param {number} [options.maxWait]
|
|
2244
|
-
* The maximum time `func` is allowed to be delayed before it's invoked.
|
|
2245
|
-
* @param {boolean} [options.trailing=true]
|
|
2246
|
-
* Specify invoking on the trailing edge of the timeout.
|
|
2247
|
-
* @returns {Function} Returns the new debounced function.
|
|
2248
|
-
* @example
|
|
2249
|
-
*
|
|
2250
|
-
* // Avoid costly calculations while the window size is in flux.
|
|
2251
|
-
* jQuery(window).on('resize', _.debounce(calculateLayout, 150));
|
|
2252
|
-
*
|
|
2253
|
-
* // Invoke `sendMail` when clicked, debouncing subsequent calls.
|
|
2254
|
-
* jQuery(element).on('click', _.debounce(sendMail, 300, {
|
|
2255
|
-
* 'leading': true,
|
|
2256
|
-
* 'trailing': false
|
|
2257
|
-
* }));
|
|
2258
|
-
*
|
|
2259
|
-
* // Ensure `batchLog` is invoked once after 1 second of debounced calls.
|
|
2260
|
-
* var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });
|
|
2261
|
-
* var source = new EventSource('/stream');
|
|
2262
|
-
* jQuery(source).on('message', debounced);
|
|
2263
|
-
*
|
|
2264
|
-
* // Cancel the trailing debounced invocation.
|
|
2265
|
-
* jQuery(window).on('popstate', debounced.cancel);
|
|
2266
|
-
*/
|
|
2267
|
-
function debounce(func, wait, options) {
|
|
2268
|
-
var lastArgs,
|
|
2269
|
-
lastThis,
|
|
2270
|
-
maxWait,
|
|
2271
|
-
result,
|
|
2272
|
-
timerId,
|
|
2273
|
-
lastCallTime,
|
|
2274
|
-
lastInvokeTime = 0,
|
|
2275
|
-
leading = false,
|
|
2276
|
-
maxing = false,
|
|
2277
|
-
trailing = true;
|
|
2278
|
-
|
|
2279
|
-
if (typeof func != 'function') {
|
|
2280
|
-
throw new TypeError(FUNC_ERROR_TEXT);
|
|
2281
|
-
}
|
|
2282
|
-
wait = toNumber(wait) || 0;
|
|
2283
|
-
if (isObject(options)) {
|
|
2284
|
-
leading = !!options.leading;
|
|
2285
|
-
maxing = 'maxWait' in options;
|
|
2286
|
-
maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;
|
|
2287
|
-
trailing = 'trailing' in options ? !!options.trailing : trailing;
|
|
2288
|
-
}
|
|
2289
|
-
|
|
2290
|
-
function invokeFunc(time) {
|
|
2291
|
-
var args = lastArgs,
|
|
2292
|
-
thisArg = lastThis;
|
|
2293
|
-
|
|
2294
|
-
lastArgs = lastThis = undefined;
|
|
2295
|
-
lastInvokeTime = time;
|
|
2296
|
-
result = func.apply(thisArg, args);
|
|
2297
|
-
return result;
|
|
2298
|
-
}
|
|
2299
|
-
|
|
2300
|
-
function leadingEdge(time) {
|
|
2301
|
-
// Reset any `maxWait` timer.
|
|
2302
|
-
lastInvokeTime = time;
|
|
2303
|
-
// Start the timer for the trailing edge.
|
|
2304
|
-
timerId = setTimeout(timerExpired, wait);
|
|
2305
|
-
// Invoke the leading edge.
|
|
2306
|
-
return leading ? invokeFunc(time) : result;
|
|
2307
|
-
}
|
|
2308
|
-
|
|
2309
|
-
function remainingWait(time) {
|
|
2310
|
-
var timeSinceLastCall = time - lastCallTime,
|
|
2311
|
-
timeSinceLastInvoke = time - lastInvokeTime,
|
|
2312
|
-
timeWaiting = wait - timeSinceLastCall;
|
|
2313
|
-
|
|
2314
|
-
return maxing
|
|
2315
|
-
? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke)
|
|
2316
|
-
: timeWaiting;
|
|
2317
|
-
}
|
|
2318
|
-
|
|
2319
|
-
function shouldInvoke(time) {
|
|
2320
|
-
var timeSinceLastCall = time - lastCallTime,
|
|
2321
|
-
timeSinceLastInvoke = time - lastInvokeTime;
|
|
2322
|
-
|
|
2323
|
-
// Either this is the first call, activity has stopped and we're at the
|
|
2324
|
-
// trailing edge, the system time has gone backwards and we're treating
|
|
2325
|
-
// it as the trailing edge, or we've hit the `maxWait` limit.
|
|
2326
|
-
return (lastCallTime === undefined || (timeSinceLastCall >= wait) ||
|
|
2327
|
-
(timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));
|
|
2328
|
-
}
|
|
2329
|
-
|
|
2330
|
-
function timerExpired() {
|
|
2331
|
-
var time = now();
|
|
2332
|
-
if (shouldInvoke(time)) {
|
|
2333
|
-
return trailingEdge(time);
|
|
2334
|
-
}
|
|
2335
|
-
// Restart the timer.
|
|
2336
|
-
timerId = setTimeout(timerExpired, remainingWait(time));
|
|
2337
|
-
}
|
|
2338
|
-
|
|
2339
|
-
function trailingEdge(time) {
|
|
2340
|
-
timerId = undefined;
|
|
2341
|
-
|
|
2342
|
-
// Only invoke if we have `lastArgs` which means `func` has been
|
|
2343
|
-
// debounced at least once.
|
|
2344
|
-
if (trailing && lastArgs) {
|
|
2345
|
-
return invokeFunc(time);
|
|
2346
|
-
}
|
|
2347
|
-
lastArgs = lastThis = undefined;
|
|
2348
|
-
return result;
|
|
2349
|
-
}
|
|
2350
|
-
|
|
2351
|
-
function cancel() {
|
|
2352
|
-
if (timerId !== undefined) {
|
|
2353
|
-
clearTimeout(timerId);
|
|
2354
|
-
}
|
|
2355
|
-
lastInvokeTime = 0;
|
|
2356
|
-
lastArgs = lastCallTime = lastThis = timerId = undefined;
|
|
2357
|
-
}
|
|
2358
|
-
|
|
2359
|
-
function flush() {
|
|
2360
|
-
return timerId === undefined ? result : trailingEdge(now());
|
|
2361
|
-
}
|
|
2362
|
-
|
|
2363
|
-
function debounced() {
|
|
2364
|
-
var time = now(),
|
|
2365
|
-
isInvoking = shouldInvoke(time);
|
|
2366
|
-
|
|
2367
|
-
lastArgs = arguments;
|
|
2368
|
-
lastThis = this;
|
|
2369
|
-
lastCallTime = time;
|
|
2370
|
-
|
|
2371
|
-
if (isInvoking) {
|
|
2372
|
-
if (timerId === undefined) {
|
|
2373
|
-
return leadingEdge(lastCallTime);
|
|
2374
|
-
}
|
|
2375
|
-
if (maxing) {
|
|
2376
|
-
// Handle invocations in a tight loop.
|
|
2377
|
-
clearTimeout(timerId);
|
|
2378
|
-
timerId = setTimeout(timerExpired, wait);
|
|
2379
|
-
return invokeFunc(lastCallTime);
|
|
2380
|
-
}
|
|
2381
|
-
}
|
|
2382
|
-
if (timerId === undefined) {
|
|
2383
|
-
timerId = setTimeout(timerExpired, wait);
|
|
2384
|
-
}
|
|
2385
|
-
return result;
|
|
2386
|
-
}
|
|
2387
|
-
debounced.cancel = cancel;
|
|
2388
|
-
debounced.flush = flush;
|
|
2389
|
-
return debounced;
|
|
2390
|
-
}
|
|
2391
|
-
|
|
2392
|
-
debounce_1 = debounce;
|
|
2393
|
-
return debounce_1;
|
|
2394
|
-
}
|
|
2395
|
-
|
|
2396
|
-
var debounceExports = requireDebounce();
|
|
2397
|
-
var debounce = /*@__PURE__*/getDefaultExportFromCjs(debounceExports);
|
|
2398
|
-
|
|
2399
1739
|
/**
|
|
2400
1740
|
* Custom hook to manage async select field options with search, pagination, and error handling using React Query.
|
|
2401
1741
|
*
|
|
@@ -2420,13 +1760,13 @@ var debounce = /*@__PURE__*/getDefaultExportFromCjs(debounceExports);
|
|
|
2420
1760
|
* ```
|
|
2421
1761
|
*/
|
|
2422
1762
|
function useFieldOptions(field) {
|
|
2423
|
-
var _a, _b, _c, _d, _e, _f
|
|
1763
|
+
var _a, _b, _c, _d, _e, _f;
|
|
2424
1764
|
const [searchQuery, setSearchQuery] = useState("");
|
|
2425
1765
|
const queryClient = useQueryClient();
|
|
2426
1766
|
// Generate a unique query key for this field
|
|
2427
1767
|
const queryKey = useMemo(() => {
|
|
2428
1768
|
return ["field-options", field.key, field.name];
|
|
2429
|
-
}, [field.key, field.name
|
|
1769
|
+
}, [field.key, field.name]);
|
|
2430
1770
|
// Initial fetch query for static options or first page
|
|
2431
1771
|
const initialQuery = useQuery({
|
|
2432
1772
|
queryKey: [...queryKey, "initial"],
|
|
@@ -2443,16 +1783,12 @@ function useFieldOptions(field) {
|
|
|
2443
1783
|
type: "OFFSET",
|
|
2444
1784
|
hasNextPage: false,
|
|
2445
1785
|
};
|
|
2446
|
-
return await field.optionsSource.getOptions(pagination, {}
|
|
1786
|
+
return await field.optionsSource.getOptions(pagination, {});
|
|
2447
1787
|
},
|
|
2448
1788
|
enabled: !!((_a = field.optionsSource) === null || _a === void 0 ? void 0 : _a.getOptions),
|
|
2449
1789
|
staleTime: 1000 * 60 * 5, // 5 minutes
|
|
2450
1790
|
gcTime: 1000 * 60 * 10, // 10 minutes (formerly cacheTime)
|
|
2451
1791
|
});
|
|
2452
|
-
// Create debounced search function for server-side search
|
|
2453
|
-
const debouncedSetSearch = useMemo(() => debounce((query) => {
|
|
2454
|
-
setSearchQuery(query);
|
|
2455
|
-
}, 800), []);
|
|
2456
1792
|
// Infinite query for pagination
|
|
2457
1793
|
const infiniteQuery = useInfiniteQuery({
|
|
2458
1794
|
queryKey: [...queryKey, "infinite"],
|
|
@@ -2478,43 +1814,35 @@ function useFieldOptions(field) {
|
|
|
2478
1814
|
staleTime: 1000 * 60 * 5, // 5 minutes
|
|
2479
1815
|
gcTime: 1000 * 60 * 10, // 10 minutes
|
|
2480
1816
|
});
|
|
2481
|
-
// Combine all options from initial query and infinite query
|
|
1817
|
+
// Combine all options from initial query and infinite query
|
|
2482
1818
|
const allOptions = useMemo(() => {
|
|
2483
1819
|
var _a, _b;
|
|
2484
|
-
const
|
|
1820
|
+
const options = [];
|
|
2485
1821
|
// Add initial options
|
|
2486
1822
|
if ((_a = initialQuery.data) === null || _a === void 0 ? void 0 : _a.options) {
|
|
2487
|
-
initialQuery.data.options
|
|
2488
|
-
optionsMap.set(option.value, option);
|
|
2489
|
-
});
|
|
1823
|
+
options.push(...initialQuery.data.options);
|
|
2490
1824
|
}
|
|
2491
1825
|
// Add paginated options
|
|
2492
1826
|
if ((_b = infiniteQuery.data) === null || _b === void 0 ? void 0 : _b.pages) {
|
|
2493
1827
|
infiniteQuery.data.pages.forEach((page) => {
|
|
2494
1828
|
if (page.options) {
|
|
2495
|
-
page.options
|
|
2496
|
-
optionsMap.set(option.value, option);
|
|
2497
|
-
});
|
|
1829
|
+
options.push(...page.options);
|
|
2498
1830
|
}
|
|
2499
1831
|
});
|
|
2500
1832
|
}
|
|
2501
|
-
return
|
|
1833
|
+
return options;
|
|
2502
1834
|
}, [initialQuery.data, infiniteQuery.data]);
|
|
2503
|
-
// Filter options by query (client-side filtering
|
|
1835
|
+
// Filter options by query (client-side filtering)
|
|
2504
1836
|
const filteredOptions = useMemo(() => {
|
|
2505
|
-
|
|
2506
|
-
|
|
2507
|
-
|
|
2508
|
-
|
|
2509
|
-
|
|
2510
|
-
// When searchable is true, use the server-filtered results directly
|
|
2511
|
-
return allOptions;
|
|
2512
|
-
}, [allOptions, searchQuery, (_e = initialQuery.data) === null || _e === void 0 ? void 0 : _e.searchable]);
|
|
1837
|
+
// For now, we'll do client-side filtering
|
|
1838
|
+
// In a real implementation, you might want to use the searchOptions function
|
|
1839
|
+
// and create a separate query for search results
|
|
1840
|
+
return allOptions.filter((option) => option.label.toLowerCase().includes(searchQuery.toLowerCase()));
|
|
1841
|
+
}, [allOptions, searchQuery]);
|
|
2513
1842
|
// Search handler
|
|
2514
1843
|
const search = useCallback((query) => {
|
|
2515
|
-
|
|
2516
|
-
|
|
2517
|
-
}, [debouncedSetSearch]);
|
|
1844
|
+
setSearchQuery(query);
|
|
1845
|
+
}, []);
|
|
2518
1846
|
// Load more handler
|
|
2519
1847
|
const loadMore = useCallback(async () => {
|
|
2520
1848
|
if (infiniteQuery.hasNextPage && !infiniteQuery.isFetchingNextPage) {
|
|
@@ -2563,7 +1891,7 @@ function useFieldOptions(field) {
|
|
|
2563
1891
|
search,
|
|
2564
1892
|
loadMore,
|
|
2565
1893
|
totalLoadedOptions: allOptions.length,
|
|
2566
|
-
error: ((
|
|
1894
|
+
error: ((_e = initialQuery.error) === null || _e === void 0 ? void 0 : _e.message) || ((_f = infiniteQuery.error) === null || _f === void 0 ? void 0 : _f.message) || null,
|
|
2567
1895
|
};
|
|
2568
1896
|
}
|
|
2569
1897
|
|