igniteui-angular-charts
Version:
Ignite UI Angular charting components for building rich data visualizations for modern web apps.
303 lines (302 loc) • 11.5 kB
JavaScript
/*
THIS INFRAGISTICS ULTIMATE SOFTWARE LICENSE AGREEMENT ("AGREEMENT") LOCATED HERE:
https://www.infragistics.com/legal/license/igultimate-la
https://www.infragistics.com/legal/license/igultimate-eula
GOVERNS THE LICENSING, INSTALLATION AND USE OF INFRAGISTICS SOFTWARE. BY DOWNLOADING AND/OR INSTALLING AND USING INFRAGISTICS SOFTWARE: you are indicating that you have read and understand this Agreement, and agree to be legally bound by it on behalf of the yourself and your company.
*/
import { Base, markType } from "igniteui-angular-core";
import { dateMaxValue, dateMinValue, dateAddYears, dateFromValues, dateAddMonths, dateFromTicks } from "igniteui-angular-core";
import { stringIsNullOrWhiteSpace } from "igniteui-angular-core";
/**
* @hidden
*/
export let FinancialChartRangeSelectorViewModel = /*@__PURE__*/ (() => {
class FinancialChartRangeSelectorViewModel extends Base {
constructor() {
super(...arguments);
this.b = null;
this._notifyChanged = null;
this._options = null;
this.v = dateMaxValue();
this.u = dateMinValue();
this._oneMonthChecked = false;
this._threeMonthsChecked = false;
this._sixMonthsChecked = false;
this._yearToDateChecked = false;
this._oneYearChecked = false;
this._allChecked = false;
this._oneMonthVisible = false;
this._threeMonthsVisible = false;
this._sixMonthsVisible = false;
this._yearToDateVisible = false;
this._oneYearVisible = false;
this._allVisible = false;
this.t = dateMinValue();
this.s = dateMaxValue();
this._onRangeChanged = null;
}
get notifyChanged() {
return this._notifyChanged;
}
set notifyChanged(a) {
this._notifyChanged = a;
}
get options() {
return this._options;
}
set options(a) {
this._options = a;
}
get selectionStart() {
return this.v;
}
set selectionStart(a) {
this.v = a;
}
get selectionEnd() {
return this.u;
}
set selectionEnd(a) {
this.u = a;
}
get oneMonthChecked() {
return this._oneMonthChecked;
}
set oneMonthChecked(a) {
this._oneMonthChecked = a;
}
get threeMonthsChecked() {
return this._threeMonthsChecked;
}
set threeMonthsChecked(a) {
this._threeMonthsChecked = a;
}
get sixMonthsChecked() {
return this._sixMonthsChecked;
}
set sixMonthsChecked(a) {
this._sixMonthsChecked = a;
}
get yearToDateChecked() {
return this._yearToDateChecked;
}
set yearToDateChecked(a) {
this._yearToDateChecked = a;
}
get oneYearChecked() {
return this._oneYearChecked;
}
set oneYearChecked(a) {
this._oneYearChecked = a;
}
get allChecked() {
return this._allChecked;
}
set allChecked(a) {
this._allChecked = a;
}
get oneMonthVisible() {
return this._oneMonthVisible;
}
set oneMonthVisible(a) {
this._oneMonthVisible = a;
}
get threeMonthsVisible() {
return this._threeMonthsVisible;
}
set threeMonthsVisible(a) {
this._threeMonthsVisible = a;
}
get sixMonthsVisible() {
return this._sixMonthsVisible;
}
set sixMonthsVisible(a) {
this._sixMonthsVisible = a;
}
get yearToDateVisible() {
return this._yearToDateVisible;
}
set yearToDateVisible(a) {
this._yearToDateVisible = a;
}
get oneYearVisible() {
return this._oneYearVisible;
}
set oneYearVisible(a) {
this._oneYearVisible = a;
}
get allVisible() {
return this._allVisible;
}
set allVisible(a) {
this._allVisible = a;
}
p() {
if (this.options == null) {
return false;
}
let a = this.oneMonthVisible;
let b = this.threeMonthsVisible;
let c = this.sixMonthsVisible;
let d = this.yearToDateVisible;
let e = this.oneYearVisible;
let f = this.allVisible;
this.oneMonthVisible = this.options.contains(0);
this.threeMonthsVisible = this.options.contains(1);
this.sixMonthsVisible = this.options.contains(2);
this.yearToDateVisible = this.options.contains(3);
this.oneYearVisible = this.options.contains(4);
this.allVisible = this.options.contains(5);
return a != this.oneMonthVisible || b != this.threeMonthsVisible || c != this.sixMonthsVisible || d != this.yearToDateVisible || e != this.oneYearVisible || f != this.allVisible;
}
get financialChart_RangeSelector_OneMonth() {
return !stringIsNullOrWhiteSpace(this.b.bq) ? this.b.bq : "1M";
}
get financialChart_RangeSelector_ThreeMonths() {
return !stringIsNullOrWhiteSpace(this.b.bt) ? this.b.bt : "3M";
}
get financialChart_RangeSelector_SixMonths() {
return !stringIsNullOrWhiteSpace(this.b.bs) ? this.b.bs : "6M";
}
get financialChart_RangeSelector_YearToDate() {
return !stringIsNullOrWhiteSpace(this.b.bv) ? this.b.bv : "YTD";
}
get financialChart_RangeSelector_OneYear() {
return !stringIsNullOrWhiteSpace(this.b.br) ? this.b.br : "1Y";
}
get financialChart_RangeSelector_All() {
return !stringIsNullOrWhiteSpace(this.b.bo) ? this.b.bo : "ALL";
}
get financialChart_RangeSelector_From() {
return !stringIsNullOrWhiteSpace(this.b.bp) ? this.b.bp : "From";
}
get financialChart_RangeSelector_To() {
return !stringIsNullOrWhiteSpace(this.b.bu) ? this.b.bu : "To";
}
get rangeStart() {
return this.t;
}
set rangeStart(a) {
this.t = a;
}
get rangeEnd() {
return this.s;
}
set rangeEnd(a) {
this.s = a;
}
onPropertiesChanged() {
let a = false;
let b = +(this.selectionEnd) == +(this.rangeEnd);
if (this.allChecked != ((+(this.selectionStart) == +(this.rangeStart)) && b)) {
this.allChecked = (+(this.selectionStart) == +(this.rangeStart)) && b;
a = true;
}
if (this.oneYearChecked != ((+(this.selectionStart) == +(this.oneYearFromEnd)) && b)) {
this.oneYearChecked = (+(this.selectionStart) == +(this.oneYearFromEnd)) && b;
a = true;
}
if (this.yearToDateChecked != ((+(this.selectionStart) == +(this.firstDayOfEndYear)) && b)) {
this.yearToDateChecked = (+(this.selectionStart) == +(this.firstDayOfEndYear)) && b;
a = true;
}
if (this.sixMonthsChecked != ((+(this.selectionStart) == +(this.sixMonthsFromEnd)) && b)) {
this.sixMonthsChecked = (+(this.selectionStart) == +(this.sixMonthsFromEnd)) && b;
a = true;
}
if (this.threeMonthsChecked != ((+(this.selectionStart) == +(this.threeMonthsFromEnd)) && b)) {
this.threeMonthsChecked = (+(this.selectionStart) == +(this.threeMonthsFromEnd)) && b;
a = true;
}
if (this.oneMonthChecked != ((+(this.selectionStart) == +(this.oneMonthFromEnd)) && b)) {
this.oneMonthChecked = (+(this.selectionStart) == +(this.oneMonthFromEnd)) && b;
a = true;
}
if (a) {
if (this.notifyChanged != null) {
this.notifyChanged();
}
}
return a;
}
get oneYearFromEnd() {
return dateAddYears(this.rangeEnd, -1);
}
get firstDayOfEndYear() {
return dateFromValues(this.rangeEnd.getFullYear(), 1, 1, 0, 0, 0, 0);
}
get sixMonthsFromEnd() {
return dateAddMonths(this.rangeEnd, -6);
}
get threeMonthsFromEnd() {
return dateAddMonths(this.rangeEnd, -3);
}
get oneMonthFromEnd() {
return dateAddMonths(this.rangeEnd, -1);
}
changeSelection(a) {
this.allChecked = false;
this.oneMonthChecked = false;
this.threeMonthsChecked = false;
this.sixMonthsChecked = false;
this.yearToDateChecked = false;
this.oneYearChecked = false;
if (a == "1m") {
this.oneMonthChecked = true;
}
else if (a == "3m") {
this.threeMonthsChecked = true;
}
else if (a == "6m") {
this.sixMonthsChecked = true;
}
else if (a == "YTD") {
this.yearToDateChecked = true;
}
else if (a == "1y") {
this.oneYearChecked = true;
}
else if (a == "all") {
this.allChecked = true;
}
this.onRadioButtonChanged();
}
onRadioButtonChanged() {
let a = dateFromTicks(this.selectionStart.getTime());
let b = dateFromTicks(this.selectionEnd.getTime());
this.selectionEnd = this.rangeEnd;
if (this.oneMonthChecked) {
this.selectionStart = this.oneMonthFromEnd;
}
if (this.threeMonthsChecked) {
this.selectionStart = this.threeMonthsFromEnd;
}
if (this.sixMonthsChecked) {
this.selectionStart = this.sixMonthsFromEnd;
}
if (this.yearToDateChecked) {
this.selectionStart = this.firstDayOfEndYear;
}
if (this.oneYearChecked) {
this.selectionStart = this.oneYearFromEnd;
}
if (this.allChecked) {
this.selectionStart = this.rangeStart;
}
if (+(this.selectionStart) != +a || +(this.selectionEnd) != +b) {
this.onRangeChanged();
if (this.notifyChanged != null) {
this.notifyChanged();
}
}
}
get onRangeChanged() {
return this._onRangeChanged;
}
set onRangeChanged(a) {
this._onRangeChanged = a;
}
}
FinancialChartRangeSelectorViewModel.$t = markType(FinancialChartRangeSelectorViewModel, 'FinancialChartRangeSelectorViewModel');
return FinancialChartRangeSelectorViewModel;
})();