-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #177 from SFDigitalServices/release-7.2.0
Release 7.2.0
- Loading branch information
Showing
9 changed files
with
248 additions
and
13 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
--- | ||
title: Autocomplete components | ||
--- | ||
|
||
This theme _disables_ the default autocomplete functionality of formio.js's | ||
built-in [select component] and only enables it if the component has an | ||
`autocomplete` tag in the "Field tags" input of the "API" tab on the form.io portal: | ||
|
||
![](https://help.form.io/assets/img/api1.png) | ||
|
||
## Translation | ||
We patch the `customOptions` of every autocomplete component at runtime to | ||
include translated (or, at least, translatable) UI strings with predictable | ||
keys that can be customized either globally (all autocomplete components in a | ||
single form) or for each instance. These are the options that [Choices.js] lets | ||
us localize: | ||
|
||
| Option | English | Notes | ||
:--- | :--- | :--- | ||
[`searchPlaceholderValue`](https://github.com/jshjohnson/Choices#searchplaceholdervalue) | "Type to search" | The placeholder text of the search input | ||
[`noResultsText`](https://github.com/jshjohnson/Choices#noresultstext) | "No results found" | | ||
[`itemSelectText`](https://github.com/jshjohnson/Choices#itemselecttext) | _none_ | Displayed on the right side of the dropdown alongside the currently highlighted option | ||
[`maxItemText`](https://github.com/jshjohnson/Choices#maxitemtext) | <nobr>"Only {{count}} values can be added"</nobr> | The `{{count}}` placeholder is substituted with the [maxItemCount](https://github.com/jshjohnson/Choices#maxitemcount) option. | ||
[`noChoicesText`](https://github.com/jshjohnson/Choices#nochoicestext) | "No choices to choose from" | This should only show up if we haven't provided any static options or have a dynamic select driven by an API that doesn't return any results. | ||
[`addItemText`](https://github.com/jshjohnson/Choices#additemtext) | _none_ | ⚠️ I **think** that this option is only applicable when freeform values are allowed. If so, this shows up when you've typed a search string as a prompt, e.g. "Press Enter to add **{{value}}**", where `{{value}}` is substituted with the "backend" value of the option. | ||
|
||
To translate these for all autocomplete components in your form, you'll need to | ||
prefix each option with the `autocomplete.` prefix. So, to translate the text | ||
that shows up when no items match the typed value, you would add translations | ||
for the `autocomplete.noResultsText` Phrase key. | ||
|
||
You can also translate these strings for individual components by prefixing | ||
`autcomplete.{option}` with the component's key and a `.`. For instance, if you | ||
had an autocomplete component with the key `yourJob` and wanted to translate | ||
the placeholder text, you would add translations for the | ||
`yourJob.autocomplete.searchPlaceholderValue` Phrase key. | ||
|
||
The default translations for the `autocomplete.*` keys live in this repo's | ||
[i18n directory] and can be updated from the [generic strings Phrase project]. | ||
|
||
[select component]: https://help.form.io/userguide/form-components/#select | ||
[choices.js]: https://github.com/jshjohnson/Choices#readme | ||
[i18n directory]: https://github.com/SFDigitalServices/formio-sfds/tree/main/src/i18n | ||
[generic strings phrase project]: https://app.phrase.com/accounts/city-county-of-san-francisco/projects/form-io-generic-strings |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
e0dc789
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs: