Giter VIP home page Giter VIP logo

strapi-plugin-country-select's People

Contributors

chrisebert avatar marob avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

strapi-plugin-country-select's Issues

"Not supported" in when used in component

Hi!

image

When adding a country into a component I get "Not supported", when I add the field into a collection it works just fine.

This worked before, maybe something changed in Strapi? Any ideas?

Add a default country

Hi and thank you for your work on this plugin, it's so useful!

I was wondering how much work it would be to add a "Default country" to the settings? So that this country is then automatically pre-selected. I hope it's clear what I mean.

Cheers!

Unable to clear country value

A recent change in the Combobox Strapi design system makes it so that the clear callback needs to be defined, else the clear icon doesn't show up and it's impossible to unset the value of the field.

I fixed the issue by adding this function inside the CountrySelect component:

(...)
const isValidValue = !value || parsedOptions.hasOwnProperty(value);

const handleClear = () => {
  onChange({
    target: {
      name: name,
      value: '',
      type: attribute.type,
    },
  });
};
(...)

...and by linking it to the Combobox component clear attribute:

(...)
<Combobox
    placeholder={placeholder && formatMessage(placeholder)}
    aria-label={formatMessage(intlLabel)}
    aria-disabled={disabled}
    disabled={disabled}
    value={isValidValue ? value : null}
    onChange={countryCode => onChange({ target: { name, value: countryCode, type: attribute.type }})}
    onClear={handleClear}
>
(...)

China missing

Hello,

China is missing in the select.
Maybe adding a custom list would help Issue#7 ?

Thanks

Screenshot 2023-10-18 at 11 14 12 AM

Allow adding countries

Some countries or codes may not be available in i18n-iso-countries.
For example, "UK" is an alias of "GB", "TP" was used instead of "TL" (Timor-Leste) before, ...

Could we make extending the country list possible?

The goal would be to be able to configure some per-locale json files with extra countries in the project's code and to load that json files from the plugin (some dynamic import but coming from a file in the Strapi project, with exception handling if no json has been defined).

For example, with the following .../en.json in the Strapi project:

{
    "TP": "Timor-Leste (TP)",
    "UK": ["United Kingdom (UK)", "UK (UK)", "Great Britain (UK)"]
}

We'd have, in the component list:

  • ...
  • Timor-Leste
  • Timor-Leste (TP)
  • ...
  • United Kingdom
  • United Kingdom (UK)
  • ...

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.