@refinitiv-ui/elements 7.0.0 → 7.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +195 -449
- package/LICENSE +2 -2
- package/README.md +12 -10
- package/cli.mjs +5 -3
- package/lib/accordion/index.d.ts +1 -1
- package/lib/accordion/index.js +4 -7
- package/lib/appstate-bar/index.d.ts +2 -2
- package/lib/appstate-bar/index.js +10 -4
- package/lib/autosuggest/index.d.ts +7 -7
- package/lib/autosuggest/index.js +80 -80
- package/lib/autosuggest/themes/solar/charcoal/index.js +1 -1
- package/lib/autosuggest/themes/solar/pearl/index.js +1 -1
- package/lib/button/index.js +7 -10
- package/lib/button-bar/index.d.ts +1 -1
- package/lib/button-bar/index.js +12 -12
- package/lib/calendar/index.d.ts +39 -39
- package/lib/calendar/index.js +156 -123
- package/lib/calendar/utils.js +1 -1
- package/lib/canvas/index.d.ts +1 -1
- package/lib/canvas/index.js +2 -4
- package/lib/card/helpers/types.d.ts +2 -2
- package/lib/card/index.d.ts +5 -5
- package/lib/card/index.js +34 -28
- package/lib/chart/elements/chart.d.ts +4 -4
- package/lib/chart/elements/chart.js +39 -33
- package/lib/chart/plugins/doughnut-center-label.d.ts +3 -3
- package/lib/chart/plugins/doughnut-center-label.js +13 -9
- package/lib/checkbox/index.d.ts +1 -1
- package/lib/checkbox/index.js +12 -13
- package/lib/clock/index.d.ts +55 -55
- package/lib/clock/index.js +84 -95
- package/lib/clock/themes/halo/dark/index.js +1 -1
- package/lib/clock/themes/halo/light/index.js +1 -1
- package/lib/clock/themes/solar/charcoal/index.js +1 -1
- package/lib/clock/themes/solar/pearl/index.js +1 -1
- package/lib/collapse/index.d.ts +1 -1
- package/lib/collapse/index.js +27 -18
- package/lib/collapse/themes/halo/dark/index.js +1 -1
- package/lib/collapse/themes/halo/light/index.js +1 -1
- package/lib/color-dialog/elements/color-palettes.d.ts +1 -1
- package/lib/color-dialog/elements/color-palettes.js +5 -6
- package/lib/color-dialog/elements/grayscale-palettes.d.ts +1 -1
- package/lib/color-dialog/elements/grayscale-palettes.js +9 -9
- package/lib/color-dialog/elements/palettes.js +5 -4
- package/lib/color-dialog/helpers/value-model.js +7 -9
- package/lib/color-dialog/index.d.ts +6 -6
- package/lib/color-dialog/index.js +53 -37
- package/lib/color-picker/index.d.ts +2 -2
- package/lib/color-picker/index.js +40 -34
- package/lib/combo-box/helpers/filter.d.ts +2 -2
- package/lib/combo-box/helpers/types.d.ts +1 -1
- package/lib/combo-box/index.d.ts +9 -9
- package/lib/combo-box/index.js +61 -55
- package/lib/configuration/elements/configuration.js +2 -2
- package/lib/counter/index.d.ts +4 -4
- package/lib/counter/index.js +9 -7
- package/lib/datetime-field/index.d.ts +4 -5
- package/lib/datetime-field/index.js +32 -23
- package/lib/datetime-field/utils.js +11 -1
- package/lib/datetime-picker/index.d.ts +75 -75
- package/lib/datetime-picker/index.js +150 -131
- package/lib/datetime-picker/locales.js +5 -5
- package/lib/datetime-picker/utils.js +9 -9
- package/lib/dialog/draggable-element.js +1 -2
- package/lib/dialog/index.d.ts +5 -5
- package/lib/dialog/index.js +51 -47
- package/lib/email-field/index.d.ts +1 -1
- package/lib/email-field/index.js +6 -6
- package/lib/events.d.ts +1 -1
- package/lib/flag/index.d.ts +1 -1
- package/lib/flag/index.js +6 -5
- package/lib/flag/utils/FlagLoader.js +1 -1
- package/lib/header/index.d.ts +1 -1
- package/lib/header/index.js +2 -2
- package/lib/header/themes/halo/dark/index.js +1 -1
- package/lib/header/themes/halo/light/index.js +1 -1
- package/lib/header/themes/solar/charcoal/index.js +1 -1
- package/lib/header/themes/solar/pearl/index.js +1 -1
- package/lib/heatmap/helpers/color.d.ts +1 -1
- package/lib/heatmap/helpers/color.js +11 -5
- package/lib/heatmap/helpers/track.js +3 -3
- package/lib/heatmap/index.d.ts +9 -9
- package/lib/heatmap/index.js +51 -42
- package/lib/icon/index.d.ts +2 -2
- package/lib/icon/index.js +8 -10
- package/lib/interactive-chart/helpers/types.d.ts +3 -3
- package/lib/interactive-chart/index.d.ts +29 -29
- package/lib/interactive-chart/index.js +69 -55
- package/lib/item/helpers/types.d.ts +1 -1
- package/lib/item/index.d.ts +3 -3
- package/lib/item/index.js +24 -20
- package/lib/jsx.d.ts +6 -4
- package/lib/label/index.d.ts +1 -1
- package/lib/label/index.js +10 -7
- package/lib/layout/index.d.ts +7 -7
- package/lib/layout/index.js +7 -7
- package/lib/led-gauge/index.d.ts +1 -1
- package/lib/led-gauge/index.js +10 -10
- package/lib/list/elements/list.d.ts +3 -3
- package/lib/list/elements/list.js +10 -12
- package/lib/list/helpers/renderer.js +2 -2
- package/lib/list/helpers/types.d.ts +1 -1
- package/lib/list/index.d.ts +1 -1
- package/lib/list/renderer.d.ts +7 -7
- package/lib/loader/index.js +7 -8
- package/lib/multi-input/index.d.ts +6 -6
- package/lib/multi-input/index.js +39 -45
- package/lib/notification/elements/notification-tray.d.ts +2 -2
- package/lib/notification/elements/notification-tray.js +3 -3
- package/lib/notification/elements/notification.d.ts +2 -2
- package/lib/notification/elements/notification.js +14 -13
- package/lib/notification/helpers/status.js +1 -1
- package/lib/notification/themes/halo/dark/index.js +1 -1
- package/lib/notification/themes/halo/light/index.js +1 -1
- package/lib/notification/themes/solar/charcoal/index.js +1 -1
- package/lib/notification/themes/solar/pearl/index.js +1 -1
- package/lib/number-field/index.d.ts +5 -6
- package/lib/number-field/index.js +37 -47
- package/lib/overlay/elements/overlay-viewport.d.ts +1 -1
- package/lib/overlay/elements/overlay.d.ts +2 -2
- package/lib/overlay/elements/overlay.js +152 -96
- package/lib/overlay/helpers/types.d.ts +1 -1
- package/lib/overlay/managers/backdrop-manager.d.ts +1 -1
- package/lib/overlay/managers/backdrop-manager.js +2 -2
- package/lib/overlay/managers/close-manager.js +2 -1
- package/lib/overlay/managers/focus-manager.js +23 -13
- package/lib/overlay/managers/interaction-lock-manager.d.ts +4 -4
- package/lib/overlay/managers/interaction-lock-manager.js +33 -25
- package/lib/overlay/managers/viewport-manager.d.ts +2 -2
- package/lib/overlay/managers/viewport-manager.js +3 -2
- package/lib/overlay/managers/zindex-manager.js +4 -2
- package/lib/overlay-menu/helpers/types.d.ts +2 -2
- package/lib/overlay-menu/index.d.ts +1 -1
- package/lib/overlay-menu/index.js +44 -33
- package/lib/overlay-menu/managers/menu-manager.d.ts +10 -10
- package/lib/overlay-menu/managers/menu-manager.js +14 -13
- package/lib/pagination/index.d.ts +4 -4
- package/lib/pagination/index.js +39 -14
- package/lib/panel/index.js +1 -1
- package/lib/password-field/index.d.ts +2 -2
- package/lib/password-field/index.js +3 -3
- package/lib/pill/index.d.ts +1 -1
- package/lib/pill/index.js +22 -19
- package/lib/progress-bar/index.d.ts +1 -1
- package/lib/progress-bar/index.js +38 -37
- package/lib/radio-button/index.d.ts +2 -2
- package/lib/radio-button/index.js +17 -12
- package/lib/radio-button/radio-button-registry.js +8 -5
- package/lib/rating/index.d.ts +1 -1
- package/lib/rating/index.js +2 -5
- package/lib/rating/utils.d.ts +6 -6
- package/lib/rating/utils.js +6 -6
- package/lib/search-field/index.d.ts +2 -2
- package/lib/search-field/index.js +4 -4
- package/lib/select/index.d.ts +34 -34
- package/lib/select/index.js +68 -81
- package/lib/sidebar-layout/index.d.ts +2 -2
- package/lib/sidebar-layout/index.js +7 -9
- package/lib/slider/index.d.ts +2 -2
- package/lib/slider/index.js +57 -45
- package/lib/slider/utils.d.ts +10 -10
- package/lib/slider/utils.js +10 -10
- package/lib/sparkline/index.d.ts +1 -1
- package/lib/sparkline/index.js +7 -8
- package/lib/swing-gauge/helpers.js +2 -2
- package/lib/swing-gauge/index.d.ts +19 -19
- package/lib/swing-gauge/index.js +91 -81
- package/lib/tab/index.d.ts +1 -1
- package/lib/tab/index.js +16 -27
- package/lib/tab/themes/halo/dark/index.js +1 -1
- package/lib/tab/themes/halo/light/index.js +1 -1
- package/lib/tab/themes/solar/charcoal/index.js +1 -1
- package/lib/tab/themes/solar/pearl/index.js +1 -1
- package/lib/tab-bar/helpers/animate.js +1 -1
- package/lib/tab-bar/index.d.ts +1 -1
- package/lib/tab-bar/index.js +34 -18
- package/lib/tab-bar/themes/halo/dark/index.js +1 -1
- package/lib/tab-bar/themes/halo/light/index.js +1 -1
- package/lib/text-field/index.d.ts +1 -1
- package/lib/text-field/index.js +34 -31
- package/lib/time-picker/index.d.ts +6 -6
- package/lib/time-picker/index.js +103 -89
- package/lib/toggle/index.d.ts +1 -1
- package/lib/toggle/index.js +4 -3
- package/lib/toggle/themes/halo/dark/index.js +1 -1
- package/lib/toggle/themes/halo/light/index.js +1 -1
- package/lib/toggle/themes/solar/charcoal/index.js +1 -1
- package/lib/toggle/themes/solar/pearl/index.js +1 -1
- package/lib/tooltip/elements/title-tooltip.js +2 -2
- package/lib/tooltip/index.d.ts +27 -27
- package/lib/tooltip/index.js +42 -38
- package/lib/tooltip/managers/tooltip-manager.d.ts +1 -1
- package/lib/tornado-chart/elements/tornado-chart.d.ts +1 -1
- package/lib/tornado-chart/elements/tornado-chart.js +2 -2
- package/lib/tornado-chart/elements/tornado-item.d.ts +2 -2
- package/lib/tornado-chart/elements/tornado-item.js +12 -10
- package/lib/tree/elements/tree-item.d.ts +3 -3
- package/lib/tree/elements/tree-item.js +21 -19
- package/lib/tree/elements/tree.d.ts +1 -1
- package/lib/tree/elements/tree.js +12 -11
- package/lib/tree/helpers/renderer.js +4 -3
- package/lib/tree/index.d.ts +1 -1
- package/lib/tree/managers/tree-manager.d.ts +1 -1
- package/lib/tree/managers/tree-manager.js +17 -18
- 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 +9 -9
- package/lib/tree-select/index.js +91 -82
- package/lib/tree-select/themes/halo/dark/index.js +1 -1
- package/lib/tree-select/themes/halo/light/index.js +1 -1
- package/lib/tree-select/themes/solar/charcoal/index.js +1 -1
- package/lib/tree-select/themes/solar/pearl/index.js +1 -1
- package/lib/version.js +1 -1
- package/package.json +17 -17
- package/tsconfig.tsbuildinfo +1 -1
package/lib/icon/index.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { __decorate } from "tslib";
|
|
2
|
-
import {
|
|
2
|
+
import { consume } from '@lit-labs/context';
|
|
3
|
+
import { BasicElement, css, svg } from '@refinitiv-ui/core';
|
|
3
4
|
import { customElement } from '@refinitiv-ui/core/decorators/custom-element.js';
|
|
4
5
|
import { property } from '@refinitiv-ui/core/decorators/property.js';
|
|
5
6
|
import { unsafeSVG } from '@refinitiv-ui/core/directives/unsafe-svg.js';
|
|
6
|
-
import { Deferred,
|
|
7
|
+
import { Deferred, isBase64svg, isUrl } from '@refinitiv-ui/utils/loader.js';
|
|
8
|
+
import { efConfig } from '../configuration/index.js';
|
|
7
9
|
import { VERSION } from '../version.js';
|
|
8
10
|
import { IconLoader } from './utils/IconLoader.js';
|
|
9
|
-
import { consume } from '@lit-labs/context';
|
|
10
|
-
import { efConfig } from '../configuration/index.js';
|
|
11
11
|
import { SpriteLoader } from './utils/SpriteLoader.js';
|
|
12
12
|
const EmptyTemplate = svg ``;
|
|
13
13
|
/**
|
|
@@ -88,7 +88,7 @@ let Icon = class Icon extends BasicElement {
|
|
|
88
88
|
* @returns icon map if exists
|
|
89
89
|
*/
|
|
90
90
|
get iconMap() {
|
|
91
|
-
return this.icon && this.config?.icon.map[this.icon] || null;
|
|
91
|
+
return (this.icon && this.config?.icon.map[this.icon]) || null;
|
|
92
92
|
}
|
|
93
93
|
/**
|
|
94
94
|
* Called after the component is first rendered
|
|
@@ -122,7 +122,7 @@ let Icon = class Icon extends BasicElement {
|
|
|
122
122
|
if (!this._icon) {
|
|
123
123
|
return false;
|
|
124
124
|
}
|
|
125
|
-
if (this.iconMap &&
|
|
125
|
+
if (this.iconMap && !isBase64svg(this.iconMap) && !isUrl(this.iconMap)) {
|
|
126
126
|
return false;
|
|
127
127
|
}
|
|
128
128
|
return true;
|
|
@@ -155,8 +155,7 @@ let Icon = class Icon extends BasicElement {
|
|
|
155
155
|
async loadAndRenderIcon(src) {
|
|
156
156
|
const iconTemplateCacheItem = iconTemplateCache.get(src);
|
|
157
157
|
if (!iconTemplateCacheItem) {
|
|
158
|
-
iconTemplateCache.set(src, IconLoader.loadSVG(src)
|
|
159
|
-
.then(body => svg `${unsafeSVG(body)}`));
|
|
158
|
+
iconTemplateCache.set(src, IconLoader.loadSVG(src).then((body) => svg `${unsafeSVG(body)}`));
|
|
160
159
|
return this.loadAndRenderIcon(src); // Load again and await cache result
|
|
161
160
|
}
|
|
162
161
|
this.template = await iconTemplateCacheItem;
|
|
@@ -170,8 +169,7 @@ let Icon = class Icon extends BasicElement {
|
|
|
170
169
|
async loadAndRenderSpriteIcon(iconName) {
|
|
171
170
|
const iconTemplateCacheItem = iconTemplateCache.get(iconName);
|
|
172
171
|
if (!iconTemplateCacheItem) {
|
|
173
|
-
iconTemplateCache.set(iconName, SpriteLoader.loadSpriteSVG(iconName)
|
|
174
|
-
.then(body => svg `${unsafeSVG(body)}`));
|
|
172
|
+
iconTemplateCache.set(iconName, SpriteLoader.loadSpriteSVG(iconName).then((body) => svg `${unsafeSVG(body)}`));
|
|
175
173
|
return this.loadAndRenderIcon(iconName); // Load again and await cache result
|
|
176
174
|
}
|
|
177
175
|
this.template = await iconTemplateCacheItem;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
1
|
+
import type { HSLColor, RGBColor } from '@refinitiv-ui/utils/color.js';
|
|
2
|
+
import type { AreaSeriesPartialOptions, AreaStyleOptions, BarData, BarSeriesPartialOptions, BarStyleOptions, CandlestickSeriesPartialOptions, CandlestickStyleOptions, ChartOptions, DeepPartial, HistogramData, HistogramSeriesPartialOptions, HistogramStyleOptions, ISeriesApi, LineData, LineSeriesPartialOptions, LineStyleOptions, SeriesPartialOptions, SeriesType } from 'lightweight-charts';
|
|
3
3
|
type SeriesOptions = AreaSeriesPartialOptions | BarSeriesPartialOptions | CandlestickSeriesPartialOptions | HistogramSeriesPartialOptions | LineSeriesPartialOptions;
|
|
4
4
|
type SeriesStyleOptions = LineStyleOptions & AreaStyleOptions & BarStyleOptions & CandlestickStyleOptions & HistogramStyleOptions;
|
|
5
5
|
type SeriesData = LineData[] | BarData[] | HistogramData[];
|
|
@@ -43,4 +43,4 @@ interface InteractiveChartSeries {
|
|
|
43
43
|
data: SeriesData;
|
|
44
44
|
seriesOptions?: SeriesPartialOptions<SeriesOptions>;
|
|
45
45
|
}
|
|
46
|
-
export { InteractiveChartConfig, InteractiveChartSeries, Time, Theme, RowLegend, SeriesList, SeriesDataItem, SeriesStyleOptions, ColorToStringFunction, LegendStyle };
|
|
46
|
+
export { InteractiveChartConfig, InteractiveChartSeries, Time, Theme, RowLegend, SeriesList, SeriesData, SeriesDataItem, SeriesOptions, SeriesStyleOptions, ColorToStringFunction, LegendStyle };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { JSXInterface } from '../jsx';
|
|
2
|
-
import { ResponsiveElement, TemplateResult, CSSResultGroup, PropertyValues, ElementSize } from '@refinitiv-ui/core';
|
|
3
2
|
import { IChartApi, MouseEventParams } from 'lightweight-charts';
|
|
3
|
+
import { CSSResultGroup, ElementSize, PropertyValues, ResponsiveElement, TemplateResult } from '@refinitiv-ui/core';
|
|
4
4
|
import '../tooltip/index.js';
|
|
5
|
-
import type { InteractiveChartConfig, InteractiveChartSeries, RowLegend, SeriesList, SeriesDataItem } from './helpers/types';
|
|
6
5
|
import { LegendStyle } from './helpers/types.js';
|
|
7
|
-
|
|
6
|
+
import type { InteractiveChartConfig, InteractiveChartSeries, RowLegend, SeriesData, SeriesDataItem, SeriesList, SeriesOptions, SeriesStyleOptions, Theme, Time } from './helpers/types.js';
|
|
7
|
+
export type { InteractiveChartConfig, InteractiveChartSeries, Time, Theme, RowLegend, SeriesList, SeriesData, SeriesDataItem, SeriesOptions, SeriesStyleOptions, LegendStyle };
|
|
8
8
|
/**
|
|
9
9
|
* A charting component that allows you to create several use cases of financial chart.
|
|
10
10
|
* By lightweight-charts library.
|
|
@@ -26,7 +26,7 @@ export declare class InteractiveChart extends ResponsiveElement {
|
|
|
26
26
|
/**
|
|
27
27
|
* Chart configurations for init chart
|
|
28
28
|
* @type {InteractiveChartConfig}
|
|
29
|
-
|
|
29
|
+
*/
|
|
30
30
|
config: InteractiveChartConfig | null;
|
|
31
31
|
/**
|
|
32
32
|
* Hide legend
|
|
@@ -96,9 +96,9 @@ export declare class InteractiveChart extends ResponsiveElement {
|
|
|
96
96
|
*/
|
|
97
97
|
resizedCallback(size: ElementSize): void;
|
|
98
98
|
/**
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
99
|
+
* Legend value observer
|
|
100
|
+
* @returns {void}
|
|
101
|
+
*/
|
|
102
102
|
private onLegendChange;
|
|
103
103
|
/**
|
|
104
104
|
* Legend style observer
|
|
@@ -108,9 +108,9 @@ export declare class InteractiveChart extends ResponsiveElement {
|
|
|
108
108
|
*/
|
|
109
109
|
private onLegendStyleChange;
|
|
110
110
|
/**
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
111
|
+
* Jump last value observer
|
|
112
|
+
* @returns {void}
|
|
113
|
+
*/
|
|
114
114
|
private onJumpButtonChange;
|
|
115
115
|
/**
|
|
116
116
|
* update width and height of chart
|
|
@@ -179,15 +179,15 @@ export declare class InteractiveChart extends ResponsiveElement {
|
|
|
179
179
|
*/
|
|
180
180
|
private convertColorToString;
|
|
181
181
|
/**
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
182
|
+
* Create data configuration from theme
|
|
183
|
+
* @returns {void}
|
|
184
|
+
*/
|
|
185
185
|
private createSeriesOptions;
|
|
186
186
|
/**
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
187
|
+
* Apply Theme to chart
|
|
188
|
+
* @param config value config
|
|
189
|
+
* @returns {void}
|
|
190
|
+
*/
|
|
191
191
|
private applyTheme;
|
|
192
192
|
/**
|
|
193
193
|
* Apply text color legend from chart options
|
|
@@ -253,13 +253,13 @@ export declare class InteractiveChart extends ResponsiveElement {
|
|
|
253
253
|
*/
|
|
254
254
|
private createSpanOHLC;
|
|
255
255
|
/**
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
256
|
+
* Create text used by several series types such as bars or candlesticks
|
|
257
|
+
* @param rowLegend Legend element
|
|
258
|
+
* @param rowData Value of series
|
|
259
|
+
* @param priceColor color of series
|
|
260
|
+
* @param index Series index
|
|
261
|
+
* @returns {void}
|
|
262
|
+
*/
|
|
263
263
|
private createTextOHLC;
|
|
264
264
|
/**
|
|
265
265
|
* Create text price used by several series types
|
|
@@ -335,11 +335,11 @@ export declare class InteractiveChart extends ResponsiveElement {
|
|
|
335
335
|
*/
|
|
336
336
|
colors(): string[];
|
|
337
337
|
/**
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
338
|
+
* A `CSSResultGroup` that will be used
|
|
339
|
+
* to style the host, slotted children
|
|
340
|
+
* and the internal template of the element.
|
|
341
|
+
* @return CSS template
|
|
342
|
+
*/
|
|
343
343
|
static get styles(): CSSResultGroup;
|
|
344
344
|
/**
|
|
345
345
|
* A `TemplateResult` that will be used
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
var InteractiveChart_1;
|
|
2
2
|
import { __decorate } from "tslib";
|
|
3
|
-
import {
|
|
3
|
+
import { createChart as chart } from 'lightweight-charts';
|
|
4
|
+
import { ResponsiveElement, css, html } from '@refinitiv-ui/core';
|
|
4
5
|
import { customElement } from '@refinitiv-ui/core/decorators/custom-element.js';
|
|
5
6
|
import { property } from '@refinitiv-ui/core/decorators/property.js';
|
|
6
7
|
import { query } from '@refinitiv-ui/core/decorators/query.js';
|
|
7
|
-
import { VERSION } from '../version.js';
|
|
8
8
|
import { color as parseColor } from '@refinitiv-ui/utils/color.js';
|
|
9
|
-
import { createChart as chart } from 'lightweight-charts';
|
|
10
9
|
import '../tooltip/index.js';
|
|
11
|
-
import {
|
|
10
|
+
import { VERSION } from '../version.js';
|
|
12
11
|
import { merge } from './helpers/merge.js';
|
|
12
|
+
import { LegendStyle } from './helpers/types.js';
|
|
13
13
|
const NOT_AVAILABLE_DATA = 'N/A';
|
|
14
14
|
const NO_DATA_POINT = '--';
|
|
15
15
|
/**
|
|
@@ -24,7 +24,7 @@ let InteractiveChart = InteractiveChart_1 = class InteractiveChart extends Respo
|
|
|
24
24
|
/**
|
|
25
25
|
* Chart configurations for init chart
|
|
26
26
|
* @type {InteractiveChartConfig}
|
|
27
|
-
|
|
27
|
+
*/
|
|
28
28
|
this.config = null;
|
|
29
29
|
/**
|
|
30
30
|
* Hide legend
|
|
@@ -185,9 +185,9 @@ let InteractiveChart = InteractiveChart_1 = class InteractiveChart extends Respo
|
|
|
185
185
|
}
|
|
186
186
|
}
|
|
187
187
|
/**
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
188
|
+
* Legend value observer
|
|
189
|
+
* @returns {void}
|
|
190
|
+
*/
|
|
191
191
|
onLegendChange() {
|
|
192
192
|
if (!this.disabledLegend) {
|
|
193
193
|
this.createLegend();
|
|
@@ -214,9 +214,9 @@ let InteractiveChart = InteractiveChart_1 = class InteractiveChart extends Respo
|
|
|
214
214
|
}
|
|
215
215
|
}
|
|
216
216
|
/**
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
217
|
+
* Jump last value observer
|
|
218
|
+
* @returns {void}
|
|
219
|
+
*/
|
|
220
220
|
onJumpButtonChange() {
|
|
221
221
|
if (!this.disabledJumpButton) {
|
|
222
222
|
this.createJumpButton(this.width, this.height);
|
|
@@ -410,9 +410,9 @@ let InteractiveChart = InteractiveChart_1 = class InteractiveChart extends Respo
|
|
|
410
410
|
return color || {};
|
|
411
411
|
}
|
|
412
412
|
/**
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
413
|
+
* Create data configuration from theme
|
|
414
|
+
* @returns {void}
|
|
415
|
+
*/
|
|
416
416
|
createSeriesOptions() {
|
|
417
417
|
if (this.theme) {
|
|
418
418
|
let colorIndex = 0;
|
|
@@ -464,12 +464,12 @@ let InteractiveChart = InteractiveChart_1 = class InteractiveChart extends Respo
|
|
|
464
464
|
wickDownColor: this.theme.chartDownColor
|
|
465
465
|
};
|
|
466
466
|
// Update color index
|
|
467
|
-
if (!seriesOptions.upColor
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
467
|
+
if (!seriesOptions.upColor ||
|
|
468
|
+
!seriesOptions.downColor ||
|
|
469
|
+
!seriesOptions.borderUpColor ||
|
|
470
|
+
!seriesOptions.borderDownColor ||
|
|
471
|
+
!seriesOptions.wickUpColor ||
|
|
472
|
+
!seriesOptions.wickDownColor) {
|
|
473
473
|
colorIndex++;
|
|
474
474
|
}
|
|
475
475
|
}
|
|
@@ -484,7 +484,8 @@ let InteractiveChart = InteractiveChart_1 = class InteractiveChart extends Respo
|
|
|
484
484
|
}
|
|
485
485
|
// Update config seriesOptions not have seriesOptions
|
|
486
486
|
if (!this.internalConfig.series[index].seriesOptions) {
|
|
487
|
-
this.internalConfig.series[index].seriesOptions =
|
|
487
|
+
this.internalConfig.series[index].seriesOptions =
|
|
488
|
+
seriesThemeOptions;
|
|
488
489
|
}
|
|
489
490
|
else {
|
|
490
491
|
merge(seriesOptions, seriesThemeOptions);
|
|
@@ -493,10 +494,10 @@ let InteractiveChart = InteractiveChart_1 = class InteractiveChart extends Respo
|
|
|
493
494
|
}
|
|
494
495
|
}
|
|
495
496
|
/**
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
497
|
+
* Apply Theme to chart
|
|
498
|
+
* @param config value config
|
|
499
|
+
* @returns {void}
|
|
500
|
+
*/
|
|
500
501
|
applyTheme(config) {
|
|
501
502
|
if (this.chart && this.theme) {
|
|
502
503
|
const style = getComputedStyle(this);
|
|
@@ -628,7 +629,7 @@ let InteractiveChart = InteractiveChart_1 = class InteractiveChart extends Respo
|
|
|
628
629
|
for (let idx = 0; idx < this.internalConfig.series.length; idx++) {
|
|
629
630
|
const chartType = this.internalConfig.series[idx].type;
|
|
630
631
|
const dataSet = this.internalConfig.series[idx].data || [];
|
|
631
|
-
const symbol =
|
|
632
|
+
const symbol = this.internalConfig.series[idx].symbolName || this.internalConfig.series[idx].symbol || '';
|
|
632
633
|
const isLegendVisible = this.internalConfig.series[idx].legendVisible !== false;
|
|
633
634
|
// Create row legend element
|
|
634
635
|
if (!rowLegend) {
|
|
@@ -650,11 +651,11 @@ let InteractiveChart = InteractiveChart_1 = class InteractiveChart extends Respo
|
|
|
650
651
|
}
|
|
651
652
|
this.legendContainer.appendChild(rowLegendElem);
|
|
652
653
|
}
|
|
653
|
-
/* Update value legend element on subscribeCrosshairMove.
|
|
654
|
-
* Don't need to be updated if chart has no data.
|
|
655
|
-
*/
|
|
656
|
-
/* c8 ignore start */
|
|
657
654
|
else if (rowLegend && dataSet.length) {
|
|
655
|
+
/* Update value legend element on subscribeCrosshairMove.
|
|
656
|
+
* Don't need to be updated if chart has no data.
|
|
657
|
+
*/
|
|
658
|
+
/* c8 ignore start */
|
|
658
659
|
let value;
|
|
659
660
|
let priceColor = '';
|
|
660
661
|
// When have price on event moved on the crosshair
|
|
@@ -675,7 +676,10 @@ let InteractiveChart = InteractiveChart_1 = class InteractiveChart extends Respo
|
|
|
675
676
|
const latestData = dataSet[dataSet.length - 1];
|
|
676
677
|
if (latestData) {
|
|
677
678
|
priceColor = this.getColorInSeries(latestData, chartType, idx);
|
|
678
|
-
value =
|
|
679
|
+
value =
|
|
680
|
+
chartType === 'bar' || chartType === 'candlestick'
|
|
681
|
+
? latestData
|
|
682
|
+
: latestData.value;
|
|
679
683
|
this.isCrosshairVisible = false;
|
|
680
684
|
this.hasDataPoint = true;
|
|
681
685
|
}
|
|
@@ -704,7 +708,7 @@ let InteractiveChart = InteractiveChart_1 = class InteractiveChart extends Respo
|
|
|
704
708
|
if (chartType === 'bar' || chartType === 'candlestick') {
|
|
705
709
|
if (!this.hasDataPoint && rowLegendElem instanceof NodeList) {
|
|
706
710
|
const spanElem = rowLegendElem[index].querySelectorAll('span.price,span.ohlc');
|
|
707
|
-
spanElem.forEach(span => rowLegendElem[index].removeChild(span));
|
|
711
|
+
spanElem.forEach((span) => rowLegendElem[index].removeChild(span));
|
|
708
712
|
const span = document.createElement('span');
|
|
709
713
|
span.className = 'price';
|
|
710
714
|
span.textContent = value;
|
|
@@ -732,16 +736,18 @@ let InteractiveChart = InteractiveChart_1 = class InteractiveChart extends Respo
|
|
|
732
736
|
}
|
|
733
737
|
}
|
|
734
738
|
/**
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
739
|
+
* Create text used by several series types such as bars or candlesticks
|
|
740
|
+
* @param rowLegend Legend element
|
|
741
|
+
* @param rowData Value of series
|
|
742
|
+
* @param priceColor color of series
|
|
743
|
+
* @param index Series index
|
|
744
|
+
* @returns {void}
|
|
745
|
+
*/
|
|
742
746
|
createTextOHLC(rowLegend, rowData, priceColor, index) {
|
|
743
747
|
// Uses price formatter if provided
|
|
744
|
-
const formatter = this.internalConfig.series[index].hasOwnProperty('legendPriceFormatter')
|
|
748
|
+
const formatter = this.internalConfig.series[index].hasOwnProperty('legendPriceFormatter')
|
|
749
|
+
? this.internalConfig.series[index].legendPriceFormatter
|
|
750
|
+
: null;
|
|
745
751
|
if (formatter) {
|
|
746
752
|
rowData = {
|
|
747
753
|
open: formatter(rowData.open),
|
|
@@ -879,7 +885,9 @@ let InteractiveChart = InteractiveChart_1 = class InteractiveChart extends Respo
|
|
|
879
885
|
return this.getLegendPriceColor(this.seriesList[index].options().color);
|
|
880
886
|
}
|
|
881
887
|
else if (chartType === 'candlestick') {
|
|
882
|
-
const value = seriesData.hasOwnProperty('seriesPrices')
|
|
888
|
+
const value = seriesData.hasOwnProperty('seriesPrices')
|
|
889
|
+
? seriesData?.seriesPrices.get(this.seriesList[index])
|
|
890
|
+
: seriesData;
|
|
883
891
|
const barStyle = this.seriesList[index].options();
|
|
884
892
|
const colorBar = value.close > value.open ? barStyle.borderUpColor : barStyle.borderDownColor;
|
|
885
893
|
return colorBar;
|
|
@@ -891,7 +899,9 @@ let InteractiveChart = InteractiveChart_1 = class InteractiveChart extends Respo
|
|
|
891
899
|
return this.getLegendPriceColor(this.seriesList[index].options().lineColor);
|
|
892
900
|
}
|
|
893
901
|
else if (chartType === 'volume') {
|
|
894
|
-
const priceValue = seriesData.hasOwnProperty('seriesPrices')
|
|
902
|
+
const priceValue = seriesData.hasOwnProperty('seriesPrices')
|
|
903
|
+
? seriesData.seriesPrices.get(this.seriesList[index])
|
|
904
|
+
: seriesData.value;
|
|
895
905
|
let dataItem = {};
|
|
896
906
|
this.internalConfig.series[index].data.forEach((dataConfig) => {
|
|
897
907
|
const data = dataConfig;
|
|
@@ -899,10 +909,10 @@ let InteractiveChart = InteractiveChart_1 = class InteractiveChart extends Respo
|
|
|
899
909
|
const timeSeriesData = seriesData.time;
|
|
900
910
|
// if via time point data string format 'yyyy-mm-dd' or object '{ year: 2019, month: 6, day: 1 }'
|
|
901
911
|
if (time.hasOwnProperty('day') && time.hasOwnProperty('month') && time.hasOwnProperty('year')) {
|
|
902
|
-
if (time.day === timeSeriesData.day
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
912
|
+
if (time.day === timeSeriesData.day &&
|
|
913
|
+
time.month === timeSeriesData.month &&
|
|
914
|
+
time.year === timeSeriesData.year &&
|
|
915
|
+
data.value === priceValue) {
|
|
906
916
|
dataItem = dataConfig;
|
|
907
917
|
}
|
|
908
918
|
}
|
|
@@ -936,7 +946,7 @@ let InteractiveChart = InteractiveChart_1 = class InteractiveChart extends Respo
|
|
|
936
946
|
const position = this.getPriceScalePosition();
|
|
937
947
|
const pricePosition = position === 'left' ? 30 : 0;
|
|
938
948
|
const buttonTop = `${height - 70}px`;
|
|
939
|
-
const buttonLeft = `${
|
|
949
|
+
const buttonLeft = `${width + pricePosition - 100}px`;
|
|
940
950
|
this.jumpButtonContainer.style.top = buttonTop;
|
|
941
951
|
this.jumpButtonContainer.style.left = buttonLeft;
|
|
942
952
|
// Create subscribeVisibleTimeRangeChange
|
|
@@ -995,11 +1005,11 @@ let InteractiveChart = InteractiveChart_1 = class InteractiveChart extends Respo
|
|
|
995
1005
|
return colors;
|
|
996
1006
|
}
|
|
997
1007
|
/**
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1008
|
+
* A `CSSResultGroup` that will be used
|
|
1009
|
+
* to style the host, slotted children
|
|
1010
|
+
* and the internal template of the element.
|
|
1011
|
+
* @return CSS template
|
|
1012
|
+
*/
|
|
1003
1013
|
static get styles() {
|
|
1004
1014
|
return css `
|
|
1005
1015
|
:host {
|
|
@@ -1009,7 +1019,7 @@ let InteractiveChart = InteractiveChart_1 = class InteractiveChart extends Respo
|
|
|
1009
1019
|
z-index: 0;
|
|
1010
1020
|
}
|
|
1011
1021
|
|
|
1012
|
-
[part=legend] {
|
|
1022
|
+
[part='legend'] {
|
|
1013
1023
|
position: absolute;
|
|
1014
1024
|
z-index: 1000;
|
|
1015
1025
|
}
|
|
@@ -1029,8 +1039,12 @@ let InteractiveChart = InteractiveChart_1 = class InteractiveChart extends Respo
|
|
|
1029
1039
|
<div part="jump-button"></div>
|
|
1030
1040
|
</div>
|
|
1031
1041
|
<div part="branding-container" title="" tooltip="Powered by Trading View">
|
|
1032
|
-
<svg width="33" height="19" viewBox="0 0 611 314"
|
|
1033
|
-
<path
|
|
1042
|
+
<svg width="33" height="19" viewBox="0 0 611 314" part="branding">
|
|
1043
|
+
<path
|
|
1044
|
+
fill-rule="evenodd"
|
|
1045
|
+
clip-rule="evenodd"
|
|
1046
|
+
d="M341 124C375.242 124 403 96.2417 403 62C403 27.7583 375.242 0 341 0C306.758 0 279 27.7583 279 62C279 96.2417 306.758 124 341 124ZM481 314H337L467 4H611L481 314ZM124 4H248V128V314H124V128H0V4H124Z"
|
|
1047
|
+
/>
|
|
1034
1048
|
</svg>
|
|
1035
1049
|
</div>
|
|
1036
1050
|
<div part="chart"></div>
|
package/lib/item/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { JSXInterface } from '../jsx';
|
|
2
|
-
import {
|
|
3
|
-
import '../icon/index.js';
|
|
2
|
+
import { CSSResultGroup, ControlElement, PropertyValues, TemplateResult } from '@refinitiv-ui/core';
|
|
4
3
|
import '../checkbox/index.js';
|
|
5
|
-
import
|
|
4
|
+
import '../icon/index.js';
|
|
5
|
+
import type { ItemData, ItemDivider, ItemHeader, ItemText, ItemType } from './helpers/types';
|
|
6
6
|
export type { ItemType, ItemText, ItemHeader, ItemDivider, ItemData };
|
|
7
7
|
/**
|
|
8
8
|
* Used as a basic building block to compose complex custom elements,
|
package/lib/item/index.js
CHANGED
|
@@ -2,14 +2,13 @@ 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 {
|
|
6
|
-
import '
|
|
5
|
+
import { createRef, ref } from '@refinitiv-ui/core/directives/ref.js';
|
|
6
|
+
import { isElementOverflown } from '@refinitiv-ui/utils/element.js';
|
|
7
7
|
import '../checkbox/index.js';
|
|
8
|
+
import '../icon/index.js';
|
|
8
9
|
import { registerOverflowTooltip } from '../tooltip/index.js';
|
|
9
|
-
import {
|
|
10
|
-
|
|
11
|
-
const isAllWhitespaceTextNode = (node) => node.nodeType === document.TEXT_NODE
|
|
12
|
-
&& !node.textContent?.trim();
|
|
10
|
+
import { VERSION } from '../version.js';
|
|
11
|
+
const isAllWhitespaceTextNode = (node) => node.nodeType === document.TEXT_NODE && !node.textContent?.trim();
|
|
13
12
|
/**
|
|
14
13
|
* Used as a basic building block to compose complex custom elements,
|
|
15
14
|
* additionally it can be used by applications
|
|
@@ -85,7 +84,7 @@ let Item = class Item extends ControlElement {
|
|
|
85
84
|
*/
|
|
86
85
|
this.checkSlotChildren = (event) => {
|
|
87
86
|
const slot = event.target;
|
|
88
|
-
this.isSlotEmpty = !slot.assignedNodes().filter(node => !this.isIgnorable(node)).length;
|
|
87
|
+
this.isSlotEmpty = !slot.assignedNodes().filter((node) => !this.isIgnorable(node)).length;
|
|
89
88
|
this.requestUpdate();
|
|
90
89
|
};
|
|
91
90
|
}
|
|
@@ -107,18 +106,18 @@ let Item = class Item extends ControlElement {
|
|
|
107
106
|
display: flex;
|
|
108
107
|
align-items: center;
|
|
109
108
|
}
|
|
110
|
-
[part=checkbox] {
|
|
109
|
+
[part='checkbox'] {
|
|
111
110
|
pointer-events: none;
|
|
112
111
|
}
|
|
113
|
-
[part=left],
|
|
114
|
-
[part=right] {
|
|
112
|
+
[part='left'],
|
|
113
|
+
[part='right'] {
|
|
115
114
|
display: flex;
|
|
116
115
|
align-items: center;
|
|
117
116
|
}
|
|
118
|
-
[part=center] {
|
|
117
|
+
[part='center'] {
|
|
119
118
|
flex: 1;
|
|
120
119
|
}
|
|
121
|
-
:host([type=divider]) > * {
|
|
120
|
+
:host([type='divider']) > * {
|
|
122
121
|
display: none;
|
|
123
122
|
}
|
|
124
123
|
`;
|
|
@@ -128,8 +127,7 @@ let Item = class Item extends ControlElement {
|
|
|
128
127
|
* @returns whether node can be ignored.
|
|
129
128
|
*/
|
|
130
129
|
isIgnorable(node) {
|
|
131
|
-
return node.nodeType === document.COMMENT_NODE
|
|
132
|
-
|| isAllWhitespaceTextNode(node);
|
|
130
|
+
return node.nodeType === document.COMMENT_NODE || isAllWhitespaceTextNode(node);
|
|
133
131
|
}
|
|
134
132
|
/**
|
|
135
133
|
* Handles aria-selected or aria-checked when toggle between single and multiple selection mode
|
|
@@ -216,13 +214,15 @@ let Item = class Item extends ControlElement {
|
|
|
216
214
|
* @returns return true if an item is overflown.
|
|
217
215
|
*/
|
|
218
216
|
isItemOverflown() {
|
|
219
|
-
return this.isItemElementOverflown(this.labelRef.value) || this.isItemElementOverflown(this.subLabelRef.value);
|
|
217
|
+
return (this.isItemElementOverflown(this.labelRef.value) || this.isItemElementOverflown(this.subLabelRef.value));
|
|
220
218
|
}
|
|
221
219
|
/**
|
|
222
220
|
* Get icon template if icon attribute is defined
|
|
223
221
|
*/
|
|
224
222
|
get iconTemplate() {
|
|
225
|
-
return this.icon !== null && this.icon !== undefined
|
|
223
|
+
return this.icon !== null && this.icon !== undefined
|
|
224
|
+
? html `<ef-icon part="icon" .icon="${this.icon}"></ef-icon>`
|
|
225
|
+
: undefined;
|
|
226
226
|
}
|
|
227
227
|
/**
|
|
228
228
|
* Get subLabel template if it is defined and no slot content present
|
|
@@ -241,7 +241,10 @@ let Item = class Item extends ControlElement {
|
|
|
241
241
|
*/
|
|
242
242
|
get slotContent() {
|
|
243
243
|
const nodes = this.slotRef.value?.assignedNodes() || [];
|
|
244
|
-
return nodes
|
|
244
|
+
return nodes
|
|
245
|
+
.map((node) => node.textContent)
|
|
246
|
+
.join(' ')
|
|
247
|
+
.trim();
|
|
245
248
|
}
|
|
246
249
|
/**
|
|
247
250
|
* Get template for `for` attribute.
|
|
@@ -256,7 +259,9 @@ let Item = class Item extends ControlElement {
|
|
|
256
259
|
*/
|
|
257
260
|
get multipleTemplate() {
|
|
258
261
|
const multiple = this.multiple && (!this.type || this.type === 'text');
|
|
259
|
-
return multiple
|
|
262
|
+
return multiple
|
|
263
|
+
? html `<ef-checkbox part="checkbox" .checked="${this.selected}" tabindex="-1"></ef-checkbox>`
|
|
264
|
+
: undefined;
|
|
260
265
|
}
|
|
261
266
|
/**
|
|
262
267
|
* Return true if the item can be highlighted. True if not disabled and type is Text
|
|
@@ -274,8 +279,7 @@ let Item = class Item extends ControlElement {
|
|
|
274
279
|
render() {
|
|
275
280
|
return html `
|
|
276
281
|
<div part="left">
|
|
277
|
-
${this.iconTemplate}
|
|
278
|
-
${this.multipleTemplate}
|
|
282
|
+
${this.iconTemplate} ${this.multipleTemplate}
|
|
279
283
|
<slot name="left"></slot>
|
|
280
284
|
</div>
|
|
281
285
|
<div part="center" ${ref(this.labelRef)}>
|
package/lib/jsx.d.ts
CHANGED
|
@@ -48,9 +48,11 @@ export declare namespace JSXInterface {
|
|
|
48
48
|
innerHTML?: string;
|
|
49
49
|
key?: string | number;
|
|
50
50
|
accessKey?: string;
|
|
51
|
-
class?:
|
|
52
|
-
|
|
53
|
-
|
|
51
|
+
class?:
|
|
52
|
+
| string
|
|
53
|
+
| {
|
|
54
|
+
[className: string]: boolean;
|
|
55
|
+
};
|
|
54
56
|
contentEditable?: boolean | string;
|
|
55
57
|
contenteditable?: boolean | string;
|
|
56
58
|
contextMenu?: string;
|
|
@@ -220,4 +222,4 @@ export declare namespace JSXInterface {
|
|
|
220
222
|
onTransitionEnd?: (event: TransitionEvent) => void;
|
|
221
223
|
onTransitionEndCapture?: (event: TransitionEvent) => void;
|
|
222
224
|
}
|
|
223
|
-
}
|
|
225
|
+
}
|
package/lib/label/index.d.ts
CHANGED
package/lib/label/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { __decorate } from "tslib";
|
|
2
|
-
import { BasicElement,
|
|
2
|
+
import { BasicElement, 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
5
|
import { styleMap } from '@refinitiv-ui/core/directives/style-map.js';
|
|
6
|
-
import { VERSION } from '../version.js';
|
|
7
6
|
import { addTooltipCondition, removeTooltipCondition } from '../tooltip/index.js';
|
|
7
|
+
import { VERSION } from '../version.js';
|
|
8
8
|
/**
|
|
9
9
|
* Configuration object
|
|
10
10
|
* for mutations observers
|
|
@@ -144,7 +144,10 @@ let Label = class Label extends BasicElement {
|
|
|
144
144
|
recalculate(mutation = false) {
|
|
145
145
|
const oldValue = this.text;
|
|
146
146
|
const raw = this.textContent || '';
|
|
147
|
-
this.chunks = raw
|
|
147
|
+
this.chunks = raw
|
|
148
|
+
.split(_)
|
|
149
|
+
.map((chunk) => chunk.trim())
|
|
150
|
+
.filter((chunk) => chunk);
|
|
148
151
|
const newValue = this.text;
|
|
149
152
|
if (oldValue !== newValue) {
|
|
150
153
|
this.requestUpdate('text', oldValue);
|
|
@@ -178,7 +181,9 @@ let Label = class Label extends BasicElement {
|
|
|
178
181
|
}
|
|
179
182
|
const leftPart = html `<div class="split left">${left.join(_)}</div>`;
|
|
180
183
|
const centerPart = isSingleWord ? undefined : html `<div class="split center"> </div>`;
|
|
181
|
-
const rightPart = right.length
|
|
184
|
+
const rightPart = right.length
|
|
185
|
+
? html `<div class="split right"><span dir="ltr">${right.join(_)}</span></div>`
|
|
186
|
+
: undefined;
|
|
182
187
|
return html `${leftPart}${centerPart}${rightPart}`;
|
|
183
188
|
}
|
|
184
189
|
/**
|
|
@@ -190,9 +195,7 @@ let Label = class Label extends BasicElement {
|
|
|
190
195
|
'-webkit-line-clamp': `${this.lineClamp}`,
|
|
191
196
|
wordBreak: this.lineClamp === 1 ? 'break-all' : ''
|
|
192
197
|
};
|
|
193
|
-
return html `
|
|
194
|
-
<span class="clamp" style="${styleMap(styles)}">${this.text}</span>
|
|
195
|
-
`;
|
|
198
|
+
return html ` <span class="clamp" style="${styleMap(styles)}">${this.text}</span> `;
|
|
196
199
|
}
|
|
197
200
|
/**
|
|
198
201
|
* A `TemplateResult` that will be used
|