
Security News
npm Adopts OIDC for Trusted Publishing in CI/CD Workflows
npm now supports Trusted Publishing with OIDC, enabling secure package publishing directly from CI/CD workflows without relying on long-lived tokens.
sel-esri-custom-table
Advanced tools
The useWithAdvanceSearch
hook is designed to manage state for dynamic fields in a React application. It uses data from a feature layer and a time query to fetch unique field values and update the state accordingly.
To use this hook in your project, ensure you have the required dependencies:
npm install sel-esri-advance-search
The ESRIAdvanceSearch component can be used directly in your React application as shown below:
import ESRIAdvanceSearch from 'esri-advance-search';
const MyComponent = ({ featureLayer, autocompleteFields, setFinalQuery }) => {
return (
<ESRIAdvanceSearch
featureLayer={featureLayer}
timeQuery={"Proj_Start_Year <= 2026 AND Proj_End_Year >= 2017"}
autocompleteFields={autocompleteFields}
setFinalQuery={setFinalQuery}
/>
);
};
You can use the useWithAdvanceSearch custom hook for more control over the advanced search functionalities and get the attributes from the advance search.
import { useWithAdvanceSearch } from 'esri-advance-search';
const MyComponent = ({ featureLayer, autocompleteFields, setFinalQuery }) => {
const { fetchFeatures } = useWithAdvanceSearch({
featureLayer,
timeQuery: "Proj_Start_Year <= 2026 AND Proj_End_Year >= 2017",
autocompleteFields,
setFinalQuery,
});
// Example usage of fetchFeatures
useEffect(() => {
const fetchData = async () => {
// pass query to fetchFeatures()
const features = await fetchFeatures("Proj_Status = 'Active'");
};
fetchData();
}, [fetchFeatures]);
return <div>My ESRI Advanced Search Component</div>;
};
Here's a more detailed example demonstrating the usage of useWithAdvanceSearch:
import React, { useState } from 'react';
import { useWithAdvanceSearch } from 'esri-advance-search';
const MyComponent = ({ featureLayer }) => {
const [finalQuery, setFinalQuery] = useState('');
const autocompleteFields = ['Project_Name', 'Project_Manager'];
const { state, autocompleteData, setAutocompleteData, fetchFeatures } = useWithAdvanceSearch({
featureLayer,
timeQuery: "Proj_Start_Year <= 2026 AND Proj_End_Year >= 2017",
autocompleteFields,
setFinalQuery,
});
const handleSearch = async () => {
const features = await fetchFeatures(finalQuery);
};
return (
<div>
<button onClick={handleSearch}>Search</button>
{/* Render UI based on state and autocompleteData */}
</div>
);
};
Ensure the featureLayer prop is valid and not null before using the hook. The hook will fetch and update field values whenever featureLayer, autocompleteData, timeQuery, or autocompleteFields change. You can manage autocompleteData using the provided setAutocompleteData function.
If there is an error updating the fields, it will be logged to the console with the message: "Error updating fields:"
To publish the npm package, follow these steps:
{
"version": "1.0.3"
}
git add .
git commit -m "Update version to 1.0.3"
git push origin main
FAQs
## Overview
The npm package sel-esri-custom-table receives a total of 0 weekly downloads. As such, sel-esri-custom-table popularity was classified as not popular.
We found that sel-esri-custom-table demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
npm now supports Trusted Publishing with OIDC, enabling secure package publishing directly from CI/CD workflows without relying on long-lived tokens.
Research
/Security News
A RubyGems malware campaign used 60 malicious packages posing as automation tools to steal credentials from social media and marketing tool users.
Security News
The CNA Scorecard ranks CVE issuers by data completeness, revealing major gaps in patch info and software identifiers across thousands of vulnerabilities.