Skip to content
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

Currency Component: Support other currencies - Add suffix / prefix options #866

Merged
merged 2 commits into from
Dec 20, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,5 @@ dump.rdb
node_modules
bower_components
.idea
.ruby-version
.ruby-gemset
10 changes: 5 additions & 5 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
### Added
- FOR-1787: Ability to save Day component with empty day / month / year, added trailing zeros to saved value
- Added File types

### Fixed
- FOR-1850: Wrong key for Encrypted setting in builder
- FOR-1847: Renderer crashing when TextArea is rendered in readOnly and viewAsHtml mode
Expand All @@ -59,11 +59,11 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
## 3.7.0
### Changed
- Added the 'hideOnChildrenHidden' parameter for Columns to hide when their children are hidden.

### Added
- FOR-1806: languageChanged event
- FOR-1844: Support for private file downloads with the URL file configuration. Also added a File Upload server @ https://github.com/formio/formio-upload that supports this feature.

### Fixed
- FOR-1595: Placement of description for Edit Grid
- FOR-1657: Select component Values template.
Expand Down Expand Up @@ -101,7 +101,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).

## 3.6.10
### Fixed
- FOR-1491: Fix bug with Day when form rendered as HTML
- FOR-1491: Fix bug with Day when form rendered as HTML
- FOR-1812: Fixed issues where timezones were not converting properly.

## 3.6.9
Expand All @@ -127,7 +127,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
### Fixed
- FOR-1733: Fixed issue with preview destroy on change.
- FOR-1728: Problems with running the renderer within iOS applications.

## 3.6.5
### Fixed
- Broken build.
Expand Down
36 changes: 30 additions & 6 deletions dist/formio.full.js

Large diffs are not rendered by default.

20 changes: 10 additions & 10 deletions dist/formio.full.min.js

Large diffs are not rendered by default.

14 changes: 13 additions & 1 deletion src/components/currency/Currency.form.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,16 @@
import baseEditForm from '../base/Base.form';
import CurrencyEditDisplay from './editForm/Currency.edit.display';
import CurrencyEditData from './editForm/Currency.edit.data';

export default function(...extend) {
return baseEditForm(...extend);
return baseEditForm([
{
key: 'display',
components: CurrencyEditDisplay
},
{
key: 'data',
components: CurrencyEditData
}
], ...extend);
}
6 changes: 3 additions & 3 deletions src/components/currency/Currency.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ export default class CurrencyComponent extends NumberComponent {
currency: this.component.currency,
decimalLimit: this.decimalLimit,
decimalSeparator: this.decimalSeparator,
lang: this.options.language,
lang: this.options.language
});
this.prefix = affixes.prefix;
this.suffix = affixes.suffix;
this.prefix = this.options.prefix || affixes.prefix;
this.suffix = this.options.suffix || affixes.suffix;
}

