diff --git a/package-lock.json b/package-lock.json index fff2c717..42a31e67 100644 --- a/package-lock.json +++ b/package-lock.json @@ -17,6 +17,7 @@ "cldr-data": "^36.0.1", "clean-deep": "^3.4.0", "copy-to-clipboard": "^3.3.3", + "countries-list": "^3.0.6", "deepmerge": "^4.3.1", "design-react-kit": "^5.0.0-7", "dotenv": "^16.3.1", @@ -5932,6 +5933,11 @@ "js-yaml": "bin/js-yaml.js" } }, + "node_modules/countries-list": { + "version": "3.0.6", + "resolved": "https://registry.npmjs.org/countries-list/-/countries-list-3.0.6.tgz", + "integrity": "sha512-BCJODHTSRMIxS0W80NZw8bC7x6/WS8Tf4FdtFrEbW0FONBbqTAzOrKNG06UEMgLGxOZpOJddiVEdCztKLpmPxA==" + }, "node_modules/country-flag-icons": { "version": "1.5.7", "resolved": "https://registry.npmjs.org/country-flag-icons/-/country-flag-icons-1.5.7.tgz", @@ -25324,6 +25330,11 @@ } } }, + "countries-list": { + "version": "3.0.6", + "resolved": "https://registry.npmjs.org/countries-list/-/countries-list-3.0.6.tgz", + "integrity": "sha512-BCJODHTSRMIxS0W80NZw8bC7x6/WS8Tf4FdtFrEbW0FONBbqTAzOrKNG06UEMgLGxOZpOJddiVEdCztKLpmPxA==" + }, "country-flag-icons": { "version": "1.5.7", "resolved": "https://registry.npmjs.org/country-flag-icons/-/country-flag-icons-1.5.7.tgz", diff --git a/package.json b/package.json index 4b50aab2..66ad1643 100644 --- a/package.json +++ b/package.json @@ -84,6 +84,7 @@ "cldr-data": "^36.0.1", "clean-deep": "^3.4.0", "copy-to-clipboard": "^3.3.3", + "countries-list": "^3.0.6", "deepmerge": "^4.3.1", "design-react-kit": "^5.0.0-7", "dotenv": "^16.3.1", diff --git a/src/app/contents/countries.ts b/src/app/contents/countries.ts deleted file mode 100644 index f0ce0989..00000000 --- a/src/app/contents/countries.ts +++ /dev/null @@ -1,251 +0,0 @@ -export default [ - "ad", - "ae", - "af", - "ag", - "ai", - "al", - "am", - "ao", - "aq", - "ar", - "as", - "at", - "au", - "aw", - "ax", - "az", - "ba", - "bb", - "bd", - "be", - "bf", - "bg", - "bh", - "bi", - "bj", - "bl", - "bm", - "bn", - "bo", - "bq", - "br", - "bs", - "bt", - "bv", - "bw", - "by", - "bz", - "ca", - "cc", - "cd", - "cf", - "cg", - "ch", - "ci", - "ck", - "cl", - "cm", - "cn", - "co", - "cr", - "cu", - "cv", - "cw", - "cx", - "cy", - "cz", - "de", - "dj", - "dk", - "dm", - "do", - "dz", - "ec", - "ee", - "eg", - "eh", - "er", - "es", - "et", - "fi", - "fj", - "fk", - "fm", - "fo", - "fr", - "ga", - "gb", - "gd", - "ge", - "gf", - "gg", - "gh", - "gi", - "gl", - "gm", - "gn", - "gp", - "gq", - "gr", - "gs", - "gt", - "gu", - "gw", - "gy", - "hk", - "hm", - "hn", - "hr", - "ht", - "hu", - "id", - "ie", - "il", - "im", - "in", - "io", - "iq", - "ir", - "is", - "it", - "je", - "jm", - "jo", - "jp", - "ke", - "kg", - "kh", - "ki", - "km", - "kn", - "kp", - "kr", - "kw", - "ky", - "kz", - "la", - "lb", - "lc", - "li", - "lk", - "lr", - "ls", - "lt", - "lu", - "lv", - "ly", - "ma", - "mc", - "md", - "me", - "mf", - "mg", - "mh", - "mk", - "ml", - "mm", - "mn", - "mo", - "mp", - "mq", - "mr", - "ms", - "mt", - "mu", - "mv", - "mw", - "mx", - "my", - "mz", - "na", - "nc", - "ne", - "nf", - "ng", - "ni", - "nl", - "no", - "np", - "nr", - "nu", - "nz", - "om", - "pa", - "pe", - "pf", - "pg", - "ph", - "pk", - "pl", - "pm", - "pn", - "pr", - "ps", - "pt", - "pw", - "py", - "qa", - "re", - "ro", - "rs", - "ru", - "rw", - "sa", - "sb", - "sc", - "sd", - "se", - "sg", - "sh", - "si", - "sj", - "sk", - "sl", - "sm", - "sn", - "so", - "sr", - "ss", - "st", - "sv", - "sx", - "sy", - "sz", - "tc", - "td", - "tf", - "tg", - "th", - "tj", - "tk", - "tl", - "tm", - "tn", - "to", - "tr", - "tt", - "tv", - "tw", - "tz", - "ua", - "ug", - "um", - "us", - "uy", - "uz", - "va", - "vc", - "ve", - "vg", - "vi", - "vn", - "vu", - "wf", - "ws", - "ye", - "yt", - "za", - "zm", - "zw", -]; diff --git a/src/app/contents/fields/generic.ts b/src/app/contents/fields/generic.ts index 0ded8dd5..693e8ebc 100644 --- a/src/app/contents/fields/generic.ts +++ b/src/app/contents/fields/generic.ts @@ -1,8 +1,7 @@ import categories from "../categories"; import scopes from "../scopes"; import licenses from "../../../generated/licenses.json"; -import { allLangs } from '../../../i18n'; -import countries from "../countries"; +import { allLangs, allCountries } from '../../../i18n'; const developmentStatus_list = [ "concept", @@ -303,8 +302,10 @@ const fields = (): Array => { type: "array", items: { title: "item", - type: "string", - enum: countries, + type: "object", + dataKey: "value", + textField: "text", + enum: allCountries(), }, section: 6, group: "intendedAudience", @@ -315,8 +316,10 @@ const fields = (): Array => { type: "array", items: { title: "item", - type: "string", - enum: countries, + type: "object", + dataKey: "value", + textField: "text", + enum: allCountries(), }, section: 6, group: "intendedAudience", @@ -358,7 +361,9 @@ const fields = (): Array => { type: "array", items: { title: "item", - type: "string", + type: "object", + dataKey: "value", + textField: "text", enum: allLangs(), }, widget: "tags", diff --git a/src/app/form/widgets/TagWidget.js b/src/app/form/widgets/TagWidget.js index 36e82f05..c08ab24f 100644 --- a/src/app/form/widgets/TagWidget.js +++ b/src/app/form/widgets/TagWidget.js @@ -19,6 +19,10 @@ const TagWidget = (props) => { }); const className = classNames(["form-group", { "has-error": invalid }]); + const multiSelectDataOpts = (props.schema.items.dataKey && props.schema.items.textField) + ? { dataKey: props.schema.items.dataKey, textField: props.schema.items.textField } + : {}; + return (