@thoughtspot/ts-chart-sdk 0.0.2-alpha.20 → 0.0.2-alpha.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ts-chart-sdk.d.ts +121 -1
- package/lib/types/common.types.d.ts +36 -0
- package/lib/types/common.types.d.ts.map +1 -1
- package/lib/utils/date-formatting.d.ts +85 -1
- package/lib/utils/date-formatting.d.ts.map +1 -1
- package/lib/utils/date-formatting.js +342 -9
- package/lib/utils/date-formatting.js.map +1 -1
- package/lib/utils/date-formatting.spec.js +301 -31
- package/lib/utils/date-formatting.spec.js.map +1 -1
- package/lib/utils/date-utils.d.ts +6 -0
- package/lib/utils/date-utils.d.ts.map +1 -0
- package/lib/utils/date-utils.js +20 -0
- package/lib/utils/date-utils.js.map +1 -0
- package/lib/utils/date-utils.spec.d.ts +2 -0
- package/lib/utils/date-utils.spec.d.ts.map +1 -0
- package/lib/utils/date-utils.spec.js +63 -0
- package/lib/utils/date-utils.spec.js.map +1 -0
- package/lib/utils/formatting-util.d.ts +10 -0
- package/lib/utils/formatting-util.d.ts.map +1 -0
- package/lib/utils/formatting-util.js +78 -0
- package/lib/utils/formatting-util.js.map +1 -0
- package/lib/utils/formatting-util.spec.d.ts +2 -0
- package/lib/utils/formatting-util.spec.d.ts.map +1 -0
- package/lib/utils/formatting-util.spec.js +247 -0
- package/lib/utils/formatting-util.spec.js.map +1 -0
- package/package.json +1 -1
- package/src/types/common.types.ts +62 -1
- package/src/utils/date-formatting.spec.ts +375 -32
- package/src/utils/date-formatting.ts +584 -14
- package/src/utils/date-utils.spec.ts +93 -0
- package/src/utils/date-utils.ts +69 -0
- package/src/utils/formatting-util.spec.ts +312 -0
- package/src/utils/formatting-util.ts +234 -0
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
import { ChartSpecificColumnType, ColumnTimeBucket, ColumnType, DataType, } from '../types/answer-column.types';
|
|
2
|
+
import * as DateFormatting from './date-formatting';
|
|
3
|
+
import { getFormatPatternForBucket, showDateFinancialYearFormat, } from './date-utils';
|
|
4
|
+
import { generateMapOptions, getBaseTypeFormatterInstance, getDataFormatter, getFormatPattern, } from './formatting-util';
|
|
5
|
+
jest.mock('./date-utils', () => ({
|
|
6
|
+
getFormatPatternForBucket: jest.fn(),
|
|
7
|
+
showDateFinancialYearFormat: jest.fn(),
|
|
8
|
+
getCustomCalendarGuid: jest
|
|
9
|
+
.fn()
|
|
10
|
+
.mockReturnValue('7573c08b-753b-478b-84fd-6e702d481ff6'),
|
|
11
|
+
}));
|
|
12
|
+
describe('formatting utils', () => {
|
|
13
|
+
const mockOptions = {
|
|
14
|
+
quarterStartMonth: 1,
|
|
15
|
+
tsLocaleBasedStringsFormats: {
|
|
16
|
+
null_value_placeholder_label: '{Null}',
|
|
17
|
+
empty_value_placeholder_label: '{Empty}',
|
|
18
|
+
other_value_placeholder_label: '{Other}',
|
|
19
|
+
unavailabe_column_sample_value: '{Unavailable}',
|
|
20
|
+
weekOfDay: {
|
|
21
|
+
Friday: 'Friday',
|
|
22
|
+
Monday: 'Monday',
|
|
23
|
+
Saturday: 'Saturday',
|
|
24
|
+
Sunday: 'Sunday',
|
|
25
|
+
Thursday: 'Thursday',
|
|
26
|
+
Tuesday: 'Tuesday',
|
|
27
|
+
Wednesday: 'Wednesday',
|
|
28
|
+
},
|
|
29
|
+
monthOfYear: {
|
|
30
|
+
April: 'April',
|
|
31
|
+
August: 'August',
|
|
32
|
+
December: 'December',
|
|
33
|
+
February: 'February',
|
|
34
|
+
January: 'January',
|
|
35
|
+
July: 'July',
|
|
36
|
+
June: 'June',
|
|
37
|
+
March: 'March',
|
|
38
|
+
May: 'May',
|
|
39
|
+
November: 'November',
|
|
40
|
+
October: 'October',
|
|
41
|
+
September: 'September',
|
|
42
|
+
},
|
|
43
|
+
quarter_of_year: 'Q{1}',
|
|
44
|
+
},
|
|
45
|
+
tsDateConstants: {
|
|
46
|
+
day_in_month_format: 'e',
|
|
47
|
+
day_in_quarter_format: 'e',
|
|
48
|
+
day_in_year_format: 'j',
|
|
49
|
+
day_of_week_format: 'e',
|
|
50
|
+
month_in_quarter_format: 'm',
|
|
51
|
+
month_in_year_format: 'm',
|
|
52
|
+
special_value_unavailable: 'N/A',
|
|
53
|
+
week_in_year_format: 'V',
|
|
54
|
+
},
|
|
55
|
+
tsLocaleBasedDateFormats: {
|
|
56
|
+
DATE_SHORT: 'y',
|
|
57
|
+
},
|
|
58
|
+
quarter_of_year: 'Q{1}',
|
|
59
|
+
tsDefinedCustomCalenders: {
|
|
60
|
+
'43121d86-347a-4dbb-bea8-5e5bb899e427': {
|
|
61
|
+
calendar: '7573c08b-753b-478b-84fd-6e702d481ff6',
|
|
62
|
+
fiscal: 'bfa39848-ba4f-46d8-80fd-b695064e61b7',
|
|
63
|
+
french: 'a7316e8d-d4dd-4eaf-9294-396db951b422',
|
|
64
|
+
},
|
|
65
|
+
},
|
|
66
|
+
displayToCustomCalendarValueMap: {
|
|
67
|
+
'1234567891': {
|
|
68
|
+
v: {
|
|
69
|
+
s: 'start',
|
|
70
|
+
e: 'end',
|
|
71
|
+
},
|
|
72
|
+
d: 'custom Date',
|
|
73
|
+
},
|
|
74
|
+
'1234567892': {
|
|
75
|
+
v: {
|
|
76
|
+
s: '1234567890',
|
|
77
|
+
e: 'end',
|
|
78
|
+
},
|
|
79
|
+
},
|
|
80
|
+
},
|
|
81
|
+
};
|
|
82
|
+
test('getFormatPattern should call getFormatPatternForBucket with bucket and return pattern', () => {
|
|
83
|
+
const column = {
|
|
84
|
+
id: 'testId',
|
|
85
|
+
name: 'test',
|
|
86
|
+
type: ColumnType.MEASURE,
|
|
87
|
+
chartSpecificColumnType: ChartSpecificColumnType.UNKNOWN,
|
|
88
|
+
timeBucket: ColumnTimeBucket.YEARLY,
|
|
89
|
+
dataType: DataType.DATE,
|
|
90
|
+
calenderGuid: '12345',
|
|
91
|
+
};
|
|
92
|
+
expect(getFormatPattern(column)).toBe(undefined);
|
|
93
|
+
expect(getFormatPatternForBucket).toHaveBeenCalledWith(column.timeBucket);
|
|
94
|
+
});
|
|
95
|
+
test('should return date formatter if column is date', () => {
|
|
96
|
+
const column = {
|
|
97
|
+
id: 'testId',
|
|
98
|
+
name: 'test',
|
|
99
|
+
type: ColumnType.MEASURE,
|
|
100
|
+
chartSpecificColumnType: ChartSpecificColumnType.UNKNOWN,
|
|
101
|
+
timeBucket: ColumnTimeBucket.YEARLY,
|
|
102
|
+
dataType: DataType.DATE,
|
|
103
|
+
calenderGuid: '12345',
|
|
104
|
+
};
|
|
105
|
+
const options = { isMillisIncluded: true };
|
|
106
|
+
const formatter = getBaseTypeFormatterInstance(column, options);
|
|
107
|
+
expect(typeof formatter).toBe('function');
|
|
108
|
+
const formattedDate = formatter(1234567890, mockOptions);
|
|
109
|
+
expect(formattedDate).toBe('2009');
|
|
110
|
+
const customFormattedDate = formatter(1234567891, mockOptions);
|
|
111
|
+
const customFormattedDateWithoutDisplayValue = formatter(1234567892, mockOptions);
|
|
112
|
+
expect(customFormattedDateWithoutDisplayValue).toBe('2009');
|
|
113
|
+
expect(customFormattedDate).toBe('custom Date');
|
|
114
|
+
expect(showDateFinancialYearFormat).toHaveBeenCalledWith(column);
|
|
115
|
+
});
|
|
116
|
+
test('should return dateNum formatter if column is dateNum', () => {
|
|
117
|
+
const column = {
|
|
118
|
+
id: 'testId',
|
|
119
|
+
name: 'test',
|
|
120
|
+
type: ColumnType.ATTRIBUTE,
|
|
121
|
+
chartSpecificColumnType: ChartSpecificColumnType.UNKNOWN,
|
|
122
|
+
timeBucket: ColumnTimeBucket.HOUR_OF_DAY,
|
|
123
|
+
dataType: DataType.INT64,
|
|
124
|
+
calenderGuid: '12345',
|
|
125
|
+
};
|
|
126
|
+
const options = { isMillisIncluded: true };
|
|
127
|
+
const formatter = getBaseTypeFormatterInstance(column, options);
|
|
128
|
+
expect(typeof formatter).toBe('function');
|
|
129
|
+
const formattedDate = formatter(1234567890, mockOptions);
|
|
130
|
+
expect(formattedDate).toBe(1234567890);
|
|
131
|
+
const customFormattedDate = formatter(1234567891, mockOptions);
|
|
132
|
+
const customFormattedDateWithoutDisplayValue = formatter(1234567892, mockOptions);
|
|
133
|
+
expect(customFormattedDateWithoutDisplayValue).toBe(1234567892);
|
|
134
|
+
expect(customFormattedDate).toBe('custom Date');
|
|
135
|
+
});
|
|
136
|
+
test('should return a default formatter for non-date types', () => {
|
|
137
|
+
const column = {
|
|
138
|
+
id: 'testId',
|
|
139
|
+
name: 'test',
|
|
140
|
+
type: ColumnType.MEASURE,
|
|
141
|
+
chartSpecificColumnType: ChartSpecificColumnType.UNKNOWN,
|
|
142
|
+
timeBucket: ColumnTimeBucket.HOUR_OF_DAY,
|
|
143
|
+
dataType: DataType.INT64,
|
|
144
|
+
calenderGuid: '12345',
|
|
145
|
+
};
|
|
146
|
+
const options = { isMillisIncluded: true };
|
|
147
|
+
const formatter = getBaseTypeFormatterInstance(column, options);
|
|
148
|
+
expect(formatter('test')).toBe('test');
|
|
149
|
+
});
|
|
150
|
+
test('getDataFormatter should return appropriate formatter based on column type', () => {
|
|
151
|
+
const column = {
|
|
152
|
+
id: 'testId',
|
|
153
|
+
name: 'test',
|
|
154
|
+
type: ColumnType.ATTRIBUTE,
|
|
155
|
+
chartSpecificColumnType: ChartSpecificColumnType.UNKNOWN,
|
|
156
|
+
timeBucket: ColumnTimeBucket.YEARLY,
|
|
157
|
+
dataType: DataType.DATE,
|
|
158
|
+
calenderGuid: '12345',
|
|
159
|
+
};
|
|
160
|
+
const options = { isMillisIncluded: true };
|
|
161
|
+
const formatter = getDataFormatter(column, options);
|
|
162
|
+
expect(typeof formatter).toBe('function');
|
|
163
|
+
const formattedDate = formatter(1234567890, mockOptions);
|
|
164
|
+
expect(formattedDate).toBe('2009');
|
|
165
|
+
const customFormattedDate = formatter(1234567891, mockOptions);
|
|
166
|
+
const customFormattedDateWithoutDisplayValue = formatter(1234567892, mockOptions);
|
|
167
|
+
expect(customFormattedDateWithoutDisplayValue).toBe('2009');
|
|
168
|
+
expect(customFormattedDate).toBe('custom Date');
|
|
169
|
+
expect(showDateFinancialYearFormat).toHaveBeenCalledWith(column);
|
|
170
|
+
});
|
|
171
|
+
test('generateMapOptions should return map options based on appConfig and column', () => {
|
|
172
|
+
const column = {
|
|
173
|
+
id: 'testId',
|
|
174
|
+
name: 'test',
|
|
175
|
+
type: ColumnType.ATTRIBUTE,
|
|
176
|
+
chartSpecificColumnType: ChartSpecificColumnType.UNKNOWN,
|
|
177
|
+
timeBucket: ColumnTimeBucket.YEARLY,
|
|
178
|
+
dataType: DataType.DATE,
|
|
179
|
+
calenderGuid: '12345',
|
|
180
|
+
};
|
|
181
|
+
const appConfig = {
|
|
182
|
+
localeOptions: { locale: 'en-US', quarterStartMonth: 1 },
|
|
183
|
+
dateFormatsConfig: {
|
|
184
|
+
tsLocaleBasedDateFormats: 'MM-DD-YYYY',
|
|
185
|
+
tsLocaleBasedStringsFormats: 'YYYY/MM/DD',
|
|
186
|
+
tsDateConstants: {},
|
|
187
|
+
tsDefinedCustomCalenders: {},
|
|
188
|
+
DEFAULT_DATASOURCE_ID: 'source1',
|
|
189
|
+
},
|
|
190
|
+
};
|
|
191
|
+
const data = [{ v: { s: 'key1' } }, { v: { s: 'key2' } }];
|
|
192
|
+
const mapOptions = generateMapOptions(appConfig, column, data);
|
|
193
|
+
expect(mapOptions.locale).toBe('en-US');
|
|
194
|
+
expect(mapOptions.quarterStartMonth).toBe(1);
|
|
195
|
+
expect(mapOptions.displayToCustomCalendarValueMap).toEqual({
|
|
196
|
+
key1: data[0],
|
|
197
|
+
key2: data[1],
|
|
198
|
+
});
|
|
199
|
+
});
|
|
200
|
+
test('should have format pattern as DATETIME_SHORT_WITH_MILLIS when format pattern is null', () => {
|
|
201
|
+
const column = {
|
|
202
|
+
id: 'testId',
|
|
203
|
+
name: 'test',
|
|
204
|
+
type: ColumnType.VIRTUAL,
|
|
205
|
+
chartSpecificColumnType: ChartSpecificColumnType.UNKNOWN,
|
|
206
|
+
timeBucket: ColumnTimeBucket.MONTHLY,
|
|
207
|
+
dataType: DataType.DATE_TIME,
|
|
208
|
+
calenderGuid: '12345',
|
|
209
|
+
};
|
|
210
|
+
const options = { isMillisIncluded: true };
|
|
211
|
+
const formatter = getBaseTypeFormatterInstance(column, options);
|
|
212
|
+
expect(typeof formatter).toBe('function');
|
|
213
|
+
});
|
|
214
|
+
test('should correctly set format pattern for date-time column with and without milliseconds', () => {
|
|
215
|
+
jest.spyOn(DateFormatting, 'formatDate').mockImplementation(jest.fn());
|
|
216
|
+
const column = {
|
|
217
|
+
id: 'testId',
|
|
218
|
+
name: 'test',
|
|
219
|
+
type: ColumnType.MEASURE,
|
|
220
|
+
chartSpecificColumnType: ChartSpecificColumnType.UNKNOWN,
|
|
221
|
+
timeBucket: ColumnTimeBucket.MONTHLY,
|
|
222
|
+
dataType: DataType.DATE_TIME,
|
|
223
|
+
calenderGuid: '12345',
|
|
224
|
+
};
|
|
225
|
+
const optionsWithMillis = { isMillisIncluded: true };
|
|
226
|
+
const optionsWithoutMillis = { isMillisIncluded: false };
|
|
227
|
+
const formatterWithMillis = getBaseTypeFormatterInstance(column, optionsWithMillis);
|
|
228
|
+
const formatterWithoutMillis = getBaseTypeFormatterInstance(column, optionsWithoutMillis);
|
|
229
|
+
expect(typeof formatterWithMillis).toBe('function');
|
|
230
|
+
expect(typeof formatterWithoutMillis).toBe('function');
|
|
231
|
+
const dateFormatPresetsMock = {
|
|
232
|
+
DATETIME_SHORT_WITH_MILLIS: 'DATETIME_SHORT_WITH_MILLIS',
|
|
233
|
+
DATETIME_SHORT_WITH_SECONDS: 'DATETIME_SHORT_WITH_SECONDS',
|
|
234
|
+
};
|
|
235
|
+
const formattedDateWithMillis = formatterWithMillis(1234567890, mockOptions);
|
|
236
|
+
expect(DateFormatting.formatDate).toHaveBeenCalledWith(1234567890, dateFormatPresetsMock.DATETIME_SHORT_WITH_MILLIS, true, {
|
|
237
|
+
...mockOptions,
|
|
238
|
+
customCalendarOverridesFiscalOffset: true,
|
|
239
|
+
});
|
|
240
|
+
const formattedDateWithoutMillis = formatterWithoutMillis(1234567890, mockOptions);
|
|
241
|
+
expect(DateFormatting.formatDate).toHaveBeenCalledWith(1234567890, dateFormatPresetsMock.DATETIME_SHORT_WITH_SECONDS, true, {
|
|
242
|
+
...mockOptions,
|
|
243
|
+
customCalendarOverridesFiscalOffset: true,
|
|
244
|
+
});
|
|
245
|
+
});
|
|
246
|
+
});
|
|
247
|
+
//# sourceMappingURL=formatting-util.spec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"formatting-util.spec.js","sourceRoot":"","sources":["../../src/utils/formatting-util.spec.ts"],"names":[],"mappings":"AAAA,OAAO,EAEH,uBAAuB,EACvB,gBAAgB,EAChB,UAAU,EACV,QAAQ,GACX,MAAM,8BAA8B,CAAC;AACtC,OAAO,KAAK,cAAc,MAAM,mBAAmB,CAAC;AACpD,OAAO,EACH,yBAAyB,EACzB,2BAA2B,GAC9B,MAAM,cAAc,CAAC;AACtB,OAAO,EACH,kBAAkB,EAClB,4BAA4B,EAC5B,gBAAgB,EAChB,gBAAgB,GACnB,MAAM,mBAAmB,CAAC;AAE3B,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,GAAG,EAAE,CAAC,CAAC;IAC7B,yBAAyB,EAAE,IAAI,CAAC,EAAE,EAAE;IACpC,2BAA2B,EAAE,IAAI,CAAC,EAAE,EAAE;IACtC,qBAAqB,EAAE,IAAI;SACtB,EAAE,EAAE;SACJ,eAAe,CAAC,sCAAsC,CAAC;CAC/D,CAAC,CAAC,CAAC;AAEJ,QAAQ,CAAC,kBAAkB,EAAE,GAAG,EAAE;IAC9B,MAAM,WAAW,GAAG;QAChB,iBAAiB,EAAE,CAAC;QACpB,2BAA2B,EAAE;YACzB,4BAA4B,EAAE,QAAQ;YACtC,6BAA6B,EAAE,SAAS;YACxC,6BAA6B,EAAE,SAAS;YACxC,8BAA8B,EAAE,eAAe;YAC/C,SAA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MAAM,iBAAiB,GAAG,EAAE,gBAAgB,EAAE,IAAI,EAAE,CAAC;QACrD,MAAM,oBAAoB,GAAG,EAAE,gBAAgB,EAAE,KAAK,EAAE,CAAC;QAEzD,MAAM,mBAAmB,GAAG,4BAA4B,CACpD,MAAM,EACN,iBAAiB,CACpB,CAAC;QACF,MAAM,sBAAsB,GAAG,4BAA4B,CACvD,MAAM,EACN,oBAAoB,CACvB,CAAC;QAEF,MAAM,CAAC,OAAO,mBAAmB,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QACpD,MAAM,CAAC,OAAO,sBAAsB,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAGvD,MAAM,qBAAqB,GAAG;YAC1B,0BAA0B,EAAE,4BAA4B;YACxD,2BAA2B,EAAE,6BAA6B;SAC7D,CAAC;QAGF,MAAM,uBAAuB,GAAG,mBAAmB,CAC/C,UAAU,EACV,WAAW,CACd,CAAC;QACF,MAAM,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC,oBAAoB,CAClD,UAAU,EACV,qBAAqB,CAAC,0BAA0B,EAChD,IAAI,EACJ;YACI,GAAG,WAAW;YACd,mCAAmC,EAAE,IAAI;SAC5C,CACJ,CAAC;QACF,MAAM,0BAA0B,GAAG,sBAAsB,CACrD,UAAU,EACV,WAAW,CACd,CAAC;QACF,MAAM,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC,oBAAoB,CAClD,UAAU,EACV,qBAAqB,CAAC,2BAA2B,EACjD,IAAI,EACJ;YACI,GAAG,WAAW;YACd,mCAAmC,EAAE,IAAI;SAC5C,CACJ,CAAC;IACN,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -250,9 +250,70 @@ export type ChartSdkCustomStylingConfig = {
|
|
|
250
250
|
fontFaces?: Array<TSFontFace>;
|
|
251
251
|
};
|
|
252
252
|
|
|
253
|
+
/**
|
|
254
|
+
* Defines a set of standardized date and datetime format strings used for
|
|
255
|
+
* displaying dates and times in various formats. Each format string represents
|
|
256
|
+
* a specific date or time pattern that can be used for localized display purposes.
|
|
257
|
+
*/
|
|
258
|
+
|
|
259
|
+
export interface DateFormats {
|
|
260
|
+
DATE_SHORT: string;
|
|
261
|
+
DATE_SHORT_2_DIGIT_YEAR: string;
|
|
262
|
+
DATE_SHORT_WITH_HOUR: string;
|
|
263
|
+
DATE_SHORT_WITH_HOUR_WITHOUT_YEAR: string;
|
|
264
|
+
DATE_SHORT_WITH_HOUR_24: string;
|
|
265
|
+
DATE_SHORT_WITH_HOUR_24_WITHOUT_YEAR: string;
|
|
266
|
+
DATETIME_SHORT: string;
|
|
267
|
+
DATETIME_SHORT_WITHOUT_YEAR: string;
|
|
268
|
+
DATETIME_24_SHORT: string;
|
|
269
|
+
DATETIME_24_SHORT_WITH_MILLIS: string;
|
|
270
|
+
DATETIME_24_SHORT_WITH_MILLIS_WITHOUT_YEAR: string;
|
|
271
|
+
DATETIME_SHORT_WITH_SECONDS: string;
|
|
272
|
+
DATETIME_SHORT_WITH_SECONDS_WITHOUT_YEAR: string;
|
|
273
|
+
DATETIME_SHORT_WITH_MILLIS: string;
|
|
274
|
+
DATETIME_SHORT_WITH_MILLIS_WITHOUT_YEAR: string;
|
|
275
|
+
QUARTER_WITH_YEAR: string;
|
|
276
|
+
QUARTER_WITH_2_DIGIT_YEAR: string;
|
|
277
|
+
DEFAULT_TIME_FORMAT: string;
|
|
278
|
+
MONTH_WITH_YEAR: string;
|
|
279
|
+
MONTH_WITH_DAY_AND_YEAR: string;
|
|
280
|
+
MONTH_WITH_2_DIGIT_YEAR: string;
|
|
281
|
+
DAY_WITH_MONTH: string;
|
|
282
|
+
DAY_WITH_MONTH_NUM: string;
|
|
283
|
+
QUARTER: string;
|
|
284
|
+
MONTH_ONLY: string;
|
|
285
|
+
DATETIME_WITH_SHORT_OFFSET: string;
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
/**
|
|
289
|
+
* Configuration object for date formats and settings in the Chart SDK.
|
|
290
|
+
* Provides locale-specific date and string formats, constants, and custom calendars.
|
|
291
|
+
*
|
|
292
|
+
* @type ChartSdkDateFormatsConfig
|
|
293
|
+
*
|
|
294
|
+
* @property tsLocaleBasedDateFormats - Optional. A record mapping locale identifiers to date format settings,
|
|
295
|
+
* each represented by a `DateFormats` object.
|
|
296
|
+
* @property tsLocaleBasedStringsFormats - Optional. A record mapping locale identifiers to localized string
|
|
297
|
+
* formats, where each format is represented by a string.
|
|
298
|
+
* @property tsDateConstants - Optional. A record mapping string keys to date-related constants, often used
|
|
299
|
+
* for standard date patterns or other fixed date-related values(mostly used to identify the case
|
|
300
|
+
* for backend proccessed date in case of MONTH_OF_YEAR,DAY_OF_WEEK).
|
|
301
|
+
* @property tsDefinedCustomCalenders - Optional. Custom calendar configurations, which have GUID of TS defined Custom calenders.
|
|
302
|
+
* @property defaultDataSourceId - Optional. The data source identifier for the date formats, used
|
|
303
|
+
* to specify the primary data source for TS defined custom calenders.
|
|
304
|
+
*/
|
|
305
|
+
|
|
306
|
+
export type ChartSdkDateFormatsConfig = {
|
|
307
|
+
tsLocaleBasedDateFormats?: Record<string, DateFormats>;
|
|
308
|
+
tsLocaleBasedStringsFormats?: Record<string, string>;
|
|
309
|
+
tsDateConstants?: Record<string, string>;
|
|
310
|
+
tsDefinedCustomCalenders?: any;
|
|
311
|
+
defaultDataSourceId?: string;
|
|
312
|
+
};
|
|
313
|
+
|
|
253
314
|
export interface AppConfig {
|
|
254
315
|
styleConfig?: ChartSdkCustomStylingConfig;
|
|
255
|
-
|
|
316
|
+
dateFormatsConfig?: ChartSdkDateFormatsConfig;
|
|
256
317
|
appOptions?: {
|
|
257
318
|
isMobile?: boolean;
|
|
258
319
|
isPrintMode?: boolean; // export mode on/off
|