From 558d83b182997ba3aa16df947c1a9ddb43cb1c25 Mon Sep 17 00:00:00 2001 From: melloware Date: Wed, 16 Nov 2022 17:00:06 -0500 Subject: [PATCH] Autocomplete typescript doc fixes --- components/doc/autocomplete/basicdoc.js | 4 +-- components/doc/autocomplete/dropdowndoc.js | 4 +-- .../doc/autocomplete/forceselectiondoc.js | 4 +-- components/doc/autocomplete/groupdoc.js | 12 ++++---- components/doc/autocomplete/multipledoc.js | 28 ++++++++--------- components/doc/autocomplete/objectsdoc.js | 28 ++++++++--------- components/doc/autocomplete/templatedoc.js | 30 +++++++++---------- .../doc/autocomplete/virtualscrolldoc.js | 12 ++++---- 8 files changed, 61 insertions(+), 61 deletions(-) diff --git a/components/doc/autocomplete/basicdoc.js b/components/doc/autocomplete/basicdoc.js index b328ecbf07..fb1a47c854 100644 --- a/components/doc/autocomplete/basicdoc.js +++ b/components/doc/autocomplete/basicdoc.js @@ -1,7 +1,7 @@ import { useState } from 'react'; import { AutoComplete } from '../../lib/autocomplete/AutoComplete'; -import { DocSectionText } from '../common/docsectiontext'; import { DocSectionCode } from '../common/docsectioncode'; +import { DocSectionText } from '../common/docsectiontext'; export function BasicDoc(props) { const [value, setValue] = useState(''); @@ -34,7 +34,7 @@ export default function BasicDemo() { `, typescript: ` import { useState } from "react"; -import { AutoComplete } from "primereact/autocomplete"; +import { AutoComplete, AutoCompleteCompleteMethodParams } from "primereact/autocomplete"; export default function BasicDemo() { const [value, setValue] = useState(''); diff --git a/components/doc/autocomplete/dropdowndoc.js b/components/doc/autocomplete/dropdowndoc.js index d540753a14..676c6ca0c8 100644 --- a/components/doc/autocomplete/dropdowndoc.js +++ b/components/doc/autocomplete/dropdowndoc.js @@ -1,7 +1,7 @@ import { useState } from 'react'; import { AutoComplete } from '../../lib/autocomplete/AutoComplete'; -import { DocSectionText } from '../common/docsectiontext'; import { DocSectionCode } from '../common/docsectioncode'; +import { DocSectionText } from '../common/docsectiontext'; export function DropdownDoc(props) { const [value, setValue] = useState(''); @@ -37,7 +37,7 @@ export default function DropdownDemo() { `, typescript: ` import { useState } from "react"; -import { AutoComplete } from "primereact/autocomplete"; +import { AutoComplete, AutoCompleteCompleteMethodParams } from "primereact/autocomplete"; export default function DropdownDemo() { const [value, setValue] = useState(''); diff --git a/components/doc/autocomplete/forceselectiondoc.js b/components/doc/autocomplete/forceselectiondoc.js index f0aadc608c..57a3da3aa1 100644 --- a/components/doc/autocomplete/forceselectiondoc.js +++ b/components/doc/autocomplete/forceselectiondoc.js @@ -1,7 +1,7 @@ import { useState } from 'react'; import { AutoComplete } from '../../lib/autocomplete/AutoComplete'; -import { DocSectionText } from '../common/docsectiontext'; import { DocSectionCode } from '../common/docsectioncode'; +import { DocSectionText } from '../common/docsectiontext'; export function ForceSelectionDoc(props) { const [value, setValue] = useState(''); @@ -34,7 +34,7 @@ export default function ForceSelectionDemo() { `, typescript: ` import { useState } from "react"; -import { AutoComplete } from "primereact/autocomplete"; +import { AutoComplete, AutoCompleteCompleteMethodParams } from "primereact/autocomplete"; export default function ForceSelectionDemo() { const [value, setValue] = useState(''); diff --git a/components/doc/autocomplete/groupdoc.js b/components/doc/autocomplete/groupdoc.js index 3171f69e5e..f636c769a2 100644 --- a/components/doc/autocomplete/groupdoc.js +++ b/components/doc/autocomplete/groupdoc.js @@ -1,8 +1,8 @@ -import { useState } from 'react'; import getConfig from 'next/config'; +import { useState } from 'react'; import { AutoComplete } from '../../lib/autocomplete/AutoComplete'; -import { DocSectionText } from '../common/docsectiontext'; import { DocSectionCode } from '../common/docsectioncode'; +import { DocSectionText } from '../common/docsectiontext'; export function GroupDoc(props) { const [selectedCity, setSelectedCity] = useState(null); @@ -73,7 +73,7 @@ export function GroupDoc(props) { const code = { basic: ` - setSelectedCity(e.value)} suggestions={filteredCities} completeMethod={search} + setSelectedCity(e.value)} suggestions={filteredCities} completeMethod={search} field="label" optionGroupLabel="label" optionGroupChildren="items" optionGroupTemplate={groupedItemTemplate} placeholder="Hint: type 'a'" /> `, javascript: ` @@ -147,14 +147,14 @@ export default function GroupDemo() { } return ( - setSelectedCity(e.value)} suggestions={filteredCities} completeMethod={search} + setSelectedCity(e.value)} suggestions={filteredCities} completeMethod={search} field="label" optionGroupLabel="label" optionGroupChildren="items" optionGroupTemplate={groupedItemTemplate} placeholder="Hint: type 'a'" /> ) } `, typescript: ` import { useState } from 'react'; -import { AutoComplete } from "primereact/autocomplete"; +import { AutoComplete, AutoCompleteCompleteMethodParams } from "primereact/autocomplete"; interface City { label: string; @@ -234,7 +234,7 @@ export default function GroupDemo() { } return ( - setSelectedCity(e.value)} suggestions={filteredCities} completeMethod={search} + setSelectedCity(e.value)} suggestions={filteredCities} completeMethod={search} field="label" optionGroupLabel="label" optionGroupChildren="items" optionGroupTemplate={groupedItemTemplate} placeholder="Hint: type 'a'" /> ) } diff --git a/components/doc/autocomplete/multipledoc.js b/components/doc/autocomplete/multipledoc.js index 61084ae4dd..49b10f5e46 100644 --- a/components/doc/autocomplete/multipledoc.js +++ b/components/doc/autocomplete/multipledoc.js @@ -1,8 +1,8 @@ import { useEffect, useState } from 'react'; +import { CountryService } from '../../../service/CountryService'; import { AutoComplete } from '../../lib/autocomplete/AutoComplete'; -import { DocSectionText } from '../common/docsectiontext'; import { DocSectionCode } from '../common/docsectioncode'; -import { CountryService } from '../../../service/CountryService'; +import { DocSectionText } from '../common/docsectiontext'; export function MultipleDoc(props) { const [countries, setCountries] = useState([]); @@ -32,10 +32,10 @@ export function MultipleDoc(props) { countryservice.getCountries().then((data) => setCountries(data)); /* Countries is an array of objects with name, code pairs; - [ + [ ... - {"name": "United Kingdom", "code": "UK"}, - {"name": "United States", "code": "USA"}, + {"name": "United Kingdom", "code": "UK"}, + {"name": "United States", "code": "USA"}, ... ] */ @@ -62,7 +62,7 @@ export default function MultipleDemo() { if (!event.query.trim().length) { _filteredCountries = [...countries]; - } + } else { _filteredCountries = countries.filter((country) => { return country.name.toLowerCase().startsWith(event.query.toLowerCase()); @@ -77,10 +77,10 @@ export default function MultipleDemo() { countryservice.getCountries().then((data) => setCountries(data)); /* Countries is an array of objects with a name and a code; - [ + [ ... - {"name": "United Kingdom", "code": "UK"}, - {"name": "United States", "code": "USA"}, + {"name": "United Kingdom", "code": "UK"}, + {"name": "United States", "code": "USA"}, ... ] */ @@ -93,7 +93,7 @@ export default function MultipleDemo() { `, typescript: ` import { useEffect, useState } from 'react'; -import { AutoComplete } from "primereact/autocomplete"; +import { AutoComplete, AutoCompleteCompleteMethodParams } from "primereact/autocomplete"; interface Country { name: string; @@ -113,7 +113,7 @@ export default function MultipleDemo() { if (!event.query.trim().length) { _filteredCountries = [...countries]; - } + } else { _filteredCountries = countries.filter((country) => { return country.name.toLowerCase().startsWith(event.query.toLowerCase()); @@ -128,10 +128,10 @@ export default function MultipleDemo() { countryservice.getCountries().then((data) => setCountries(data)); /* Countries is an array of objects with a name and a code; - [ + [ ... - {"name": "United Kingdom", "code": "UK"}, - {"name": "United States", "code": "USA"}, + {"name": "United Kingdom", "code": "UK"}, + {"name": "United States", "code": "USA"}, ... ] */ diff --git a/components/doc/autocomplete/objectsdoc.js b/components/doc/autocomplete/objectsdoc.js index 71f432b9d7..29a372ae77 100644 --- a/components/doc/autocomplete/objectsdoc.js +++ b/components/doc/autocomplete/objectsdoc.js @@ -1,8 +1,8 @@ import { useEffect, useState } from 'react'; +import { CountryService } from '../../../service/CountryService'; import { AutoComplete } from '../../lib/autocomplete/AutoComplete'; -import { DocSectionText } from '../common/docsectiontext'; import { DocSectionCode } from '../common/docsectioncode'; -import { CountryService } from '../../../service/CountryService'; +import { DocSectionText } from '../common/docsectiontext'; export function ObjectsDoc(props) { const [countries, setCountries] = useState([]); @@ -32,10 +32,10 @@ export function ObjectsDoc(props) { countryservice.getCountries().then((data) => setCountries(data)); /* Countries is an array of objects with name, code pairs; - [ + [ ... - {"name": "United Kingdom", "code": "UK"}, - {"name": "United States", "code": "USA"}, + {"name": "United Kingdom", "code": "UK"}, + {"name": "United States", "code": "USA"}, ... ] */ @@ -62,7 +62,7 @@ export default function ObjectDemo() { if (!event.query.trim().length) { _filteredCountries = [...countries]; - } + } else { _filteredCountries = countries.filter((country) => { return country.name.toLowerCase().startsWith(event.query.toLowerCase()); @@ -77,10 +77,10 @@ export default function ObjectDemo() { countryservice.getCountries().then((data) => setCountries(data)); /* Countries is an array of objects with a name and a code; - [ + [ ... - {"name": "United Kingdom", "code": "UK"}, - {"name": "United States", "code": "USA"}, + {"name": "United Kingdom", "code": "UK"}, + {"name": "United States", "code": "USA"}, ... ] */ @@ -93,7 +93,7 @@ export default function ObjectDemo() { `, typescript: ` import { useEffect, useState } from 'react'; -import { AutoComplete } from "primereact/autocomplete"; +import { AutoComplete, AutoCompleteCompleteMethodParams } from "primereact/autocomplete"; interface Country { name: string; @@ -113,7 +113,7 @@ export default function ObjectDemo() { if (!event.query.trim().length) { _filteredCountries = [...countries]; - } + } else { _filteredCountries = countries.filter((country) => { return country.name.toLowerCase().startsWith(event.query.toLowerCase()); @@ -128,10 +128,10 @@ export default function ObjectDemo() { countryservice.getCountries().then((data) => setCountries(data)); /* Countries is an array of objects with a name and a code; - [ + [ ... - {"name": "United Kingdom", "code": "UK"}, - {"name": "United States", "code": "USA"}, + {"name": "United Kingdom", "code": "UK"}, + {"name": "United States", "code": "USA"}, ... ] */ diff --git a/components/doc/autocomplete/templatedoc.js b/components/doc/autocomplete/templatedoc.js index b195da755f..a113a1ebc8 100644 --- a/components/doc/autocomplete/templatedoc.js +++ b/components/doc/autocomplete/templatedoc.js @@ -1,9 +1,9 @@ -import { useEffect, useState } from 'react'; import getConfig from 'next/config'; +import { useEffect, useState } from 'react'; +import { CountryService } from '../../../service/CountryService'; import { AutoComplete } from '../../lib/autocomplete/AutoComplete'; -import { DocSectionText } from '../common/docsectiontext'; import { DocSectionCode } from '../common/docsectioncode'; -import { CountryService } from '../../../service/CountryService'; +import { DocSectionText } from '../common/docsectiontext'; export function TemplateDoc(props) { const [countries, setCountries] = useState([]); @@ -49,10 +49,10 @@ export function TemplateDoc(props) { countryservice.getCountries().then((data) => setCountries(data)); /* Countries is an array of objects with name, code pairs; - [ + [ ... - {"name": "United Kingdom", "code": "UK"}, - {"name": "United States", "code": "USA"}, + {"name": "United Kingdom", "code": "UK"}, + {"name": "United States", "code": "USA"}, ... ] */ @@ -79,7 +79,7 @@ export default function TemplateDemo() { if (!event.query.trim().length) { _filteredCountries = [...countries]; - } + } else { _filteredCountries = countries.filter((country) => { return country.name.toLowerCase().startsWith(event.query.toLowerCase()); @@ -109,10 +109,10 @@ export default function TemplateDemo() { countryservice.getCountries().then((data) => setCountries(data)); /* Countries is an array of objects with a name and a code; - [ + [ ... - {"name": "United Kingdom", "code": "UK"}, - {"name": "United States", "code": "USA"}, + {"name": "United Kingdom", "code": "UK"}, + {"name": "United States", "code": "USA"}, ... ] */ @@ -125,7 +125,7 @@ export default function TemplateDemo() { `, typescript: ` import { useEffect, useState } from 'react'; -import { AutoComplete } from "primereact/autocomplete"; +import { AutoComplete, AutoCompleteCompleteMethodParams } from "primereact/autocomplete"; interface Country { name: string; @@ -145,7 +145,7 @@ export default function TemplateDemo() { if (!event.query.trim().length) { _filteredCountries = [...countries]; - } + } else { _filteredCountries = countries.filter((country) => { return country.name.toLowerCase().startsWith(event.query.toLowerCase()); @@ -175,10 +175,10 @@ export default function TemplateDemo() { countryservice.getCountries().then((data) => setCountries(data)); /* Countries is an array of objects with a name and a code; - [ + [ ... - {"name": "United Kingdom", "code": "UK"}, - {"name": "United States", "code": "USA"}, + {"name": "United Kingdom", "code": "UK"}, + {"name": "United States", "code": "USA"}, ... ] */ diff --git a/components/doc/autocomplete/virtualscrolldoc.js b/components/doc/autocomplete/virtualscrolldoc.js index 65e8bfd97b..46ffaadef3 100644 --- a/components/doc/autocomplete/virtualscrolldoc.js +++ b/components/doc/autocomplete/virtualscrolldoc.js @@ -1,8 +1,8 @@ -import { useState } from 'react'; import Link from 'next/link'; +import { useState } from 'react'; import { AutoComplete } from '../../lib/autocomplete/AutoComplete'; -import { DocSectionText } from '../common/docsectiontext'; import { DocSectionCode } from '../common/docsectioncode'; +import { DocSectionText } from '../common/docsectiontext'; export function VirtualScrollDoc(props) { const [selectedItem, setSelectedItem] = useState(null); @@ -27,7 +27,7 @@ export function VirtualScrollDoc(props) { const code = { basic: ` - setSelectedItem(e.value)} /> `, javascript: ` @@ -55,14 +55,14 @@ export default function VirtualScrollerDemo() { } return ( - setSelectedItem(e.value)} /> ) } `, typescript: ` import { useState } from "react"; -import { AutoComplete } from "primereact/autocomplete"; +import { AutoComplete, AutoCompleteCompleteMethodParams } from "primereact/autocomplete"; interface Item { label: string; @@ -90,7 +90,7 @@ export default function VirtualScrollerDemo() { } return ( - setSelectedItem(e.value)} /> ) }