get defaultSchema() {
Expand Down
186 changes: 186 additions & 0 deletions src/components/currency/editForm/Currency.edit.data.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,186 @@
export default [
{
type: 'select',
input: true,
weight: 50,
key: 'currency',
label: 'Currency',
tooltip: 'The currency to use in currency formatting. Possible values are (ISO-4217) currency codes.',
defaultValue: 'USD',
dataSrc: 'values',
data: {
values: [
{ label: 'US Dollar (USD)', value: 'USD' },
{ label: 'Euro (EUR)', value: 'EUR' },
{ label: 'Pound Sterling (GBP)', value: 'GBP' },
{ label: 'Australian Dollar (AUD)', value: 'AUD' },
{ label: 'Afghani (AFN)', value: 'AFN' },
{ label: 'Lek (ALL)', value: 'ALL' },
{ label: 'Algerian Dinar (DZD)', value: 'DZD' },
{ label: 'Kwanza (AOA)', value: 'AOA' },
{ label: 'East Caribbean Dollar (XCD)', value: 'XCD' },
{ label: 'Argentine Peso (ARS)', value: 'ARS' },
{ label: 'Armenian Dram (AMD)', value: 'AMD' },
{ label: 'Aruban Florin (AWG)', value: 'AWG' },
{ label: 'Azerbaijan Manat (AZN)', value: 'AZN' },
{ label: 'Bahamian Dollar (BSD)', value: 'BSD' },
{ label: 'Bahraini Dinar (BHD)', value: 'BHD' },
{ label: 'Taka (BDT)', value: 'BDT' },
{ label: 'Barbados Dollar (BBD)', value: 'BBD' },
{ label: 'Belarusian Ruble (BYN)', value: 'BYN' },
{ label: 'Belize Dollar (BZD)', value: 'BZD' },
{ label: 'CFA Franc BCEAO (XOF)', value: 'XOF' },
{ label: 'Bermudian Dollar (BMD)', value: 'BMD' },
{ label: 'Indian Rupee (INR)', value: 'INR' },
{ label: 'Ngultrum (BTN)', value: 'BTN' },
{ label: 'Boliviano (BOB)', value: 'BOB' },
{ label: 'Mvdol (BOV)', value: 'BOV' },
{ label: 'Convertible Mark (BAM)', value: 'BAM' },
{ label: 'Pula (BWP)', value: 'BWP' },
{ label: 'Norwegian Krone (NOK)', value: 'NOK' },
{ label: 'Brazilian Real (BRL)', value: 'BRL' },
{ label: 'Brunei Dollar (BND)', value: 'BND' },
{ label: 'Bulgarian Lev (BGN)', value: 'BGN' },
{ label: 'Burundi Franc (BIF)', value: 'BIF' },
{ label: 'Cabo Verde Escudo (CVE)', value: 'CVE' },
{ label: 'Riel (KHR)', value: 'KHR' },
{ label: 'CFA Franc BEAC (XAF)', value: 'XAF' },
{ label: 'Canadian Dollar (CAD)', value: 'CAD' },
{ label: 'Cayman Islands Dollar (KYD)', value: 'KYD' },
{ label: 'Chilean Peso (CLP)', value: 'CLP' },
{ label: 'Unidad de Fomento (CLF)', value: 'CLF' },
{ label: 'Yuan Renminbi (CNY)', value: 'CNY' },
{ label: 'Colombian Peso (COP)', value: 'COP' },
{ label: 'Unidad de Valor Real (COU)', value: 'COU' },
{ label: 'Comorian Franc (KMF)', value: 'KMF' },
{ label: 'Congolese Franc (CDF)', value: 'CDF' },
{ label: 'New Zealand Dollar (NZD)', value: 'NZD' },
{ label: 'Costa Rican Colon (CRC)', value: 'CRC' },
{ label: 'Kuna (HRK)', value: 'HRK' },
{ label: 'Cuban Peso (CUP)', value: 'CUP' },
{ label: 'Peso Convertible (CUC)', value: 'CUC' },
{ label: 'Netherlands Antillean Guilder (ANG)', value: 'ANG' },
{ label: 'Czech Koruna (CZK)', value: 'CZK' },
{ label: 'Danish Krone (DKK)', value: 'DKK' },
{ label: 'Djibouti Franc (DJF)', value: 'DJF' },
{ label: 'Dominican Peso (DOP)', value: 'DOP' },
{ label: 'Egyptian Pound (EGP)', value: 'EGP' },
{ label: 'El Salvador Colon (SVC)', value: 'SVC' },
{ label: 'Nakfa (ERN)', value: 'ERN' },
{ label: 'Ethiopian Birr (ETB)', value: 'ETB' },
{ label: 'Falkland Islands Pound (FKP)', value: 'FKP' },
{ label: 'Fiji Dollar (FJD)', value: 'FJD' },
{ label: 'CFP Franc (XPF)', value: 'XPF' },
{ label: 'Dalasi (GMD)', value: 'GMD' },
{ label: 'Lari (GEL)', value: 'GEL' },
{ label: 'Ghana Cedi (GHS)', value: 'GHS' },
{ label: 'Gibraltar Pound (GIP)', value: 'GIP' },
{ label: 'Quetzal (GTQ)', value: 'GTQ' },
{ label: 'Guinean Franc (GNF)', value: 'GNF' },
{ label: 'Guyana Dollar (GYD)', value: 'GYD' },
{ label: 'Gourde (HTG)', value: 'HTG' },
{ label: 'Lempira (HNL)', value: 'HNL' },
{ label: 'Hong Kong Dollar (HKD)', value: 'HKD' },
{ label: 'Forint (HUF)', value: 'HUF' },
{ label: 'Iceland Krona (ISK)', value: 'ISK' },
{ label: 'Indian Rupee (INR)', value: 'INR' },
{ label: 'Rupiah (IDR)', value: 'IDR' },
{ label: 'SDR (Special Drawing Right) (XDR)', value: 'XDR' },
{ label: 'Iranian Rial (IRR)', value: 'IRR' },
{ label: 'Iraqi Dinar (IQD)', value: 'IQD' },
{ label: 'New Israeli Sheqel (ILS)', value: 'ILS' },
{ label: 'Jamaican Dollar (JMD)', value: 'JMD' },
{ label: 'Yen (JPY)', value: 'JPY' },
{ label: 'Jordanian Dinar (JOD)', value: 'JOD' },
{ label: 'Tenge (KZT)', value: 'KZT' },
{ label: 'Kenyan Shilling (KES)', value: 'KES' },
{ label: 'North Korean Won (KPW)', value: 'KPW' },
{ label: 'Won (KRW)', value: 'KRW' },
{ label: 'Kuwaiti Dinar (KWD)', value: 'KWD' },
{ label: 'Som (KGS)', value: 'KGS' },
{ label: 'Lao Kip (LAK)', value: 'LAK' },
{ label: 'Lebanese Pound (LBP)', value: 'LBP' },
{ label: 'Loti (LSL)', value: 'LSL' },
{ label: 'Rand (ZAR)', value: 'ZAR' },
{ label: 'Liberian Dollar (LRD)', value: 'LRD' },
{ label: 'Libyan Dinar (LYD)', value: 'LYD' },
{ label: 'Swiss Franc (CHF)', value: 'CHF' },
{ label: 'Pataca (MOP)', value: 'MOP' },
{ label: 'Denar (MKD)', value: 'MKD' },
{ label: 'Malagasy Ariary (MGA)', value: 'MGA' },
{ label: 'Malawi Kwacha (MWK)', value: 'MWK' },
{ label: 'Malaysian Ringgit (MYR)', value: 'MYR' },
{ label: 'Rufiyaa (MVR)', value: 'MVR' },
{ label: 'Ouguiya (MRU)', value: 'MRU' },
{ label: 'Mauritius Rupee (MUR)', value: 'MUR' },
{ label: 'ADB Unit of Account (XUA)', value: 'XUA' },
{ label: 'Mexican Peso (MXN)', value: 'MXN' },
{ label: 'Mexican Unidad de Inversion (UDI) (MXV)', value: 'MXV' },
{ label: 'Moldovan Leu (MDL)', value: 'MDL' },
{ label: 'Tugrik (MNT)', value: 'MNT' },
{ label: 'Moroccan Dirham (MAD)', value: 'MAD' },
{ label: 'Mozambique Metical (MZN)', value: 'MZN' },
{ label: 'Kyat (MMK)', value: 'MMK' },
{ label: 'Namibia Dollar (NAD)', value: 'NAD' },
{ label: 'Nepalese Rupee (NPR)', value: 'NPR' },
{ label: 'Cordoba Oro (NIO)', value: 'NIO' },
{ label: 'Naira (NGN)', value: 'NGN' },
{ label: 'Rial Omani (OMR)', value: 'OMR' },
{ label: 'Pakistan Rupee (PKR)', value: 'PKR' },
{ label: 'Balboa (PAB)', value: 'PAB' },
{ label: 'Kina (PGK)', value: 'PGK' },
{ label: 'Guarani (PYG)', value: 'PYG' },
{ label: 'Sol (PEN)', value: 'PEN' },
{ label: 'Philippine Peso (PHP)', value: 'PHP' },
{ label: 'Zloty (PLN)', value: 'PLN' },
{ label: 'Qatari Rial (QAR)', value: 'QAR' },
{ label: 'Romanian Leu (RON)', value: 'RON' },
{ label: 'Russian Ruble (RUB)', value: 'RUB' },
{ label: 'Rwanda Franc (RWF)', value: 'RWF' },
{ label: 'Saint Helena Pound (SHP)', value: 'SHP' },
{ label: 'Tala (WST)', value: 'WST' },
{ label: 'Dobra (STN)', value: 'STN' },
{ label: 'Saudi Riyal (SAR)', value: 'SAR' },
{ label: 'Serbian Dinar (RSD)', value: 'RSD' },
{ label: 'Seychelles Rupee (SCR)', value: 'SCR' },
{ label: 'Leone (SLL)', value: 'SLL' },
{ label: 'Singapore Dollar (SGD)', value: 'SGD' },
{ label: 'Sucre (XSU)', value: 'XSU' },
{ label: 'Solomon Islands Dollar (SBD)', value: 'SBD' },
{ label: 'Somali Shilling (SOS)', value: 'SOS' },
{ label: 'South Sudanese Pound (SSP)', value: 'SSP' },
{ label: 'Sri Lanka Rupee (LKR)', value: 'LKR' },
{ label: 'Sudanese Pound (SDG)', value: 'SDG' },
{ label: 'Surinam Dollar (SRD)', value: 'SRD' },
{ label: 'Lilangeni (SZL)', value: 'SZL' },
{ label: 'Swedish Krona (SEK)', value: 'SEK' },
{ label: 'WIR Euro (CHE)', value: 'CHE' },
{ label: 'WIR Franc (CHW)', value: 'CHW' },
{ label: 'Syrian Pound (SYP)', value: 'SYP' },
{ label: 'New Taiwan Dollar (TWD)', value: 'TWD' },
{ label: 'Somoni (TJS)', value: 'TJS' },
{ label: 'Tanzanian Shilling (TZS)', value: 'TZS' },
{ label: 'Baht (THB)', value: 'THB' },
{ label: 'Pa’anga (TOP)', value: 'TOP' },
{ label: 'Trinidad and Tobago Dollar (TTD)', value: 'TTD' },
{ label: 'Tunisian Dinar (TND)', value: 'TND' },
{ label: 'Turkish Lira (TRY)', value: 'TRY' },
{ label: 'Turkmenistan New Manat (TMT)', value: 'TMT' },
{ label: 'Uganda Shilling (UGX)', value: 'UGX' },
{ label: 'Hryvnia (UAH)', value: 'UAH' },
{ label: 'UAE Dirham (AED)', value: 'AED' },
{ label: 'US Dollar (Next day) (USN)', value: 'USN' },
{ label: 'Peso Uruguayo (UYU)', value: 'UYU' },
{ label: 'Uruguay Peso en Unidades Indexadas (UYI)', value: 'UYI' },
{ label: 'Unidad Previsional (UYW)', value: 'UYW' },
{ label: 'Uzbekistan Sum (UZS)', value: 'UZS' },
{ label: 'Vatu (VUV)', value: 'VUV' },
{ label: 'Bolívar Soberano (VES)', value: 'VES' },
{ label: 'Dong (VND)', value: 'VND' },
{ label: 'Yemeni Rial (YER)', value: 'YER' },
{ label: 'Zambian Kwacha (ZMW)', value: 'ZMW' },
{ label: 'Zimbabwe Dollar (ZWL),', value: 'ZWL' }
]
}
}
];
18 changes: 18 additions & 0 deletions src/components/currency/editForm/Currency.edit.display.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
export default [
{
type: 'textfield',
input: true,
weight: 310,
key: 'prefix',
abarrak marked this conversation as resolved.
Show resolved Hide resolved
label: 'prefix',
tooltip: 'Specify the prefix symbol after the component (e.g.: USD, EUR)'
},
{
type: 'textfield',
input: true,
weight: 320,
key: 'suffix',
label: 'suffix',
tooltip: 'Specify the suffix symbol after the component (e.g.: USD, EUR).'
}
];