@amcharts/amcharts5 5.11.0 → 5.11.2
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/.internal/charts/funnel/FunnelSlice.d.ts +24 -0
- package/.internal/charts/funnel/FunnelSlice.d.ts.map +1 -1
- package/.internal/charts/funnel/FunnelSlice.js +70 -11
- package/.internal/charts/funnel/FunnelSlice.js.map +1 -1
- package/.internal/charts/hierarchy/Hierarchy.js +1 -1
- package/.internal/charts/hierarchy/Hierarchy.js.map +1 -1
- package/.internal/charts/map/MapSeries.d.ts.map +1 -1
- package/.internal/charts/map/MapSeries.js +8 -0
- package/.internal/charts/map/MapSeries.js.map +1 -1
- package/.internal/charts/stock/SettingsModal.d.ts +7 -0
- package/.internal/charts/stock/SettingsModal.d.ts.map +1 -1
- package/.internal/charts/stock/SettingsModal.js +8 -7
- package/.internal/charts/stock/SettingsModal.js.map +1 -1
- package/.internal/charts/stock/drawing/HorizontalLineSeries.d.ts.map +1 -1
- package/.internal/charts/stock/drawing/HorizontalLineSeries.js +1 -1
- package/.internal/charts/stock/drawing/HorizontalLineSeries.js.map +1 -1
- package/.internal/charts/stock/drawing/HorizontalRaySeries.d.ts.map +1 -1
- package/.internal/charts/stock/drawing/HorizontalRaySeries.js +1 -1
- package/.internal/charts/stock/drawing/HorizontalRaySeries.js.map +1 -1
- package/.internal/charts/stock/toolbar/DateRangeSelector.d.ts +8 -0
- package/.internal/charts/stock/toolbar/DateRangeSelector.d.ts.map +1 -1
- package/.internal/charts/stock/toolbar/DateRangeSelector.js +13 -3
- package/.internal/charts/stock/toolbar/DateRangeSelector.js.map +1 -1
- package/.internal/charts/xy/axes/Axis.d.ts +1 -0
- package/.internal/charts/xy/axes/Axis.d.ts.map +1 -1
- package/.internal/charts/xy/axes/Axis.js +2 -0
- package/.internal/charts/xy/axes/Axis.js.map +1 -1
- package/.internal/charts/xy/axes/DateAxis.d.ts +1 -0
- package/.internal/charts/xy/axes/DateAxis.d.ts.map +1 -1
- package/.internal/charts/xy/axes/DateAxis.js +4 -0
- package/.internal/charts/xy/axes/DateAxis.js.map +1 -1
- package/.internal/charts/xy/series/XYSeries.d.ts +1 -0
- package/.internal/charts/xy/series/XYSeries.d.ts.map +1 -1
- package/.internal/charts/xy/series/XYSeries.js +13 -0
- package/.internal/charts/xy/series/XYSeries.js.map +1 -1
- package/.internal/core/Registry.js +1 -1
- package/.internal/core/Registry.js.map +1 -1
- package/.internal/core/Root.d.ts.map +1 -1
- package/.internal/core/Root.js +57 -4
- package/.internal/core/Root.js.map +1 -1
- package/.internal/core/render/Container.d.ts +10 -0
- package/.internal/core/render/Container.d.ts.map +1 -1
- package/.internal/core/render/Container.js.map +1 -1
- package/.internal/core/render/SerialChart.d.ts.map +1 -1
- package/.internal/core/render/SerialChart.js +1 -0
- package/.internal/core/render/SerialChart.js.map +1 -1
- package/.internal/core/render/Series.d.ts +1 -0
- package/.internal/core/render/Series.d.ts.map +1 -1
- package/.internal/core/render/Series.js +2 -0
- package/.internal/core/render/Series.js.map +1 -1
- package/.internal/core/render/Sprite.d.ts +117 -2
- package/.internal/core/render/Sprite.d.ts.map +1 -1
- package/.internal/core/render/Sprite.js +5 -0
- package/.internal/core/render/Sprite.js.map +1 -1
- package/.internal/core/util/Accessibility.d.ts +2 -115
- package/.internal/core/util/Accessibility.d.ts.map +1 -1
- package/.internal/core/util/Accessibility.js.map +1 -1
- package/.internal/core/util/DurationFormatter.d.ts.map +1 -1
- package/.internal/core/util/DurationFormatter.js +57 -2
- package/.internal/core/util/DurationFormatter.js.map +1 -1
- package/.internal/core/util/Type.js +1 -1
- package/.internal/core/util/Type.js.map +1 -1
- package/CHANGELOG.md +32 -0
- package/examples/javascript/flow-arc-horizontal/package.json +1 -1
- package/examples/javascript/flow-arc-vertical/package.json +1 -1
- package/examples/javascript/flow-chord/package.json +1 -1
- package/examples/javascript/flow-chord-directed/package.json +1 -1
- package/examples/javascript/flow-chord-non-ribbon/package.json +1 -1
- package/examples/javascript/flow-sankey/package.json +1 -1
- package/examples/javascript/gauge/package.json +1 -1
- package/examples/javascript/gauge-bands/package.json +1 -1
- package/examples/javascript/hierarchy-force-directed/package.json +1 -1
- package/examples/javascript/hierarchy-pack/package.json +1 -1
- package/examples/javascript/hierarchy-partition/package.json +1 -1
- package/examples/javascript/hierarchy-sunburst/package.json +1 -1
- package/examples/javascript/hierarchy-tree/package.json +1 -1
- package/examples/javascript/hierarchy-treemap/package.json +1 -1
- package/examples/javascript/hierarchy-voronoi-treemap/package.json +1 -1
- package/examples/javascript/jest/package.json +1 -1
- package/examples/javascript/json-pie/package.json +1 -1
- package/examples/javascript/json-xy/package.json +1 -1
- package/examples/javascript/map-animating-along-lines/package.json +1 -1
- package/examples/javascript/map-clustered-points/package.json +1 -1
- package/examples/javascript/map-day-and-night/package.json +1 -1
- package/examples/javascript/map-globe-rotate-to-country/package.json +1 -1
- package/examples/javascript/map-globe-with-projected-circles/package.json +1 -1
- package/examples/javascript/map-with-bubbles/package.json +1 -1
- package/examples/javascript/map-zoom-to-country/package.json +1 -1
- package/examples/javascript/misc-40-charts/package.json +1 -1
- package/examples/javascript/misc-microchart-grid/package.json +1 -1
- package/examples/javascript/pie-chart/package.json +1 -1
- package/examples/javascript/pie-donut-chart/package.json +1 -1
- package/examples/javascript/pie-variable-radius/package.json +1 -1
- package/examples/javascript/radar-column-iwatch-style/package.json +1 -1
- package/examples/javascript/radar-heat-map/package.json +1 -1
- package/examples/javascript/radar-line/package.json +1 -1
- package/examples/javascript/radar-time-line/package.json +1 -1
- package/examples/javascript/sliced-funnel/package.json +1 -1
- package/examples/javascript/sliced-pictorial-stacked/package.json +1 -1
- package/examples/javascript/sliced-pyramid/package.json +1 -1
- package/examples/javascript/stock-chart/package.json +1 -1
- package/examples/javascript/stock-chart-comparing-stocks/package.json +1 -1
- package/examples/javascript/stock-chart-data-granularity/package.json +1 -1
- package/examples/javascript/stock-chart-data-grouping/package.json +1 -1
- package/examples/javascript/stock-chart-intraday/package.json +1 -1
- package/examples/javascript/stock-chart-live/package.json +1 -1
- package/examples/javascript/stock-chart-volume-separate-panel/package.json +1 -1
- package/examples/javascript/venn-diagram/package.json +1 -1
- package/examples/javascript/wordcloud-with-data/package.json +1 -1
- package/examples/javascript/wordcloud-with-text/package.json +1 -1
- package/examples/javascript/xy-100-percent-stacked-column/package.json +1 -1
- package/examples/javascript/xy-animated-bullet-at-the-end-of-the-series/package.json +1 -1
- package/examples/javascript/xy-bubble/package.json +1 -1
- package/examples/javascript/xy-candlestick/package.json +1 -1
- package/examples/javascript/xy-clustered-column/package.json +1 -1
- package/examples/javascript/xy-column/package.json +1 -1
- package/examples/javascript/xy-comparing-series-google-analytics-style/package.json +1 -1
- package/examples/javascript/xy-data-grouping/package.json +1 -1
- package/examples/javascript/xy-draggable-range/package.json +1 -1
- package/examples/javascript/xy-drawing-series-with-mouse-or-touch/package.json +1 -1
- package/examples/javascript/xy-dumbbell plot/package.json +1 -1
- package/examples/javascript/xy-evenly-spaced-date-axis/package.json +1 -1
- package/examples/javascript/xy-line/package.json +1 -1
- package/examples/javascript/xy-line-highlight-on-legend-hover/package.json +1 -1
- package/examples/javascript/xy-live-data/package.json +1 -1
- package/examples/javascript/xy-multiple-synced-value-axes/package.json +1 -1
- package/examples/javascript/xy-ohlc/package.json +1 -1
- package/examples/javascript/xy-real-time-data-sorting/package.json +1 -1
- package/examples/javascript/xy-smoothed-line/package.json +1 -1
- package/examples/javascript/xy-stacked-and-clustered-column/package.json +1 -1
- package/examples/javascript/xy-stacked-column/package.json +1 -1
- package/examples/javascript/xy-stacked-step/package.json +1 -1
- package/examples/javascript/xy-stock/package.json +1 -1
- package/examples/javascript/xy-stock-comparing/package.json +1 -1
- package/examples/typescript/flow-arc-horizontal/package.json +1 -1
- package/examples/typescript/flow-arc-vertical/package.json +1 -1
- package/examples/typescript/flow-chord/package.json +1 -1
- package/examples/typescript/flow-chord-directed/package.json +1 -1
- package/examples/typescript/flow-chord-non-ribbon/package.json +1 -1
- package/examples/typescript/flow-sankey/package.json +1 -1
- package/examples/typescript/gauge/package.json +1 -1
- package/examples/typescript/gauge-bands/package.json +1 -1
- package/examples/typescript/hierarchy-force-directed/package.json +1 -1
- package/examples/typescript/hierarchy-pack/package.json +1 -1
- package/examples/typescript/hierarchy-partition/package.json +1 -1
- package/examples/typescript/hierarchy-sunburst/package.json +1 -1
- package/examples/typescript/hierarchy-tree/package.json +1 -1
- package/examples/typescript/hierarchy-treemap/package.json +1 -1
- package/examples/typescript/hierarchy-voronoi-treemap/package.json +1 -1
- package/examples/typescript/jest/package.json +1 -1
- package/examples/typescript/json-pie/package.json +1 -1
- package/examples/typescript/json-xy/package.json +1 -1
- package/examples/typescript/map-animating-along-lines/package.json +1 -1
- package/examples/typescript/map-clustered-points/package.json +1 -1
- package/examples/typescript/map-day-and-night/package.json +1 -1
- package/examples/typescript/map-globe-rotate-to-country/package.json +1 -1
- package/examples/typescript/map-globe-with-projected-circles/package.json +1 -1
- package/examples/typescript/map-with-bubbles/package.json +1 -1
- package/examples/typescript/map-zoom-to-country/package.json +1 -1
- package/examples/typescript/misc-40-charts/package.json +1 -1
- package/examples/typescript/misc-microchart-grid/package.json +1 -1
- package/examples/typescript/pie-chart/package.json +1 -1
- package/examples/typescript/pie-donut-chart/package.json +1 -1
- package/examples/typescript/pie-variable-radius/package.json +1 -1
- package/examples/typescript/radar-column-iwatch-style/package.json +1 -1
- package/examples/typescript/radar-heat-map/package.json +1 -1
- package/examples/typescript/radar-line/package.json +1 -1
- package/examples/typescript/radar-time-line/package.json +1 -1
- package/examples/typescript/sliced-funnel/package.json +1 -1
- package/examples/typescript/sliced-pictorial-stacked/package.json +1 -1
- package/examples/typescript/sliced-pyramid/package.json +1 -1
- package/examples/typescript/stock-chart/package.json +1 -1
- package/examples/typescript/stock-chart-comparing-stocks/package.json +1 -1
- package/examples/typescript/stock-chart-data-granularity/package.json +1 -1
- package/examples/typescript/stock-chart-data-grouping/package.json +1 -1
- package/examples/typescript/stock-chart-intraday/package.json +1 -1
- package/examples/typescript/stock-chart-live/package.json +1 -1
- package/examples/typescript/stock-chart-volume-separate-panel/package.json +1 -1
- package/examples/typescript/venn-diagram/package.json +1 -1
- package/examples/typescript/wordcloud-with-data/package.json +1 -1
- package/examples/typescript/wordcloud-with-text/package.json +1 -1
- package/examples/typescript/xy-100-percent-stacked-column/package.json +1 -1
- package/examples/typescript/xy-animated-bullet-at-the-end-of-the-series/package.json +1 -1
- package/examples/typescript/xy-bubble/package.json +1 -1
- package/examples/typescript/xy-candlestick/package.json +1 -1
- package/examples/typescript/xy-clustered-column/package.json +1 -1
- package/examples/typescript/xy-column/package.json +1 -1
- package/examples/typescript/xy-comparing-series-google-analytics-style/package.json +1 -1
- package/examples/typescript/xy-data-grouping/package.json +1 -1
- package/examples/typescript/xy-draggable-range/package.json +1 -1
- package/examples/typescript/xy-drawing-series-with-mouse-or-touch/package.json +1 -1
- package/examples/typescript/xy-dumbbell plot/package.json +1 -1
- package/examples/typescript/xy-evenly-spaced-date-axis/package.json +1 -1
- package/examples/typescript/xy-line/package.json +1 -1
- package/examples/typescript/xy-line-highlight-on-legend-hover/package.json +1 -1
- package/examples/typescript/xy-live-data/package.json +1 -1
- package/examples/typescript/xy-multiple-synced-value-axes/package.json +1 -1
- package/examples/typescript/xy-ohlc/package.json +1 -1
- package/examples/typescript/xy-real-time-data-sorting/package.json +1 -1
- package/examples/typescript/xy-smoothed-line/package.json +1 -1
- package/examples/typescript/xy-stacked-and-clustered-column/package.json +1 -1
- package/examples/typescript/xy-stacked-column/package.json +1 -1
- package/examples/typescript/xy-stacked-step/package.json +1 -1
- package/examples/typescript/xy-stock/package.json +1 -1
- package/examples/typescript/xy-stock-comparing/package.json +1 -1
- package/locales/nl_NL.js +1 -1
- package/locales/nl_NL.js.map +1 -1
- package/package.json +2 -2
|
@@ -2,123 +2,10 @@
|
|
|
2
2
|
* Accessibility setting that can be applied to any visual element.
|
|
3
3
|
*
|
|
4
4
|
* @see {@link https://www.amcharts.com/docs/v5/concepts/accessibility/} for more info
|
|
5
|
+
* @deprecated Since 5.11.2. Moved to ISpriteSettings
|
|
6
|
+
* @ignore
|
|
5
7
|
*/
|
|
6
8
|
export interface IAccessibilitySettings {
|
|
7
|
-
/**
|
|
8
|
-
* An internal order by which focusable elements will be selected within the
|
|
9
|
-
* chart.
|
|
10
|
-
*
|
|
11
|
-
* @see {@link https://www.amcharts.com/docs/v5/concepts/accessibility/#Focusing_elements} for more info
|
|
12
|
-
*/
|
|
13
|
-
tabindexOrder?: number;
|
|
14
|
-
/**
|
|
15
|
-
* Simulate hover on an element when it gains focus, including changing hover
|
|
16
|
-
* appearance and displaying a tooltip if application.
|
|
17
|
-
*
|
|
18
|
-
* @see {@link https://www.amcharts.com/docs/v5/concepts/accessibility/#Focusing_elements} for more info
|
|
19
|
-
*/
|
|
20
|
-
hoverOnFocus?: boolean;
|
|
21
|
-
/**
|
|
22
|
-
* Can element be focused, i.e. selected using TAB key.
|
|
23
|
-
*
|
|
24
|
-
* @see {@link https://www.amcharts.com/docs/v5/concepts/accessibility/#Focusing_elements} for more info
|
|
25
|
-
*/
|
|
26
|
-
focusable?: boolean;
|
|
27
|
-
/**
|
|
28
|
-
* An identifier by which to group common elements into focusable groups.
|
|
29
|
-
*
|
|
30
|
-
* If set, only the first element in he group will be focusable via TAB key.
|
|
31
|
-
* When it is selected, the rest of the elements in the same group can be
|
|
32
|
-
* selected using arrow keys.
|
|
33
|
-
*
|
|
34
|
-
* It allows users to TAB-through chart elements quickly without the need
|
|
35
|
-
* to TAB into each and every element.
|
|
36
|
-
*
|
|
37
|
-
* It's up to implementer of the charts to provide meaningful `ariaLabel` to
|
|
38
|
-
* the element, which advertises this capability and provides adequate
|
|
39
|
-
* instructions.
|
|
40
|
-
*
|
|
41
|
-
* @see {@link https://www.amcharts.com/docs/v5/concepts/accessibility/#Grouping_focusable_elements} for more info
|
|
42
|
-
* @since 5.0.6
|
|
43
|
-
*/
|
|
44
|
-
focusableGroup?: string | number;
|
|
45
|
-
/**
|
|
46
|
-
* If set, the text will be read out (announced) by a screen reader when
|
|
47
|
-
* focused element is "clicked" (by pressing ENTER or SPACE).
|
|
48
|
-
*
|
|
49
|
-
* @since 5.10.8
|
|
50
|
-
*/
|
|
51
|
-
clickAnnounceText?: string;
|
|
52
|
-
/**
|
|
53
|
-
* Element's role.
|
|
54
|
-
*
|
|
55
|
-
* @see {@link https://www.amcharts.com/docs/v5/concepts/accessibility/#Roles} for more info
|
|
56
|
-
*/
|
|
57
|
-
role?: Role;
|
|
58
|
-
/**
|
|
59
|
-
* `aria-live` setting.
|
|
60
|
-
*/
|
|
61
|
-
ariaLive?: AriaLive;
|
|
62
|
-
/**
|
|
63
|
-
* `aria-checked` setting.
|
|
64
|
-
*
|
|
65
|
-
* This setting is ignored unless `role` is one of the following:
|
|
66
|
-
* * `"checkbox"`
|
|
67
|
-
* * `"option"`
|
|
68
|
-
* * `"radio"`
|
|
69
|
-
* * `"menuitemcheckbox"`
|
|
70
|
-
* * `"menuitemradio"`
|
|
71
|
-
* * `"treeitem"`
|
|
72
|
-
*/
|
|
73
|
-
ariaChecked?: boolean;
|
|
74
|
-
/**
|
|
75
|
-
* `aria-current` setting.
|
|
76
|
-
*
|
|
77
|
-
* @see {@link https://w3c.github.io/aria/#aria-current} for more info
|
|
78
|
-
* @since 5.9.8
|
|
79
|
-
*/
|
|
80
|
-
ariaCurrent?: string;
|
|
81
|
-
/**
|
|
82
|
-
* `aria-selected` setting.
|
|
83
|
-
*
|
|
84
|
-
* @see {@link https://w3c.github.io/aria/#aria-selected} for more info
|
|
85
|
-
* @since 5.9.8
|
|
86
|
-
*/
|
|
87
|
-
ariaSelected?: boolean;
|
|
88
|
-
/**
|
|
89
|
-
* `aria-hidden` setting.
|
|
90
|
-
*/
|
|
91
|
-
ariaHidden?: boolean;
|
|
92
|
-
/**
|
|
93
|
-
* Label for the element to use for screen readers.
|
|
94
|
-
*
|
|
95
|
-
* @see {@link https://www.amcharts.com/docs/v5/concepts/accessibility/#Screen_reader} for more info
|
|
96
|
-
*/
|
|
97
|
-
ariaLabel?: string;
|
|
98
|
-
/**
|
|
99
|
-
* `aria-orientation` setting.
|
|
100
|
-
*/
|
|
101
|
-
ariaOrientation?: string;
|
|
102
|
-
/**
|
|
103
|
-
* `aria-valuenow` setting.
|
|
104
|
-
*/
|
|
105
|
-
ariaValueNow?: string;
|
|
106
|
-
/**
|
|
107
|
-
* `aria-valuemin` setting.
|
|
108
|
-
*/
|
|
109
|
-
ariaValueMin?: string;
|
|
110
|
-
/**
|
|
111
|
-
* `aria-valuemax` setting.
|
|
112
|
-
*/
|
|
113
|
-
ariaValueMax?: string;
|
|
114
|
-
/**
|
|
115
|
-
* `aria-valuetext` setting.
|
|
116
|
-
*/
|
|
117
|
-
ariaValueText?: string;
|
|
118
|
-
/**
|
|
119
|
-
* `aria-controls` setting.
|
|
120
|
-
*/
|
|
121
|
-
ariaControls?: string;
|
|
122
9
|
}
|
|
123
10
|
/**
|
|
124
11
|
* Defines available accessibility roles.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Accessibility.d.ts","sourceRoot":"","sources":["../../../../../src/.internal/core/util/Accessibility.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"Accessibility.d.ts","sourceRoot":"","sources":["../../../../../src/.internal/core/util/Accessibility.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,MAAM,WAAW,sBAAsB;CAAG;AAG1C;;;;GAIG;AACH,oBAAY,IAAI,GACf,OAAO,GACL,aAAa,GACb,aAAa,GACb,SAAS,GACT,QAAQ,GACR,QAAQ,GACR,UAAU,GACV,cAAc,GACd,UAAU,GACV,SAAS,GACT,eAAe,GACf,WAAW,GACX,aAAa,GACb,YAAY,GACZ,QAAQ,GACR,WAAW,GACX,UAAU,GACV,MAAM,GACN,QAAQ,GACR,MAAM,GACN,UAAU,GACV,OAAO,GACP,SAAS,GACT,KAAK,GACL,OAAO,GACP,UAAU,GACV,MAAM,GACN,MAAM,GACN,SAAS,GACT,UAAU,GACV,KAAK,GACL,MAAM,GACN,SAAS,GACT,MAAM,GACN,MAAM,GACN,SAAS,GACT,UAAU,GACV,kBAAkB,GAClB,eAAe,GACf,YAAY,GACZ,MAAM,GACN,MAAM,GACN,QAAQ,GACR,cAAc,GACd,aAAa,GACb,OAAO,GACP,YAAY,GACZ,OAAO,GACP,QAAQ,GACR,UAAU,GACV,KAAK,GACL,UAAU,GACV,WAAW,GACX,WAAW,GACX,QAAQ,GACR,SAAS,GACT,aAAa,GACb,QAAQ,GACR,WAAW,GACX,QAAQ,GACR,YAAY,GACZ,QAAQ,GACR,WAAW,GACX,QAAQ,GACR,KAAK,GACL,SAAS,GACT,UAAU,GACV,SAAS,GACT,OAAO,GACP,SAAS,GACT,SAAS,GACT,MAAM,GACN,UAAU,GACV,UAAU,GACV,QAAQ,GACR,QAAQ,CAAC;AAGZ;;GAEG;AACH,oBAAY,QAAQ,GAAG,KAAK,GAAG,QAAQ,GAAG,WAAW,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Accessibility.js","sourceRoot":"","sources":["../../../../../src/.internal/core/util/Accessibility.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * Accessibility setting that can be applied to any visual element.\n *\n * @see {@link https://www.amcharts.com/docs/v5/concepts/accessibility/} for more info\n
|
|
1
|
+
{"version":3,"file":"Accessibility.js","sourceRoot":"","sources":["../../../../../src/.internal/core/util/Accessibility.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * Accessibility setting that can be applied to any visual element.\n *\n * @see {@link https://www.amcharts.com/docs/v5/concepts/accessibility/} for more info\n * @deprecated Since 5.11.2. Moved to ISpriteSettings\n * @ignore\n */\nexport interface IAccessibilitySettings {}\n\n\n/**\n * Defines available accessibility roles.\n *\n * @see {@link https://www.amcharts.com/docs/v5/concepts/accessibility/} for more info\n */\nexport type Role =\n\t\"alert\"\n\t| \"alertdialog\"\n\t| \"application\"\n\t| \"article\"\n\t| \"banner\"\n\t| \"button\"\n\t| \"checkbox\"\n\t| \"columnheader\"\n\t| \"combobox\"\n\t| \"command\"\n\t| \"complementary\"\n\t| \"composite\"\n\t| \"contentinfo\"\n\t| \"definition\"\n\t| \"dialog\"\n\t| \"directory\"\n\t| \"document\"\n\t| \"form\"\n\t| \"figure\"\n\t| \"grid\"\n\t| \"gridcell\"\n\t| \"group\"\n\t| \"heading\"\n\t| \"img\"\n\t| \"input\"\n\t| \"landmark\"\n\t| \"link\"\n\t| \"list\"\n\t| \"listbox\"\n\t| \"listitem\"\n\t| \"log\"\n\t| \"main\"\n\t| \"marquee\"\n\t| \"math\"\n\t| \"menu\"\n\t| \"menubar\"\n\t| \"menuitem\"\n\t| \"menuitemcheckbox\"\n\t| \"menuitemradio\"\n\t| \"navigation\"\n\t| \"none\"\n\t| \"note\"\n\t| \"option\"\n\t| \"presentation\"\n\t| \"progressbar\"\n\t| \"radio\"\n\t| \"radiogroup\"\n\t| \"range\"\n\t| \"region\"\n\t| \"roletype\"\n\t| \"row\"\n\t| \"rowgroup\"\n\t| \"rowheader\"\n\t| \"scrollbar\"\n\t| \"search\"\n\t| \"section\"\n\t| \"sectionhead\"\n\t| \"select\"\n\t| \"separator\"\n\t| \"slider\"\n\t| \"spinbutton\"\n\t| \"status\"\n\t| \"structure\"\n\t| \"switch\"\n\t| \"tab\"\n\t| \"tablist\"\n\t| \"tabpanel\"\n\t| \"textbox\"\n\t| \"timer\"\n\t| \"toolbar\"\n\t| \"tooltip\"\n\t| \"tree\"\n\t| \"treegrid\"\n\t| \"treeitem\"\n\t| \"widget\"\n\t| \"window\";\n\n\n/**\n * Available options for `aria-live` attribute\n */\nexport type AriaLive = \"off\" | \"polite\" | \"assertive\";\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DurationFormatter.d.ts","sourceRoot":"","sources":["../../../../../src/.internal/core/util/DurationFormatter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE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;;;;;;;;;;;;;;OAkBG;IACI,SAAS,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,QAAQ,GAAG,MAAM;IAyB/E;;;;;;;OAOG;IACI,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,QAAQ,GAAG,QAAQ,GAAG,SAAS;IA2B7E;;;;;;OAMG;IACI,eAAe,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,QAAQ,GAAG,MAAM;IAUlE,SAAS,CAAC,aAAa,CAAC,QAAQ,EAAE,QAAQ,GAAG,MAAM;IAInD,SAAS,CAAC,cAAc,IAAI,GAAG;CAa/B"}
|
|
@@ -301,12 +301,21 @@ export class DurationFormatter extends Entity {
|
|
|
301
301
|
let tstamp = this.toTimeStamp(value, details.baseUnit);
|
|
302
302
|
// Init return value
|
|
303
303
|
let res = details.template;
|
|
304
|
+
const values = {
|
|
305
|
+
millisecond: 0,
|
|
306
|
+
second: 0,
|
|
307
|
+
minute: 0,
|
|
308
|
+
hour: 0,
|
|
309
|
+
day: 0,
|
|
310
|
+
week: 0,
|
|
311
|
+
month: 0,
|
|
312
|
+
year: 0
|
|
313
|
+
};
|
|
304
314
|
// Iterate through duration parts
|
|
305
315
|
for (let i = 0, len = details.parts.length; i < len; i++) {
|
|
306
316
|
// Gather the part
|
|
307
317
|
let part = details.parts[i];
|
|
308
318
|
let unit = this._toTimeUnit(part.substr(0, 1));
|
|
309
|
-
let digits = part.length;
|
|
310
319
|
// Calculate current unit value
|
|
311
320
|
let ints;
|
|
312
321
|
const unitValue = this._getUnitValue(unit);
|
|
@@ -316,10 +325,56 @@ export class DurationFormatter extends Entity {
|
|
|
316
325
|
else {
|
|
317
326
|
ints = Math.round(tstamp / unitValue);
|
|
318
327
|
}
|
|
319
|
-
|
|
328
|
+
values[unit] += ints;
|
|
320
329
|
// Reduce timestamp
|
|
321
330
|
tstamp -= ints * unitValue;
|
|
322
331
|
}
|
|
332
|
+
// Check if we have full unit that we need to bump up to higher unit
|
|
333
|
+
$object.each(values, (unit, value) => {
|
|
334
|
+
if (unit == "millisecond" && value == 1000) {
|
|
335
|
+
values["second"]++;
|
|
336
|
+
values["millisecond"] = 0;
|
|
337
|
+
}
|
|
338
|
+
else if (unit == "second" && value == 60) {
|
|
339
|
+
values["minute"]++;
|
|
340
|
+
values["second"] = 0;
|
|
341
|
+
}
|
|
342
|
+
else if (unit == "minute" && value == 60) {
|
|
343
|
+
values["hour"]++;
|
|
344
|
+
values["minute"] = 0;
|
|
345
|
+
}
|
|
346
|
+
else if (unit == "hour" && value == 24) {
|
|
347
|
+
values["day"]++;
|
|
348
|
+
values["hour"] = 0;
|
|
349
|
+
}
|
|
350
|
+
else if (unit == "day" && value == 7) {
|
|
351
|
+
values["week"]++;
|
|
352
|
+
values["day"] = 0;
|
|
353
|
+
}
|
|
354
|
+
else if (unit == "day" && value == 30) {
|
|
355
|
+
values["month"]++;
|
|
356
|
+
values["day"] = 0;
|
|
357
|
+
}
|
|
358
|
+
else if (unit == "month" && value == 12) {
|
|
359
|
+
values["year"]++;
|
|
360
|
+
values["month"] = 0;
|
|
361
|
+
}
|
|
362
|
+
// if (val > 0) {
|
|
363
|
+
// res = res.replace($type.PLACEHOLDER, $utils.padString(val, 2, "0"));
|
|
364
|
+
// }
|
|
365
|
+
// else {
|
|
366
|
+
// res = res.replace($type.PLACEHOLDER, "");
|
|
367
|
+
// }
|
|
368
|
+
});
|
|
369
|
+
// Iterate again
|
|
370
|
+
for (let i = 0, len = details.parts.length; i < len; i++) {
|
|
371
|
+
// Gather the part
|
|
372
|
+
let part = details.parts[i];
|
|
373
|
+
let unit = this._toTimeUnit(part.substr(0, 1));
|
|
374
|
+
let digits = part.length;
|
|
375
|
+
// Calculate current unit value
|
|
376
|
+
res = res.replace($type.PLACEHOLDER, $utils.padString(values[unit], digits, "0"));
|
|
377
|
+
}
|
|
323
378
|
// Reapply negative sign
|
|
324
379
|
if (negative) {
|
|
325
380
|
res = "-" + res;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DurationFormatter.js","sourceRoot":"","sources":["../../../../../src/.internal/core/util/DurationFormatter.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAmC,MAAM,UAAU,CAAA;AAClE,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhD,OAAO,KAAK,OAAO,MAAM,UAAU,CAAC;AACpC,OAAO,KAAK,MAAM,MAAM,SAAS,CAAC;AAClC,OAAO,KAAK,KAAK,MAAM,QAAQ,CAAC;AAgDhC;;;;GAIG;AACH,MAAM,OAAO,iBAAkB,SAAQ,MAAM;IAA7C;;QAoFC;;WAEG;QACH;;;;mBAAsD;gBACrD,GAAG,EAAE,GAAG;gBACR,GAAG,EAAE,GAAG;gBACR,GAAG,EAAE,GAAG;gBACR,GAAG,EAAE,GAAG;gBACR,GAAG,EAAE,GAAG;gBACR,GAAG,EAAE,GAAG;aACR;WAAC;IAiaH,CAAC;IA3fU,YAAY;QACrB,MAAM,YAAY,GAAG,uBAAuB,CAAC;QAC7C,MAAM,OAAO,GAAG,kBAAkB,CAAC;QACnC,MAAM,OAAO,GAAG,kBAAkB,CAAC;QACnC,MAAM,KAAK,GAAG,gBAAgB,CAAC;QAC/B,MAAM,IAAI,GAAG,eAAe,CAAC;QAC7B,MAAM,KAAK,GAAG,gBAAgB,CAAC;QAC/B,MAAM,MAAM,GAAG,iBAAiB,CAAC;QACjC,MAAM,KAAK,GAAG,gBAAgB,CAAC;QAE/B,MAAM,OAAO,GAAG,SAAS,CAAC;QAC1B,MAAM,OAAO,GAAG,SAAS,CAAC;QAC1B,MAAM,KAAK,GAAG,OAAO,CAAC;QACtB,MAAM,IAAI,GAAG,MAAM,CAAC;QACpB,MAAM,KAAK,GAAG,OAAO,CAAC;QACtB,MAAM,MAAM,GAAG,OAAO,CAAC;QACvB,MAAM,KAAK,GAAG,OAAO,C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,CAAC,QAAQ,EAAE;YACd,QAAQ,GAAG,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;SAChC;QAED,OAAO,KAAK,GAAG,IAAI,CAAC,aAAa,CAAC,QAAS,CAAC,CAAC;IAC9C,CAAC;IAES,aAAa,CAAC,QAAkB;QACzC,OAAO,IAAI,CAAC,cAAc,EAAE,CAAC,QAAQ,CAAC,CAAC;IACxC,CAAC;IAES,cAAc;QACvB,OAAO;YACN,aAAa,EAAE,CAAC;YAChB,QAAQ,EAAE,IAAI;YACd,QAAQ,EAAE,KAAK;YACf,MAAM,EAAE,OAAO;YACf,KAAK,EAAE,QAAQ;YACf,MAAM,EAAE,SAAS;YACjB,OAAO,EAAE,UAAU;YACnB,MAAM,EAAE,WAAW;SACnB,CAAC;IACH,CAAC;CAED","sourcesContent":["import type { TimeUnit } from \"./Time\";\r\n\r\nimport { Entity, IEntitySettings, IEntityPrivate } from \"./Entity\"\r\nimport { TextFormatter } from \"./TextFormatter\";\r\n\r\nimport * as $object from \"./Object\";\r\nimport * as $utils from \"./Utils\";\r\nimport * as $type from \"./Type\";\r\n\r\n\r\nexport interface IDurationFormatterSettings extends IEntitySettings {\r\n\r\n\t/**\r\n\t * A universal duration format to use wherever number needs to be formatted\r\n\t * as a duration.\r\n\t */\r\n\tdurationFormat?: string;\r\n\r\n\t/**\r\n\t * A base value. Any number below it will be considered \"negative\".\r\n\t *\r\n\t * @default 0\r\n\t */\r\n\tnegativeBase?: number;\r\n\r\n\t/**\r\n\t * Identifies what values are used in duration.\r\n\t *\r\n\t * Available options: `\"millisecond\"`, `\"second\"` (default), `\"minute\"`, `\"hour\"`, `\"day\"`, `\"week\"`, `\"month\"`, and `\"year\"`.\r\n\t *\r\n\t * @see {@link https://www.amcharts.com/docs/v5/concepts/formatters/formatting-durations/#Base_unit} for more info\r\n\t * @default \"second\"\r\n\t */\r\n\tbaseUnit?: TimeUnit;\r\n\r\n\t/**\r\n\t * Time unit dependent duration formats.\r\n\t *\r\n\t * Used be [[DurationAxis]].\r\n\t */\r\n\tdurationFormats?: Partial<Record<TimeUnit, Partial<Record<TimeUnit, string>>>>;\r\n\r\n\t/**\r\n\t * An array of data fields that hold duration values and should be formatted\r\n\t * with a [[DurationFormatter]].\r\n\t *\r\n\t * @see {@link https://www.amcharts.com/docs/v5/concepts/formatters/data-placeholders/#Formatting_placeholders} for more info\r\n\t */\r\n\tdurationFields?: string[];\r\n\r\n}\r\n\r\nexport interface IDurationFormatterPrivate extends IEntityPrivate {\r\n}\r\n\r\n/**\r\n * A class used to format numberic values as time duration.\r\n *\r\n * @see {@link https://www.amcharts.com/docs/v5/concepts/formatters/formatting-durations/} for more info\r\n */\r\nexport class DurationFormatter extends Entity {\r\n\tdeclare public _settings: IDurationFormatterSettings;\r\n\tdeclare public _privateSettings: IDurationFormatterPrivate;\r\n\r\n\tprotected _setDefaults() {\r\n\t\tconst dmillisecond = \"_duration_millisecond\";\r\n\t\tconst dsecond = \"_duration_second\";\r\n\t\tconst dminute = \"_duration_minute\";\r\n\t\tconst dhour = \"_duration_hour\";\r\n\t\tconst dday = \"_duration_day\";\r\n\t\tconst dweek = \"_duration_week\";\r\n\t\tconst dmonth = \"_duration_month\";\r\n\t\tconst dyear = \"_duration_year\";\r\n\r\n\t\tconst asecond = \"_second\";\r\n\t\tconst aminute = \"_minute\";\r\n\t\tconst ahour = \"_hour\";\r\n\t\tconst aday = \"_day\";\r\n\t\tconst aweek = \"_week\";\r\n\t\tconst amonth = \"_week\";\r\n\t\tconst ayear = \"_year\";\r\n\r\n\t\t// Defaults\r\n\t\tthis._setDefault(\"negativeBase\", 0);\r\n\t\tthis._setDefault(\"baseUnit\", \"second\");\r\n\t\tthis._setDefault(\"durationFormats\", {\r\n\t\t\t\"millisecond\": {\r\n\t\t\t\t\"millisecond\": this._t(dmillisecond),\r\n\t\t\t\t\"second\": this._t((dmillisecond + asecond) as any),\r\n\t\t\t\t\"minute\": this._t((dmillisecond + aminute) as any),\r\n\t\t\t\t\"hour\": this._t((dmillisecond + ahour) as any),\r\n\t\t\t\t\"day\": this._t((dmillisecond + aday) as any),\r\n\t\t\t\t\"week\": this._t((dmillisecond + aweek) as any),\r\n\t\t\t\t\"month\": this._t((dmillisecond + amonth) as any),\r\n\t\t\t\t\"year\": this._t((dmillisecond + ayear) as any)\r\n\t\t\t},\r\n\t\t\t\"second\": {\r\n\t\t\t\t\"second\": this._t((dsecond) as any),\r\n\t\t\t\t\"minute\": this._t((dsecond + aminute) as any),\r\n\t\t\t\t\"hour\": this._t((dsecond + ahour) as any),\r\n\t\t\t\t\"day\": this._t((dsecond + aday) as any),\r\n\t\t\t\t\"week\": this._t((dsecond + aweek) as any),\r\n\t\t\t\t\"month\": this._t((dsecond + amonth) as any),\r\n\t\t\t\t\"year\": this._t((dsecond + ayear) as any)\r\n\t\t\t},\r\n\t\t\t\"minute\": {\r\n\t\t\t\t\"minute\": this._t((dminute) as any),\r\n\t\t\t\t\"hour\": this._t((dminute + ahour) as any),\r\n\t\t\t\t\"day\": this._t((dminute + aday) as any),\r\n\t\t\t\t\"week\": this._t((dminute + aweek) as any),\r\n\t\t\t\t\"month\": this._t((dminute + amonth) as any),\r\n\t\t\t\t\"year\": this._t((dminute + ayear) as any)\r\n\t\t\t},\r\n\t\t\t\"hour\": {\r\n\t\t\t\t\"hour\": this._t((dhour) as any),\r\n\t\t\t\t\"day\": this._t((dhour + aday) as any),\r\n\t\t\t\t\"week\": this._t((dhour + aweek) as any),\r\n\t\t\t\t\"month\": this._t((dhour + amonth) as any),\r\n\t\t\t\t\"year\": this._t((dhour + ayear) as any)\r\n\t\t\t},\r\n\t\t\t\"day\": {\r\n\t\t\t\t\"day\": this._t((dday) as any),\r\n\t\t\t\t\"week\": this._t((dday + aweek) as any),\r\n\t\t\t\t\"month\": this._t((dday + amonth) as any),\r\n\t\t\t\t\"year\": this._t((dday + ayear) as any)\r\n\t\t\t},\r\n\t\t\t\"week\": {\r\n\t\t\t\t\"week\": this._t((dweek) as any),\r\n\t\t\t\t\"month\": this._t((dweek + amonth) as any),\r\n\t\t\t\t\"year\": this._t((dweek + ayear) as any)\r\n\t\t\t},\r\n\t\t\t\"month\": {\r\n\t\t\t\t\"month\": this._t((dmonth) as any),\r\n\t\t\t\t\"year\": this._t((dmonth + ayear) as any)\r\n\t\t\t},\r\n\t\t\t\"year\": {\r\n\t\t\t\t\"year\": this._t(dyear)\r\n\t\t\t}\r\n\t\t});\r\n\r\n\t\tsuper._setDefaults();\r\n\t}\r\n\r\n\r\n\t/**\r\n\t * Collection of aliases for units.\r\n\t */\r\n\tprotected _unitAliases: { [index: string]: string } = {\r\n\t\t\"Y\": \"y\",\r\n\t\t\"D\": \"d\",\r\n\t\t\"H\": \"h\",\r\n\t\t\"K\": \"h\",\r\n\t\t\"k\": \"h\",\r\n\t\t\"n\": \"S\"\r\n\t};\r\n\r\n\tpublic _beforeChanged() {\r\n\t\tsuper._beforeChanged();\r\n\t}\r\n\r\n\t/**\r\n\t * Formats the number as duration.\r\n\t *\r\n\t * For example `1000` (base unit seconds) would be converted to `16:40` as in\r\n\t * 16 minutes and 40 seconds.\r\n\t *\r\n\t * @param value Value to format\r\n\t * @param format Format to apply\r\n\t * @param base Override base unit\r\n\t * @return Formatted number\r\n\t */\r\n\tpublic format(value: number | string, format?: string, base?: TimeUnit): string {\r\n\r\n\t\t// no base unit?\r\n\t\tlet baseUnit = base || this.get(\"baseUnit\");\r\n\r\n\t\t// no format passed in or empty\r\n\t\tif (typeof format === \"undefined\" || format === \"\") {\r\n\t\t\tif (this.get(\"durationFormat\") != null) {\r\n\t\t\t\tformat = this.get(\"durationFormat\");\r\n\t\t\t}\r\n\t\t\telse {\r\n\t\t\t\tformat = this.getFormat($type.toNumber(value), undefined, baseUnit);\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t// Clean format\r\n\t\tformat = $utils.cleanFormat(format!);\r\n\r\n\t\t// get format info (it will also deal with parser caching)\r\n\t\tlet info = this.parseFormat(format, baseUnit);\r\n\r\n\t\t// cast to number just in case\r\n\t\t// TODO: maybe use better casting\r\n\t\tlet source: number = Number(value);\r\n\r\n\t\t// format and replace the number\r\n\t\tlet details;\r\n\t\tif (source > this.get(\"negativeBase\")) {\r\n\t\t\tdetails = info.positive;\r\n\t\t}\r\n\t\telse if (source < this.get(\"negativeBase\")) {\r\n\t\t\tdetails = info.negative;\r\n\t\t}\r\n\t\telse {\r\n\t\t\tdetails = info.zero;\r\n\t\t}\r\n\r\n\t\t// Format\r\n\t\tlet formatted = this.applyFormat(source, details);\r\n\r\n\t\t// Apply color?\r\n\t\tif (details.color !== \"\") {\r\n\t\t\tformatted = \"[\" + details.color + \"]\" + formatted + \"[/]\";\r\n\t\t}\r\n\r\n\t\treturn formatted;\r\n\t}\r\n\r\n\t/**\r\n\t * Parses supplied format into structured object which can be used to format\r\n\t * the number.\r\n\t *\r\n\t * @param format Format string, i.e. \"#,###.00\"\r\n\t * @param base Override base unit\r\n\t * @return Parsed information\r\n\t */\r\n\tprotected parseFormat(format: string, base?: TimeUnit): any {\r\n\r\n\t\t// Check cache\r\n\t\t// TODO\r\n\t\t// let cached = this.getCache(format);\r\n\t\t// if (cached != null) {\r\n\t\t// \treturn cached;\r\n\t\t// }\r\n\r\n\t\t// no base unit?\r\n\t\tlet baseUnit = base || this.get(\"baseUnit\");\r\n\r\n\t\t// Initialize duration parsing info\r\n\t\tlet info = {\r\n\t\t\t\"positive\": {\r\n\t\t\t\t\"color\": \"\",\r\n\t\t\t\t\"template\": \"\",\r\n\t\t\t\t\"parts\": <any>[],\r\n\t\t\t\t\"source\": \"\",\r\n\t\t\t\t\"baseUnit\": baseUnit,\r\n\t\t\t\t\"parsed\": false,\r\n\t\t\t\t\"absolute\": false\r\n\t\t\t},\r\n\t\t\t\"negative\": {\r\n\t\t\t\t\"color\": \"\",\r\n\t\t\t\t\"template\": \"\",\r\n\t\t\t\t\"parts\": <any>[],\r\n\t\t\t\t\"source\": \"\",\r\n\t\t\t\t\"baseUnit\": baseUnit,\r\n\t\t\t\t\"parsed\": false,\r\n\t\t\t\t\"absolute\": false\r\n\t\t\t},\r\n\t\t\t\"zero\": {\r\n\t\t\t\t\"color\": \"\",\r\n\t\t\t\t\"template\": \"\",\r\n\t\t\t\t\"parts\": <any>[],\r\n\t\t\t\t\"source\": \"\",\r\n\t\t\t\t\"baseUnit\": baseUnit,\r\n\t\t\t\t\"parsed\": false,\r\n\t\t\t\t\"absolute\": false\r\n\t\t\t}\r\n\t\t};\r\n\r\n\t\t// Escape double vertical bars (that mean display one vertical bar)\r\n\t\tformat = format.replace(\"||\", $type.PLACEHOLDER2);\r\n\r\n\t\t// Split it up and deal with different formats\r\n\t\tlet parts = format.split(\"|\");\r\n\t\tinfo.positive.source = parts[0];\r\n\r\n\t\tif (typeof parts[2] === \"undefined\") {\r\n\t\t\tinfo.zero = info.positive;\r\n\t\t}\r\n\t\telse {\r\n\t\t\tinfo.zero.source = parts[2];\r\n\t\t}\r\n\r\n\t\tif (typeof parts[1] === \"undefined\") {\r\n\t\t\tinfo.negative = info.positive;\r\n\t\t}\r\n\t\telse {\r\n\t\t\tinfo.negative.source = parts[1];\r\n\t\t}\r\n\r\n\t\t// Parse each\r\n\t\t$object.each(info, (_part, item) => {\r\n\t\t\t// Already parsed\r\n\t\t\tif (item.parsed) {\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\r\n\t\t\t// Check cached\r\n\t\t\t// TODO\r\n\t\t\t// if (typeof this.getCache(item.source) !== \"undefined\") {\r\n\t\t\t// \tinfo[part] = this.getCache(item.source);\r\n\t\t\t// \treturn;\r\n\t\t\t// }\r\n\r\n\t\t\t// Begin parsing\r\n\t\t\tlet partFormat: string = item.source;\r\n\r\n\t\t\t// Check for [] directives\r\n\t\t\tlet dirs: string[] | null = [];\r\n\t\t\tdirs = item.source.match(/^\\[([^\\]]*)\\]/);\r\n\t\t\tif (dirs && dirs.length && dirs[0] !== \"\") {\r\n\t\t\t\tpartFormat = item.source.substr(dirs[0].length);\r\n\t\t\t\titem.color = dirs[1];\r\n\t\t\t}\r\n\r\n\r\n\t\t\t// Let TextFormatter split into chunks\r\n\t\t\tlet chunks = TextFormatter.chunk(partFormat, true);\r\n\t\t\tfor (let i: number = 0; i < chunks.length; i++) {\r\n\t\t\t\tlet chunk = chunks[i];\r\n\r\n\t\t\t\t// replace back double vertical bar\r\n\t\t\t\tchunk.text = chunk.text.replace($type.PLACEHOLDER2, \"|\");\r\n\r\n\t\t\t\tif (chunk.type === \"value\") {\r\n\r\n\t\t\t\t\t// Just \"Duration\"?\r\n\t\t\t\t\t// if (chunk.text.toLowerCase() === \"duration\") {\r\n\t\t\t\t\t// \tchunk.text = durationFormat;\r\n\t\t\t\t\t// }\r\n\r\n\t\t\t\t\t// Check for \"a\" (absolute) modifier\r\n\t\t\t\t\tif (chunk.text.match(/[yYMdDwhHKkmsSn]+a/)) {\r\n\t\t\t\t\t\titem.absolute = true;\r\n\t\t\t\t\t\tchunk.text = chunk.text.replace(/([yYMdDwhHKkmsSn]+)a/, \"$1\");\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\t// Find all possible parts\r\n\t\t\t\t\tlet matches = chunk.text.match(/y+|Y+|M+|d+|D+|w+|h+|H+|K+|k+|m+|s+|S+|n+/g);\r\n\r\n\t\t\t\t\tif (matches) {\r\n\t\t\t\t\t\t// Populate template\r\n\t\t\t\t\t\tfor (let x = 0; x < matches.length; x++) {\r\n\t\t\t\t\t\t\t// Is it an alias?\r\n\t\t\t\t\t\t\tif (matches[x] == null) {\r\n\t\t\t\t\t\t\t\tmatches[x] = this._unitAliases[matches[x]];\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\titem.parts.push(matches[x]);\r\n\t\t\t\t\t\t\tchunk.text = chunk.text.replace(matches[x], $type.PLACEHOLDER);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\r\n\t\t\t\t// Apply to template\r\n\t\t\t\titem.template += chunk.text;\r\n\t\t\t}\r\n\r\n\t\t\t// Apply style formatting\r\n\t\t\t//item.template = TextFormatter.format(item.template, this.outputFormat);\r\n\r\n\t\t\t// Save cache\r\n\t\t\t// TODO\r\n\t\t\t//this.setCache(item.source, item);\r\n\r\n\t\t\t// Mark this as parsed\r\n\t\t\titem.parsed = true;\r\n\t\t});\r\n\r\n\t\t// Save cache (the whole thing)\r\n\t\t// TODO\r\n\t\t//this.setCache(format, info);\r\n\r\n\t\treturn info;\r\n\t}\r\n\r\n\t/**\r\n\t * Applies parsed format to a numeric value.\r\n\t *\r\n\t * @param value Value\r\n\t * @param details Parsed format as returned by {parseFormat}\r\n\t * @return Formatted duration\r\n\t */\r\n\tprotected applyFormat(value: number, details: any): string {\r\n\r\n\t\t// Use absolute values\r\n\t\tlet negative = !details.absolute && (value < this.get(\"negativeBase\"));\r\n\t\tvalue = Math.abs(value);\r\n\r\n\t\t// Recalculate to milliseconds\r\n\t\tlet tstamp = this.toTimeStamp(value, details.baseUnit);\r\n\r\n\t\t// Init return value\r\n\t\tlet res = details.template;\r\n\r\n\t\t// Iterate through duration parts\r\n\t\tfor (let i = 0, len = details.parts.length; i < len; i++) {\r\n\r\n\t\t\t// Gather the part\r\n\t\t\tlet part = details.parts[i];\r\n\t\t\tlet unit = this._toTimeUnit(part.substr(0, 1));\r\n\t\t\tlet digits = part.length;\r\n\r\n\t\t\t// Calculate current unit value\r\n\t\t\tlet ints: number;\r\n\t\t\tconst unitValue = this._getUnitValue(unit!);\r\n\t\t\tif (i < (len -1)) {\r\n\t\t\t\tints = Math.floor(tstamp / unitValue);\r\n\t\t\t}\r\n\t\t\telse {\r\n\t\t\t\tints = Math.round(tstamp / unitValue);\r\n\t\t\t}\r\n\t\t\tres = res.replace($type.PLACEHOLDER, $utils.padString(ints, digits, \"0\"));\r\n\r\n\t\t\t// Reduce timestamp\r\n\t\t\ttstamp -= ints * unitValue;\r\n\t\t}\r\n\r\n\t\t// Reapply negative sign\r\n\t\tif (negative) {\r\n\t\t\tres = \"-\" + res;\r\n\t\t}\r\n\r\n\t\treturn res;\r\n\t}\r\n\r\n\t/**\r\n\t * Converts numeric value to timestamp in milliseconds.\r\n\t *\r\n\t * @param value A source value\r\n\t * @param baseUnit Base unit the source value is in: \"q\", \"s\", \"i\", \"h\", \"d\", \"w\", \"m\", \"y\"\r\n\t * @return Value representation as a timestamp in milliseconds\r\n\t */\r\n\tpublic toTimeStamp(value: number, baseUnit: TimeUnit): number {\r\n\t\treturn value * this._getUnitValue(baseUnit);\r\n\t}\r\n\r\n\tprotected _toTimeUnit(code: string): TimeUnit | undefined {\r\n\t\tswitch (code) {\r\n\t\t\tcase \"S\":\r\n\t\t\t\treturn \"millisecond\";\r\n\t\t\tcase \"s\":\r\n\t\t\t\treturn \"second\";\r\n\t\t\tcase \"m\":\r\n\t\t\t\treturn \"minute\";\r\n\t\t\tcase \"h\":\r\n\t\t\t\treturn \"hour\";\r\n\t\t\tcase \"d\":\r\n\t\t\t\treturn \"day\";\r\n\t\t\tcase \"w\":\r\n\t\t\t\treturn \"week\";\r\n\t\t\tcase \"M\":\r\n\t\t\t\treturn \"month\";\r\n\t\t\tcase \"y\":\r\n\t\t\t\treturn \"year\";\r\n\t\t};\r\n\t}\r\n\r\n\t/**\r\n\t * Returns appropriate default format for the value.\r\n\t *\r\n\t * If `maxValue` is sepcified, it will use that value to determine the time\r\n\t * unit for the format.\r\n\t *\r\n\t * For example if your `baseUnit` is `\"second\"` and you pass in `10`, you\r\n\t * will get `\"10\"`.\r\n\t *\r\n\t * However, you might want it to be formatted in the context of bigger scale,\r\n\t * say 10 minutes (600 seconds). If you pass in `600` as `maxValue`, all\r\n\t * values, including small ones will use format with minutes, e.g.:\r\n\t * `00:10`, `00:50`, `12: 30`, etc.\r\n\t *\r\n\t * @param value Value to format\r\n\t * @param maxValue Maximum value to be used to determine format\r\n\t * @param baseUnit Base unit of the value\r\n\t * @return Format\r\n\t */\r\n\tpublic getFormat(value: number, maxValue?: number, baseUnit?: TimeUnit): string {\r\n\r\n\t\t// Is format override set?\r\n\t\tif (this.get(\"durationFormat\") != null) {\r\n\t\t\treturn this.get(\"durationFormat\")!;\r\n\t\t}\r\n\r\n\t\t// Get base unit\r\n\t\tif (!baseUnit) {\r\n\t\t\tbaseUnit = this.get(\"baseUnit\");\r\n\t\t}\r\n\r\n\t\tif (maxValue != null && value != maxValue) {\r\n\t\t\tvalue = Math.abs(value);\r\n\t\t\tmaxValue = Math.abs(maxValue);\r\n\t\t\tlet maxUnit = this.getValueUnit(Math.max(value, maxValue), baseUnit);\r\n\t\t\treturn (<any>this.get(\"durationFormats\"))[baseUnit!][maxUnit!];\r\n\t\t}\r\n\t\telse {\r\n\t\t\tlet unit = this.getValueUnit(value, baseUnit);\r\n\t\t\treturn (<any>this.get(\"durationFormats\"))[baseUnit!][unit!];\r\n\t\t}\r\n\r\n\t}\r\n\r\n\t/**\r\n\t * Returns value's closest denominator time unit, e.g 100 seconds is\r\n\t * `\"minute\"`, while 59 seconds would still be `second`.\r\n\t *\r\n\t * @param value Source duration value\r\n\t * @param baseUnit Base unit\r\n\t * @return Denominator\r\n\t */\r\n\tpublic getValueUnit(value: number, baseUnit?: TimeUnit): TimeUnit | undefined {\r\n\r\n\t\t// Get base unit\r\n\t\tif (!baseUnit) {\r\n\t\t\tbaseUnit = this.get(\"baseUnit\");\r\n\t\t}\r\n\r\n\t\t// Convert to milliseconds\r\n\t\tlet currentUnit: any;\r\n\t\tlet ms = this.getMilliseconds(value, baseUnit);\r\n\t\t$object.eachContinue(this._getUnitValues(), (key, val) => {\r\n\t\t\tif (key == baseUnit || currentUnit) {\r\n\t\t\t\tlet num = ms / val;\r\n\t\t\t\tif (num <= 1) {\r\n\t\t\t\t\tif (!currentUnit) {\r\n\t\t\t\t\t\tcurrentUnit = key;\r\n\t\t\t\t\t}\r\n\t\t\t\t\treturn false;\r\n\t\t\t\t}\r\n\t\t\t\tcurrentUnit = key;\r\n\t\t\t}\r\n\t\t\treturn true;\r\n\t\t});\r\n\r\n\t\treturn currentUnit;\r\n\t}\r\n\r\n\t/**\r\n\t * Converts value to milliseconds according to `baseUnit`.\r\n\t *\r\n\t * @param value Source duration value\r\n\t * @param baseUnit Base unit\r\n\t * @return Value in milliseconds\r\n\t */\r\n\tpublic getMilliseconds(value: number, baseUnit?: TimeUnit): number {\r\n\r\n\t\t// Get base unit\r\n\t\tif (!baseUnit) {\r\n\t\t\tbaseUnit = this.get(\"baseUnit\");\r\n\t\t}\r\n\r\n\t\treturn value * this._getUnitValue(baseUnit!);\r\n\t}\r\n\r\n\tprotected _getUnitValue(timeUnit: TimeUnit): number {\r\n\t\treturn this._getUnitValues()[timeUnit];\r\n\t}\r\n\r\n\tprotected _getUnitValues(): any {\r\n\t\treturn {\r\n\t\t\t\"millisecond\": 1,\r\n\t\t\t\"second\": 1000,\r\n\t\t\t\"minute\": 60000,\r\n\t\t\t\"hour\": 3600000,\r\n\t\t\t\"day\": 86400000,\r\n\t\t\t\"week\": 604800000,\r\n\t\t\t\"month\": 2592000000,\r\n\t\t\t\"year\": 31536000000,\r\n\t\t};\r\n\t}\r\n\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"DurationFormatter.js","sourceRoot":"","sources":["../../../../../src/.internal/core/util/DurationFormatter.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAmC,MAAM,UAAU,CAAA;AAClE,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhD,OAAO,KAAK,OAAO,MAAM,UAAU,CAAC;AACpC,OAAO,KAAK,MAAM,MAAM,SAAS,CAAC;AAClC,OAAO,KAAK,KAAK,MAAM,QAAQ,CAAC;AAgDhC;;;;GAIG;AACH,MAAM,OAAO,iBAAkB,SAAQ,MAAM;IAA7C;;QAoFC;;WAEG;QACH;;;;mBAAsD;gBACrD,GAAG,EAAE,GAAG;gBACR,GAAG,EAAE,GAAG;gBACR,GAAG,EAAE,GAAG;gBACR,GAAG,EAAE,GAAG;gBACR,GAAG,EAAE,GAAG;gBACR,GAAG,EAAE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AO,WAAW,CAAC;IACpB,CAAC;IAED;;;;;;OAMG;IACI,eAAe,CAAC,KAAa,EAAE,QAAmB;QAExD,gBAAgB;QAChB,IAAI,CAAC,QAAQ,EAAE;YACd,QAAQ,GAAG,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;SAChC;QAED,OAAO,KAAK,GAAG,IAAI,CAAC,aAAa,CAAC,QAAS,CAAC,CAAC;IAC9C,CAAC;IAES,aAAa,CAAC,QAAkB;QACzC,OAAO,IAAI,CAAC,cAAc,EAAE,CAAC,QAAQ,CAAC,CAAC;IACxC,CAAC;IAES,cAAc;QACvB,OAAO;YACN,aAAa,EAAE,CAAC;YAChB,QAAQ,EAAE,IAAI;YACd,QAAQ,EAAE,KAAK;YACf,MAAM,EAAE,OAAO;YACf,KAAK,EAAE,QAAQ;YACf,MAAM,EAAE,SAAS;YACjB,OAAO,EAAE,UAAU;YACnB,MAAM,EAAE,WAAW;SACnB,CAAC;IACH,CAAC;CAED","sourcesContent":["import type { TimeUnit } from \"./Time\";\r\n\r\nimport { Entity, IEntitySettings, IEntityPrivate } from \"./Entity\"\r\nimport { TextFormatter } from \"./TextFormatter\";\r\n\r\nimport * as $object from \"./Object\";\r\nimport * as $utils from \"./Utils\";\r\nimport * as $type from \"./Type\";\r\n\r\n\r\nexport interface IDurationFormatterSettings extends IEntitySettings {\r\n\r\n\t/**\r\n\t * A universal duration format to use wherever number needs to be formatted\r\n\t * as a duration.\r\n\t */\r\n\tdurationFormat?: string;\r\n\r\n\t/**\r\n\t * A base value. Any number below it will be considered \"negative\".\r\n\t *\r\n\t * @default 0\r\n\t */\r\n\tnegativeBase?: number;\r\n\r\n\t/**\r\n\t * Identifies what values are used in duration.\r\n\t *\r\n\t * Available options: `\"millisecond\"`, `\"second\"` (default), `\"minute\"`, `\"hour\"`, `\"day\"`, `\"week\"`, `\"month\"`, and `\"year\"`.\r\n\t *\r\n\t * @see {@link https://www.amcharts.com/docs/v5/concepts/formatters/formatting-durations/#Base_unit} for more info\r\n\t * @default \"second\"\r\n\t */\r\n\tbaseUnit?: TimeUnit;\r\n\r\n\t/**\r\n\t * Time unit dependent duration formats.\r\n\t *\r\n\t * Used be [[DurationAxis]].\r\n\t */\r\n\tdurationFormats?: Partial<Record<TimeUnit, Partial<Record<TimeUnit, string>>>>;\r\n\r\n\t/**\r\n\t * An array of data fields that hold duration values and should be formatted\r\n\t * with a [[DurationFormatter]].\r\n\t *\r\n\t * @see {@link https://www.amcharts.com/docs/v5/concepts/formatters/data-placeholders/#Formatting_placeholders} for more info\r\n\t */\r\n\tdurationFields?: string[];\r\n\r\n}\r\n\r\nexport interface IDurationFormatterPrivate extends IEntityPrivate {\r\n}\r\n\r\n/**\r\n * A class used to format numberic values as time duration.\r\n *\r\n * @see {@link https://www.amcharts.com/docs/v5/concepts/formatters/formatting-durations/} for more info\r\n */\r\nexport class DurationFormatter extends Entity {\r\n\tdeclare public _settings: IDurationFormatterSettings;\r\n\tdeclare public _privateSettings: IDurationFormatterPrivate;\r\n\r\n\tprotected _setDefaults() {\r\n\t\tconst dmillisecond = \"_duration_millisecond\";\r\n\t\tconst dsecond = \"_duration_second\";\r\n\t\tconst dminute = \"_duration_minute\";\r\n\t\tconst dhour = \"_duration_hour\";\r\n\t\tconst dday = \"_duration_day\";\r\n\t\tconst dweek = \"_duration_week\";\r\n\t\tconst dmonth = \"_duration_month\";\r\n\t\tconst dyear = \"_duration_year\";\r\n\r\n\t\tconst asecond = \"_second\";\r\n\t\tconst aminute = \"_minute\";\r\n\t\tconst ahour = \"_hour\";\r\n\t\tconst aday = \"_day\";\r\n\t\tconst aweek = \"_week\";\r\n\t\tconst amonth = \"_week\";\r\n\t\tconst ayear = \"_year\";\r\n\r\n\t\t// Defaults\r\n\t\tthis._setDefault(\"negativeBase\", 0);\r\n\t\tthis._setDefault(\"baseUnit\", \"second\");\r\n\t\tthis._setDefault(\"durationFormats\", {\r\n\t\t\t\"millisecond\": {\r\n\t\t\t\t\"millisecond\": this._t(dmillisecond),\r\n\t\t\t\t\"second\": this._t((dmillisecond + asecond) as any),\r\n\t\t\t\t\"minute\": this._t((dmillisecond + aminute) as any),\r\n\t\t\t\t\"hour\": this._t((dmillisecond + ahour) as any),\r\n\t\t\t\t\"day\": this._t((dmillisecond + aday) as any),\r\n\t\t\t\t\"week\": this._t((dmillisecond + aweek) as any),\r\n\t\t\t\t\"month\": this._t((dmillisecond + amonth) as any),\r\n\t\t\t\t\"year\": this._t((dmillisecond + ayear) as any)\r\n\t\t\t},\r\n\t\t\t\"second\": {\r\n\t\t\t\t\"second\": this._t((dsecond) as any),\r\n\t\t\t\t\"minute\": this._t((dsecond + aminute) as any),\r\n\t\t\t\t\"hour\": this._t((dsecond + ahour) as any),\r\n\t\t\t\t\"day\": this._t((dsecond + aday) as any),\r\n\t\t\t\t\"week\": this._t((dsecond + aweek) as any),\r\n\t\t\t\t\"month\": this._t((dsecond + amonth) as any),\r\n\t\t\t\t\"year\": this._t((dsecond + ayear) as any)\r\n\t\t\t},\r\n\t\t\t\"minute\": {\r\n\t\t\t\t\"minute\": this._t((dminute) as any),\r\n\t\t\t\t\"hour\": this._t((dminute + ahour) as any),\r\n\t\t\t\t\"day\": this._t((dminute + aday) as any),\r\n\t\t\t\t\"week\": this._t((dminute + aweek) as any),\r\n\t\t\t\t\"month\": this._t((dminute + amonth) as any),\r\n\t\t\t\t\"year\": this._t((dminute + ayear) as any)\r\n\t\t\t},\r\n\t\t\t\"hour\": {\r\n\t\t\t\t\"hour\": this._t((dhour) as any),\r\n\t\t\t\t\"day\": this._t((dhour + aday) as any),\r\n\t\t\t\t\"week\": this._t((dhour + aweek) as any),\r\n\t\t\t\t\"month\": this._t((dhour + amonth) as any),\r\n\t\t\t\t\"year\": this._t((dhour + ayear) as any)\r\n\t\t\t},\r\n\t\t\t\"day\": {\r\n\t\t\t\t\"day\": this._t((dday) as any),\r\n\t\t\t\t\"week\": this._t((dday + aweek) as any),\r\n\t\t\t\t\"month\": this._t((dday + amonth) as any),\r\n\t\t\t\t\"year\": this._t((dday + ayear) as any)\r\n\t\t\t},\r\n\t\t\t\"week\": {\r\n\t\t\t\t\"week\": this._t((dweek) as any),\r\n\t\t\t\t\"month\": this._t((dweek + amonth) as any),\r\n\t\t\t\t\"year\": this._t((dweek + ayear) as any)\r\n\t\t\t},\r\n\t\t\t\"month\": {\r\n\t\t\t\t\"month\": this._t((dmonth) as any),\r\n\t\t\t\t\"year\": this._t((dmonth + ayear) as any)\r\n\t\t\t},\r\n\t\t\t\"year\": {\r\n\t\t\t\t\"year\": this._t(dyear)\r\n\t\t\t}\r\n\t\t});\r\n\r\n\t\tsuper._setDefaults();\r\n\t}\r\n\r\n\r\n\t/**\r\n\t * Collection of aliases for units.\r\n\t */\r\n\tprotected _unitAliases: { [index: string]: string } = {\r\n\t\t\"Y\": \"y\",\r\n\t\t\"D\": \"d\",\r\n\t\t\"H\": \"h\",\r\n\t\t\"K\": \"h\",\r\n\t\t\"k\": \"h\",\r\n\t\t\"n\": \"S\"\r\n\t};\r\n\r\n\tpublic _beforeChanged() {\r\n\t\tsuper._beforeChanged();\r\n\t}\r\n\r\n\t/**\r\n\t * Formats the number as duration.\r\n\t *\r\n\t * For example `1000` (base unit seconds) would be converted to `16:40` as in\r\n\t * 16 minutes and 40 seconds.\r\n\t *\r\n\t * @param value Value to format\r\n\t * @param format Format to apply\r\n\t * @param base Override base unit\r\n\t * @return Formatted number\r\n\t */\r\n\tpublic format(value: number | string, format?: string, base?: TimeUnit): string {\r\n\r\n\t\t// no base unit?\r\n\t\tlet baseUnit = base || this.get(\"baseUnit\");\r\n\r\n\t\t// no format passed in or empty\r\n\t\tif (typeof format === \"undefined\" || format === \"\") {\r\n\t\t\tif (this.get(\"durationFormat\") != null) {\r\n\t\t\t\tformat = this.get(\"durationFormat\");\r\n\t\t\t}\r\n\t\t\telse {\r\n\t\t\t\tformat = this.getFormat($type.toNumber(value), undefined, baseUnit);\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t// Clean format\r\n\t\tformat = $utils.cleanFormat(format!);\r\n\r\n\t\t// get format info (it will also deal with parser caching)\r\n\t\tlet info = this.parseFormat(format, baseUnit);\r\n\r\n\t\t// cast to number just in case\r\n\t\t// TODO: maybe use better casting\r\n\t\tlet source: number = Number(value);\r\n\r\n\t\t// format and replace the number\r\n\t\tlet details;\r\n\t\tif (source > this.get(\"negativeBase\")) {\r\n\t\t\tdetails = info.positive;\r\n\t\t}\r\n\t\telse if (source < this.get(\"negativeBase\")) {\r\n\t\t\tdetails = info.negative;\r\n\t\t}\r\n\t\telse {\r\n\t\t\tdetails = info.zero;\r\n\t\t}\r\n\r\n\r\n\t\t// Format\r\n\t\tlet formatted = this.applyFormat(source, details);\r\n\r\n\t\t// Apply color?\r\n\t\tif (details.color !== \"\") {\r\n\t\t\tformatted = \"[\" + details.color + \"]\" + formatted + \"[/]\";\r\n\t\t}\r\n\r\n\t\treturn formatted;\r\n\t}\r\n\r\n\t/**\r\n\t * Parses supplied format into structured object which can be used to format\r\n\t * the number.\r\n\t *\r\n\t * @param format Format string, i.e. \"#,###.00\"\r\n\t * @param base Override base unit\r\n\t * @return Parsed information\r\n\t */\r\n\tprotected parseFormat(format: string, base?: TimeUnit): any {\r\n\r\n\t\t// Check cache\r\n\t\t// TODO\r\n\t\t// let cached = this.getCache(format);\r\n\t\t// if (cached != null) {\r\n\t\t// \treturn cached;\r\n\t\t// }\r\n\r\n\t\t// no base unit?\r\n\t\tlet baseUnit = base || this.get(\"baseUnit\");\r\n\r\n\t\t// Initialize duration parsing info\r\n\t\tlet info = {\r\n\t\t\t\"positive\": {\r\n\t\t\t\t\"color\": \"\",\r\n\t\t\t\t\"template\": \"\",\r\n\t\t\t\t\"parts\": <any>[],\r\n\t\t\t\t\"source\": \"\",\r\n\t\t\t\t\"baseUnit\": baseUnit,\r\n\t\t\t\t\"parsed\": false,\r\n\t\t\t\t\"absolute\": false\r\n\t\t\t},\r\n\t\t\t\"negative\": {\r\n\t\t\t\t\"color\": \"\",\r\n\t\t\t\t\"template\": \"\",\r\n\t\t\t\t\"parts\": <any>[],\r\n\t\t\t\t\"source\": \"\",\r\n\t\t\t\t\"baseUnit\": baseUnit,\r\n\t\t\t\t\"parsed\": false,\r\n\t\t\t\t\"absolute\": false\r\n\t\t\t},\r\n\t\t\t\"zero\": {\r\n\t\t\t\t\"color\": \"\",\r\n\t\t\t\t\"template\": \"\",\r\n\t\t\t\t\"parts\": <any>[],\r\n\t\t\t\t\"source\": \"\",\r\n\t\t\t\t\"baseUnit\": baseUnit,\r\n\t\t\t\t\"parsed\": false,\r\n\t\t\t\t\"absolute\": false\r\n\t\t\t}\r\n\t\t};\r\n\r\n\t\t// Escape double vertical bars (that mean display one vertical bar)\r\n\t\tformat = format.replace(\"||\", $type.PLACEHOLDER2);\r\n\r\n\t\t// Split it up and deal with different formats\r\n\t\tlet parts = format.split(\"|\");\r\n\t\tinfo.positive.source = parts[0];\r\n\r\n\t\tif (typeof parts[2] === \"undefined\") {\r\n\t\t\tinfo.zero = info.positive;\r\n\t\t}\r\n\t\telse {\r\n\t\t\tinfo.zero.source = parts[2];\r\n\t\t}\r\n\r\n\t\tif (typeof parts[1] === \"undefined\") {\r\n\t\t\tinfo.negative = info.positive;\r\n\t\t}\r\n\t\telse {\r\n\t\t\tinfo.negative.source = parts[1];\r\n\t\t}\r\n\r\n\t\t// Parse each\r\n\t\t$object.each(info, (_part, item) => {\r\n\t\t\t// Already parsed\r\n\t\t\tif (item.parsed) {\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\r\n\t\t\t// Check cached\r\n\t\t\t// TODO\r\n\t\t\t// if (typeof this.getCache(item.source) !== \"undefined\") {\r\n\t\t\t// \tinfo[part] = this.getCache(item.source);\r\n\t\t\t// \treturn;\r\n\t\t\t// }\r\n\r\n\t\t\t// Begin parsing\r\n\t\t\tlet partFormat: string = item.source;\r\n\r\n\t\t\t// Check for [] directives\r\n\t\t\tlet dirs: string[] | null = [];\r\n\t\t\tdirs = item.source.match(/^\\[([^\\]]*)\\]/);\r\n\t\t\tif (dirs && dirs.length && dirs[0] !== \"\") {\r\n\t\t\t\tpartFormat = item.source.substr(dirs[0].length);\r\n\t\t\t\titem.color = dirs[1];\r\n\t\t\t}\r\n\r\n\r\n\t\t\t// Let TextFormatter split into chunks\r\n\t\t\tlet chunks = TextFormatter.chunk(partFormat, true);\r\n\t\t\tfor (let i: number = 0; i < chunks.length; i++) {\r\n\t\t\t\tlet chunk = chunks[i];\r\n\r\n\t\t\t\t// replace back double vertical bar\r\n\t\t\t\tchunk.text = chunk.text.replace($type.PLACEHOLDER2, \"|\");\r\n\r\n\t\t\t\tif (chunk.type === \"value\") {\r\n\r\n\t\t\t\t\t// Just \"Duration\"?\r\n\t\t\t\t\t// if (chunk.text.toLowerCase() === \"duration\") {\r\n\t\t\t\t\t// \tchunk.text = durationFormat;\r\n\t\t\t\t\t// }\r\n\r\n\t\t\t\t\t// Check for \"a\" (absolute) modifier\r\n\t\t\t\t\tif (chunk.text.match(/[yYMdDwhHKkmsSn]+a/)) {\r\n\t\t\t\t\t\titem.absolute = true;\r\n\t\t\t\t\t\tchunk.text = chunk.text.replace(/([yYMdDwhHKkmsSn]+)a/, \"$1\");\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\t// Find all possible parts\r\n\t\t\t\t\tlet matches = chunk.text.match(/y+|Y+|M+|d+|D+|w+|h+|H+|K+|k+|m+|s+|S+|n+/g);\r\n\r\n\t\t\t\t\tif (matches) {\r\n\t\t\t\t\t\t// Populate template\r\n\t\t\t\t\t\tfor (let x = 0; x < matches.length; x++) {\r\n\t\t\t\t\t\t\t// Is it an alias?\r\n\t\t\t\t\t\t\tif (matches[x] == null) {\r\n\t\t\t\t\t\t\t\tmatches[x] = this._unitAliases[matches[x]];\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\titem.parts.push(matches[x]);\r\n\t\t\t\t\t\t\tchunk.text = chunk.text.replace(matches[x], $type.PLACEHOLDER);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\r\n\t\t\t\t// Apply to template\r\n\t\t\t\titem.template += chunk.text;\r\n\t\t\t}\r\n\r\n\t\t\t// Apply style formatting\r\n\t\t\t//item.template = TextFormatter.format(item.template, this.outputFormat);\r\n\r\n\t\t\t// Save cache\r\n\t\t\t// TODO\r\n\t\t\t//this.setCache(item.source, item);\r\n\r\n\t\t\t// Mark this as parsed\r\n\t\t\titem.parsed = true;\r\n\t\t});\r\n\r\n\t\t// Save cache (the whole thing)\r\n\t\t// TODO\r\n\t\t//this.setCache(format, info);\r\n\r\n\t\treturn info;\r\n\t}\r\n\r\n\t/**\r\n\t * Applies parsed format to a numeric value.\r\n\t *\r\n\t * @param value Value\r\n\t * @param details Parsed format as returned by {parseFormat}\r\n\t * @return Formatted duration\r\n\t */\r\n\tprotected applyFormat(value: number, details: any): string {\r\n\r\n\t\t// Use absolute values\r\n\t\tlet negative = !details.absolute && (value < this.get(\"negativeBase\"));\r\n\t\tvalue = Math.abs(value);\r\n\r\n\r\n\t\t// Recalculate to milliseconds\r\n\t\tlet tstamp = this.toTimeStamp(value, details.baseUnit);\r\n\r\n\t\t// Init return value\r\n\t\tlet res = details.template;\r\n\t\tconst values: any = {\r\n\t\t\tmillisecond: 0,\r\n\t\t\tsecond: 0,\r\n\t\t\tminute: 0,\r\n\t\t\thour: 0,\r\n\t\t\tday: 0,\r\n\t\t\tweek: 0,\r\n\t\t\tmonth: 0,\r\n\t\t\tyear: 0\r\n\t\t};\r\n\r\n\t\t// Iterate through duration parts\r\n\t\tfor (let i = 0, len = details.parts.length; i < len; i++) {\r\n\r\n\t\t\t// Gather the part\r\n\t\t\tlet part = details.parts[i];\r\n\t\t\tlet unit: any = this._toTimeUnit(part.substr(0, 1));\r\n\r\n\t\t\t// Calculate current unit value\r\n\t\t\tlet ints: number;\r\n\t\t\tconst unitValue = this._getUnitValue(unit!);\r\n\t\t\tif (i < (len -1)) {\r\n\t\t\t\tints = Math.floor(tstamp / unitValue);\r\n\t\t\t}\r\n\t\t\telse {\r\n\t\t\t\tints = Math.round(tstamp / unitValue);\r\n\t\t\t}\r\n\r\n\t\t\tvalues[unit] += ints;\r\n\r\n\t\t\t// Reduce timestamp\r\n\t\t\ttstamp -= ints * unitValue;\r\n\t\t}\r\n\r\n\t\t// Check if we have full unit that we need to bump up to higher unit\r\n\t\t$object.each(values, (unit, value) => {\r\n\t\t\tif (unit == \"millisecond\" && value == 1000) {\r\n\t\t\t\tvalues[\"second\"]++;\r\n\t\t\t\tvalues[\"millisecond\"] = 0;\r\n\t\t\t}\r\n\t\t\telse if (unit == \"second\" && value == 60) {\r\n\t\t\t\tvalues[\"minute\"]++;\r\n\t\t\t\tvalues[\"second\"] = 0;\r\n\t\t\t}\r\n\t\t\telse if (unit == \"minute\" && value == 60) {\r\n\t\t\t\tvalues[\"hour\"]++;\r\n\t\t\t\tvalues[\"minute\"] = 0;\r\n\t\t\t}\r\n\t\t\telse if (unit == \"hour\" && value == 24) {\r\n\t\t\t\tvalues[\"day\"]++;\r\n\t\t\t\tvalues[\"hour\"] = 0;\r\n\t\t\t}\r\n\t\t\telse if (unit == \"day\" && value == 7) {\r\n\t\t\t\tvalues[\"week\"]++;\r\n\t\t\t\tvalues[\"day\"] = 0;\r\n\t\t\t}\r\n\t\t\telse if (unit == \"day\" && value == 30) {\r\n\t\t\t\tvalues[\"month\"]++;\r\n\t\t\t\tvalues[\"day\"] = 0;\r\n\t\t\t}\r\n\t\t\telse if (unit == \"month\" && value == 12) {\r\n\t\t\t\tvalues[\"year\"]++;\r\n\t\t\t\tvalues[\"month\"] = 0;\r\n\t\t\t}\r\n\t\t\t// if (val > 0) {\r\n\t\t\t// \tres = res.replace($type.PLACEHOLDER, $utils.padString(val, 2, \"0\"));\r\n\t\t\t// }\r\n\t\t\t// else {\r\n\t\t\t// \tres = res.replace($type.PLACEHOLDER, \"\");\r\n\t\t\t// }\r\n\t\t});\r\n\r\n\t\t// Iterate again\r\n\t\tfor (let i = 0, len = details.parts.length; i < len; i++) {\r\n\t\t\t// Gather the part\r\n\t\t\tlet part = details.parts[i];\r\n\t\t\tlet unit: any = this._toTimeUnit(part.substr(0, 1));\r\n\t\t\tlet digits = part.length;\r\n\r\n\t\t\t// Calculate current unit value\r\n\t\t\tres = res.replace($type.PLACEHOLDER, $utils.padString(values[unit], digits, \"0\"));\r\n\t\t}\r\n\r\n\r\n\t\t// Reapply negative sign\r\n\t\tif (negative) {\r\n\t\t\tres = \"-\" + res;\r\n\t\t}\r\n\r\n\t\treturn res;\r\n\t}\r\n\r\n\t/**\r\n\t * Converts numeric value to timestamp in milliseconds.\r\n\t *\r\n\t * @param value A source value\r\n\t * @param baseUnit Base unit the source value is in: \"q\", \"s\", \"i\", \"h\", \"d\", \"w\", \"m\", \"y\"\r\n\t * @return Value representation as a timestamp in milliseconds\r\n\t */\r\n\tpublic toTimeStamp(value: number, baseUnit: TimeUnit): number {\r\n\t\treturn value * this._getUnitValue(baseUnit);\r\n\t}\r\n\r\n\tprotected _toTimeUnit(code: string): TimeUnit | undefined {\r\n\t\tswitch (code) {\r\n\t\t\tcase \"S\":\r\n\t\t\t\treturn \"millisecond\";\r\n\t\t\tcase \"s\":\r\n\t\t\t\treturn \"second\";\r\n\t\t\tcase \"m\":\r\n\t\t\t\treturn \"minute\";\r\n\t\t\tcase \"h\":\r\n\t\t\t\treturn \"hour\";\r\n\t\t\tcase \"d\":\r\n\t\t\t\treturn \"day\";\r\n\t\t\tcase \"w\":\r\n\t\t\t\treturn \"week\";\r\n\t\t\tcase \"M\":\r\n\t\t\t\treturn \"month\";\r\n\t\t\tcase \"y\":\r\n\t\t\t\treturn \"year\";\r\n\t\t};\r\n\t}\r\n\r\n\t/**\r\n\t * Returns appropriate default format for the value.\r\n\t *\r\n\t * If `maxValue` is sepcified, it will use that value to determine the time\r\n\t * unit for the format.\r\n\t *\r\n\t * For example if your `baseUnit` is `\"second\"` and you pass in `10`, you\r\n\t * will get `\"10\"`.\r\n\t *\r\n\t * However, you might want it to be formatted in the context of bigger scale,\r\n\t * say 10 minutes (600 seconds). If you pass in `600` as `maxValue`, all\r\n\t * values, including small ones will use format with minutes, e.g.:\r\n\t * `00:10`, `00:50`, `12: 30`, etc.\r\n\t *\r\n\t * @param value Value to format\r\n\t * @param maxValue Maximum value to be used to determine format\r\n\t * @param baseUnit Base unit of the value\r\n\t * @return Format\r\n\t */\r\n\tpublic getFormat(value: number, maxValue?: number, baseUnit?: TimeUnit): string {\r\n\r\n\t\t// Is format override set?\r\n\t\tif (this.get(\"durationFormat\") != null) {\r\n\t\t\treturn this.get(\"durationFormat\")!;\r\n\t\t}\r\n\r\n\t\t// Get base unit\r\n\t\tif (!baseUnit) {\r\n\t\t\tbaseUnit = this.get(\"baseUnit\");\r\n\t\t}\r\n\r\n\t\tif (maxValue != null && value != maxValue) {\r\n\t\t\tvalue = Math.abs(value);\r\n\t\t\tmaxValue = Math.abs(maxValue);\r\n\t\t\tlet maxUnit = this.getValueUnit(Math.max(value, maxValue), baseUnit);\r\n\t\t\treturn (<any>this.get(\"durationFormats\"))[baseUnit!][maxUnit!];\r\n\t\t}\r\n\t\telse {\r\n\t\t\tlet unit = this.getValueUnit(value, baseUnit);\r\n\t\t\treturn (<any>this.get(\"durationFormats\"))[baseUnit!][unit!];\r\n\t\t}\r\n\r\n\t}\r\n\r\n\t/**\r\n\t * Returns value's closest denominator time unit, e.g 100 seconds is\r\n\t * `\"minute\"`, while 59 seconds would still be `second`.\r\n\t *\r\n\t * @param value Source duration value\r\n\t * @param baseUnit Base unit\r\n\t * @return Denominator\r\n\t */\r\n\tpublic getValueUnit(value: number, baseUnit?: TimeUnit): TimeUnit | undefined {\r\n\r\n\t\t// Get base unit\r\n\t\tif (!baseUnit) {\r\n\t\t\tbaseUnit = this.get(\"baseUnit\");\r\n\t\t}\r\n\r\n\t\t// Convert to milliseconds\r\n\t\tlet currentUnit: any;\r\n\t\tlet ms = this.getMilliseconds(value, baseUnit);\r\n\t\t$object.eachContinue(this._getUnitValues(), (key, val) => {\r\n\t\t\tif (key == baseUnit || currentUnit) {\r\n\t\t\t\tlet num = ms / val;\r\n\t\t\t\tif (num <= 1) {\r\n\t\t\t\t\tif (!currentUnit) {\r\n\t\t\t\t\t\tcurrentUnit = key;\r\n\t\t\t\t\t}\r\n\t\t\t\t\treturn false;\r\n\t\t\t\t}\r\n\t\t\t\tcurrentUnit = key;\r\n\t\t\t}\r\n\t\t\treturn true;\r\n\t\t});\r\n\r\n\t\treturn currentUnit;\r\n\t}\r\n\r\n\t/**\r\n\t * Converts value to milliseconds according to `baseUnit`.\r\n\t *\r\n\t * @param value Source duration value\r\n\t * @param baseUnit Base unit\r\n\t * @return Value in milliseconds\r\n\t */\r\n\tpublic getMilliseconds(value: number, baseUnit?: TimeUnit): number {\r\n\r\n\t\t// Get base unit\r\n\t\tif (!baseUnit) {\r\n\t\t\tbaseUnit = this.get(\"baseUnit\");\r\n\t\t}\r\n\r\n\t\treturn value * this._getUnitValue(baseUnit!);\r\n\t}\r\n\r\n\tprotected _getUnitValue(timeUnit: TimeUnit): number {\r\n\t\treturn this._getUnitValues()[timeUnit];\r\n\t}\r\n\r\n\tprotected _getUnitValues(): any {\r\n\t\treturn {\r\n\t\t\t\"millisecond\": 1,\r\n\t\t\t\"second\": 1000,\r\n\t\t\t\"minute\": 60000,\r\n\t\t\t\"hour\": 3600000,\r\n\t\t\t\"day\": 86400000,\r\n\t\t\t\"week\": 604800000,\r\n\t\t\t\"month\": 2592000000,\r\n\t\t\t\"year\": 31536000000,\r\n\t\t};\r\n\t}\r\n\r\n}\r\n"]}
|
|
@@ -54,7 +54,7 @@ export function assert(condition, message = "Assertion failed") {
|
|
|
54
54
|
export function toNumber(value) {
|
|
55
55
|
if (value != null && !isNumber(value)) {
|
|
56
56
|
let converted = Number(value);
|
|
57
|
-
if (isNaN(converted) && isString(value) && value != "") {
|
|
57
|
+
if (isNaN(converted) && isString(value) && value != "" && value.match(/[0-9]+/)) {
|
|
58
58
|
return toNumber(value.replace(/[^0-9.\-]+/g, ''));
|
|
59
59
|
}
|
|
60
60
|
return converted;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Type.js","sourceRoot":"","sources":["../../../../../src/.internal/core/util/Type.ts"],"names":[],"mappings":"AAAA;;;GAGG;AA+CH;;;;;GAKG;AAEH;;;;;GAKG;AACH,MAAM,UAAU,KAAK,CAAC,KAAa;IAClC,OAAO,MAAM,CAAC,KAAK,CAAC,KAAK,KAAK,CAAC;AAChC,CAAC;AAaD;;;;;;GAMG;AACH,MAAM,UAAU,OAAO,CAAI,KAAQ;IAClC,OAAO,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAS,CAAC;AAC1C,CAAC;AAGD;;;;;;GAMG;AACH,MAAM,UAAU,MAAM,CAAC,SAAkB,EAAE,UAAkB,kBAAkB;IAC9E,IAAI,CAAC,SAAS,EAAE;QACf,MAAM,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC;KACzB;AACF,CAAC;AAGD;;;;;GAKG;AAGH;;;;;GAKG;AACH,MAAM,UAAU,QAAQ,CAAC,KAAU;IAClC,IAAI,KAAK,IAAI,IAAI,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE;QACtC,IAAI,SAAS,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;QAC9B,IAAI,KAAK,CAAC,SAAS,CAAC,IAAI,QAAQ,CAAC,KAAK,CAAC,IAAI,KAAK,IAAI,EAAE,EAAE;YACvD,OAAO,QAAQ,CAAC,KAAK,CAAC,OAAO,CAAC,aAAa,EAAE,EAAE,CAAC,CAAC,CAAC;SAClD;QACD,OAAO,SAAS,CAAC;KACjB;IACD,OAAO,KAAK,CAAC;AACd,CAAC;AAID;;;;;GAKG;AACH,MAAM,UAAU,MAAM,CAAC,KAA6B;IACnD,IAAI,MAAM,CAAC,KAAK,CAAC,EAAE;QAClB,uCAAuC;QACvC,OAAO,IAAI,IAAI,CAAC,KAAK,CA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,CAAC,KAAK,eAAe,CAAC;AAC3C,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,QAAQ,CAAC,KAAU;IAClC,OAAO,OAAO,KAAK,KAAK,QAAQ,CAAC;AAClC,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,QAAQ,CAAC,KAAU;IAClC,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,MAAM,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC;AAC5D,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,QAAQ,CAAC,KAAU;IAClC,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,CAAC;AACpD,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,OAAO,CAAC,KAAU;IACjC,OAAO,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAC7B,CAAC;AAGD;;;;;GAKG;AAGH;;GAEG;AACH,MAAM,CAAC,MAAM,WAAW,GAAW,SAAS,CAAC;AAE7C;;GAEG;AACH,MAAM,CAAC,MAAM,YAAY,GAAW,UAAU,CAAC","sourcesContent":["/**\n * A collection of utility functions for various type checks and conversion\n * @hidden\n */\n\n/**\n * ============================================================================\n * IMPORTS\n * ============================================================================\n * @hidden\n */\n\n/**\n * ============================================================================\n * MISC\n * ============================================================================\n * @hidden\n */\n\ntype Cond<T, Keys extends keyof T> = Keys extends never\n\t? never\n\t: { [K in Keys]: T[K] };\n\ntype Never<T> = T extends undefined ? never : T;\n\n/**\n * Selects all the keys of T which have a value of U.\n */\nexport type SelectKeys<T, U> = Never<{ [K in keyof T]: T[K] extends U ? K : never }[keyof T]>;\n\n/**\n * Creates a new type which is the same as T except it only has the properties of type U.\n */\nexport type Select<T, U> = Cond<T, SelectKeys<T, U>>;\n\n\n/**\n * @todo Description\n * @ignore Exclude from docs\n */\nexport type Public<T> = { [P in keyof T]: T[P] };\n\n\n/**\n * `Keyof<T>` is the same as `keyof T` except it only accepts string keys, not numbers or symbols.\n */\nexport type Keyof<T> = Extract<keyof T, string>;\n\n\n\n/**\n * ============================================================================\n * TYPE CHECK\n * ============================================================================\n * @hidden\n */\n\n/**\n * Returns `true` if value is not a number (NaN).\n *\n * @param value Input value\n * @return Is NaN?\n */\nexport function isNaN(value: number): boolean {\n\treturn Number(value) !== value;\n}\n\n/**\n * Represents a type for all available JavaScript variable types.\n */\nexport type Type\n\t= \"[object Object]\"\n\t| \"[object Array]\"\n\t| \"[object String]\"\n\t| \"[object Number]\"\n\t| \"[object Boolean]\"\n\t| \"[object Date]\";\n\n/**\n * Returns a type of the value.\n *\n * @param value Input value\n * @return Type of the value\n * @ignore\n */\nexport function getType<A>(value: A): Type {\n\treturn ({}).toString.call(value) as Type;\n}\n\n\n/**\n * Asserts that the condition is true.\n *\n * @param condition Condition to check\n * @param message Message to display in the error\n * @ignore\n */\nexport function assert(condition: boolean, message: string = \"Assertion failed\"): asserts condition {\n\tif (!condition) {\n\t\tthrow new Error(message);\n\t}\n}\n\n\n/**\n * ============================================================================\n * QUICK CONVERSION\n * ============================================================================\n * @hidden\n */\n\n\n/**\n * Converts any value into a `number`.\n *\n * @param value Source value\n * @return Number representation of value\n */\nexport function toNumber(value: any): number {\n\tif (value != null && !isNumber(value)) {\n\t\tlet converted = Number(value);\n\t\tif (isNaN(converted) && isString(value) && value != \"\") {\n\t\t\treturn toNumber(value.replace(/[^0-9.\\-]+/g, ''));\n\t\t}\n\t\treturn converted;\n\t}\n\treturn value;\n}\n\n\n\n/**\n * Converts anything to Date object.\n *\n * @param value A value of any type\n * @return Date object representing a value\n */\nexport function toDate(value: Date | number | string): Date {\n\tif (isDate(value)) {\n\t\t// TODO maybe don't create a new Date ?\n\t\treturn new Date(value);\n\t}\n\n\telse if (isNumber(value)) {\n\t\treturn new Date(value);\n\t}\n\n\telse {\n\t\t// Try converting to number (assuming timestamp)\n\t\tlet num = Number(value);\n\n\t\tif (!isNumber(num)) {\n\t\t\treturn new Date(value);\n\t\t}\n\t\telse {\n\t\t\treturn new Date(num);\n\t\t}\n\t}\n}\n\n/**\n * Converts numeric value into string. Deals with large or small numbers that\n * would otherwise use exponents.\n *\n * @param value Numeric value\n * @return Numeric value as string\n */\nexport function numberToString(value: number): string {\n\t// TODO handle Infinity and -Infinity\n\tif (isNaN(value)) {\n\t\treturn \"NaN\";\n\t}\n\n\tif (value === Infinity) {\n\t\treturn \"Infinity\";\n\t}\n\n\tif (value === -Infinity) {\n\t\treturn \"-Infinity\";\n\t}\n\n\t// Negative 0\n\tif ((value === 0) && (1 / value === -Infinity)) {\n\t\treturn \"-0\";\n\t}\n\n\t// Preserve negative and deal with absoute values\n\tlet negative = value < 0;\n\n\tvalue = Math.abs(value);\n\n\t// TODO test this\n\tlet parsed = /^([0-9]+)(?:\\.([0-9]+))?(?:e[\\+\\-]([0-9]+))?$/.exec(\"\" + value)!;\n\tlet digits = parsed[1];\n\tlet decimals = parsed[2] || \"\";\n\n\tlet res: string;\n\n\t// Leave the nummber as it is if it does not use exponents\n\tif (parsed[3] === undefined) {\n\t\tres = (decimals === \"\" ? digits : digits + \".\" + decimals);\n\n\t} else {\n\t\tlet exponent = +parsed[3];\n\n\t\t// Deal with decimals\n\t\tif (value < 1) {\n\t\t\tlet zeros = exponent - 1;\n\n\t\t\tres = \"0.\" + repeat(\"0\", zeros) + digits + decimals;\n\n\t\t\t// Deal with integers\n\t\t} else {\n\t\t\tlet zeros = exponent - decimals.length;\n\n\t\t\tif (zeros === 0) {\n\t\t\t\tres = digits + decimals;\n\n\t\t\t} else if (zeros < 0) {\n\t\t\t\tres = digits + decimals.slice(0, zeros) + \".\" + decimals.slice(zeros);\n\n\t\t\t} else {\n\t\t\t\tres = digits + decimals + repeat(\"0\", zeros);\n\t\t\t}\n\t\t}\n\t}\n\n\treturn negative ? \"-\" + res : res;\n}\n\n/**\n * Repeats a `string` number of times as set in `amount`.\n *\n * @ignore Exclude from docs\n * @todo Make this faster\n * @param string Source string\n * @param amount Number of times to repeat string\n * @return New string\n */\nexport function repeat(string: string, amount: number): string {\n return new Array(amount + 1).join(string);\n}\n\n\n/**\n * ============================================================================\n * VALUE PRESENCE CHECK\n * ============================================================================\n * @hidden\n */\n\n/**\n * Defines an optional value that can be of any type or `undefined`.\n */\nexport type Optional<A> = A | undefined;\n\n\n/**\n * ============================================================================\n * TYPE CHECK\n * ============================================================================\n * @hidden\n */\n\n/**\n * Checks if parameter is `Date`.\n *\n * @param value Input value\n * @return Is Date?\n */\nexport function isDate(value: any): value is Date {\n\treturn getType(value) === \"[object Date]\";\n}\n\n/**\n * Checks if parameter is `string`.\n *\n * @param value Input value\n * @return Is string?\n */\nexport function isString(value: any): value is string {\n\treturn typeof value === \"string\";\n}\n\n/**\n * Checks if parameter is `number`.\n *\n * @param value Input value\n * @return Is number?\n */\nexport function isNumber(value: any): value is number {\n\treturn typeof value === \"number\" && Number(value) == value;\n}\n\n/**\n * Checks if parameter is `object`.\n *\n * @param value Input value\n * @return Is object?\n */\nexport function isObject(value: any): value is object {\n\treturn typeof value === \"object\" && value !== null;\n}\n\n/**\n * Checks if parameter is `Array`.\n *\n * @param value Input value\n * @return Is Array?\n */\nexport function isArray(value: any): value is Array<unknown> {\n\treturn Array.isArray(value);\n}\n\n\n/**\n * ============================================================================\n * STATIC CONSTANTS\n * ============================================================================\n * @hidden\n */\n\n\n/**\n * @ignore Exclude from docs\n */\nexport const PLACEHOLDER: string = \"__§§§__\";\n\n/**\n * @ignore Exclude from docs\n */\nexport const PLACEHOLDER2: string = \"__§§§§__\";\n"]}
|
|
1
|
+
{"version":3,"file":"Type.js","sourceRoot":"","sources":["../../../../../src/.internal/core/util/Type.ts"],"names":[],"mappings":"AAAA;;;GAGG;AA+CH;;;;;GAKG;AAEH;;;;;GAKG;AACH,MAAM,UAAU,KAAK,CAAC,KAAa;IAClC,OAAO,MAAM,CAAC,KAAK,CAAC,KAAK,KAAK,CAAC;AAChC,CAAC;AAaD;;;;;;GAMG;AACH,MAAM,UAAU,OAAO,CAAI,KAAQ;IAClC,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,CAAC,KAAU;IAClC,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,CAAC;AACpD,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,OAAO,CAAC,KAAU;IACjC,OAAO,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAC7B,CAAC;AAGD;;;;;GAKG;AAGH;;GAEG;AACH,MAAM,CAAC,MAAM,WAAW,GAAW,SAAS,CAAC;AAE7C;;GAEG;AACH,MAAM,CAAC,MAAM,YAAY,GAAW,UAAU,CAAC","sourcesContent":["/**\n * A collection of utility functions for various type checks and conversion\n * @hidden\n */\n\n/**\n * ============================================================================\n * IMPORTS\n * ============================================================================\n * @hidden\n */\n\n/**\n * ============================================================================\n * MISC\n * ============================================================================\n * @hidden\n */\n\ntype Cond<T, Keys extends keyof T> = Keys extends never\n\t? never\n\t: { [K in Keys]: T[K] };\n\ntype Never<T> = T extends undefined ? never : T;\n\n/**\n * Selects all the keys of T which have a value of U.\n */\nexport type SelectKeys<T, U> = Never<{ [K in keyof T]: T[K] extends U ? K : never }[keyof T]>;\n\n/**\n * Creates a new type which is the same as T except it only has the properties of type U.\n */\nexport type Select<T, U> = Cond<T, SelectKeys<T, U>>;\n\n\n/**\n * @todo Description\n * @ignore Exclude from docs\n */\nexport type Public<T> = { [P in keyof T]: T[P] };\n\n\n/**\n * `Keyof<T>` is the same as `keyof T` except it only accepts string keys, not numbers or symbols.\n */\nexport type Keyof<T> = Extract<keyof T, string>;\n\n\n\n/**\n * ============================================================================\n * TYPE CHECK\n * ============================================================================\n * @hidden\n */\n\n/**\n * Returns `true` if value is not a number (NaN).\n *\n * @param value Input value\n * @return Is NaN?\n */\nexport function isNaN(value: number): boolean {\n\treturn Number(value) !== value;\n}\n\n/**\n * Represents a type for all available JavaScript variable types.\n */\nexport type Type\n\t= \"[object Object]\"\n\t| \"[object Array]\"\n\t| \"[object String]\"\n\t| \"[object Number]\"\n\t| \"[object Boolean]\"\n\t| \"[object Date]\";\n\n/**\n * Returns a type of the value.\n *\n * @param value Input value\n * @return Type of the value\n * @ignore\n */\nexport function getType<A>(value: A): Type {\n\treturn ({}).toString.call(value) as Type;\n}\n\n\n/**\n * Asserts that the condition is true.\n *\n * @param condition Condition to check\n * @param message Message to display in the error\n * @ignore\n */\nexport function assert(condition: boolean, message: string = \"Assertion failed\"): asserts condition {\n\tif (!condition) {\n\t\tthrow new Error(message);\n\t}\n}\n\n\n/**\n * ============================================================================\n * QUICK CONVERSION\n * ============================================================================\n * @hidden\n */\n\n\n/**\n * Converts any value into a `number`.\n *\n * @param value Source value\n * @return Number representation of value\n */\nexport function toNumber(value: any): number {\n\tif (value != null && !isNumber(value)) {\n\t\tlet converted = Number(value);\n\t\tif (isNaN(converted) && isString(value) && value != \"\" && value.match(/[0-9]+/)) {\n\t\t\treturn toNumber(value.replace(/[^0-9.\\-]+/g, ''));\n\t\t}\n\t\treturn converted;\n\t}\n\treturn value;\n}\n\n\n\n/**\n * Converts anything to Date object.\n *\n * @param value A value of any type\n * @return Date object representing a value\n */\nexport function toDate(value: Date | number | string): Date {\n\tif (isDate(value)) {\n\t\t// TODO maybe don't create a new Date ?\n\t\treturn new Date(value);\n\t}\n\n\telse if (isNumber(value)) {\n\t\treturn new Date(value);\n\t}\n\n\telse {\n\t\t// Try converting to number (assuming timestamp)\n\t\tlet num = Number(value);\n\n\t\tif (!isNumber(num)) {\n\t\t\treturn new Date(value);\n\t\t}\n\t\telse {\n\t\t\treturn new Date(num);\n\t\t}\n\t}\n}\n\n/**\n * Converts numeric value into string. Deals with large or small numbers that\n * would otherwise use exponents.\n *\n * @param value Numeric value\n * @return Numeric value as string\n */\nexport function numberToString(value: number): string {\n\t// TODO handle Infinity and -Infinity\n\tif (isNaN(value)) {\n\t\treturn \"NaN\";\n\t}\n\n\tif (value === Infinity) {\n\t\treturn \"Infinity\";\n\t}\n\n\tif (value === -Infinity) {\n\t\treturn \"-Infinity\";\n\t}\n\n\t// Negative 0\n\tif ((value === 0) && (1 / value === -Infinity)) {\n\t\treturn \"-0\";\n\t}\n\n\t// Preserve negative and deal with absoute values\n\tlet negative = value < 0;\n\n\tvalue = Math.abs(value);\n\n\t// TODO test this\n\tlet parsed = /^([0-9]+)(?:\\.([0-9]+))?(?:e[\\+\\-]([0-9]+))?$/.exec(\"\" + value)!;\n\tlet digits = parsed[1];\n\tlet decimals = parsed[2] || \"\";\n\n\tlet res: string;\n\n\t// Leave the nummber as it is if it does not use exponents\n\tif (parsed[3] === undefined) {\n\t\tres = (decimals === \"\" ? digits : digits + \".\" + decimals);\n\n\t} else {\n\t\tlet exponent = +parsed[3];\n\n\t\t// Deal with decimals\n\t\tif (value < 1) {\n\t\t\tlet zeros = exponent - 1;\n\n\t\t\tres = \"0.\" + repeat(\"0\", zeros) + digits + decimals;\n\n\t\t\t// Deal with integers\n\t\t} else {\n\t\t\tlet zeros = exponent - decimals.length;\n\n\t\t\tif (zeros === 0) {\n\t\t\t\tres = digits + decimals;\n\n\t\t\t} else if (zeros < 0) {\n\t\t\t\tres = digits + decimals.slice(0, zeros) + \".\" + decimals.slice(zeros);\n\n\t\t\t} else {\n\t\t\t\tres = digits + decimals + repeat(\"0\", zeros);\n\t\t\t}\n\t\t}\n\t}\n\n\treturn negative ? \"-\" + res : res;\n}\n\n/**\n * Repeats a `string` number of times as set in `amount`.\n *\n * @ignore Exclude from docs\n * @todo Make this faster\n * @param string Source string\n * @param amount Number of times to repeat string\n * @return New string\n */\nexport function repeat(string: string, amount: number): string {\n return new Array(amount + 1).join(string);\n}\n\n\n/**\n * ============================================================================\n * VALUE PRESENCE CHECK\n * ============================================================================\n * @hidden\n */\n\n/**\n * Defines an optional value that can be of any type or `undefined`.\n */\nexport type Optional<A> = A | undefined;\n\n\n/**\n * ============================================================================\n * TYPE CHECK\n * ============================================================================\n * @hidden\n */\n\n/**\n * Checks if parameter is `Date`.\n *\n * @param value Input value\n * @return Is Date?\n */\nexport function isDate(value: any): value is Date {\n\treturn getType(value) === \"[object Date]\";\n}\n\n/**\n * Checks if parameter is `string`.\n *\n * @param value Input value\n * @return Is string?\n */\nexport function isString(value: any): value is string {\n\treturn typeof value === \"string\";\n}\n\n/**\n * Checks if parameter is `number`.\n *\n * @param value Input value\n * @return Is number?\n */\nexport function isNumber(value: any): value is number {\n\treturn typeof value === \"number\" && Number(value) == value;\n}\n\n/**\n * Checks if parameter is `object`.\n *\n * @param value Input value\n * @return Is object?\n */\nexport function isObject(value: any): value is object {\n\treturn typeof value === \"object\" && value !== null;\n}\n\n/**\n * Checks if parameter is `Array`.\n *\n * @param value Input value\n * @return Is Array?\n */\nexport function isArray(value: any): value is Array<unknown> {\n\treturn Array.isArray(value);\n}\n\n\n/**\n * ============================================================================\n * STATIC CONSTANTS\n * ============================================================================\n * @hidden\n */\n\n\n/**\n * @ignore Exclude from docs\n */\nexport const PLACEHOLDER: string = \"__§§§__\";\n\n/**\n * @ignore Exclude from docs\n */\nexport const PLACEHOLDER2: string = \"__§§§§__\";\n"]}
|
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,38 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
|
|
|
5
5
|
Please note, that this project, while following numbering syntax, it DOES NOT
|
|
6
6
|
adhere to [Semantic Versioning](http://semver.org/spec/v2.0.0.html) rules.
|
|
7
7
|
|
|
8
|
+
## [5.11.2] - 2025-03-21
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
- `strokeWidths` setting added to `SettingsModal`.
|
|
12
|
+
- `cornerRadiusTL`, `cornerRadiusTR`, `cornerRadiusBR`, `cornerRadiusBL` added to `FunnelSlice`. Use it to add rounded corner to funnel slices.
|
|
13
|
+
|
|
14
|
+
### Changed
|
|
15
|
+
- Screen reader alerts were not being read out if the message was exact same text as the last one.
|
|
16
|
+
- All settings from `IAccessibilitySettings` have been moved to `ISpriteSettings`.
|
|
17
|
+
|
|
18
|
+
### Fixed
|
|
19
|
+
- Fixed a prompt in Dutch (nl_NL) translation.
|
|
20
|
+
- A Horizontal Line drawing restored from serialized data was not visible until chart zoom.
|
|
21
|
+
- HTML content outside of a scrollable `Container` were still visible.
|
|
22
|
+
- `am5.type.toNumber()` could go into infinite loop with some non-numeric input values.
|
|
23
|
+
- Removing of an `XYSeries` from an `XYChart` with a `DateAxis` and data grouping enabled could cause newly added series to be wrongly grouped.
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
## [5.11.1] - 2025-02-25
|
|
27
|
+
|
|
28
|
+
### Added
|
|
29
|
+
- New setting `disableWeekDays` (array of numbers) in `DateRangeSelector`. E.g. set to `diasbleWeekDays: [0, 6]` to disable Sundays and Saturdays.
|
|
30
|
+
|
|
31
|
+
### Fixed
|
|
32
|
+
- The value of a `Hierarchy` node with `toggleKey: "none"` would be reset to `"disabled"`, after data was appended to the node.
|
|
33
|
+
- `DurationFormatter` was not correctly rounding fractional numbers in some cases.
|
|
34
|
+
- `DateRangeSelector` was not correctly handling `firstDayOfWeek` value from locale.
|
|
35
|
+
- `XYCursor` lines were not focusable until cursor was shown for the first time.
|
|
36
|
+
- Setting `exclude` on a `MapSeries` would not re-enable previously excluded objects.
|
|
37
|
+
- Fixed issue with stacking of negative values.
|
|
38
|
+
|
|
39
|
+
|
|
8
40
|
## [5.11.0] - 2025-02-03
|
|
9
41
|
|
|
10
42
|
### Added
|