-
Notifications
You must be signed in to change notification settings - Fork 326
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TagInput - Functional component for tag-like inputs #3735
base: master
Are you sure you want to change the base?
Commits on Sep 17, 2024
-
Initial commit: Rename component, set basic structure
No actual functionality implemented yet, just renames the component from "StringArrayEditor" to "TagInput", for brevity at the possible cost of clarity. For now, the original StringArrayEditor is kept and named "TagInput-class.jsx" so that I can reference it as I work on the functional component.
Configuration menu - View commit details
-
Copy full SHA for e8e16f4 - Browse repository at this point
Copy the full SHA e8e16f4View commit details -
Configuration menu - View commit details
-
Copy full SHA for ea7f18e - Browse repository at this point
Copy the full SHA ea7f18eView commit details
Commits on Sep 18, 2024
-
Render element for each value from props
Take an array of values from props, load it into valueContext state with an "editing" boolean for each value. Then, when rendering the component, take each value in the valueContext array and create a div for each -- at this point, if the value is "being edited", it returns a div with text "editing". If not being edited, it returns a div with the value as text. Nothing is being edited at this point since that functionality doesn't exist yet.
Configuration menu - View commit details
-
Copy full SHA for d505e4e - Browse repository at this point
Copy the full SHA d505e4eView commit details -
Render tags as "write" or "read"
Tags are now either "readTag" or "writeTag", with the former being a div with the tag value and the latter a text input with the value. Minor class name change in LESS.
Configuration menu - View commit details
-
Copy full SHA for d5c5b43 - Browse repository at this point
Copy the full SHA d5c5b43View commit details -
Add click handler for readTags to open text input
Clicking on a readTag now converts that tag to a text input, and maintains the tag value. It also closes any other open text inputs amongst the tags (but leaves the "new tag" input open).
Configuration menu - View commit details
-
Copy full SHA for 36aa4ea - Browse repository at this point
Copy the full SHA 36aa4eaView commit details
Commits on Sep 19, 2024
-
add editing of input functionality
Currently uses uncontrolled inputs with a `defaultValue` attribute set to the values passed in via props. The input can then be edited, and when `Enter` is pressed, it updates the stored value state. Later, this can be updated to be trigger with `Tab` or clicking outside the active input element.
Configuration menu - View commit details
-
Copy full SHA for c5033db - Browse repository at this point
Copy the full SHA c5033dbView commit details -
Add in handlers for TagInput value changes
Now brew metadata is actually updated and preserved across reloads to match updated tag values. useEffect calls the props.onChange event from the parent component on every change to the valueContext state of this component (right now, after hitting Enter in a tag input).
Configuration menu - View commit details
-
Copy full SHA for d1686c4 - Browse repository at this point
Copy the full SHA d1686c4View commit details -
Add method for adding new tags
Component now accepts new tags entered in the always-present input field. Entering a value and hitting Enter submits the tag, and it appears as a new tag. Updated the tag list keys to be unique (via `index`). To-Do: empty 'new tag' input after submitting.
Configuration menu - View commit details
-
Copy full SHA for 70a3cb9 - Browse repository at this point
Copy the full SHA 70a3cb9View commit details -
Add 'remove' button and method
New button that triggers `submitTag()` method directly (rather than throw onKeyDown event) and passes `null` as the newValue. New `if` condition checks for null on newValue and if true, removes the tag that matches the originalValue. This *does* currently delete all duplicate tags if they match the one you are deleting. Not sure when you'd ever want duplicate tags, but regardless i'll likely switch this to work via Index, not value.
Configuration menu - View commit details
-
Copy full SHA for c65210b - Browse repository at this point
Copy the full SHA c65210bView commit details -
Use index to find and remove tags
Fixes issue in last commit, so removing a tag that has duplicate value of other tags only removes the correct one, not the others as well.
Configuration menu - View commit details
-
Copy full SHA for c1288ce - Browse repository at this point
Copy the full SHA c1288ceView commit details -
Set new tag input to clear itself after submission
Now whenever a new tag is submitted, the input element is cleared and ready for the next tag. Whitespace cleanup.
Configuration menu - View commit details
-
Copy full SHA for a54adc1 - Browse repository at this point
Copy the full SHA a54adc1View commit details -
Now comma (`,`) submits a tag, like `Enter`
Configuration menu - View commit details
-
Copy full SHA for 5b4a7c1 - Browse repository at this point
Copy the full SHA 5b4a7c1View commit details -
Adjust html structure to handle tags as list
Begin work on setting a better html structure for the component. Create a .less file for the component, which I may not actually use.
Configuration menu - View commit details
-
Copy full SHA for 7ea1696 - Browse repository at this point
Copy the full SHA 7ea1696View commit details -
Configuration menu - View commit details
-
Copy full SHA for 8a67e1e - Browse repository at this point
Copy the full SHA 8a67e1eView commit details -
Fix multiple duplicate tags updating at once
Fixes an issue where tags with duplicate values would all update to the same value after editing just one. Also an adjustment to the parameters that are passed to handleInputKeyDown-- they are now one object. This helps handle an "options" object where more optional features can be turned on and off.
Configuration menu - View commit details
-
Copy full SHA for b585e85 - Browse repository at this point
Copy the full SHA b585e85View commit details -
Configuration menu - View commit details
-
Copy full SHA for 10a9bc2 - Browse repository at this point
Copy the full SHA 10a9bc2View commit details -
Configuration menu - View commit details
-
Copy full SHA for 433f016 - Browse repository at this point
Copy the full SHA 433f016View commit details
Commits on Sep 23, 2024
-
Configuration menu - View commit details
-
Copy full SHA for a9b6d5f - Browse repository at this point
Copy the full SHA a9b6d5fView commit details -
This file was just the old StringArrayEditor that I kept around for easy reference. Can be deleted now.
Configuration menu - View commit details
-
Copy full SHA for 5af45f1 - Browse repository at this point
Copy the full SHA 5af45f1View commit details
Commits on Sep 24, 2024
-
Configuration menu - View commit details
-
Copy full SHA for a96ff6e - Browse repository at this point
Copy the full SHA a96ff6eView commit details