-
Notifications
You must be signed in to change notification settings - Fork 11
Locale support for sa-currency-input and date-picker #44
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
base: master
Are you sure you want to change the base?
Locale support for sa-currency-input and date-picker #44
Conversation
|
remove package.json |
| stateChanges = new Subject<void>(); | ||
| private _value: any; | ||
| private viewValue: string; | ||
| //private viewValue: string; |
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.
remove comment
|
|
||
| constructor(private _focusMonitor: FocusMonitor, private _elementRef: ElementRef<HTMLElement>, @Optional() @Self() public ngControl: NgControl, @Inject(LOCALE_ID) private locale: string,private currencyPipe: CurrencyPipe) { | ||
|
|
||
| this.decimalSeparator = '.'; |
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.
get decimal separator based on locale
| @@ -1,7 +1,33 @@ | |||
| import { NgModule } from '@angular/core'; | |||
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.
make a different PR for examples
- Both decimal and group selector values are now set based on the app's locale instead of hardcoded values. - Registered spanish locale data. - Removed the hardcoded locale from module.ts - Removed commented code.
…plified-ui into locale-support-new
- Fixed shouldLabelFloat based on current focused state and FormControl's value
| static nextId = 0; | ||
| private decimalSeparator: string; | ||
|
|
||
| private decimalSeparator; |
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.
add type
| private decimalSeparator: string; | ||
|
|
||
| private decimalSeparator; | ||
| private groupSeparator; |
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.
same here
|
|
||
| import localeEs from '@angular/common/locales/es'; | ||
|
|
||
| registerLocaleData(localeEs); |
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.
we can register locale in the app only
| this.viewValue = num; | ||
| this.value = this.parse(num); | ||
| }); | ||
| this.currencyValue.valueChanges.pipe(debounceTime(200)).subscribe((num) => {}); |
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.
we can remove this subscription
| set value(val: string | null) { | ||
| this._value = val; | ||
| if (this._value != null && this._value !== '') { | ||
| if (this._value != null && this._value !== '' && this._value >= 0) { |
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.
remove greater than check
| get shouldLabelFloat() { | ||
| return this.focused || !this.empty; | ||
| if (!this.focused) { | ||
| return this.currencyValue.value !== null; |
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.
can we use this.empty instead of checking null?
| @ViewChild('input') inputRef: ElementRef; | ||
| @Input() allowNegative: boolean = true; | ||
|
|
||
| @Input()allowNegative: boolean = true; |
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.
add space
|
|
||
| if(this.currencyValue.value != null) { | ||
| if (origin) { | ||
| this.currencyValue.setValue(this.parse(this.currencyValue.value.replace(getLocaleCurrencySymbol(this.locale), ''))); |
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.
we should add logic to replace currency symbol in parse method
angular.json
Outdated
| } | ||
| "defaultProject": "simplified-ui-library", | ||
| "cli": { | ||
| "analytics": "cb8df5c8-539c-4c04-bbee-3864e14c6b3a" |
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.
why are we using this analytics property?
Added locale support for currency input and date time picker