Comparing version 1.0.29 to 1.0.30
@@ -79,3 +79,3 @@ "use strict"; | ||
return [2 /*return*/, []]; | ||
}); }); } : _b, _c = _a.data, data = _c === void 0 ? [] : _c, errors = _a.errors, _d = _a.required, required = _d === void 0 ? false : _d, name = _a.name, _e = _a.fullWidth, fullWidth = _e === void 0 ? false : _e, placeholder = _a.placeholder, id = _a.id, _f = _a.type, type = _f === void 0 ? 'custom_select' : _f, _g = _a.readOnly, readOnly = _g === void 0 ? false : _g, _h = _a.disabled, disabled = _h === void 0 ? false : _h, value = _a.value, _j = _a.isMultiple, isMultiple = _j === void 0 ? false : _j, _k = _a.desc, desc = _k === void 0 ? 'name' : _k, _l = _a.descId, descId = _l === void 0 ? 'id' : _l, singleSelect = _a.singleSelect, className = _a.className, _m = _a.async, async = _m === void 0 ? false : _m, nextBlock = _a.nextBlock, paginationEnabled = _a.paginationEnabled; | ||
}); }); } : _b, _c = _a.data, data = _c === void 0 ? [] : _c, errors = _a.errors, _d = _a.required, required = _d === void 0 ? false : _d, name = _a.name, _e = _a.fullWidth, fullWidth = _e === void 0 ? false : _e, placeholder = _a.placeholder, id = _a.id, _f = _a.type, type = _f === void 0 ? 'custom_select' : _f, _g = _a.readOnly, readOnly = _g === void 0 ? false : _g, _h = _a.disabled, disabled = _h === void 0 ? false : _h, value = _a.value, _j = _a.isMultiple, isMultiple = _j === void 0 ? false : _j, _k = _a.desc, desc = _k === void 0 ? 'name' : _k, _l = _a.descId, descId = _l === void 0 ? 'id' : _l, singleSelect = _a.singleSelect, className = _a.className, _m = _a.async, async = _m === void 0 ? false : _m, nextBlock = _a.nextBlock, paginationEnabled = _a.paginationEnabled, initialLoad = _a.initialLoad; | ||
var dropdownRef = (0, react_1.useRef)(null); | ||
@@ -88,3 +88,3 @@ // State Hooks Section | ||
// API call for suggestions through a custom hook | ||
var _s = (0, autosuggestions_1.useSuggestions)(getData, data, dropOpen, async, paginationEnabled | ||
var _s = (0, autosuggestions_1.useSuggestions)(getData, data, dropOpen, async, paginationEnabled, initialLoad | ||
// nextBlock | ||
@@ -91,0 +91,0 @@ ), suggestions = _s.suggestions, isLoading = _s.isLoading, handlePickSuggestions = _s.handlePickSuggestions; |
@@ -27,3 +27,4 @@ type ValueProps = { | ||
nextBlock?: number; | ||
initialLoad?: boolean; | ||
} | ||
export {}; |
type ValueProps = { | ||
[key: string]: string; | ||
}; | ||
type UseSuggestionsType = (getData: (key?: string, next?: number) => Promise<ValueProps[]>, initialData?: ValueProps[], dropOpen?: boolean, asyncFetch?: boolean, paginationEnabled?: boolean) => { | ||
type UseSuggestionsType = (getData: (key?: string, next?: number) => Promise<ValueProps[]>, initialData?: ValueProps[], dropOpen?: boolean, asyncFetch?: boolean, paginationEnabled?: boolean, initialLoad?: boolean) => { | ||
suggestions: ValueProps[]; | ||
@@ -6,0 +6,0 @@ isLoading: boolean; |
@@ -50,3 +50,3 @@ "use strict"; | ||
var react_1 = require("react"); | ||
var useSuggestions = function (getData, initialData, dropOpen, asyncFetch, paginationEnabled) { | ||
var useSuggestions = function (getData, initialData, dropOpen, asyncFetch, paginationEnabled, initialLoad) { | ||
if (initialData === void 0) { initialData = []; } | ||
@@ -56,2 +56,3 @@ if (dropOpen === void 0) { dropOpen = false; } | ||
if (paginationEnabled === void 0) { paginationEnabled = false; } | ||
if (initialLoad === void 0) { initialLoad = false; } | ||
var _a = (0, react_1.useState)(initialData), suggestions = _a[0], setSuggestions = _a[1]; | ||
@@ -68,3 +69,3 @@ var _b = (0, react_1.useState)(false), isLoading = _b[0], setIsLoading = _b[1]; | ||
_a.trys.push([1, 3, 4, 5]); | ||
return [4 /*yield*/, (asyncFetch | ||
return [4 /*yield*/, (asyncFetch || initialLoad | ||
? getData(value, nextPage) | ||
@@ -71,0 +72,0 @@ : Promise.resolve(initialData))]; |
{ | ||
"name": "qbs-core", | ||
"version": "1.0.29", | ||
"version": "1.0.30", | ||
"description": "React Components", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -31,2 +31,3 @@ type ValueProps = { | ||
nextBlock?: number; | ||
initialLoad?: boolean; | ||
} |
@@ -12,3 +12,4 @@ import { useEffect, useState } from 'react'; | ||
asyncFetch?: boolean, | ||
paginationEnabled?: boolean | ||
paginationEnabled?: boolean, | ||
initialLoad?: boolean | ||
) => { | ||
@@ -29,3 +30,4 @@ suggestions: ValueProps[]; | ||
asyncFetch = false, | ||
paginationEnabled = false | ||
paginationEnabled = false, | ||
initialLoad = false | ||
) => { | ||
@@ -42,3 +44,3 @@ const [suggestions, setSuggestions] = useState<ValueProps[]>(initialData); | ||
try { | ||
const data = await (asyncFetch | ||
const data = await (asyncFetch || initialLoad | ||
? getData(value, nextPage) | ||
@@ -45,0 +47,0 @@ : Promise.resolve(initialData)); |
@@ -12,3 +12,3 @@ const path = require('path'); | ||
hot: true, | ||
port: 3001, // port to run the dev server on | ||
port: 3000, // port to run the dev server on | ||
// stats: 'errors-only', // only show errors in the output | ||
@@ -15,0 +15,0 @@ clientLogLevel: 'silent', |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
99300
47
2063