@refinitiv-ui/elements 6.1.1 → 6.2.1
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/CHANGELOG.md +31 -0
- package/lib/autosuggest/helpers/utils.js +1 -1
- package/lib/color-dialog/elements/palettes.js +1 -2
- package/lib/color-dialog/helpers/color-helpers.d.ts +0 -7
- package/lib/color-dialog/helpers/color-helpers.js +0 -15
- package/lib/color-dialog/helpers/value-model.js +1 -2
- package/lib/color-dialog/index.js +1 -2
- package/lib/color-picker/custom-elements.json +71 -0
- package/lib/color-picker/custom-elements.md +19 -0
- package/lib/color-picker/index.d.ts +130 -0
- package/lib/color-picker/index.js +235 -0
- package/lib/color-picker/themes/halo/dark/index.js +3 -0
- package/lib/color-picker/themes/halo/light/index.js +3 -0
- package/lib/color-picker/themes/solar/charcoal/index.js +3 -0
- package/lib/color-picker/themes/solar/pearl/index.js +3 -0
- package/lib/dialog/index.d.ts +6 -4
- package/lib/dialog/index.js +12 -4
- package/lib/heatmap/index.js +1 -0
- package/lib/interactive-chart/index.d.ts +11 -7
- package/lib/interactive-chart/index.js +35 -25
- package/lib/interactive-chart/themes/halo/dark/index.js +1 -1
- package/lib/interactive-chart/themes/halo/light/index.js +1 -1
- package/lib/interactive-chart/themes/solar/charcoal/index.js +1 -1
- package/lib/interactive-chart/themes/solar/pearl/index.js +1 -1
- package/lib/item/custom-elements.json +0 -5
- package/lib/item/custom-elements.md +0 -1
- package/lib/item/index.d.ts +36 -8
- package/lib/item/index.js +71 -18
- package/lib/version.js +1 -1
- package/package.json +21 -16
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,37 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [6.2.1](https://github.com/Refinitiv/refinitiv-ui/compare/@refinitiv-ui/elements@6.2.0...@refinitiv-ui/elements@6.2.1) (2022-09-26)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **autosuggest:** fix invalid label when disabled suggestion item ([#451](https://github.com/Refinitiv/refinitiv-ui/issues/451)) ([1944007](https://github.com/Refinitiv/refinitiv-ui/commit/194400774dece311856bc9bd0f80a17362a9466e))
|
|
12
|
+
* **configurations:** move import extension eslint rule to local env ([#459](https://github.com/Refinitiv/refinitiv-ui/issues/459)) ([f8a9e1a](https://github.com/Refinitiv/refinitiv-ui/commit/f8a9e1a710901028da57e314ff5a879dab5d9e73))
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
# [6.2.0](https://github.com/Refinitiv/refinitiv-ui/compare/@refinitiv-ui/elements@6.1.1...@refinitiv-ui/elements@6.2.0) (2022-09-14)
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
### Bug Fixes
|
|
22
|
+
|
|
23
|
+
* **color-picker:** update snapshot and remove backdrop ([#447](https://github.com/Refinitiv/refinitiv-ui/issues/447)) ([d6c086c](https://github.com/Refinitiv/refinitiv-ui/commit/d6c086c4ab405d8183258c72bc566f4bb640a635))
|
|
24
|
+
* **dialog:** change withBackdrop and withShadow to proprerty ([#445](https://github.com/Refinitiv/refinitiv-ui/issues/445)) ([2740f00](https://github.com/Refinitiv/refinitiv-ui/commit/2740f008b5163a396dd244570a93064bf0c8d844))
|
|
25
|
+
* **interactive-chart:** fix left position on legend ([#449](https://github.com/Refinitiv/refinitiv-ui/issues/449)) ([ede4f93](https://github.com/Refinitiv/refinitiv-ui/commit/ede4f93776671f9261675a3a0d5bd32a62c317d5))
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
### Features
|
|
29
|
+
|
|
30
|
+
* **color-picker:** add color picker ([#444](https://github.com/Refinitiv/refinitiv-ui/issues/444)) ([3718003](https://github.com/Refinitiv/refinitiv-ui/commit/37180039a77d908acd731c89067ecfce3f23955f))
|
|
31
|
+
* **item:** show tooltip when text ellipsis ([#394](https://github.com/Refinitiv/refinitiv-ui/issues/394)) ([8943eb6](https://github.com/Refinitiv/refinitiv-ui/commit/8943eb625bfd54a6014f6815940eacd924d67ab4))
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
6
37
|
## [6.1.1](https://github.com/Refinitiv/refinitiv-ui/compare/@refinitiv-ui/elements@6.1.0...@refinitiv-ui/elements@6.1.1) (2022-08-29)
|
|
7
38
|
|
|
8
39
|
|
|
@@ -3,8 +3,7 @@ import { BasicElement, svg } from '@refinitiv-ui/core';
|
|
|
3
3
|
import { property } from '@refinitiv-ui/core/decorators/property.js';
|
|
4
4
|
import { query } from '@refinitiv-ui/core/decorators/query.js';
|
|
5
5
|
import { VERSION } from '../../version.js';
|
|
6
|
-
import { rgb } from '@refinitiv-ui/utils/color.js';
|
|
7
|
-
import { isHex } from '../helpers/color-helpers.js';
|
|
6
|
+
import { rgb, isHex } from '@refinitiv-ui/utils/color.js';
|
|
8
7
|
/**
|
|
9
8
|
* Element base class usually used
|
|
10
9
|
* for creating palettes elements.
|
|
@@ -7,10 +7,3 @@ export declare const COLOR_ITEMS: string[][];
|
|
|
7
7
|
*/
|
|
8
8
|
export declare const GRAYSCALE_ITEMS: string[][];
|
|
9
9
|
export declare const NOCOLOR_POINTS = "6, 2, 15, 6, 15, 17, 6, 21, -3, 17, -3, 6";
|
|
10
|
-
export declare const isHex: (value: string) => boolean;
|
|
11
|
-
/**
|
|
12
|
-
* Remove hash (#) sign from hex value
|
|
13
|
-
* @param hex Hex to check
|
|
14
|
-
* @returns hex value without # sign
|
|
15
|
-
*/
|
|
16
|
-
export declare const removeHashSign: (hex: string) => string;
|
|
@@ -144,18 +144,3 @@ export const GRAYSCALE_ITEMS = [
|
|
|
144
144
|
['155, 2, 164, 6, 164, 17, 155, 21, 146, 17, 146, 6', '#000000']
|
|
145
145
|
];
|
|
146
146
|
export const NOCOLOR_POINTS = '6, 2, 15, 6, 15, 17, 6, 21, -3, 17, -3, 6';
|
|
147
|
-
const HEX_REGEXP = /^#([0-9A-F]{3}){1,2}$/i; // used to validate HEX
|
|
148
|
-
export const isHex = (value) => HEX_REGEXP.test(value);
|
|
149
|
-
/**
|
|
150
|
-
* Remove hash (#) sign from hex value
|
|
151
|
-
* @param hex Hex to check
|
|
152
|
-
* @returns hex value without # sign
|
|
153
|
-
*/
|
|
154
|
-
export const removeHashSign = (hex) => {
|
|
155
|
-
if (hex) {
|
|
156
|
-
if (hex.startsWith('#')) {
|
|
157
|
-
hex = hex.slice(1);
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
return hex;
|
|
161
|
-
};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { rgb } from '@refinitiv-ui/utils/color.js';
|
|
2
|
-
import { isHex } from './color-helpers.js';
|
|
1
|
+
import { rgb, isHex } from '@refinitiv-ui/utils/color.js';
|
|
3
2
|
const rgbNumberToString = (value) => isNaN(value) ? '' : `${value}`; // replace NaN with empty string
|
|
4
3
|
/**
|
|
5
4
|
* A helper model in order to keep and update values between RGB and HEX
|
|
@@ -4,10 +4,9 @@ import { customElement } from '@refinitiv-ui/core/decorators/custom-element.js';
|
|
|
4
4
|
import { property } from '@refinitiv-ui/core/decorators/property.js';
|
|
5
5
|
import { query } from '@refinitiv-ui/core/decorators/query.js';
|
|
6
6
|
import { styleMap } from '@refinitiv-ui/core/directives/style-map.js';
|
|
7
|
-
import { rgb } from '@refinitiv-ui/utils/color.js';
|
|
7
|
+
import { rgb, isHex, removeHashSign } from '@refinitiv-ui/utils/color.js';
|
|
8
8
|
import { VERSION } from '../version.js';
|
|
9
9
|
import { ValueModel } from './helpers/value-model.js';
|
|
10
|
-
import { isHex, removeHashSign } from './helpers/color-helpers.js';
|
|
11
10
|
import '../button/index.js';
|
|
12
11
|
import '../number-field/index.js';
|
|
13
12
|
import '../text-field/index.js';
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": "experimental",
|
|
3
|
+
"tags": [
|
|
4
|
+
{
|
|
5
|
+
"name": "ef-color-picker",
|
|
6
|
+
"description": "\nColor picker control",
|
|
7
|
+
"attributes": [
|
|
8
|
+
{
|
|
9
|
+
"name": "allow-nocolor",
|
|
10
|
+
"description": "Set the color dialog to activate no-color option",
|
|
11
|
+
"type": "boolean",
|
|
12
|
+
"default": "false"
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
"name": "opened",
|
|
16
|
+
"description": "Toggles the opened state of the dialog",
|
|
17
|
+
"type": "boolean",
|
|
18
|
+
"default": "false"
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
"name": "readonly",
|
|
22
|
+
"description": "Set readonly state",
|
|
23
|
+
"type": "boolean",
|
|
24
|
+
"default": "false"
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
"name": "disabled",
|
|
28
|
+
"description": "Set disabled state",
|
|
29
|
+
"type": "boolean",
|
|
30
|
+
"default": "false"
|
|
31
|
+
}
|
|
32
|
+
],
|
|
33
|
+
"properties": [
|
|
34
|
+
{
|
|
35
|
+
"name": "allowNocolor",
|
|
36
|
+
"attribute": "allow-nocolor",
|
|
37
|
+
"description": "Set the color dialog to activate no-color option",
|
|
38
|
+
"type": "boolean",
|
|
39
|
+
"default": "false"
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
"name": "opened",
|
|
43
|
+
"attribute": "opened",
|
|
44
|
+
"description": "Toggles the opened state of the dialog",
|
|
45
|
+
"type": "boolean",
|
|
46
|
+
"default": "false"
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
"name": "readonly",
|
|
50
|
+
"attribute": "readonly",
|
|
51
|
+
"description": "Set readonly state",
|
|
52
|
+
"type": "boolean",
|
|
53
|
+
"default": "false"
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
"name": "disabled",
|
|
57
|
+
"attribute": "disabled",
|
|
58
|
+
"description": "Set disabled state",
|
|
59
|
+
"type": "boolean",
|
|
60
|
+
"default": "false"
|
|
61
|
+
}
|
|
62
|
+
],
|
|
63
|
+
"events": [
|
|
64
|
+
{
|
|
65
|
+
"name": "value-changed",
|
|
66
|
+
"description": "Dispatched when value changes"
|
|
67
|
+
}
|
|
68
|
+
]
|
|
69
|
+
}
|
|
70
|
+
]
|
|
71
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# ef-color-picker
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
Color picker control
|
|
5
|
+
|
|
6
|
+
## Properties
|
|
7
|
+
|
|
8
|
+
| Property | Attribute | Type | Default | Description |
|
|
9
|
+
|----------------|-----------------|-----------|---------|--------------------------------------------------|
|
|
10
|
+
| `allowNocolor` | `allow-nocolor` | `boolean` | false | Set the color dialog to activate no-color option |
|
|
11
|
+
| `disabled` | `disabled` | `boolean` | false | Set disabled state |
|
|
12
|
+
| `opened` | `opened` | `boolean` | false | Toggles the opened state of the dialog |
|
|
13
|
+
| `readonly` | `readonly` | `boolean` | false | Set readonly state |
|
|
14
|
+
|
|
15
|
+
## Events
|
|
16
|
+
|
|
17
|
+
| Event | Description |
|
|
18
|
+
|-----------------|-------------------------------|
|
|
19
|
+
| `value-changed` | Dispatched when value changes |
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import { JSXInterface } from '../jsx';
|
|
2
|
+
import { ControlElement, PropertyValues, TemplateResult, CSSResult } from '@refinitiv-ui/core';
|
|
3
|
+
import '../color-dialog/index.js';
|
|
4
|
+
import '@refinitiv-ui/phrasebook/locale/en/color-picker.js';
|
|
5
|
+
/**
|
|
6
|
+
*
|
|
7
|
+
* Color picker control
|
|
8
|
+
* @fires value-changed - Dispatched when value changes
|
|
9
|
+
*
|
|
10
|
+
* @attr {boolean} readonly - Set readonly state
|
|
11
|
+
* @prop {boolean} [readonly=false] - Set readonly state
|
|
12
|
+
*
|
|
13
|
+
* @attr {boolean} disabled - Set disabled state
|
|
14
|
+
* @prop {boolean} [disabled=false] - Set disabled state
|
|
15
|
+
*/
|
|
16
|
+
export declare class ColorPicker extends ControlElement {
|
|
17
|
+
/**
|
|
18
|
+
* Element version number
|
|
19
|
+
* @returns version number
|
|
20
|
+
*/
|
|
21
|
+
static get version(): string;
|
|
22
|
+
/**
|
|
23
|
+
* Set the color dialog to activate no-color option
|
|
24
|
+
*/
|
|
25
|
+
allowNocolor: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Set lang to color dialog
|
|
28
|
+
* @ignore
|
|
29
|
+
*/
|
|
30
|
+
lang: string;
|
|
31
|
+
/**
|
|
32
|
+
* A `CSSResult` that will be used
|
|
33
|
+
* to style the host, slotted children
|
|
34
|
+
* and the internal template of the element.
|
|
35
|
+
* @returns CSS template
|
|
36
|
+
*/
|
|
37
|
+
static get styles(): CSSResult | CSSResult[];
|
|
38
|
+
private lazyRendered;
|
|
39
|
+
/**
|
|
40
|
+
* Toggles the opened state of the dialog
|
|
41
|
+
*/
|
|
42
|
+
opened: boolean;
|
|
43
|
+
private dialogEl?;
|
|
44
|
+
/**
|
|
45
|
+
* Check if value is valid HEX value (including #)
|
|
46
|
+
* @param value Value to check
|
|
47
|
+
* @returns true if value is valid
|
|
48
|
+
*/
|
|
49
|
+
protected isValidValue(value: string): boolean;
|
|
50
|
+
/**
|
|
51
|
+
* Used to show a warning when the value does not pass the validation
|
|
52
|
+
* @param value that is invalid
|
|
53
|
+
* @returns {void}
|
|
54
|
+
*/
|
|
55
|
+
protected warnInvalidValue(value: string): void;
|
|
56
|
+
/**
|
|
57
|
+
* Return true if popup can be opened
|
|
58
|
+
*/
|
|
59
|
+
private get canOpenPopup();
|
|
60
|
+
/**
|
|
61
|
+
* Called after the component is first rendered
|
|
62
|
+
* @param changedProperties Properties which have changed
|
|
63
|
+
* @returns {void}
|
|
64
|
+
*/
|
|
65
|
+
protected firstUpdated(changedProperties: PropertyValues): void;
|
|
66
|
+
/**
|
|
67
|
+
* Updates the element
|
|
68
|
+
* @param changedProperties Properties that has changed
|
|
69
|
+
* @returns {void}
|
|
70
|
+
*/
|
|
71
|
+
protected update(changedProperties: PropertyValues): void;
|
|
72
|
+
/**
|
|
73
|
+
* Run on tap event
|
|
74
|
+
* @param event Tap event
|
|
75
|
+
* @returns {void}
|
|
76
|
+
*/
|
|
77
|
+
private onTap;
|
|
78
|
+
/**
|
|
79
|
+
* Handles key input on color picker
|
|
80
|
+
* @param event Key down event object
|
|
81
|
+
* @returns {void}
|
|
82
|
+
*/
|
|
83
|
+
private onKeyDown;
|
|
84
|
+
/**
|
|
85
|
+
* Set opened state with event
|
|
86
|
+
* @param opened True if opened
|
|
87
|
+
* @returns {void}
|
|
88
|
+
*/
|
|
89
|
+
private setOpened;
|
|
90
|
+
/**
|
|
91
|
+
* Run on color dialog value-changed event
|
|
92
|
+
* @param event value-changed event
|
|
93
|
+
* @returns {void}
|
|
94
|
+
*/
|
|
95
|
+
private onColorDialogValueChanged;
|
|
96
|
+
/**
|
|
97
|
+
* Run on color dialog opened-changed event
|
|
98
|
+
* @param event opened-changed event
|
|
99
|
+
* @returns {void}
|
|
100
|
+
*/
|
|
101
|
+
private onColorDialogOpenedChanged;
|
|
102
|
+
/**
|
|
103
|
+
* Color dialog template
|
|
104
|
+
*/
|
|
105
|
+
private get dialogTemplate();
|
|
106
|
+
/**
|
|
107
|
+
* Color item template
|
|
108
|
+
*/
|
|
109
|
+
private get colorItemTemplate();
|
|
110
|
+
/**
|
|
111
|
+
* A `TemplateResult` that will be used
|
|
112
|
+
* to render the updated internal template.
|
|
113
|
+
* @return Render template
|
|
114
|
+
*/
|
|
115
|
+
protected render(): TemplateResult;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
declare global {
|
|
119
|
+
interface HTMLElementTagNameMap {
|
|
120
|
+
'ef-color-picker': ColorPicker;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
namespace JSX {
|
|
124
|
+
interface IntrinsicElements {
|
|
125
|
+
'ef-color-picker': Partial<ColorPicker> | JSXInterface.ControlHTMLAttributes<ColorPicker>;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
export {};
|
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
import { __decorate } from "tslib";
|
|
2
|
+
import { ControlElement, html, css, WarningNotice } 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 { styleMap } from '@refinitiv-ui/core/directives/style-map.js';
|
|
7
|
+
import { ifDefined } from '@refinitiv-ui/core/directives/if-defined.js';
|
|
8
|
+
import { VERSION } from '../version.js';
|
|
9
|
+
import { isHex } from '@refinitiv-ui/utils/color.js';
|
|
10
|
+
import '../color-dialog/index.js';
|
|
11
|
+
import '@refinitiv-ui/phrasebook/locale/en/color-picker.js';
|
|
12
|
+
const DIALOG_POSITION = ['right-start', 'right-end', 'right-middle', 'left-start', 'left-end', 'left-middle'];
|
|
13
|
+
/**
|
|
14
|
+
*
|
|
15
|
+
* Color picker control
|
|
16
|
+
* @fires value-changed - Dispatched when value changes
|
|
17
|
+
*
|
|
18
|
+
* @attr {boolean} readonly - Set readonly state
|
|
19
|
+
* @prop {boolean} [readonly=false] - Set readonly state
|
|
20
|
+
*
|
|
21
|
+
* @attr {boolean} disabled - Set disabled state
|
|
22
|
+
* @prop {boolean} [disabled=false] - Set disabled state
|
|
23
|
+
*/
|
|
24
|
+
let ColorPicker = class ColorPicker extends ControlElement {
|
|
25
|
+
constructor() {
|
|
26
|
+
super(...arguments);
|
|
27
|
+
/**
|
|
28
|
+
* Set the color dialog to activate no-color option
|
|
29
|
+
*/
|
|
30
|
+
this.allowNocolor = false;
|
|
31
|
+
/**
|
|
32
|
+
* Set lang to color dialog
|
|
33
|
+
* @ignore
|
|
34
|
+
*/
|
|
35
|
+
this.lang = '';
|
|
36
|
+
this.lazyRendered = false; /* speed up rendering by not populating color dialog on first load */
|
|
37
|
+
/**
|
|
38
|
+
* Toggles the opened state of the dialog
|
|
39
|
+
*/
|
|
40
|
+
this.opened = false;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Element version number
|
|
44
|
+
* @returns version number
|
|
45
|
+
*/
|
|
46
|
+
static get version() {
|
|
47
|
+
return VERSION;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* A `CSSResult` that will be used
|
|
51
|
+
* to style the host, slotted children
|
|
52
|
+
* and the internal template of the element.
|
|
53
|
+
* @returns CSS template
|
|
54
|
+
*/
|
|
55
|
+
static get styles() {
|
|
56
|
+
return css `
|
|
57
|
+
:host {
|
|
58
|
+
display: inline-block;
|
|
59
|
+
}
|
|
60
|
+
[part=color-item][no-color] {
|
|
61
|
+
background: linear-gradient(to bottom right, transparent calc(50% - 1px),
|
|
62
|
+
var(--no-color-line-color, #ff0000) calc(50% - 1px),
|
|
63
|
+
var(--no-color-line-color, #ff0000) calc(50% + 1px),
|
|
64
|
+
transparent calc(50% + 1px));
|
|
65
|
+
}
|
|
66
|
+
`;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Check if value is valid HEX value (including #)
|
|
70
|
+
* @param value Value to check
|
|
71
|
+
* @returns true if value is valid
|
|
72
|
+
*/
|
|
73
|
+
isValidValue(value) {
|
|
74
|
+
return value === '' || isHex(value);
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Used to show a warning when the value does not pass the validation
|
|
78
|
+
* @param value that is invalid
|
|
79
|
+
* @returns {void}
|
|
80
|
+
*/
|
|
81
|
+
warnInvalidValue(value) {
|
|
82
|
+
new WarningNotice(`The specified value "${value}" is not valid value. The correct value should look like "#fff" or "#ffffff".`).show();
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Return true if popup can be opened
|
|
86
|
+
*/
|
|
87
|
+
get canOpenPopup() {
|
|
88
|
+
return !(this.disabled || this.readonly);
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Called after the component is first rendered
|
|
92
|
+
* @param changedProperties Properties which have changed
|
|
93
|
+
* @returns {void}
|
|
94
|
+
*/
|
|
95
|
+
firstUpdated(changedProperties) {
|
|
96
|
+
super.firstUpdated(changedProperties);
|
|
97
|
+
this.addEventListener('tap', this.onTap);
|
|
98
|
+
this.addEventListener('keydown', this.onKeyDown);
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Updates the element
|
|
102
|
+
* @param changedProperties Properties that has changed
|
|
103
|
+
* @returns {void}
|
|
104
|
+
*/
|
|
105
|
+
update(changedProperties) {
|
|
106
|
+
if (changedProperties.has('opened') && this.opened) {
|
|
107
|
+
this.lazyRendered = true;
|
|
108
|
+
}
|
|
109
|
+
// make sure to close dialog for disabled
|
|
110
|
+
if (this.opened && !this.canOpenPopup) {
|
|
111
|
+
this.opened = false; /* this cannot be nor stopped nor listened */
|
|
112
|
+
}
|
|
113
|
+
super.update(changedProperties);
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Run on tap event
|
|
117
|
+
* @param event Tap event
|
|
118
|
+
* @returns {void}
|
|
119
|
+
*/
|
|
120
|
+
onTap(event) {
|
|
121
|
+
const path = event.composedPath();
|
|
122
|
+
if ((this.dialogEl && path.includes(this.dialogEl)) || event.defaultPrevented) {
|
|
123
|
+
return; /* dialog is managed separately */
|
|
124
|
+
}
|
|
125
|
+
this.setOpened(!this.opened);
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Handles key input on color picker
|
|
129
|
+
* @param event Key down event object
|
|
130
|
+
* @returns {void}
|
|
131
|
+
*/
|
|
132
|
+
onKeyDown(event) {
|
|
133
|
+
if (event.defaultPrevented) {
|
|
134
|
+
return;
|
|
135
|
+
}
|
|
136
|
+
switch (event.key) {
|
|
137
|
+
case 'Enter':
|
|
138
|
+
case ' ':
|
|
139
|
+
case 'Spacebar':
|
|
140
|
+
this.setOpened(true);
|
|
141
|
+
break;
|
|
142
|
+
default:
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
145
|
+
event.preventDefault();
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Set opened state with event
|
|
149
|
+
* @param opened True if opened
|
|
150
|
+
* @returns {void}
|
|
151
|
+
*/
|
|
152
|
+
setOpened(opened) {
|
|
153
|
+
if (opened && !this.canOpenPopup) { /* never allow to open popup if cannot do so */
|
|
154
|
+
return;
|
|
155
|
+
}
|
|
156
|
+
if (this.opened !== opened) {
|
|
157
|
+
this.opened = opened;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* Run on color dialog value-changed event
|
|
162
|
+
* @param event value-changed event
|
|
163
|
+
* @returns {void}
|
|
164
|
+
*/
|
|
165
|
+
onColorDialogValueChanged(event) {
|
|
166
|
+
const value = event.detail.value;
|
|
167
|
+
this.value = value;
|
|
168
|
+
this.setAttribute('value', this.value);
|
|
169
|
+
this.notifyPropertyChange('value', this.value);
|
|
170
|
+
this.setOpened(false);
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* Run on color dialog opened-changed event
|
|
174
|
+
* @param event opened-changed event
|
|
175
|
+
* @returns {void}
|
|
176
|
+
*/
|
|
177
|
+
onColorDialogOpenedChanged(event) {
|
|
178
|
+
this.setOpened(event.detail.value);
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* Color dialog template
|
|
182
|
+
*/
|
|
183
|
+
get dialogTemplate() {
|
|
184
|
+
if (this.lazyRendered) {
|
|
185
|
+
return html `<ef-color-dialog
|
|
186
|
+
offset="4"
|
|
187
|
+
part="dialog"
|
|
188
|
+
.lang=${ifDefined(this.lang || undefined)}
|
|
189
|
+
.value=${this.value}
|
|
190
|
+
.focusBoundary=${this}
|
|
191
|
+
.positionTarget=${this}
|
|
192
|
+
.position=${DIALOG_POSITION}
|
|
193
|
+
.withBackdrop=${false}
|
|
194
|
+
?opened=${this.opened}
|
|
195
|
+
?allow-nocolor=${this.allowNocolor}
|
|
196
|
+
@opened-changed=${this.onColorDialogOpenedChanged}
|
|
197
|
+
@value-changed=${this.onColorDialogValueChanged}></ef-color-dialog>`;
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
201
|
+
* Color item template
|
|
202
|
+
*/
|
|
203
|
+
get colorItemTemplate() {
|
|
204
|
+
return html `<div part="color-item" ?no-color=${!this.value} style=${styleMap({ backgroundColor: this.value })}></div>`;
|
|
205
|
+
}
|
|
206
|
+
/**
|
|
207
|
+
* A `TemplateResult` that will be used
|
|
208
|
+
* to render the updated internal template.
|
|
209
|
+
* @return Render template
|
|
210
|
+
*/
|
|
211
|
+
render() {
|
|
212
|
+
return html `
|
|
213
|
+
${this.colorItemTemplate}
|
|
214
|
+
${this.dialogTemplate}
|
|
215
|
+
`;
|
|
216
|
+
}
|
|
217
|
+
};
|
|
218
|
+
__decorate([
|
|
219
|
+
property({ type: Boolean, attribute: 'allow-nocolor' })
|
|
220
|
+
], ColorPicker.prototype, "allowNocolor", void 0);
|
|
221
|
+
__decorate([
|
|
222
|
+
property({ type: String })
|
|
223
|
+
], ColorPicker.prototype, "lang", void 0);
|
|
224
|
+
__decorate([
|
|
225
|
+
property({ type: Boolean, reflect: true })
|
|
226
|
+
], ColorPicker.prototype, "opened", void 0);
|
|
227
|
+
__decorate([
|
|
228
|
+
query('[part=dialog]')
|
|
229
|
+
], ColorPicker.prototype, "dialogEl", void 0);
|
|
230
|
+
ColorPicker = __decorate([
|
|
231
|
+
customElement('ef-color-picker', {
|
|
232
|
+
alias: 'emerald-color-picker'
|
|
233
|
+
})
|
|
234
|
+
], ColorPicker);
|
|
235
|
+
export { ColorPicker };
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import '@refinitiv-ui/elements/color-dialog/themes/halo/dark';
|
|
2
|
+
|
|
3
|
+
elf.customStyles.define('ef-color-picker', ':host{outline:0;box-sizing:border-box;height:24px;min-width:24px;border:1px solid #404040}:host([disabled]),:host([readonly]){border-color:rgba(64,64,64,.5)}:host [part=color-item]{cursor:pointer;height:100%}:host([disabled]) [part=color-item],:host([readonly]) [part=color-item]{pointer-events:none}:host([focused=visible]){border-color:#334bff}:host(:not([readonly]):not([disabled]):not([focused]):hover){border-color:grey}');
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import '@refinitiv-ui/elements/color-dialog/themes/halo/light';
|
|
2
|
+
|
|
3
|
+
elf.customStyles.define('ef-color-picker', ':host{outline:0;box-sizing:border-box;height:24px;min-width:24px;border:1px solid #595959}:host([disabled]),:host([readonly]){border-color:rgba(89,89,89,.5)}:host [part=color-item]{cursor:pointer;height:100%}:host([disabled]) [part=color-item],:host([readonly]) [part=color-item]{pointer-events:none}:host([focused=visible]){border-color:#334bff}:host(:not([readonly]):not([disabled]):not([focused]):hover){border-color:#0d0d0d}');
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import '@refinitiv-ui/elements/color-dialog/themes/solar/charcoal';
|
|
2
|
+
|
|
3
|
+
elf.customStyles.define('ef-color-picker', ':host{outline:0;box-sizing:border-box;height:23px;min-width:23px;border:1px solid #4a4a52}:host([disabled]),:host([readonly]){border-color:rgba(74,74,82,.6)}:host [part=color-item]{cursor:pointer;height:100%}:host([disabled]) [part=color-item],:host([readonly]) [part=color-item]{pointer-events:none}:host([focused=visible]){border-color:#f93;border-style:dotted}');
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import '@refinitiv-ui/elements/color-dialog/themes/solar/pearl';
|
|
2
|
+
|
|
3
|
+
elf.customStyles.define('ef-color-picker', ':host{outline:0;box-sizing:border-box;height:23px;min-width:23px;border:1px solid #a9afba}:host([disabled]),:host([readonly]){border-color:rgba(169,175,186,.6)}:host [part=color-item]{cursor:pointer;height:100%}:host([disabled]) [part=color-item],:host([readonly]) [part=color-item]{pointer-events:none}:host([focused=visible]){border-color:#f93;border-style:dotted}');
|
package/lib/dialog/index.d.ts
CHANGED
|
@@ -85,12 +85,14 @@ export declare class Dialog extends Overlay {
|
|
|
85
85
|
private footerElement;
|
|
86
86
|
noCancelOnOutsideClick: boolean;
|
|
87
87
|
/**
|
|
88
|
-
|
|
89
|
-
|
|
88
|
+
* @ignore
|
|
89
|
+
* Hiding from document to avoid property overridden
|
|
90
|
+
*/
|
|
90
91
|
withBackdrop: boolean;
|
|
91
92
|
/**
|
|
92
|
-
|
|
93
|
-
|
|
93
|
+
* @ignore
|
|
94
|
+
* Hiding from document to avoid property overridden
|
|
95
|
+
*/
|
|
94
96
|
withShadow: boolean;
|
|
95
97
|
disconnectedCallback(): void;
|
|
96
98
|
/**
|
package/lib/dialog/index.js
CHANGED
|
@@ -61,12 +61,14 @@ let Dialog = class Dialog extends Overlay {
|
|
|
61
61
|
this.draggable = false;
|
|
62
62
|
this.noCancelOnOutsideClick = true;
|
|
63
63
|
/**
|
|
64
|
-
|
|
65
|
-
|
|
64
|
+
* @ignore
|
|
65
|
+
* Hiding from document to avoid property overridden
|
|
66
|
+
*/
|
|
66
67
|
this.withBackdrop = true;
|
|
67
68
|
/**
|
|
68
|
-
|
|
69
|
-
|
|
69
|
+
* @ignore
|
|
70
|
+
* Hiding from document to avoid property overridden
|
|
71
|
+
*/
|
|
70
72
|
this.withShadow = true;
|
|
71
73
|
}
|
|
72
74
|
/**
|
|
@@ -345,6 +347,12 @@ __decorate([
|
|
|
345
347
|
__decorate([
|
|
346
348
|
query('[part=footer]')
|
|
347
349
|
], Dialog.prototype, "footerElement", void 0);
|
|
350
|
+
__decorate([
|
|
351
|
+
property({ type: Boolean, attribute: false })
|
|
352
|
+
], Dialog.prototype, "withBackdrop", void 0);
|
|
353
|
+
__decorate([
|
|
354
|
+
property({ type: Boolean, reflect: true, attribute: 'with-shadow' })
|
|
355
|
+
], Dialog.prototype, "withShadow", void 0);
|
|
348
356
|
Dialog = __decorate([
|
|
349
357
|
customElement('ef-dialog', {
|
|
350
358
|
alias: 'coral-dialog'
|
package/lib/heatmap/index.js
CHANGED
|
@@ -1041,6 +1041,7 @@ __decorate([
|
|
|
1041
1041
|
], Heatmap.prototype, "axisHidden", void 0);
|
|
1042
1042
|
__decorate([
|
|
1043
1043
|
property({ type: Object, attribute: false })
|
|
1044
|
+
/* istanbul ignore next */
|
|
1044
1045
|
], Heatmap.prototype, "hoverCell", null);
|
|
1045
1046
|
__decorate([
|
|
1046
1047
|
property({ type: Number, attribute: 'min-point' })
|
|
@@ -21,6 +21,7 @@ export declare class InteractiveChart extends ResponsiveElement {
|
|
|
21
21
|
private static readonly DEFAULT_LINE_WIDTH;
|
|
22
22
|
private static readonly DEFAULT_FILL_OPACITY;
|
|
23
23
|
private static readonly LINE_STYLES;
|
|
24
|
+
private static readonly DEFAULT_LEGEND_LEFT_POSITION;
|
|
24
25
|
private _legendStyle?;
|
|
25
26
|
/**
|
|
26
27
|
* Chart configurations for init chart
|
|
@@ -107,7 +108,6 @@ export declare class InteractiveChart extends ResponsiveElement {
|
|
|
107
108
|
resizedCallback(size: ElementSize): void;
|
|
108
109
|
/**
|
|
109
110
|
* Legend value observer
|
|
110
|
-
* @param value Legend value
|
|
111
111
|
* @returns {void}
|
|
112
112
|
*/
|
|
113
113
|
private onLegendChange;
|
|
@@ -120,7 +120,6 @@ export declare class InteractiveChart extends ResponsiveElement {
|
|
|
120
120
|
private onLegendStyleChange;
|
|
121
121
|
/**
|
|
122
122
|
* Jump last value observer
|
|
123
|
-
* @param value jump last value
|
|
124
123
|
* @returns {void}
|
|
125
124
|
*/
|
|
126
125
|
private onJumpButtonChange;
|
|
@@ -206,11 +205,6 @@ export declare class InteractiveChart extends ResponsiveElement {
|
|
|
206
205
|
* @returns {void}
|
|
207
206
|
*/
|
|
208
207
|
private applyLegendTextColor;
|
|
209
|
-
/**
|
|
210
|
-
* Get position config for set position legend
|
|
211
|
-
* @returns {void}
|
|
212
|
-
*/
|
|
213
|
-
private applyStyleLegend;
|
|
214
208
|
/**
|
|
215
209
|
* Get position config for set position logo trading view on chart
|
|
216
210
|
* @returns {void}
|
|
@@ -229,6 +223,16 @@ export declare class InteractiveChart extends ResponsiveElement {
|
|
|
229
223
|
* @returns {void} return undefined has out of boundary chart
|
|
230
224
|
*/
|
|
231
225
|
private handleCrosshairMoved;
|
|
226
|
+
/**
|
|
227
|
+
* Callback uses for sizeChange event
|
|
228
|
+
* @returns {void}
|
|
229
|
+
*/
|
|
230
|
+
private onTimeScaleSizeChange;
|
|
231
|
+
/**
|
|
232
|
+
* Handle left position of legend
|
|
233
|
+
* @returns {void}
|
|
234
|
+
*/
|
|
235
|
+
private handleLegendLeftPosition;
|
|
232
236
|
/**
|
|
233
237
|
* Create legend element
|
|
234
238
|
* @returns {void}
|
|
@@ -82,6 +82,13 @@ let InteractiveChart = InteractiveChart_1 = class InteractiveChart extends Respo
|
|
|
82
82
|
}
|
|
83
83
|
this.createRowLegend(this.rowLegend, param);
|
|
84
84
|
};
|
|
85
|
+
/**
|
|
86
|
+
* Callback uses for sizeChange event
|
|
87
|
+
* @returns {void}
|
|
88
|
+
*/
|
|
89
|
+
this.onTimeScaleSizeChange = () => {
|
|
90
|
+
this.handleLegendLeftPosition();
|
|
91
|
+
};
|
|
85
92
|
/**
|
|
86
93
|
* Handle TimeRangeChangeEventHandler
|
|
87
94
|
* on event subscribeVisibleTimeRangeChange
|
|
@@ -153,10 +160,10 @@ let InteractiveChart = InteractiveChart_1 = class InteractiveChart extends Respo
|
|
|
153
160
|
}
|
|
154
161
|
}
|
|
155
162
|
if (changedProperties.has('disabledLegend')) {
|
|
156
|
-
this.onLegendChange(
|
|
163
|
+
this.onLegendChange();
|
|
157
164
|
}
|
|
158
165
|
if (changedProperties.has('disabledJumpButton')) {
|
|
159
|
-
this.onJumpButtonChange(
|
|
166
|
+
this.onJumpButtonChange();
|
|
160
167
|
}
|
|
161
168
|
if (changedProperties.has('deprecatedLegendStyle') || changedProperties.has('legend-style')) {
|
|
162
169
|
if (changedProperties.has('deprecatedLegendStyle')) {
|
|
@@ -186,11 +193,10 @@ let InteractiveChart = InteractiveChart_1 = class InteractiveChart extends Respo
|
|
|
186
193
|
}
|
|
187
194
|
/**
|
|
188
195
|
* Legend value observer
|
|
189
|
-
* @param value Legend value
|
|
190
196
|
* @returns {void}
|
|
191
197
|
*/
|
|
192
|
-
onLegendChange(
|
|
193
|
-
if (!
|
|
198
|
+
onLegendChange() {
|
|
199
|
+
if (!this.disabledLegend) {
|
|
194
200
|
this.createLegend();
|
|
195
201
|
}
|
|
196
202
|
else {
|
|
@@ -216,11 +222,10 @@ let InteractiveChart = InteractiveChart_1 = class InteractiveChart extends Respo
|
|
|
216
222
|
}
|
|
217
223
|
/**
|
|
218
224
|
* Jump last value observer
|
|
219
|
-
* @param value jump last value
|
|
220
225
|
* @returns {void}
|
|
221
226
|
*/
|
|
222
|
-
onJumpButtonChange(
|
|
223
|
-
if (!
|
|
227
|
+
onJumpButtonChange() {
|
|
228
|
+
if (!this.disabledJumpButton) {
|
|
224
229
|
this.createJumpButton(this.width, this.height);
|
|
225
230
|
}
|
|
226
231
|
else {
|
|
@@ -320,6 +325,7 @@ let InteractiveChart = InteractiveChart_1 = class InteractiveChart extends Respo
|
|
|
320
325
|
this.legendContainer.textContent = '';
|
|
321
326
|
this.chart.unsubscribeCrosshairMove(this.handleCrosshairMoved);
|
|
322
327
|
this.legendInitialized = false;
|
|
328
|
+
this.chart.timeScale().unsubscribeSizeChange(this.onTimeScaleSizeChange);
|
|
323
329
|
}
|
|
324
330
|
}
|
|
325
331
|
/**
|
|
@@ -335,7 +341,6 @@ let InteractiveChart = InteractiveChart_1 = class InteractiveChart extends Respo
|
|
|
335
341
|
this.applyTheme(config);
|
|
336
342
|
this.applyLegendTextColor();
|
|
337
343
|
this.applyStylesBranding();
|
|
338
|
-
this.applyStyleLegend();
|
|
339
344
|
}
|
|
340
345
|
/**
|
|
341
346
|
* Create series
|
|
@@ -561,22 +566,6 @@ let InteractiveChart = InteractiveChart_1 = class InteractiveChart extends Respo
|
|
|
561
566
|
}
|
|
562
567
|
}
|
|
563
568
|
}
|
|
564
|
-
/**
|
|
565
|
-
* Get position config for set position legend
|
|
566
|
-
* @returns {void}
|
|
567
|
-
*/
|
|
568
|
-
applyStyleLegend() {
|
|
569
|
-
if (this.chart) {
|
|
570
|
-
// Get position config for set position legend
|
|
571
|
-
const position = this.getPriceScalePosition();
|
|
572
|
-
if (position === 'left' || position === 'two-price') {
|
|
573
|
-
this.legendContainer.className = 'yaxis-left';
|
|
574
|
-
}
|
|
575
|
-
else {
|
|
576
|
-
this.legendContainer.className = 'yaxis-right';
|
|
577
|
-
}
|
|
578
|
-
}
|
|
579
|
-
}
|
|
580
569
|
/**
|
|
581
570
|
* Get position config for set position logo trading view on chart
|
|
582
571
|
* @returns {void}
|
|
@@ -606,6 +595,16 @@ let InteractiveChart = InteractiveChart_1 = class InteractiveChart extends Respo
|
|
|
606
595
|
return 'none';
|
|
607
596
|
}
|
|
608
597
|
}
|
|
598
|
+
/**
|
|
599
|
+
* Handle left position of legend
|
|
600
|
+
* @returns {void}
|
|
601
|
+
*/
|
|
602
|
+
handleLegendLeftPosition() {
|
|
603
|
+
const leftPriceScaleWidth = this.chart?.priceScale('left')?.width() || 0;
|
|
604
|
+
if (this.legendContainer) {
|
|
605
|
+
this.legendContainer.style.left = `${leftPriceScaleWidth + InteractiveChart_1.DEFAULT_LEGEND_LEFT_POSITION}px`;
|
|
606
|
+
}
|
|
607
|
+
}
|
|
609
608
|
/**
|
|
610
609
|
* Create legend element
|
|
611
610
|
* @returns {void}
|
|
@@ -617,6 +616,11 @@ let InteractiveChart = InteractiveChart_1 = class InteractiveChart extends Respo
|
|
|
617
616
|
this.rowLegend = this.shadowRoot.querySelectorAll('.row');
|
|
618
617
|
}
|
|
619
618
|
this.chart.subscribeCrosshairMove(this.handleCrosshairMoved);
|
|
619
|
+
/* Add a subscription to resizing time scale (x-axis). The event triggers after the chart rendered.
|
|
620
|
+
* So that we can know the priceScale (y-axis) width.
|
|
621
|
+
* Legend relates to priceScale directly. But the axis doesn't have event for now. So use x-axis instead.
|
|
622
|
+
*/
|
|
623
|
+
this.chart.timeScale().subscribeSizeChange(this.onTimeScaleSizeChange);
|
|
620
624
|
this.legendInitialized = true;
|
|
621
625
|
}
|
|
622
626
|
}
|
|
@@ -1010,6 +1014,11 @@ let InteractiveChart = InteractiveChart_1 = class InteractiveChart extends Respo
|
|
|
1010
1014
|
height: 300px;
|
|
1011
1015
|
z-index: 0;
|
|
1012
1016
|
}
|
|
1017
|
+
|
|
1018
|
+
[part=legend] {
|
|
1019
|
+
position: absolute;
|
|
1020
|
+
z-index: 1000;
|
|
1021
|
+
}
|
|
1013
1022
|
`;
|
|
1014
1023
|
}
|
|
1015
1024
|
/**
|
|
@@ -1044,6 +1053,7 @@ InteractiveChart.LINE_STYLES = {
|
|
|
1044
1053
|
LARGE_DASHED: 3,
|
|
1045
1054
|
SPARSE_DOTTED: 4
|
|
1046
1055
|
};
|
|
1056
|
+
InteractiveChart.DEFAULT_LEGEND_LEFT_POSITION = 15;
|
|
1047
1057
|
__decorate([
|
|
1048
1058
|
property({ type: Object })
|
|
1049
1059
|
], InteractiveChart.prototype, "config", void 0);
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import '@refinitiv-ui/elements/tooltip/themes/halo/dark';
|
|
2
2
|
|
|
3
|
-
elf.customStyles.define('ef-interactive-chart', ':host{--chart-color-1:#6678FF;--chart-color-2:#FFFFFF;--chart-color-3:#FFC800;--chart-color-4:#9064CD;--chart-color-5:#00D0D4;--chart-color-6:#FF5000;--chart-color-7:#00C389;--chart-color-8:#EA2E6C;--chart-color-9:#999999;--chart-color-10:#3BBAFF;--line-width:2;--fill-opacity:0.4;--text-color:rgba(204, 204, 204, 0.8);--background-color:#1A1A1A;--chart-up-color:#39C46E;--chart-down-color:#F5475B;--cross-hair-color:#CCCCCC;--grid-vert-line-color:rgba(38, 38, 38, 0.5);--grid-horz-line-color:rgba(38, 38, 38, 0.5);--scale-price-border-color:rgba(38, 38, 38, 0.5);--scale-times-border-color:rgba(38, 38, 38, 0.5)}:host [part=legend]{
|
|
3
|
+
elf.customStyles.define('ef-interactive-chart', ':host{--chart-color-1:#6678FF;--chart-color-2:#FFFFFF;--chart-color-3:#FFC800;--chart-color-4:#9064CD;--chart-color-5:#00D0D4;--chart-color-6:#FF5000;--chart-color-7:#00C389;--chart-color-8:#EA2E6C;--chart-color-9:#999999;--chart-color-10:#3BBAFF;--line-width:2;--fill-opacity:0.4;--text-color:rgba(204, 204, 204, 0.8);--background-color:#1A1A1A;--chart-up-color:#39C46E;--chart-down-color:#F5475B;--cross-hair-color:#CCCCCC;--grid-vert-line-color:rgba(38, 38, 38, 0.5);--grid-horz-line-color:rgba(38, 38, 38, 0.5);--scale-price-border-color:rgba(38, 38, 38, 0.5);--scale-times-border-color:rgba(38, 38, 38, 0.5)}:host [part=legend]{top:15px;color:var(--text-color);font-size:90%}:host [part=legend] .row{margin:1px 5px}:host [part=legend] .price{margin-right:5px}:host [part=legend] .ohlc{margin-right:2px}:host [part=legend].horizontal{display:flex;max-width:calc(100% - 75px);flex-wrap:wrap}:host [part=jump-button-container]{display:none;position:absolute;transition:background-color .1s;width:23px;height:23px;color:#ccc;border:1px solid #0d0d0d;box-shadow:0 0 0 0 rgba(0,0,0,.5);border-radius:100%;z-index:1000;cursor:pointer;background-color:#1a1a1a}:host [part=jump-button-container]:hover{color:#fff;border-color:#1429bd;box-shadow:0 0 0 0 rgba(0,0,0,.8);background-color:#343434}:host [part=jump-button-container]:active{color:#fff;box-shadow:0 0 0 0 rgba(0,0,0,.5);background-color:#1a1a1a}:host [part=jump-button]{position:relative;display:inline-block;width:5px;height:5px;border-top:2px solid #ccc;border-right:2px solid #ccc;transform:rotate(45deg) skew(0);margin-top:8px;margin-left:7px}:host [part=branding-container]{position:absolute;opacity:.6;bottom:3px;z-index:1000}:host [part=branding-container].left{left:10px}:host [part=branding-container].right{right:10px}:host [part=branding-container].none{top:13px;right:13px}:host [part=branding]{height:22px;width:22px;fill:rgba(204,204,204,.8)}:host [part=jump-button-container],:host [part=jump-button-container]:hover,:host [part=jump-button]{border-color:grey}');
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import '@refinitiv-ui/elements/tooltip/themes/halo/light';
|
|
2
2
|
|
|
3
|
-
elf.customStyles.define('ef-interactive-chart', ':host{--chart-color-1:#334BFF;--chart-color-2:#000000;--chart-color-3:#7F6400;--chart-color-4:#71549F;--chart-color-5:#007678;--chart-color-6:#CC4000;--chart-color-7:#007653;--chart-color-8:#D22962;--chart-color-9:#595959;--chart-color-10:#236F99;--line-width:2;--fill-opacity:0.4;--text-color:rgba(13, 13, 13, 0.8);--background-color:#FAFAFA;--chart-up-color:#246B3E;--chart-down-color:#B63243;--cross-hair-color:#404040;--grid-vert-line-color:rgba(242, 242, 242, 0.5);--grid-horz-line-color:rgba(242, 242, 242, 0.5);--scale-price-border-color:rgba(242, 242, 242, 0.5);--scale-times-border-color:rgba(242, 242, 242, 0.5)}:host [part=legend]{
|
|
3
|
+
elf.customStyles.define('ef-interactive-chart', ':host{--chart-color-1:#334BFF;--chart-color-2:#000000;--chart-color-3:#7F6400;--chart-color-4:#71549F;--chart-color-5:#007678;--chart-color-6:#CC4000;--chart-color-7:#007653;--chart-color-8:#D22962;--chart-color-9:#595959;--chart-color-10:#236F99;--line-width:2;--fill-opacity:0.4;--text-color:rgba(13, 13, 13, 0.8);--background-color:#FAFAFA;--chart-up-color:#246B3E;--chart-down-color:#B63243;--cross-hair-color:#404040;--grid-vert-line-color:rgba(242, 242, 242, 0.5);--grid-horz-line-color:rgba(242, 242, 242, 0.5);--scale-price-border-color:rgba(242, 242, 242, 0.5);--scale-times-border-color:rgba(242, 242, 242, 0.5)}:host [part=legend]{top:15px;color:var(--text-color);font-size:90%}:host [part=legend] .row{margin:1px 5px}:host [part=legend] .price{margin-right:5px}:host [part=legend] .ohlc{margin-right:2px}:host [part=legend].horizontal{display:flex;max-width:calc(100% - 75px);flex-wrap:wrap}:host [part=jump-button-container]{display:none;position:absolute;transition:background-color .1s;width:23px;height:23px;color:#0d0d0d;border:1px solid #ccc;box-shadow:0 0 0 0 rgba(0,0,0,.25);border-radius:100%;z-index:1000;cursor:pointer;background-color:#fafafa}:host [part=jump-button-container]:hover{color:#fff;border-color:#1429bd;box-shadow:0 0 0 0 rgba(0,0,0,.55);background-color:#fff}:host [part=jump-button-container]:active{color:#fff;box-shadow:0 0 0 0 rgba(0,0,0,.25);background-color:#fafafa}:host [part=jump-button]{position:relative;display:inline-block;width:5px;height:5px;border-top:2px solid #0d0d0d;border-right:2px solid #0d0d0d;transform:rotate(45deg) skew(0);margin-top:8px;margin-left:7px}:host [part=branding-container]{position:absolute;opacity:.6;bottom:3px;z-index:1000}:host [part=branding-container].left{left:10px}:host [part=branding-container].right{right:10px}:host [part=branding-container].none{top:13px;right:13px}:host [part=branding]{height:22px;width:22px;fill:rgba(13,13,13,.8)}:host [part=jump-button-container],:host [part=jump-button-container]:hover,:host [part=jump-button]{border-color:#8d8d8d}');
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import '@refinitiv-ui/elements/tooltip/themes/solar/charcoal';
|
|
2
2
|
|
|
3
|
-
elf.customStyles.define('ef-interactive-chart', ':host{--chart-color-1:#FF9933;--chart-color-2:#B10CF2;--chart-color-3:#7DE442;--chart-color-4:#3780BF;--chart-color-5:#FA4C11;--chart-color-6:#FFE433;--chart-color-7:#8C8C8C;--chart-color-8:#5A54FF;--chart-color-9:#E53766;--chart-color-10:#648608;--line-width:2;--fill-opacity:0.4;--text-color:rgba(194, 194, 194, 0.8);--background-color:#1A1A1C;--chart-up-color:#39C46E;--chart-down-color:#F5475B;--cross-hair-color:#E2E2E2;--grid-vert-line-color:rgba(10, 10, 10, 0.5);--grid-horz-line-color:rgba(10, 10, 10, 0.5);--scale-price-border-color:rgba(10, 10, 10, 0.5);--scale-times-border-color:rgba(10, 10, 10, 0.5);--chart-color-1:#FF9933;--chart-color-2:#B10CF2;--chart-color-3:#7DE442;--chart-color-4:#3780BF;--chart-color-5:#FA4C11;--chart-color-6:#FFE433;--chart-color-7:#8C8C8C;--chart-color-8:#5A54FF;--chart-color-9:#E53766;--chart-color-10:#648608;--chart-color-11:#48CBF7;--chart-color-12:#F3478E;--chart-color-13:#508BF7;--chart-color-14:#EFF748;--chart-color-15:#FF4043;--chart-color-16:#A7DB0B;--chart-color-17:#C2C2C2;--chart-color-18:#1578AD;--chart-color-19:#F2B530;--chart-color-20:#297835;--chart-color-21:#7045FF;--chart-color-22:#DD48F7;--chart-color-23:#09A8C0;--chart-color-24:#60E65C;--chart-color-25:#2960A3;--grid-vert-line-color:rgba(194, 194, 194, 0.1);--grid-horz-line-color:rgba(194, 194, 194, 0.1);--scale-price-border-color:rgba(194, 194, 194, 0.1);--scale-times-border-color:rgba(194, 194, 194, 0.1)}:host [part=legend]{
|
|
3
|
+
elf.customStyles.define('ef-interactive-chart', ':host{--chart-color-1:#FF9933;--chart-color-2:#B10CF2;--chart-color-3:#7DE442;--chart-color-4:#3780BF;--chart-color-5:#FA4C11;--chart-color-6:#FFE433;--chart-color-7:#8C8C8C;--chart-color-8:#5A54FF;--chart-color-9:#E53766;--chart-color-10:#648608;--line-width:2;--fill-opacity:0.4;--text-color:rgba(194, 194, 194, 0.8);--background-color:#1A1A1C;--chart-up-color:#39C46E;--chart-down-color:#F5475B;--cross-hair-color:#E2E2E2;--grid-vert-line-color:rgba(10, 10, 10, 0.5);--grid-horz-line-color:rgba(10, 10, 10, 0.5);--scale-price-border-color:rgba(10, 10, 10, 0.5);--scale-times-border-color:rgba(10, 10, 10, 0.5);--chart-color-1:#FF9933;--chart-color-2:#B10CF2;--chart-color-3:#7DE442;--chart-color-4:#3780BF;--chart-color-5:#FA4C11;--chart-color-6:#FFE433;--chart-color-7:#8C8C8C;--chart-color-8:#5A54FF;--chart-color-9:#E53766;--chart-color-10:#648608;--chart-color-11:#48CBF7;--chart-color-12:#F3478E;--chart-color-13:#508BF7;--chart-color-14:#EFF748;--chart-color-15:#FF4043;--chart-color-16:#A7DB0B;--chart-color-17:#C2C2C2;--chart-color-18:#1578AD;--chart-color-19:#F2B530;--chart-color-20:#297835;--chart-color-21:#7045FF;--chart-color-22:#DD48F7;--chart-color-23:#09A8C0;--chart-color-24:#60E65C;--chart-color-25:#2960A3;--grid-vert-line-color:rgba(194, 194, 194, 0.1);--grid-horz-line-color:rgba(194, 194, 194, 0.1);--scale-price-border-color:rgba(194, 194, 194, 0.1);--scale-times-border-color:rgba(194, 194, 194, 0.1)}:host [part=legend]{top:15px;color:var(--text-color);font-size:90%}:host [part=legend] .row{margin:1px 5px}:host [part=legend] .price{margin-right:5px}:host [part=legend] .ohlc{margin-right:2px}:host [part=legend].horizontal{display:flex;max-width:calc(100% - 75px);flex-wrap:wrap}:host [part=jump-button-container]{display:none;position:absolute;transition:background-color .1s;width:23px;height:23px;color:#c2c2c2;background-color:#3c3c42;border:1px solid #000;box-shadow:0 0 0 0 rgba(0,0,0,.6);border-radius:100%;z-index:1000;cursor:pointer;background-image:linear-gradient(rgba(255,255,255,.1) 10%,rgba(255,255,255,0) 100%)}:host [part=jump-button-container]:hover{color:#e2e2e2;background-color:#4d4d55;border-color:#000;box-shadow:0 0 0 0 rgba(0,0,0,.9)}:host [part=jump-button-container]:active{background-color:#38383d;color:#c2c2c2;box-shadow:0 0 0 0 rgba(0,0,0,.6);background-image:linear-gradient(rgba(255,255,255,.1) 10%,rgba(255,255,255,0) 100%)}:host [part=jump-button]{position:relative;display:inline-block;width:5px;height:5px;border-top:2px solid #c2c2c2;border-right:2px solid #c2c2c2;transform:rotate(45deg) skew(0);margin-top:8px;margin-left:7px}:host [part=branding-container]{position:absolute;opacity:.6;bottom:3px;z-index:1000}:host [part=branding-container].left{left:10px}:host [part=branding-container].right{right:10px}:host [part=branding-container].none{top:13px;right:13px}:host [part=branding]{height:22px;width:22px;fill:rgba(194,194,194,.8)}:host [part=jump-button-container]:hover [part=jump-button]{border-color:#e2e2e2}');
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import '@refinitiv-ui/elements/tooltip/themes/solar/pearl';
|
|
2
2
|
|
|
3
|
-
elf.customStyles.define('ef-interactive-chart', ':host{--chart-color-1:#EE7600;--chart-color-2:#B10CF2;--chart-color-3:#309054;--chart-color-4:#3780BF;--chart-color-5:#FA4C11;--chart-color-6:#D9B500;--chart-color-7:#8C8C8C;--chart-color-8:#5A54FF;--chart-color-9:#E53766;--chart-color-10:#648608;--line-width:2;--fill-opacity:0.4;--text-color:rgba(72, 72, 72, 0.8);--background-color:#FFFFFF;--chart-up-color:#309054;--chart-down-color:#D94255;--cross-hair-color:#ACAFB5;--grid-vert-line-color:rgba(213, 216, 219, 0.5);--grid-horz-line-color:rgba(213, 216, 219, 0.5);--scale-price-border-color:rgba(213, 216, 219, 0.5);--scale-times-border-color:rgba(213, 216, 219, 0.5);--chart-color-1:#EE7600;--chart-color-2:#B10CF2;--chart-color-3:#309054;--chart-color-4:#3780BF;--chart-color-5:#FA4C11;--chart-color-6:#D9B500;--chart-color-7:#8C8C8C;--chart-color-8:#5A54FF;--chart-color-9:#E53766;--chart-color-10:#648608;--chart-color-11:#40B6DE;--chart-color-12:#F3478E;--chart-color-13:#508BF7;--chart-color-14:#AAB218;--chart-color-15:#FF4043;--chart-color-16:#80A808;--chart-color-17:#707070;--chart-color-18:#1578AC;--chart-color-19:#D9A22B;--chart-color-20:#297835;--chart-color-21:#7045FF;--chart-color-22:#DD48F7;--chart-color-23:#09A8C0;--chart-color-24:#4BB347;--chart-color-25:#2960A3;--grid-vert-line-color:rgba(72, 72, 72, 0.1);--grid-horz-line-color:rgba(72, 72, 72, 0.1);--scale-price-border-color:rgba(72, 72, 72, 0.1);--scale-times-border-color:rgba(72, 72, 72, 0.1)}:host [part=legend]{
|
|
3
|
+
elf.customStyles.define('ef-interactive-chart', ':host{--chart-color-1:#EE7600;--chart-color-2:#B10CF2;--chart-color-3:#309054;--chart-color-4:#3780BF;--chart-color-5:#FA4C11;--chart-color-6:#D9B500;--chart-color-7:#8C8C8C;--chart-color-8:#5A54FF;--chart-color-9:#E53766;--chart-color-10:#648608;--line-width:2;--fill-opacity:0.4;--text-color:rgba(72, 72, 72, 0.8);--background-color:#FFFFFF;--chart-up-color:#309054;--chart-down-color:#D94255;--cross-hair-color:#ACAFB5;--grid-vert-line-color:rgba(213, 216, 219, 0.5);--grid-horz-line-color:rgba(213, 216, 219, 0.5);--scale-price-border-color:rgba(213, 216, 219, 0.5);--scale-times-border-color:rgba(213, 216, 219, 0.5);--chart-color-1:#EE7600;--chart-color-2:#B10CF2;--chart-color-3:#309054;--chart-color-4:#3780BF;--chart-color-5:#FA4C11;--chart-color-6:#D9B500;--chart-color-7:#8C8C8C;--chart-color-8:#5A54FF;--chart-color-9:#E53766;--chart-color-10:#648608;--chart-color-11:#40B6DE;--chart-color-12:#F3478E;--chart-color-13:#508BF7;--chart-color-14:#AAB218;--chart-color-15:#FF4043;--chart-color-16:#80A808;--chart-color-17:#707070;--chart-color-18:#1578AC;--chart-color-19:#D9A22B;--chart-color-20:#297835;--chart-color-21:#7045FF;--chart-color-22:#DD48F7;--chart-color-23:#09A8C0;--chart-color-24:#4BB347;--chart-color-25:#2960A3;--grid-vert-line-color:rgba(72, 72, 72, 0.1);--grid-horz-line-color:rgba(72, 72, 72, 0.1);--scale-price-border-color:rgba(72, 72, 72, 0.1);--scale-times-border-color:rgba(72, 72, 72, 0.1)}:host [part=legend]{top:15px;color:var(--text-color);font-size:90%}:host [part=legend] .row{margin:1px 5px}:host [part=legend] .price{margin-right:5px}:host [part=legend] .ohlc{margin-right:2px}:host [part=legend].horizontal{display:flex;max-width:calc(100% - 75px);flex-wrap:wrap}:host [part=jump-button-container]{display:none;position:absolute;transition:background-color .1s;width:23px;height:23px;color:#505050;background-color:#fafbfc;border:1px solid #a9afba;box-shadow:0 0 0 0 rgba(0,0,0,.3);border-radius:100%;z-index:1000;cursor:pointer;background-image:linear-gradient(rgba(0,0,0,0) 0,rgba(0,0,0,.1) 100%)}:host [part=jump-button-container]:hover{color:#1d1d1d;background-color:#fff;border-color:#a9afba;box-shadow:0 0 0 0 rgba(0,0,0,.6)}:host [part=jump-button-container]:active{background-color:#fff;color:#1d1d1d;box-shadow:0 0 0 0 rgba(0,0,0,.3);background-image:none}:host [part=jump-button]{position:relative;display:inline-block;width:5px;height:5px;border-top:2px solid #505050;border-right:2px solid #505050;transform:rotate(45deg) skew(0);margin-top:8px;margin-left:7px}:host [part=branding-container]{position:absolute;opacity:.6;bottom:3px;z-index:1000}:host [part=branding-container].left{left:10px}:host [part=branding-container].right{right:10px}:host [part=branding-container].none{top:13px;right:13px}:host [part=branding]{height:22px;width:22px;fill:rgba(72,72,72,.8)}:host [part=jump-button-container]:hover [part=jump-button]{border-color:#1d1d1d}');
|
|
@@ -118,11 +118,6 @@
|
|
|
118
118
|
"description": "Return true if the item can be highlighted. True if not disabled and type is Text",
|
|
119
119
|
"type": "boolean"
|
|
120
120
|
},
|
|
121
|
-
{
|
|
122
|
-
"name": "isTruncated (readonly)",
|
|
123
|
-
"description": "Getter returning if the label is truncated",
|
|
124
|
-
"type": "boolean"
|
|
125
|
-
},
|
|
126
121
|
{
|
|
127
122
|
"name": "value",
|
|
128
123
|
"attribute": "value",
|
|
@@ -13,7 +13,6 @@ to create simple menus or navigation panels.
|
|
|
13
13
|
| `highlightable (readonly)` | | `boolean` | | Return true if the item can be highlighted. True if not disabled and type is Text |
|
|
14
14
|
| `highlighted` | `highlighted` | `boolean` | false | Highlight the item |
|
|
15
15
|
| `icon` | `icon` | `string \| null` | null | Set the icon name from the ef-icon list |
|
|
16
|
-
| `isTruncated (readonly)` | | `boolean` | | Getter returning if the label is truncated |
|
|
17
16
|
| `label` | `label` | `string \| null` | null | The text for the label indicating the meaning of the item.<br />By having both `label` and content, `label` always takes priority |
|
|
18
17
|
| `multiple` | `multiple` | `boolean` | false | Is the item part of a multiple selection |
|
|
19
18
|
| `selected` | `selected` | `boolean` | false | Indicates that the item is selected |
|
package/lib/item/index.d.ts
CHANGED
|
@@ -65,9 +65,17 @@ export declare class Item extends ControlElement {
|
|
|
65
65
|
*/
|
|
66
66
|
for: string | null;
|
|
67
67
|
/**
|
|
68
|
-
*
|
|
68
|
+
* Reference to the label element
|
|
69
69
|
*/
|
|
70
|
-
private
|
|
70
|
+
private labelRef;
|
|
71
|
+
/**
|
|
72
|
+
* Reference to the subLabel element
|
|
73
|
+
*/
|
|
74
|
+
private subLabelRef;
|
|
75
|
+
/**
|
|
76
|
+
* Reference to the slot element
|
|
77
|
+
*/
|
|
78
|
+
private slotRef;
|
|
71
79
|
/**
|
|
72
80
|
* True, if there is no slotted content
|
|
73
81
|
*/
|
|
@@ -98,12 +106,34 @@ export declare class Item extends ControlElement {
|
|
|
98
106
|
* @returns {void}
|
|
99
107
|
*/
|
|
100
108
|
private typeChanged;
|
|
109
|
+
/**
|
|
110
|
+
* Called after the component is first rendered
|
|
111
|
+
* @param changedProperties Properties which have changed
|
|
112
|
+
* @returns {void}
|
|
113
|
+
*/
|
|
114
|
+
protected firstUpdated(changedProperties: PropertyValues): void;
|
|
101
115
|
/**
|
|
102
116
|
* Invoked before update() to compute values needed during the update.
|
|
103
117
|
* @param changedProperties changed properties
|
|
104
118
|
* @returns {void}
|
|
105
119
|
*/
|
|
106
120
|
protected willUpdate(changedProperties: PropertyValues): void;
|
|
121
|
+
/**
|
|
122
|
+
* Get Item content
|
|
123
|
+
* @returns return item content from slot or label and sub-label
|
|
124
|
+
*/
|
|
125
|
+
private getItemContent;
|
|
126
|
+
/**
|
|
127
|
+
* Get element overflown
|
|
128
|
+
* @param element Target element
|
|
129
|
+
* @returns return true if element is overflown.
|
|
130
|
+
*/
|
|
131
|
+
private isItemElementOverflown;
|
|
132
|
+
/**
|
|
133
|
+
* Get item overflown
|
|
134
|
+
* @returns return true if an item is overflown.
|
|
135
|
+
*/
|
|
136
|
+
private isItemOverflown;
|
|
107
137
|
/**
|
|
108
138
|
* Get icon template if icon attribute is defined
|
|
109
139
|
*/
|
|
@@ -116,6 +146,10 @@ export declare class Item extends ControlElement {
|
|
|
116
146
|
* Get label template if it is defined and no slot content present
|
|
117
147
|
*/
|
|
118
148
|
private get labelTemplate();
|
|
149
|
+
/**
|
|
150
|
+
* Get slot content
|
|
151
|
+
*/
|
|
152
|
+
private get slotContent();
|
|
119
153
|
/**
|
|
120
154
|
* Get template for `for` attribute.
|
|
121
155
|
* This is usually used with menus when an item needs to reference an element
|
|
@@ -132,12 +166,6 @@ export declare class Item extends ControlElement {
|
|
|
132
166
|
* @returns whether element is highlightable
|
|
133
167
|
*/
|
|
134
168
|
get highlightable(): boolean;
|
|
135
|
-
/**
|
|
136
|
-
* Getter returning if the label is truncated
|
|
137
|
-
* @prop {boolean} isTruncated
|
|
138
|
-
* @returns whether element is truncated or not
|
|
139
|
-
*/
|
|
140
|
-
get isTruncated(): boolean;
|
|
141
169
|
/**
|
|
142
170
|
* A `TemplateResult` that will be used
|
|
143
171
|
* to render the updated internal template.
|
package/lib/item/index.js
CHANGED
|
@@ -2,10 +2,12 @@ import { __decorate } from "tslib";
|
|
|
2
2
|
import { ControlElement, css, html } from '@refinitiv-ui/core';
|
|
3
3
|
import { customElement } from '@refinitiv-ui/core/decorators/custom-element.js';
|
|
4
4
|
import { property } from '@refinitiv-ui/core/decorators/property.js';
|
|
5
|
-
import { query } from '@refinitiv-ui/core/decorators/query.js';
|
|
6
5
|
import { VERSION } from '../version.js';
|
|
7
6
|
import '../icon/index.js';
|
|
8
7
|
import '../checkbox/index.js';
|
|
8
|
+
import { registerOverflowTooltip } from '../tooltip/index.js';
|
|
9
|
+
import { isElementOverflown } from '@refinitiv-ui/utils/element.js';
|
|
10
|
+
import { createRef, ref } from '@refinitiv-ui/core/directives/ref.js';
|
|
9
11
|
const isAllWhitespaceTextNode = (node) => node.nodeType === document.TEXT_NODE
|
|
10
12
|
&& !node.textContent?.trim();
|
|
11
13
|
/**
|
|
@@ -59,6 +61,18 @@ let Item = class Item extends ControlElement {
|
|
|
59
61
|
* Specifies which element an item is bound to
|
|
60
62
|
*/
|
|
61
63
|
this.for = null;
|
|
64
|
+
/**
|
|
65
|
+
* Reference to the label element
|
|
66
|
+
*/
|
|
67
|
+
this.labelRef = createRef();
|
|
68
|
+
/**
|
|
69
|
+
* Reference to the subLabel element
|
|
70
|
+
*/
|
|
71
|
+
this.subLabelRef = createRef();
|
|
72
|
+
/**
|
|
73
|
+
* Reference to the slot element
|
|
74
|
+
*/
|
|
75
|
+
this.slotRef = createRef();
|
|
62
76
|
/**
|
|
63
77
|
* True, if there is no slotted content
|
|
64
78
|
*/
|
|
@@ -144,6 +158,15 @@ let Item = class Item extends ControlElement {
|
|
|
144
158
|
this.enableFocus();
|
|
145
159
|
}
|
|
146
160
|
}
|
|
161
|
+
/**
|
|
162
|
+
* Called after the component is first rendered
|
|
163
|
+
* @param changedProperties Properties which have changed
|
|
164
|
+
* @returns {void}
|
|
165
|
+
*/
|
|
166
|
+
firstUpdated(changedProperties) {
|
|
167
|
+
super.firstUpdated(changedProperties);
|
|
168
|
+
registerOverflowTooltip(this, () => this.getItemContent(), () => this.isItemOverflown());
|
|
169
|
+
}
|
|
147
170
|
/**
|
|
148
171
|
* Invoked before update() to compute values needed during the update.
|
|
149
172
|
* @param changedProperties changed properties
|
|
@@ -160,6 +183,40 @@ let Item = class Item extends ControlElement {
|
|
|
160
183
|
this.selectedChanged();
|
|
161
184
|
}
|
|
162
185
|
}
|
|
186
|
+
/**
|
|
187
|
+
* Get Item content
|
|
188
|
+
* @returns return item content from slot or label and sub-label
|
|
189
|
+
*/
|
|
190
|
+
getItemContent() {
|
|
191
|
+
if (this.isSlotEmpty) {
|
|
192
|
+
let text = '';
|
|
193
|
+
if (this.label) {
|
|
194
|
+
text += this.label;
|
|
195
|
+
}
|
|
196
|
+
if (this.subLabel) {
|
|
197
|
+
text += text ? ` (${this.subLabel})` : this.subLabel;
|
|
198
|
+
}
|
|
199
|
+
return text;
|
|
200
|
+
}
|
|
201
|
+
else {
|
|
202
|
+
return this.slotContent;
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* Get element overflown
|
|
207
|
+
* @param element Target element
|
|
208
|
+
* @returns return true if element is overflown.
|
|
209
|
+
*/
|
|
210
|
+
isItemElementOverflown(element) {
|
|
211
|
+
return element ? isElementOverflown(element) : false;
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* Get item overflown
|
|
215
|
+
* @returns return true if an item is overflown.
|
|
216
|
+
*/
|
|
217
|
+
isItemOverflown() {
|
|
218
|
+
return this.isItemElementOverflown(this.labelRef.value) || this.isItemElementOverflown(this.subLabelRef.value);
|
|
219
|
+
}
|
|
163
220
|
/**
|
|
164
221
|
* Get icon template if icon attribute is defined
|
|
165
222
|
*/
|
|
@@ -170,13 +227,20 @@ let Item = class Item extends ControlElement {
|
|
|
170
227
|
* Get subLabel template if it is defined and no slot content present
|
|
171
228
|
*/
|
|
172
229
|
get subLabelTemplate() {
|
|
173
|
-
return
|
|
230
|
+
return html `<div part="sub-label" ${ref(this.subLabelRef)}>${this.subLabel}</div>`;
|
|
174
231
|
}
|
|
175
232
|
/**
|
|
176
233
|
* Get label template if it is defined and no slot content present
|
|
177
234
|
*/
|
|
178
235
|
get labelTemplate() {
|
|
179
|
-
return
|
|
236
|
+
return html `${this.label}`;
|
|
237
|
+
}
|
|
238
|
+
/**
|
|
239
|
+
* Get slot content
|
|
240
|
+
*/
|
|
241
|
+
get slotContent() {
|
|
242
|
+
const nodes = this.slotRef.value?.assignedNodes() || [];
|
|
243
|
+
return nodes.map(node => node.textContent).join(' ').trim();
|
|
180
244
|
}
|
|
181
245
|
/**
|
|
182
246
|
* Get template for `for` attribute.
|
|
@@ -201,14 +265,6 @@ let Item = class Item extends ControlElement {
|
|
|
201
265
|
get highlightable() {
|
|
202
266
|
return !this.disabled && this.type !== 'header' && this.type !== 'divider';
|
|
203
267
|
}
|
|
204
|
-
/**
|
|
205
|
-
* Getter returning if the label is truncated
|
|
206
|
-
* @prop {boolean} isTruncated
|
|
207
|
-
* @returns whether element is truncated or not
|
|
208
|
-
*/
|
|
209
|
-
get isTruncated() {
|
|
210
|
-
return !!(this.labelEl && (this.labelEl.offsetWidth < this.labelEl.scrollWidth));
|
|
211
|
-
}
|
|
212
268
|
/**
|
|
213
269
|
* A `TemplateResult` that will be used
|
|
214
270
|
* to render the updated internal template.
|
|
@@ -221,10 +277,10 @@ let Item = class Item extends ControlElement {
|
|
|
221
277
|
${this.multipleTemplate}
|
|
222
278
|
<slot name="left"></slot>
|
|
223
279
|
</div>
|
|
224
|
-
<div part="center"
|
|
225
|
-
${this.labelTemplate}
|
|
226
|
-
<slot @slotchange="${this.checkSlotChildren}"></slot>
|
|
227
|
-
${this.subLabelTemplate}
|
|
280
|
+
<div part="center" ${ref(this.labelRef)}>
|
|
281
|
+
${this.label && this.isSlotEmpty ? this.labelTemplate : undefined}
|
|
282
|
+
<slot ${ref(this.slotRef)} @slotchange="${this.checkSlotChildren}"></slot>
|
|
283
|
+
${this.subLabel && this.isSlotEmpty ? this.subLabelTemplate : undefined}
|
|
228
284
|
</div>
|
|
229
285
|
<div part="right">
|
|
230
286
|
<slot name="right"></slot>
|
|
@@ -257,9 +313,6 @@ __decorate([
|
|
|
257
313
|
__decorate([
|
|
258
314
|
property({ type: String, reflect: true })
|
|
259
315
|
], Item.prototype, "for", void 0);
|
|
260
|
-
__decorate([
|
|
261
|
-
query('#label')
|
|
262
|
-
], Item.prototype, "labelEl", void 0);
|
|
263
316
|
Item = __decorate([
|
|
264
317
|
customElement('ef-item', {
|
|
265
318
|
alias: 'coral-item'
|
package/lib/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = '6.
|
|
1
|
+
export const VERSION = '6.2.1';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@refinitiv-ui/elements",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.2.1",
|
|
4
4
|
"description": "Element Framework Elements",
|
|
5
5
|
"author": "Refinitiv",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -91,6 +91,11 @@
|
|
|
91
91
|
"./color-dialog/themes/halo/light": "./lib/color-dialog/themes/halo/light/index.js",
|
|
92
92
|
"./color-dialog/themes/solar/charcoal": "./lib/color-dialog/themes/solar/charcoal/index.js",
|
|
93
93
|
"./color-dialog/themes/solar/pearl": "./lib/color-dialog/themes/solar/pearl/index.js",
|
|
94
|
+
"./color-picker": "./lib/color-picker/index.js",
|
|
95
|
+
"./color-picker/themes/halo/dark": "./lib/color-picker/themes/halo/dark/index.js",
|
|
96
|
+
"./color-picker/themes/halo/light": "./lib/color-picker/themes/halo/light/index.js",
|
|
97
|
+
"./color-picker/themes/solar/charcoal": "./lib/color-picker/themes/solar/charcoal/index.js",
|
|
98
|
+
"./color-picker/themes/solar/pearl": "./lib/color-picker/themes/solar/pearl/index.js",
|
|
94
99
|
"./combo-box": "./lib/combo-box/index.js",
|
|
95
100
|
"./combo-box/themes/halo/dark": "./lib/combo-box/themes/halo/dark/index.js",
|
|
96
101
|
"./combo-box/themes/halo/light": "./lib/combo-box/themes/halo/light/index.js",
|
|
@@ -328,34 +333,34 @@
|
|
|
328
333
|
},
|
|
329
334
|
"dependencies": {
|
|
330
335
|
"@refinitiv-ui/browser-sparkline": "1.1.8",
|
|
331
|
-
"@refinitiv-ui/halo-theme": "^6.
|
|
332
|
-
"@refinitiv-ui/solar-theme": "^6.0
|
|
336
|
+
"@refinitiv-ui/halo-theme": "^6.2.0",
|
|
337
|
+
"@refinitiv-ui/solar-theme": "^6.1.0",
|
|
333
338
|
"@types/chart.js": "^2.9.31",
|
|
334
339
|
"chart.js": "~2.9.4",
|
|
335
340
|
"d3-interpolate": "^3.0.1",
|
|
336
341
|
"date-fns": "^2.22.1",
|
|
337
|
-
"lightweight-charts": "^3.
|
|
342
|
+
"lightweight-charts": "^3.8.0",
|
|
338
343
|
"tslib": "^2.3.1"
|
|
339
344
|
},
|
|
340
345
|
"devDependencies": {
|
|
341
|
-
"@refinitiv-ui/core": "^6.0.
|
|
342
|
-
"@refinitiv-ui/demo-block": "^6.0.
|
|
343
|
-
"@refinitiv-ui/i18n": "^6.0.
|
|
344
|
-
"@refinitiv-ui/phrasebook": "^6.
|
|
346
|
+
"@refinitiv-ui/core": "^6.0.7",
|
|
347
|
+
"@refinitiv-ui/demo-block": "^6.0.8",
|
|
348
|
+
"@refinitiv-ui/i18n": "^6.0.6",
|
|
349
|
+
"@refinitiv-ui/phrasebook": "^6.2.0",
|
|
345
350
|
"@refinitiv-ui/test-helpers": "^6.0.4",
|
|
346
|
-
"@refinitiv-ui/translate": "^6.0.
|
|
347
|
-
"@refinitiv-ui/utils": "^6.
|
|
351
|
+
"@refinitiv-ui/translate": "^6.0.7",
|
|
352
|
+
"@refinitiv-ui/utils": "^6.1.1",
|
|
348
353
|
"@types/d3-interpolate": "^3.0.1"
|
|
349
354
|
},
|
|
350
355
|
"peerDependencies": {
|
|
351
|
-
"@refinitiv-ui/core": "^6.0.
|
|
352
|
-
"@refinitiv-ui/i18n": "^6.0.
|
|
353
|
-
"@refinitiv-ui/phrasebook": "^6.
|
|
354
|
-
"@refinitiv-ui/translate": "^6.0.
|
|
355
|
-
"@refinitiv-ui/utils": "^6.
|
|
356
|
+
"@refinitiv-ui/core": "^6.0.7",
|
|
357
|
+
"@refinitiv-ui/i18n": "^6.0.6",
|
|
358
|
+
"@refinitiv-ui/phrasebook": "^6.2.0",
|
|
359
|
+
"@refinitiv-ui/translate": "^6.0.7",
|
|
360
|
+
"@refinitiv-ui/utils": "^6.1.1"
|
|
356
361
|
},
|
|
357
362
|
"publishConfig": {
|
|
358
363
|
"access": "public"
|
|
359
364
|
},
|
|
360
|
-
"gitHead": "
|
|
365
|
+
"gitHead": "57da6d58ff28705699d54ab9e9bc2ea76c563216"
|
|
361
366
|
}
|