-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
django-selectable -> django-autocomplete-light (#667)
* WIP * Further WIP * fixes * linter * Add helper methods for reverse w/ query params * fix test * Made requested changes * Revert assessment form implementation * Fix to registry, style fixes, and implementation for animal forms * Implemented in assessment forms * Implement on epi forms * Make autocomplete easier to work with, make field initial show same labels as autocomplete choices * Implemented in epi meta forms * Implemented in invitro forms * Implemented in user forms * Implemented in summary forms * Implemented in epiv2 forms, patched together an htmx fix * Remove replaced lookups * DAL text input working * Implemented DAL text in assessment forms * Implemented DAL text in animal forms * Implemented DAL text in epi forms * Added DAL test to epimeta forms * Added DAL text to invitro forms * Simplified htmx + autocomplete script * Implemented DAL text in epiv2 forms * Replaced django-selectable autocomplete url with DAL in javascript implementations * Replaced selector form * Removed lookups & some selectable files * Removed selectable tags from templates * Remove remaining selectable code from javascript * Removed last traces of django selectable, removed jquery ui. * linting * Fixed integration test * Seperated scripts needed for htmx autocomplete * Move slightly altered code to vendor, fix htmx! * Another htmx fix * convert to subpackage * indicate patch not direct vendor * code review of autocomplete * remove draggable; from jqueryui * remove jquery ui datepicker * autocomplete crossview * fix autocompletes * update htmx * try to make ci more resiliant * remove jquery ui css * updates from review * updates * updates * changes from reviews * revert most integration test changes * use labels instead of indexes * add last-failed flag for retries Co-authored-by: Andy Shapiro <shapiromatron@gmail.com>
- Loading branch information
1 parent
5540fe1
commit 99fa863
Showing
131 changed files
with
2,586 additions
and
1,686 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
import React, {Component} from "react"; | ||
import ReactDOM from "react-dom"; | ||
import PropTypes from "prop-types"; | ||
import Autosuggest from "react-autosuggest"; | ||
import {theme} from "./constants"; | ||
import h from "shared/utils/helpers"; | ||
|
||
class ClientSideAutosuggest extends Component { | ||
/* | ||
Client-side autocomplete; all possibilities are passed to the component via an input prop; | ||
the component just filters possibilities based on typing. | ||
*/ | ||
constructor(props) { | ||
super(props); | ||
this.state = { | ||
value: props.value, | ||
suggestions: [], | ||
}; | ||
} | ||
render() { | ||
const {name, options} = this.props; | ||
const {value, suggestions} = this.state; | ||
return ( | ||
<Autosuggest | ||
suggestions={suggestions} | ||
onSuggestionsFetchRequested={({value}) => { | ||
const qry = h.escapeRegexString(value.trim()), | ||
regex = new RegExp(qry, "i"), | ||
suggestions = | ||
qry.length == 0 | ||
? options | ||
: options.filter(v => regex.test(v)).slice(0, 30); | ||
this.setState({suggestions}); | ||
}} | ||
onSuggestionsClearRequested={() => { | ||
this.setState({suggestions: []}); | ||
}} | ||
getSuggestionValue={d => d} | ||
renderSuggestion={d => <span>{d}</span>} | ||
inputProps={{ | ||
className: "form-control", | ||
name, | ||
value, | ||
onChange: (event, {newValue}) => { | ||
this.setState({value: newValue}); | ||
}, | ||
}} | ||
theme={theme} | ||
/> | ||
); | ||
} | ||
} | ||
ClientSideAutosuggest.propTypes = { | ||
name: PropTypes.string.isRequired, | ||
value: PropTypes.string.isRequired, | ||
options: PropTypes.arrayOf(PropTypes.string).isRequired, | ||
}; | ||
|
||
const renderClientSideAutosuggest = function(el, name, value, options) { | ||
ReactDOM.render(<ClientSideAutosuggest name={name} value={value} options={options} />, el); | ||
}; | ||
|
||
export {ClientSideAutosuggest, renderClientSideAutosuggest}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.