@refinitiv-ui/elements 5.12.2 → 6.0.0-next.0
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/README.md +4 -4
- package/lib/accordion/index.js +2 -2
- package/lib/appstate-bar/index.d.ts +6 -0
- package/lib/appstate-bar/index.js +8 -3
- package/lib/autosuggest/index.js +10 -11
- package/lib/button/index.d.ts +2 -13
- package/lib/button/index.js +7 -42
- package/lib/button-bar/index.js +4 -5
- package/lib/calendar/constants.js +1 -1
- package/lib/calendar/index.d.ts +1 -1
- package/lib/calendar/index.js +39 -15
- package/lib/calendar/locales.js +5 -5
- package/lib/calendar/types.d.ts +1 -1
- package/lib/calendar/utils.js +5 -5
- package/lib/canvas/index.js +3 -4
- package/lib/card/index.js +6 -7
- package/lib/chart/index.js +18 -22
- package/lib/chart/plugins/doughnut-center-label.js +6 -11
- package/lib/checkbox/index.js +3 -3
- package/lib/clock/index.js +6 -6
- package/lib/clock/utils/TickManager.js +2 -2
- package/lib/collapse/index.js +7 -9
- package/lib/color-dialog/elements/color-palettes.js +1 -1
- package/lib/color-dialog/elements/grayscale-palettes.js +2 -2
- package/lib/color-dialog/elements/palettes.js +4 -5
- package/lib/color-dialog/helpers/value-model.js +1 -1
- package/lib/color-dialog/index.d.ts +1 -1
- package/lib/color-dialog/index.js +6 -6
- package/lib/combo-box/helpers/filter.d.ts +1 -1
- package/lib/combo-box/helpers/types.d.ts +1 -1
- package/lib/combo-box/index.d.ts +4 -4
- package/lib/combo-box/index.js +31 -14
- package/lib/counter/index.d.ts +6 -6
- package/lib/counter/index.js +8 -8
- package/lib/datetime-field/constants.d.ts +4 -0
- package/lib/datetime-field/constants.js +5 -0
- package/lib/datetime-field/custom-elements.json +345 -0
- package/lib/datetime-field/custom-elements.md +61 -0
- package/lib/datetime-field/index.d.ts +317 -0
- package/lib/datetime-field/index.js +660 -0
- package/lib/datetime-field/themes/halo/dark/index.js +3 -0
- package/lib/datetime-field/themes/halo/light/index.js +3 -0
- package/lib/datetime-field/themes/solar/charcoal/index.js +3 -0
- package/lib/datetime-field/themes/solar/pearl/index.js +3 -0
- package/lib/datetime-field/types.d.ts +10 -0
- package/lib/datetime-field/types.js +1 -0
- package/lib/datetime-field/utils.d.ts +25 -0
- package/lib/datetime-field/utils.js +79 -0
- package/lib/datetime-picker/index.js +6 -7
- package/lib/datetime-picker/utils.js +1 -1
- package/lib/dialog/draggable-element.js +1 -2
- package/lib/dialog/index.d.ts +1 -1
- package/lib/dialog/index.js +5 -5
- package/lib/email-field/index.d.ts +1 -1
- package/lib/email-field/index.js +8 -3
- package/lib/flag/index.js +3 -3
- package/lib/flag/utils/FlagLoader.d.ts +1 -1
- package/lib/flag/utils/FlagLoader.js +1 -1
- package/lib/header/index.js +2 -2
- package/lib/heatmap/helpers/color.d.ts +1 -1
- package/lib/heatmap/helpers/color.js +3 -5
- package/lib/heatmap/index.js +19 -28
- package/lib/icon/index.js +3 -3
- package/lib/icon/utils/IconLoader.d.ts +1 -1
- package/lib/icon/utils/IconLoader.js +1 -1
- package/lib/interactive-chart/helpers/types.d.ts +1 -1
- package/lib/interactive-chart/index.js +10 -14
- package/lib/item/helpers/types.d.ts +1 -1
- package/lib/item/index.d.ts +19 -17
- package/lib/item/index.js +45 -48
- package/lib/label/index.d.ts +1 -1
- package/lib/label/index.js +6 -6
- package/lib/layout/index.js +2 -2
- package/lib/led-gauge/index.js +2 -2
- package/lib/list/custom-elements.json +0 -13
- package/lib/list/custom-elements.md +9 -10
- package/lib/list/helpers/item-id.d.ts +8 -0
- package/lib/list/helpers/item-id.js +13 -0
- package/lib/list/helpers/{list-renderer.d.ts → renderer.d.ts} +4 -0
- package/lib/list/helpers/{list-renderer.js → renderer.js} +8 -0
- package/lib/list/helpers/types.d.ts +1 -1
- package/lib/list/index.d.ts +13 -12
- package/lib/list/index.js +30 -29
- package/lib/list/renderer.d.ts +1 -1
- package/lib/list/themes/halo/dark/index.js +1 -1
- package/lib/list/themes/halo/light/index.js +1 -1
- package/lib/list/themes/solar/charcoal/index.js +1 -1
- package/lib/list/themes/solar/pearl/index.js +1 -1
- package/lib/loader/index.js +1 -1
- package/lib/multi-input/helpers/types.d.ts +1 -1
- package/lib/multi-input/index.js +6 -7
- package/lib/notification/elements/notification-tray.js +4 -4
- package/lib/notification/elements/notification.d.ts +10 -0
- package/lib/notification/elements/notification.js +12 -3
- package/lib/number-field/index.d.ts +3 -3
- package/lib/number-field/index.js +14 -4
- package/lib/overlay/elements/overlay-backdrop.js +2 -2
- package/lib/overlay/elements/overlay-viewport.js +1 -1
- package/lib/overlay/elements/overlay.js +7 -5
- package/lib/overlay/managers/focus-manager.js +2 -3
- package/lib/overlay/managers/interaction-lock-manager.js +1 -1
- package/lib/overlay/managers/viewport-manager.js +4 -5
- package/lib/overlay/managers/zindex-manager.js +1 -1
- package/lib/overlay-menu/helpers/types.d.ts +1 -1
- package/lib/overlay-menu/index.js +12 -15
- package/lib/overlay-menu/managers/menu-manager.js +1 -1
- package/lib/pagination/index.d.ts +74 -91
- package/lib/pagination/index.js +205 -239
- package/lib/pagination/themes/halo/dark/index.js +1 -2
- package/lib/pagination/themes/halo/light/index.js +1 -2
- package/lib/pagination/themes/solar/charcoal/index.js +1 -2
- package/lib/pagination/themes/solar/pearl/index.js +1 -2
- package/lib/panel/index.js +2 -2
- package/lib/password-field/index.d.ts +2 -2
- package/lib/password-field/index.js +7 -4
- package/lib/pill/index.d.ts +16 -0
- package/lib/pill/index.js +36 -5
- package/lib/pill/themes/halo/dark/index.js +1 -1
- package/lib/pill/themes/halo/light/index.js +1 -1
- package/lib/pill/themes/solar/charcoal/index.js +1 -1
- package/lib/pill/themes/solar/pearl/index.js +1 -1
- package/lib/progress-bar/index.js +3 -3
- package/lib/radio-button/index.js +3 -3
- package/lib/radio-button/radio-button-registry.d.ts +1 -1
- package/lib/radio-button/radio-button-registry.js +4 -2
- package/lib/rating/index.js +4 -4
- package/lib/search-field/index.d.ts +2 -2
- package/lib/search-field/index.js +8 -4
- package/lib/select/index.js +11 -14
- package/lib/sidebar-layout/index.js +4 -4
- package/lib/slider/index.js +6 -8
- package/lib/sparkline/index.js +9 -10
- package/lib/swing-gauge/index.js +14 -8
- package/lib/tab/index.js +4 -4
- package/lib/tab-bar/index.js +6 -6
- package/lib/text-field/index.d.ts +14 -1
- package/lib/text-field/index.js +35 -11
- package/lib/time-picker/index.d.ts +1 -1
- package/lib/time-picker/index.js +11 -11
- package/lib/toggle/index.js +2 -2
- package/lib/tooltip/index.js +6 -8
- package/lib/tooltip/managers/tooltip-manager.js +2 -2
- package/lib/tornado-chart/elements/tornado-chart.js +2 -2
- package/lib/tornado-chart/elements/tornado-item.js +3 -3
- package/lib/tree/elements/tree-item.d.ts +3 -3
- package/lib/tree/elements/tree-item.js +5 -6
- package/lib/tree/elements/tree.d.ts +2 -3
- package/lib/tree/elements/tree.js +6 -7
- package/lib/tree/helpers/renderer.d.ts +4 -0
- package/lib/tree/helpers/renderer.js +8 -0
- package/lib/tree/helpers/types.d.ts +1 -1
- package/lib/tree/managers/tree-manager.d.ts +1 -1
- package/lib/tree/themes/halo/dark/index.js +1 -1
- package/lib/tree/themes/halo/light/index.js +1 -1
- package/lib/tree/themes/solar/charcoal/index.js +1 -1
- package/lib/tree/themes/solar/pearl/index.js +1 -1
- package/lib/tree-select/index.d.ts +3 -7
- package/lib/tree-select/index.js +39 -38
- package/lib/version.js +1 -1
- package/package.json +35 -295
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { DateTimeFormatPart, InputSelection } from './types';
|
|
2
|
+
import { Direction } from './constants.js';
|
|
3
|
+
/**
|
|
4
|
+
* Get a part index based on the selection
|
|
5
|
+
* @param selection Selection, containing selectionStart and selectionEnd
|
|
6
|
+
* @param parts The list of parts
|
|
7
|
+
* @returns index
|
|
8
|
+
*/
|
|
9
|
+
export declare const getSelectedPartIndex: (selection: InputSelection, parts: DateTimeFormatPart[]) => number;
|
|
10
|
+
/**
|
|
11
|
+
* Get next available part index based on the selection, direction and input value
|
|
12
|
+
* @param selection Selection, containing selectionStart and selectionEnd
|
|
13
|
+
* @param parts The list of parts
|
|
14
|
+
* @param inputValue The date time string value
|
|
15
|
+
* @param direction Get the previous or the next part index
|
|
16
|
+
* @returns index
|
|
17
|
+
*/
|
|
18
|
+
export declare const getNextSelectedPartIndex: (selection: InputSelection, parts: DateTimeFormatPart[], inputValue: string, direction?: Direction) => number;
|
|
19
|
+
/**
|
|
20
|
+
* Get part selectionStart and selectionEnd indexes
|
|
21
|
+
* @param index Part index
|
|
22
|
+
* @param parts The list of parts
|
|
23
|
+
* @returns selection
|
|
24
|
+
*/
|
|
25
|
+
export declare const selectPart: (index: number | undefined, parts: DateTimeFormatPart[]) => InputSelection;
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { Direction } from './constants.js';
|
|
2
|
+
const IterablePartTypes = ['year', 'day', 'month', 'hour', 'minute', 'second', 'weekday', 'dayPeriod', 'fractionalSecond'];
|
|
3
|
+
const isAllowedPart = (part) => IterablePartTypes.includes(part.type);
|
|
4
|
+
/**
|
|
5
|
+
* Get a part index based on the selection
|
|
6
|
+
* @param selection Selection, containing selectionStart and selectionEnd
|
|
7
|
+
* @param parts The list of parts
|
|
8
|
+
* @returns index
|
|
9
|
+
*/
|
|
10
|
+
export const getSelectedPartIndex = (selection, parts) => {
|
|
11
|
+
const selectionEnd = selection.selectionEnd || 0;
|
|
12
|
+
let accumulator = 0;
|
|
13
|
+
// Get the closest part to selectionEnd
|
|
14
|
+
for (let i = 0; i < parts.length; i += 1) {
|
|
15
|
+
const part = parts[i];
|
|
16
|
+
accumulator += part.value.length;
|
|
17
|
+
if (accumulator >= selectionEnd && isAllowedPart(part)) {
|
|
18
|
+
return i;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
return 0;
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* Get next available part index based on the selection, direction and input value
|
|
25
|
+
* @param selection Selection, containing selectionStart and selectionEnd
|
|
26
|
+
* @param parts The list of parts
|
|
27
|
+
* @param inputValue The date time string value
|
|
28
|
+
* @param direction Get the previous or the next part index
|
|
29
|
+
* @returns index
|
|
30
|
+
*/
|
|
31
|
+
export const getNextSelectedPartIndex = (selection, parts, inputValue, direction = Direction.Up) => {
|
|
32
|
+
let selectedIndex;
|
|
33
|
+
const { selectionEnd, selectionStart } = selection;
|
|
34
|
+
if (selectionStart === 0 && selectionEnd === inputValue.length) {
|
|
35
|
+
// Full text selected
|
|
36
|
+
selectedIndex = direction === Direction.Up ? -1 : parts.length;
|
|
37
|
+
}
|
|
38
|
+
else if (selectionEnd === 0) {
|
|
39
|
+
// Cursor at the start of the text
|
|
40
|
+
selectedIndex = -1;
|
|
41
|
+
direction = Direction.Up;
|
|
42
|
+
}
|
|
43
|
+
else if (selectionEnd === inputValue.length && selectionEnd === selectionStart) {
|
|
44
|
+
// cursor at the end of the text
|
|
45
|
+
selectedIndex = parts.length;
|
|
46
|
+
direction = Direction.Down;
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
selectedIndex = getSelectedPartIndex(selection, parts);
|
|
50
|
+
}
|
|
51
|
+
for (let i = selectedIndex + direction; direction === Direction.Up ? i < parts.length : i >= 0; i += direction) {
|
|
52
|
+
if (isAllowedPart(parts[i])) {
|
|
53
|
+
return i;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
return selectedIndex;
|
|
57
|
+
};
|
|
58
|
+
/**
|
|
59
|
+
* Get part selectionStart and selectionEnd indexes
|
|
60
|
+
* @param index Part index
|
|
61
|
+
* @param parts The list of parts
|
|
62
|
+
* @returns selection
|
|
63
|
+
*/
|
|
64
|
+
export const selectPart = (index = 0, parts) => {
|
|
65
|
+
let selectionStart = 0;
|
|
66
|
+
let selectionEnd = 0;
|
|
67
|
+
for (let i = 0; i < parts.length; i += 1) {
|
|
68
|
+
const part = parts[i];
|
|
69
|
+
selectionEnd += part.value.length;
|
|
70
|
+
if (i === index) {
|
|
71
|
+
break;
|
|
72
|
+
}
|
|
73
|
+
selectionStart = selectionEnd;
|
|
74
|
+
}
|
|
75
|
+
return {
|
|
76
|
+
selectionStart,
|
|
77
|
+
selectionEnd
|
|
78
|
+
};
|
|
79
|
+
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { __decorate } from "tslib";
|
|
2
2
|
import { ControlElement, html, css, WarningNotice } from '@refinitiv-ui/core';
|
|
3
|
-
import { customElement } from '@refinitiv-ui/core/
|
|
4
|
-
import { property } from '@refinitiv-ui/core/
|
|
5
|
-
import { query } from '@refinitiv-ui/core/
|
|
6
|
-
import { ifDefined } from '@refinitiv-ui/core/
|
|
3
|
+
import { customElement } from '@refinitiv-ui/core/decorators/custom-element.js';
|
|
4
|
+
import { property } from '@refinitiv-ui/core/decorators/property.js';
|
|
5
|
+
import { query } from '@refinitiv-ui/core/decorators/query.js';
|
|
6
|
+
import { ifDefined } from '@refinitiv-ui/core/directives/if-defined.js';
|
|
7
7
|
import { VERSION } from '../version.js';
|
|
8
8
|
import '../calendar/index.js';
|
|
9
9
|
import '../icon/index.js';
|
|
@@ -15,7 +15,7 @@ import { getDateFNSLocale } from './locales.js';
|
|
|
15
15
|
import inputFormat from 'date-fns/esm/format/index.js';
|
|
16
16
|
import inputParse from 'date-fns/esm/parse/index.js';
|
|
17
17
|
import isValid from 'date-fns/esm/isValid/index.js';
|
|
18
|
-
import { addMonths, subMonths, isAfter, isBefore, isValidDate, isValidDateTime, DateFormat, DateTimeFormat, parse, format } from '@refinitiv-ui/utils/
|
|
18
|
+
import { addMonths, subMonths, isAfter, isBefore, isValidDate, isValidDateTime, DateFormat, DateTimeFormat, parse, format } from '@refinitiv-ui/utils/date.js';
|
|
19
19
|
import { DateTimeSegment, formatToView, getCurrentTime } from './utils.js';
|
|
20
20
|
import { preload } from '../icon/index.js';
|
|
21
21
|
preload('calendar', 'down', 'left', 'right'); /* preload calendar icons for faster loading */
|
|
@@ -727,7 +727,6 @@ let DatetimePicker = class DatetimePicker extends ControlElement {
|
|
|
727
727
|
* @returns {void}
|
|
728
728
|
*/
|
|
729
729
|
onCalendarValueChanged(event) {
|
|
730
|
-
var _a, _b;
|
|
731
730
|
const values = event.target.values;
|
|
732
731
|
this.interimSegments = values.map((value, index) => {
|
|
733
732
|
const segment = this.interimSegments[index] || new DateTimeSegment();
|
|
@@ -741,7 +740,7 @@ let DatetimePicker = class DatetimePicker extends ControlElement {
|
|
|
741
740
|
// in duplex mode, avoid jumping on views
|
|
742
741
|
// Therefore if any of values have changed, save the current view
|
|
743
742
|
if (this.isDuplex() && this.calendarEl && this.calendarToEl) {
|
|
744
|
-
this.notifyViewsChange([
|
|
743
|
+
this.notifyViewsChange([this.calendarEl?.view, this.calendarToEl?.view]);
|
|
745
744
|
}
|
|
746
745
|
// Close popup if there is no time picker
|
|
747
746
|
const newValues = this.values;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { format, DateFormat, parse, TimeFormat, toTimeSegment } from '@refinitiv-ui/utils/
|
|
1
|
+
import { format, DateFormat, parse, TimeFormat, toTimeSegment } from '@refinitiv-ui/utils/date.js';
|
|
2
2
|
/**
|
|
3
3
|
* A helper class to split date time string into date and time segments
|
|
4
4
|
*/
|
|
@@ -86,9 +86,8 @@ class DraggableManager {
|
|
|
86
86
|
* @returns {void}
|
|
87
87
|
*/
|
|
88
88
|
deregister(draggableElement) {
|
|
89
|
-
var _a;
|
|
90
89
|
if (this.draggableElements.has(draggableElement)) {
|
|
91
|
-
const handle =
|
|
90
|
+
const handle = this.draggableElements.get(draggableElement)?.handle;
|
|
92
91
|
if (handle) {
|
|
93
92
|
DraggableManager.removeHandleCursor(handle);
|
|
94
93
|
}
|
package/lib/dialog/index.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ import '../panel/index.js';
|
|
|
6
6
|
import '../header/index.js';
|
|
7
7
|
import '../button/index.js';
|
|
8
8
|
import { Translate } from '@refinitiv-ui/translate';
|
|
9
|
-
import '@refinitiv-ui/phrasebook/
|
|
9
|
+
import '@refinitiv-ui/phrasebook/locale/en/dialog.js';
|
|
10
10
|
/**
|
|
11
11
|
* Popup window, designed to contain and show any HTML content.
|
|
12
12
|
* It provides modal and dragging functionality,
|
package/lib/dialog/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { __decorate } from "tslib";
|
|
2
2
|
import { css, html } from '@refinitiv-ui/core';
|
|
3
|
-
import { customElement } from '@refinitiv-ui/core/
|
|
4
|
-
import { property } from '@refinitiv-ui/core/
|
|
5
|
-
import { query } from '@refinitiv-ui/core/
|
|
3
|
+
import { customElement } from '@refinitiv-ui/core/decorators/custom-element.js';
|
|
4
|
+
import { property } from '@refinitiv-ui/core/decorators/property.js';
|
|
5
|
+
import { query } from '@refinitiv-ui/core/decorators/query.js';
|
|
6
6
|
import { VERSION } from '../version.js';
|
|
7
|
-
import { isIE } from '@refinitiv-ui/utils/
|
|
7
|
+
import { isIE } from '@refinitiv-ui/utils/browser.js';
|
|
8
8
|
import { deregister as draggableDeregister, register as draggableRegister } from './draggable-element.js';
|
|
9
9
|
import { Overlay } from '../overlay/index.js';
|
|
10
10
|
import '../icon/index.js';
|
|
@@ -12,7 +12,7 @@ import '../panel/index.js';
|
|
|
12
12
|
import '../header/index.js';
|
|
13
13
|
import '../button/index.js';
|
|
14
14
|
import { translate, TranslatePropertyKey } from '@refinitiv-ui/translate';
|
|
15
|
-
import '@refinitiv-ui/phrasebook/
|
|
15
|
+
import '@refinitiv-ui/phrasebook/locale/en/dialog.js';
|
|
16
16
|
/**
|
|
17
17
|
* Popup window, designed to contain and show any HTML content.
|
|
18
18
|
* It provides modal and dragging functionality,
|
|
@@ -2,7 +2,7 @@ import { JSXInterface } from '../jsx';
|
|
|
2
2
|
import { PropertyValues } from '@refinitiv-ui/core';
|
|
3
3
|
import '../icon/index.js';
|
|
4
4
|
import { TextField } from '../text-field/index.js';
|
|
5
|
-
import { TemplateMap } from '@refinitiv-ui/core/
|
|
5
|
+
import { TemplateMap } from '@refinitiv-ui/core/directives/template-map.js';
|
|
6
6
|
/**
|
|
7
7
|
* A form control element for email.
|
|
8
8
|
*
|
package/lib/email-field/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { __decorate } from "tslib";
|
|
2
|
-
import { customElement } from '@refinitiv-ui/core/
|
|
3
|
-
import { property } from '@refinitiv-ui/core/
|
|
2
|
+
import { customElement } from '@refinitiv-ui/core/decorators/custom-element.js';
|
|
3
|
+
import { property } from '@refinitiv-ui/core/decorators/property.js';
|
|
4
4
|
import '../icon/index.js';
|
|
5
5
|
import { TextField } from '../text-field/index.js';
|
|
6
6
|
/**
|
|
@@ -60,7 +60,12 @@ let EmailField = class EmailField extends TextField {
|
|
|
60
60
|
* @returns template map
|
|
61
61
|
*/
|
|
62
62
|
get decorateInputMap() {
|
|
63
|
-
return
|
|
63
|
+
return {
|
|
64
|
+
...super.decorateInputMap,
|
|
65
|
+
'type': 'email',
|
|
66
|
+
'inputmode': 'email',
|
|
67
|
+
'multiple': this.multiple
|
|
68
|
+
};
|
|
64
69
|
}
|
|
65
70
|
/**
|
|
66
71
|
* Check if input should be re-validated
|
package/lib/flag/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { __decorate } from "tslib";
|
|
2
2
|
import { BasicElement, svg, css } from '@refinitiv-ui/core';
|
|
3
|
-
import { customElement } from '@refinitiv-ui/core/
|
|
4
|
-
import { property } from '@refinitiv-ui/core/
|
|
5
|
-
import { unsafeHTML } from '@refinitiv-ui/core/
|
|
3
|
+
import { customElement } from '@refinitiv-ui/core/decorators/custom-element.js';
|
|
4
|
+
import { property } from '@refinitiv-ui/core/decorators/property.js';
|
|
5
|
+
import { unsafeHTML } from '@refinitiv-ui/core/directives/unsafe-html.js';
|
|
6
6
|
import { VERSION } from '../version.js';
|
|
7
7
|
import { FlagLoader } from './utils/FlagLoader.js';
|
|
8
8
|
export { preload } from './utils/FlagLoader.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CdnLoader, Deferred } from '@refinitiv-ui/utils/
|
|
1
|
+
import { CdnLoader, Deferred } from '@refinitiv-ui/utils/loader.js';
|
|
2
2
|
const isUrl = (str) => (/^https?:\/\//i).test(str);
|
|
3
3
|
/**
|
|
4
4
|
* Caches and provides flag SVGs, Loaded either by name from CDN or directly by URL.
|
package/lib/header/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { __decorate } from "tslib";
|
|
2
2
|
import { BasicElement, html, css } from '@refinitiv-ui/core';
|
|
3
|
-
import { customElement } from '@refinitiv-ui/core/
|
|
4
|
-
import { property } from '@refinitiv-ui/core/
|
|
3
|
+
import { customElement } from '@refinitiv-ui/core/decorators/custom-element.js';
|
|
4
|
+
import { property } from '@refinitiv-ui/core/decorators/property.js';
|
|
5
5
|
import { VERSION } from '../version.js';
|
|
6
6
|
/**
|
|
7
7
|
* Use to identify and separate different sections of a page.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/* istanbul ignore file */
|
|
2
|
-
import { color, rgb, hsl } from '@refinitiv-ui/utils/
|
|
2
|
+
import { color, rgb, hsl } from '@refinitiv-ui/utils/color.js';
|
|
3
3
|
import { interpolate } from 'd3-interpolate';
|
|
4
4
|
/**
|
|
5
5
|
* Check if the color is a light color
|
|
@@ -16,8 +16,7 @@ const isLight = (col) => {
|
|
|
16
16
|
* @return a color brighter than original color
|
|
17
17
|
*/
|
|
18
18
|
const brighten = (colorString) => {
|
|
19
|
-
|
|
20
|
-
return ((_a = color(colorString)) === null || _a === void 0 ? void 0 : _a.brighter(0.8).toString()) || '';
|
|
19
|
+
return color(colorString)?.brighter(0.8).toString() || '';
|
|
21
20
|
};
|
|
22
21
|
/**
|
|
23
22
|
* Darkens a color
|
|
@@ -38,7 +37,6 @@ const darken = (colorString) => {
|
|
|
38
37
|
* @returns a new blended color
|
|
39
38
|
*/
|
|
40
39
|
const blend = (color1, color2, backgroundColor, amount) => {
|
|
41
|
-
var _a;
|
|
42
40
|
let primaryColor;
|
|
43
41
|
let secondaryColor;
|
|
44
42
|
if (amount >= 0) {
|
|
@@ -63,6 +61,6 @@ const blend = (color1, color2, backgroundColor, amount) => {
|
|
|
63
61
|
const red = mixRedComponent ? Math.round(interpolate(primaryColor.r, secondaryColor.r)(factor)) : primaryColor.r;
|
|
64
62
|
const green = mixGreenComponent ? Math.round(interpolate(primaryColor.g, secondaryColor.g)(factor)) : primaryColor.g;
|
|
65
63
|
const blue = mixBlueComponent ? Math.round(interpolate(primaryColor.b, secondaryColor.b)(factor)) : primaryColor.b;
|
|
66
|
-
return
|
|
64
|
+
return color(`rgb(${red}, ${green}, ${blue})`)?.toString() || '';
|
|
67
65
|
};
|
|
68
66
|
export { blend, brighten, darken, isLight, interpolate };
|
package/lib/heatmap/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { __decorate } from "tslib";
|
|
2
2
|
import { ResponsiveElement, html, css } from '@refinitiv-ui/core';
|
|
3
|
-
import { customElement } from '@refinitiv-ui/core/
|
|
4
|
-
import { property } from '@refinitiv-ui/core/
|
|
5
|
-
import { query } from '@refinitiv-ui/core/
|
|
3
|
+
import { customElement } from '@refinitiv-ui/core/decorators/custom-element.js';
|
|
4
|
+
import { property } from '@refinitiv-ui/core/decorators/property.js';
|
|
5
|
+
import { query } from '@refinitiv-ui/core/decorators/query.js';
|
|
6
6
|
import { VERSION } from '../version.js';
|
|
7
|
-
import { MicroTaskRunner } from '@refinitiv-ui/utils/
|
|
8
|
-
import { color } from '@refinitiv-ui/utils/
|
|
7
|
+
import { MicroTaskRunner } from '@refinitiv-ui/utils/async.js';
|
|
8
|
+
import { color } from '@refinitiv-ui/utils/color.js';
|
|
9
9
|
import '../canvas/index.js';
|
|
10
10
|
import '../tooltip/index.js';
|
|
11
11
|
import { Track } from './helpers/track.js';
|
|
@@ -235,8 +235,7 @@ let Heatmap = class Heatmap extends ResponsiveElement {
|
|
|
235
235
|
* @returns array of row data
|
|
236
236
|
*/
|
|
237
237
|
get rows() {
|
|
238
|
-
|
|
239
|
-
return this.config && Array.isArray((_a = this.config) === null || _a === void 0 ? void 0 : _a.data) ? this.config.data : [];
|
|
238
|
+
return this.config && Array.isArray(this.config?.data) ? this.config.data : [];
|
|
240
239
|
}
|
|
241
240
|
/**
|
|
242
241
|
* Get row count
|
|
@@ -250,9 +249,8 @@ let Heatmap = class Heatmap extends ResponsiveElement {
|
|
|
250
249
|
* @returns count of columns
|
|
251
250
|
*/
|
|
252
251
|
get columnCount() {
|
|
253
|
-
var _a;
|
|
254
252
|
let result = 0;
|
|
255
|
-
|
|
253
|
+
this.rows?.forEach(columns => {
|
|
256
254
|
if (columns.length > result) {
|
|
257
255
|
result = columns.length;
|
|
258
256
|
}
|
|
@@ -393,11 +391,10 @@ let Heatmap = class Heatmap extends ResponsiveElement {
|
|
|
393
391
|
*/
|
|
394
392
|
/* istanbul ignore next */
|
|
395
393
|
updateTooltipOverlayPosition(cell) {
|
|
396
|
-
var _a, _b, _c;
|
|
397
394
|
// Compensate x-axis height for overlay when x-axis is at top position
|
|
398
395
|
let marginOverlayTop = 0;
|
|
399
|
-
if (
|
|
400
|
-
marginOverlayTop = this.config.xAxis.position === 'bottom' ? 0 :
|
|
396
|
+
if (this.config?.xAxis && this.xAxis?.offsetHeight) {
|
|
397
|
+
marginOverlayTop = this.config.xAxis.position === 'bottom' ? 0 : this.xAxis?.offsetHeight;
|
|
401
398
|
}
|
|
402
399
|
// Update overlay position
|
|
403
400
|
this.tooltipOverlay.style.left = `${cell.x}px`;
|
|
@@ -481,8 +478,7 @@ let Heatmap = class Heatmap extends ResponsiveElement {
|
|
|
481
478
|
*/
|
|
482
479
|
/* istanbul ignore next */
|
|
483
480
|
resetCell(cell) {
|
|
484
|
-
|
|
485
|
-
(_a = this.canvasContext) === null || _a === void 0 ? void 0 : _a.clearRect(cell.x, cell.y, cell.width, cell.height);
|
|
481
|
+
this.canvasContext?.clearRect(cell.x, cell.y, cell.width, cell.height);
|
|
486
482
|
}
|
|
487
483
|
/**
|
|
488
484
|
* Fades a cell's background from one color to another
|
|
@@ -525,14 +521,13 @@ let Heatmap = class Heatmap extends ResponsiveElement {
|
|
|
525
521
|
* @returns {void}
|
|
526
522
|
*/
|
|
527
523
|
calculateCellData() {
|
|
528
|
-
var _a, _b, _c;
|
|
529
524
|
// Reset cell
|
|
530
525
|
this.cells = [];
|
|
531
526
|
if (!this.axisHidden) {
|
|
532
|
-
if (this.yAxis &&
|
|
527
|
+
if (this.yAxis && this.config?.yAxis) {
|
|
533
528
|
this.rowTrack.init(this.yAxis.offsetHeight, this.rowCount);
|
|
534
529
|
}
|
|
535
|
-
if (this.xAxis &&
|
|
530
|
+
if (this.xAxis && this.config?.xAxis) {
|
|
536
531
|
this.colTrack.init(this.xAxis.offsetWidth, this.columnCount);
|
|
537
532
|
}
|
|
538
533
|
}
|
|
@@ -545,7 +540,7 @@ let Heatmap = class Heatmap extends ResponsiveElement {
|
|
|
545
540
|
const cellHeader = cell && cell.header ? cell.header : '';
|
|
546
541
|
const cellIndex = rowIndex * this.colTrack.laneCount + columnIndex;
|
|
547
542
|
const foregroundColor = this.foregroundColor;
|
|
548
|
-
const backgroundColor =
|
|
543
|
+
const backgroundColor = this.getBackgroundColor(cellValue)?.toString() || '';
|
|
549
544
|
if (cellHeader) {
|
|
550
545
|
this.hasCellHeader = true;
|
|
551
546
|
}
|
|
@@ -821,8 +816,7 @@ let Heatmap = class Heatmap extends ResponsiveElement {
|
|
|
821
816
|
* @returns {void}
|
|
822
817
|
*/
|
|
823
818
|
paintAllCellBackground() {
|
|
824
|
-
|
|
825
|
-
(_a = this.canvasContext) === null || _a === void 0 ? void 0 : _a.clearRect(0, 0, this.canvas.width, this.canvas.height);
|
|
819
|
+
this.canvasContext?.clearRect(0, 0, this.canvas.width, this.canvas.height);
|
|
826
820
|
for (let index = 0; index < this.cells.length; index++) {
|
|
827
821
|
this.paintCellBackground(this.cells[index]);
|
|
828
822
|
}
|
|
@@ -843,11 +837,10 @@ let Heatmap = class Heatmap extends ResponsiveElement {
|
|
|
843
837
|
* @returns {void}
|
|
844
838
|
*/
|
|
845
839
|
renderAxisX() {
|
|
846
|
-
var _a;
|
|
847
840
|
if (!this.isSizeCalculated) {
|
|
848
841
|
return;
|
|
849
842
|
}
|
|
850
|
-
const axisConfig =
|
|
843
|
+
const axisConfig = this.config?.xAxis;
|
|
851
844
|
if (!this.xAxis || !this.yAxisBox || !axisConfig) {
|
|
852
845
|
return;
|
|
853
846
|
}
|
|
@@ -909,11 +902,10 @@ let Heatmap = class Heatmap extends ResponsiveElement {
|
|
|
909
902
|
* @returns {void}
|
|
910
903
|
*/
|
|
911
904
|
renderAxisY() {
|
|
912
|
-
var _a, _b;
|
|
913
905
|
if (!this.isSizeCalculated) {
|
|
914
906
|
return;
|
|
915
907
|
}
|
|
916
|
-
const axisConfig =
|
|
908
|
+
const axisConfig = this.config?.yAxis;
|
|
917
909
|
if (!this.yAxis || !axisConfig) {
|
|
918
910
|
return;
|
|
919
911
|
}
|
|
@@ -979,7 +971,7 @@ let Heatmap = class Heatmap extends ResponsiveElement {
|
|
|
979
971
|
}
|
|
980
972
|
element.textContent = labels[i] || nbsp;
|
|
981
973
|
}
|
|
982
|
-
if (this.xAxis &&
|
|
974
|
+
if (this.xAxis && this.config?.xAxis) {
|
|
983
975
|
// TODO: Wrong crossBox margin calculation when margin = 0.5px
|
|
984
976
|
this.crossBox.style.margin = `${this.cellMargin}px`;
|
|
985
977
|
this.crossBox.style.height = `${this.xAxis.children[0].offsetHeight}px`;
|
|
@@ -1015,16 +1007,15 @@ let Heatmap = class Heatmap extends ResponsiveElement {
|
|
|
1015
1007
|
* @return Render template
|
|
1016
1008
|
*/
|
|
1017
1009
|
render() {
|
|
1018
|
-
var _a, _b;
|
|
1019
1010
|
return html `
|
|
1020
1011
|
<div id="container" @mousemove=${this.onMouseMove} @mouseleave=${this.onMouseLeave}>
|
|
1021
|
-
${
|
|
1012
|
+
${this.config?.yAxis && !this.axisHidden ? html `
|
|
1022
1013
|
<div id="y-axis-container">
|
|
1023
1014
|
<div part="cross-box"></div>
|
|
1024
1015
|
<div part="y-axis"></div>
|
|
1025
1016
|
</div>` : null}
|
|
1026
1017
|
<div id="canvas-container">
|
|
1027
|
-
${
|
|
1018
|
+
${this.config?.xAxis && !this.axisHidden ? html `<div part="x-axis"></div>` : null}
|
|
1028
1019
|
<ef-canvas part="canvas" @resize=${this.onCanvasResize}></ef-canvas>
|
|
1029
1020
|
${this.tooltipCallback ? html `<div id="tooltip-overlay"></div>` : null}
|
|
1030
1021
|
</div>
|
package/lib/icon/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { __decorate } from "tslib";
|
|
2
2
|
import { BasicElement, svg, css } from '@refinitiv-ui/core';
|
|
3
|
-
import { customElement } from '@refinitiv-ui/core/
|
|
4
|
-
import { property } from '@refinitiv-ui/core/
|
|
5
|
-
import { unsafeSVG } from '@refinitiv-ui/core/
|
|
3
|
+
import { customElement } from '@refinitiv-ui/core/decorators/custom-element.js';
|
|
4
|
+
import { property } from '@refinitiv-ui/core/decorators/property.js';
|
|
5
|
+
import { unsafeSVG } from '@refinitiv-ui/core/directives/unsafe-svg.js';
|
|
6
6
|
import { VERSION } from '../version.js';
|
|
7
7
|
import { IconLoader } from './utils/IconLoader.js';
|
|
8
8
|
export { preload } from './utils/IconLoader.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CdnLoader, Deferred } from '@refinitiv-ui/utils/
|
|
1
|
+
import { CdnLoader, Deferred } from '@refinitiv-ui/utils/loader.js';
|
|
2
2
|
const isUrl = (str) => (/^(https?:\/{2}|\.?\/)/i).test(str);
|
|
3
3
|
/**
|
|
4
4
|
* Caches and provides icon SVGs, Loaded either by name from CDN or directly by URL.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { LineData, BarData, HistogramData, DeepPartial, ChartOptions, SeriesPartialOptions, LineSeriesPartialOptions, AreaSeriesPartialOptions, BarSeriesPartialOptions, CandlestickSeriesPartialOptions, HistogramSeriesPartialOptions, LineStyleOptions, AreaStyleOptions, BarStyleOptions, CandlestickStyleOptions, HistogramStyleOptions, ISeriesApi, SeriesType } from 'lightweight-charts';
|
|
2
|
-
import type { RGBColor, HSLColor } from '@refinitiv-ui/utils/
|
|
2
|
+
import type { RGBColor, HSLColor } from '@refinitiv-ui/utils/color.js';
|
|
3
3
|
declare type SeriesOptions = AreaSeriesPartialOptions | BarSeriesPartialOptions | CandlestickSeriesPartialOptions | HistogramSeriesPartialOptions | LineSeriesPartialOptions;
|
|
4
4
|
declare type SeriesStyleOptions = LineStyleOptions & AreaStyleOptions & BarStyleOptions & CandlestickStyleOptions & HistogramStyleOptions;
|
|
5
5
|
declare type SeriesData = LineData[] | BarData[] | HistogramData[];
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
var InteractiveChart_1;
|
|
2
2
|
import { __decorate } from "tslib";
|
|
3
3
|
import { ResponsiveElement, html, css, DeprecationNotice } from '@refinitiv-ui/core';
|
|
4
|
-
import { customElement } from '@refinitiv-ui/core/
|
|
5
|
-
import { property } from '@refinitiv-ui/core/
|
|
6
|
-
import { query } from '@refinitiv-ui/core/
|
|
4
|
+
import { customElement } from '@refinitiv-ui/core/decorators/custom-element.js';
|
|
5
|
+
import { property } from '@refinitiv-ui/core/decorators/property.js';
|
|
6
|
+
import { query } from '@refinitiv-ui/core/decorators/query.js';
|
|
7
7
|
import { VERSION } from '../version.js';
|
|
8
|
-
import { color as parseColor } from '@refinitiv-ui/utils/
|
|
8
|
+
import { color as parseColor } from '@refinitiv-ui/utils/color.js';
|
|
9
9
|
import { createChart as chart } from 'lightweight-charts';
|
|
10
10
|
import '../tooltip/index.js';
|
|
11
11
|
import { LegendStyle } from './helpers/types.js';
|
|
@@ -592,8 +592,7 @@ let InteractiveChart = InteractiveChart_1 = class InteractiveChart extends Respo
|
|
|
592
592
|
* @return position
|
|
593
593
|
*/
|
|
594
594
|
getPriceScalePosition() {
|
|
595
|
-
|
|
596
|
-
const priceScale = (_a = this.chart) === null || _a === void 0 ? void 0 : _a.options();
|
|
595
|
+
const priceScale = this.chart?.options();
|
|
597
596
|
if (priceScale.leftPriceScale.visible && priceScale.rightPriceScale.visible) {
|
|
598
597
|
return 'two-price';
|
|
599
598
|
}
|
|
@@ -661,14 +660,14 @@ let InteractiveChart = InteractiveChart_1 = class InteractiveChart extends Respo
|
|
|
661
660
|
let value;
|
|
662
661
|
let priceColor = '';
|
|
663
662
|
// When have price on event moved on the crosshair
|
|
664
|
-
if (
|
|
663
|
+
if (eventMove?.seriesPrices.get(this.seriesList[idx]) && eventMove.time) {
|
|
665
664
|
value = eventMove.seriesPrices.get(this.seriesList[idx]);
|
|
666
665
|
priceColor = this.getColorInSeries(eventMove, chartType, idx);
|
|
667
666
|
this.isCrosshairVisible = true;
|
|
668
667
|
this.hasDataPoint = true;
|
|
669
668
|
}
|
|
670
669
|
// when there's no data point in the series object.
|
|
671
|
-
else if (!
|
|
670
|
+
else if (!eventMove?.seriesPrices.get(this.seriesList[idx]) && eventMove?.time) {
|
|
672
671
|
value = NO_DATA_POINT;
|
|
673
672
|
this.isCrosshairVisible = true;
|
|
674
673
|
this.hasDataPoint = false;
|
|
@@ -811,7 +810,6 @@ let InteractiveChart = InteractiveChart_1 = class InteractiveChart extends Respo
|
|
|
811
810
|
* @returns {void}
|
|
812
811
|
*/
|
|
813
812
|
createTextPrice(rowLegend, price, priceColor, index) {
|
|
814
|
-
var _a;
|
|
815
813
|
const formatter = this.internalConfig.series[index].legendPriceFormatter;
|
|
816
814
|
// Formats legend only when formatter and data point are provided
|
|
817
815
|
const formattedPrice = !!formatter && price !== NO_DATA_POINT ? formatter(price) : price;
|
|
@@ -823,7 +821,7 @@ let InteractiveChart = InteractiveChart_1 = class InteractiveChart extends Respo
|
|
|
823
821
|
// Handle update text price when mouse crosshairMove in chart
|
|
824
822
|
else if (this.isNodeListElement(rowLegend)) {
|
|
825
823
|
const symbolElem = rowLegend[index].children[0];
|
|
826
|
-
const spanIndex =
|
|
824
|
+
const spanIndex = symbolElem.getAttribute('class')?.indexOf('symbol') === 0 ? 1 : 0;
|
|
827
825
|
const rowLegendElem = rowLegend[index];
|
|
828
826
|
rowLegendElem.children[spanIndex].textContent = `${formattedPrice}`;
|
|
829
827
|
rowLegendElem.children[spanIndex].style.color = `${priceColor}`;
|
|
@@ -889,12 +887,11 @@ let InteractiveChart = InteractiveChart_1 = class InteractiveChart extends Respo
|
|
|
889
887
|
* @returns color value
|
|
890
888
|
*/
|
|
891
889
|
getColorInSeries(seriesData, chartType, index) {
|
|
892
|
-
var _a;
|
|
893
890
|
if (chartType === 'line') {
|
|
894
891
|
return this.getLegendPriceColor(this.seriesList[index].options().color);
|
|
895
892
|
}
|
|
896
893
|
else if (chartType === 'candlestick') {
|
|
897
|
-
const value = seriesData.hasOwnProperty('seriesPrices') ?
|
|
894
|
+
const value = seriesData.hasOwnProperty('seriesPrices') ? seriesData?.seriesPrices.get(this.seriesList[index]) : seriesData;
|
|
898
895
|
const barStyle = this.seriesList[index].options();
|
|
899
896
|
const colorBar = value.close > value.open ? barStyle.borderUpColor : barStyle.borderDownColor;
|
|
900
897
|
return colorBar;
|
|
@@ -967,8 +964,7 @@ let InteractiveChart = InteractiveChart_1 = class InteractiveChart extends Respo
|
|
|
967
964
|
* @returns {void}
|
|
968
965
|
*/
|
|
969
966
|
updateLegendWithLatestData() {
|
|
970
|
-
|
|
971
|
-
if (this.rowLegend && !this.isCrosshairVisible && ((_a = this.config) === null || _a === void 0 ? void 0 : _a.hasOwnProperty('series'))) {
|
|
967
|
+
if (this.rowLegend && !this.isCrosshairVisible && this.config?.hasOwnProperty('series')) {
|
|
972
968
|
for (let idx = 0; idx < this.internalConfig.series.length; idx++) {
|
|
973
969
|
const chartType = this.internalConfig.series[idx].type;
|
|
974
970
|
const series = this.internalConfig.series[idx];
|