@refinitiv-ui/elements 7.0.0 → 7.0.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 +191 -456
- package/LICENSE +2 -2
- package/README.md +13 -11
- 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 +19 -13
- package/lib/notification/helpers/status.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/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 +16 -16
- package/tsconfig.tsbuildinfo +1 -1
package/lib/card/index.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
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 { query } from '@refinitiv-ui/core/decorators/query.js';
|
|
6
6
|
import { state } from '@refinitiv-ui/core/decorators/state.js';
|
|
7
|
-
import
|
|
7
|
+
import '@refinitiv-ui/phrasebook/locale/en/card.js';
|
|
8
|
+
import { translate } from '@refinitiv-ui/translate';
|
|
8
9
|
import { isSlotEmpty } from '@refinitiv-ui/utils/is-slot-empty.js';
|
|
9
|
-
import '../label/index.js';
|
|
10
10
|
import '../button/index.js';
|
|
11
|
+
import '../label/index.js';
|
|
11
12
|
import '../overlay-menu/index.js';
|
|
12
|
-
import '
|
|
13
|
-
import { translate } from '@refinitiv-ui/translate';
|
|
13
|
+
import { VERSION } from '../version.js';
|
|
14
14
|
/**
|
|
15
15
|
* A card frame component.
|
|
16
16
|
*
|
|
@@ -63,14 +63,15 @@ let Card = class Card extends BasicElement {
|
|
|
63
63
|
display: flex;
|
|
64
64
|
flex-flow: column nowrap;
|
|
65
65
|
}
|
|
66
|
-
[part~=header] {
|
|
66
|
+
[part~='header'] {
|
|
67
67
|
display: flex;
|
|
68
68
|
}
|
|
69
|
-
[part~=header-body] {
|
|
69
|
+
[part~='header-body'] {
|
|
70
70
|
flex: 1;
|
|
71
71
|
min-width: 0px;
|
|
72
72
|
}
|
|
73
|
-
[part~=footer]:not([part~=
|
|
73
|
+
[part~='footer']:not([part~='has-content']),
|
|
74
|
+
[part~='header']:not([part~='has-content']) {
|
|
74
75
|
display: none;
|
|
75
76
|
}
|
|
76
77
|
`;
|
|
@@ -172,24 +173,25 @@ let Card = class Card extends BasicElement {
|
|
|
172
173
|
* @return menu template
|
|
173
174
|
*/
|
|
174
175
|
get menuTemplate() {
|
|
175
|
-
return html `${this.menuData
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
176
|
+
return html `${this.menuData
|
|
177
|
+
? html ` <ef-button
|
|
178
|
+
part="menu-button"
|
|
179
|
+
icon="more-vertical"
|
|
180
|
+
transparent
|
|
181
|
+
aria-label=${this.t('OPEN_MENU')}
|
|
182
|
+
aria-haspopup="true"
|
|
183
|
+
aria-controls="menu-popup"
|
|
184
|
+
aria-expanded=${this.menuOpened}
|
|
185
|
+
@tap=${this.openMenu}
|
|
186
|
+
></ef-button>
|
|
187
|
+
<ef-overlay-menu
|
|
188
|
+
id="menu-popup"
|
|
189
|
+
part="menu-popup"
|
|
190
|
+
.data=${this.menuData}
|
|
191
|
+
position="bottom-end"
|
|
192
|
+
@opened-changed=${this.onMenuOpenChanged}
|
|
193
|
+
></ef-overlay-menu>`
|
|
194
|
+
: undefined} `;
|
|
193
195
|
}
|
|
194
196
|
/**
|
|
195
197
|
* Template of header
|
|
@@ -200,7 +202,9 @@ let Card = class Card extends BasicElement {
|
|
|
200
202
|
<div part="header${this.withHeader ? ' has-content' : ''}">
|
|
201
203
|
<div part="header-body">
|
|
202
204
|
<slot name="header" @slotchange="${this.onHeaderSlotChange}"></slot>
|
|
203
|
-
${!this.headerHasContent && this.header
|
|
205
|
+
${!this.headerHasContent && this.header
|
|
206
|
+
? html `<ef-label line-clamp="3" part="header-text">${this.header}</ef-label>`
|
|
207
|
+
: null}
|
|
204
208
|
</div>
|
|
205
209
|
${this.menuTemplate}
|
|
206
210
|
</div>
|
|
@@ -215,7 +219,9 @@ let Card = class Card extends BasicElement {
|
|
|
215
219
|
<div part="footer${this.withFooter ? ' has-content' : ''}">
|
|
216
220
|
<div part="footer-body">
|
|
217
221
|
<slot name="footer" @slotchange="${this.onFooterSlotChange}"></slot>
|
|
218
|
-
${!this.footerHasContent && this.footer
|
|
222
|
+
${!this.footerHasContent && this.footer
|
|
223
|
+
? html `<ef-label line-clamp="3">${this.footer}</ef-label>`
|
|
224
|
+
: undefined}
|
|
219
225
|
</div>
|
|
220
226
|
</div>
|
|
221
227
|
`;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { JSXInterface } from '../../jsx';
|
|
2
|
-
import { BasicElement, nothing, PropertyValues, TemplateResult, CSSResultGroup } from '@refinitiv-ui/core';
|
|
3
|
-
import { Ref } from '@refinitiv-ui/core/directives/ref.js';
|
|
4
2
|
import { Chart as ChartJS } from 'chart.js';
|
|
5
|
-
import type { ChartConfiguration, ChartDataset, ChartOptions, ChartType, LegendItem, UpdateMode } from 'chart.js';
|
|
6
3
|
import 'chartjs-adapter-date-fns';
|
|
7
|
-
import {
|
|
4
|
+
import { BasicElement, CSSResultGroup, PropertyValues, TemplateResult, nothing } from '@refinitiv-ui/core';
|
|
5
|
+
import { Ref } from '@refinitiv-ui/core/directives/ref.js';
|
|
8
6
|
import '../../header/index.js';
|
|
7
|
+
import { DatasetColors } from '../helpers/index.js';
|
|
8
|
+
import type { ChartConfiguration, ChartDataset, ChartOptions, ChartType, LegendItem, UpdateMode } from 'chart.js';
|
|
9
9
|
declare module 'chart.js' {
|
|
10
10
|
interface PluginOptionsByType<TType extends ChartType = ChartType> {
|
|
11
11
|
'ef-chart': object;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { __decorate } from "tslib";
|
|
2
|
-
import {
|
|
2
|
+
import { Chart as ChartJS } from 'chart.js';
|
|
3
|
+
import 'chartjs-adapter-date-fns';
|
|
4
|
+
import { BasicElement, css, html, nothing } from '@refinitiv-ui/core';
|
|
3
5
|
import { customElement } from '@refinitiv-ui/core/decorators/custom-element.js';
|
|
4
6
|
import { property } from '@refinitiv-ui/core/decorators/property.js';
|
|
5
|
-
import {
|
|
7
|
+
import { createRef, ref } from '@refinitiv-ui/core/directives/ref.js';
|
|
6
8
|
import { color as parseColor } from '@refinitiv-ui/utils/color.js';
|
|
9
|
+
import '../../header/index.js';
|
|
7
10
|
import { VERSION } from '../../version.js';
|
|
8
|
-
import { Chart as ChartJS } from 'chart.js';
|
|
9
|
-
import 'chartjs-adapter-date-fns';
|
|
10
11
|
import { merge } from '../helpers/index.js';
|
|
11
|
-
import '../../header/index.js';
|
|
12
12
|
const CSS_COLOR_PREFIX = '--chart-color-';
|
|
13
13
|
/**
|
|
14
14
|
* Charting component that uses ChartJS library
|
|
@@ -40,7 +40,7 @@ let Chart = class Chart extends BasicElement {
|
|
|
40
40
|
let colors;
|
|
41
41
|
let borderColor;
|
|
42
42
|
let backgroundColor;
|
|
43
|
-
const isMultipleDatasets =
|
|
43
|
+
const isMultipleDatasets = chart.config.data.datasets.length > 1;
|
|
44
44
|
// From old requirement, Only line, radar, scatter, polarArea type are opaque backgroundColor
|
|
45
45
|
switch (dataset.type ?? this.config?.type) {
|
|
46
46
|
case 'line':
|
|
@@ -66,7 +66,9 @@ let Chart = class Chart extends BasicElement {
|
|
|
66
66
|
case 'polarArea':
|
|
67
67
|
const index = isMultipleDatasets ? 0 : datasetIndex;
|
|
68
68
|
colors = this.generateColors(true, dataset.data ? dataset.data.length : 1, index);
|
|
69
|
-
borderColor = isMultipleDatasets
|
|
69
|
+
borderColor = isMultipleDatasets
|
|
70
|
+
? this.getComputedVariable('--multi-dataset-border-color', '#fff')
|
|
71
|
+
: colors.solid;
|
|
70
72
|
backgroundColor = this.config?.type === 'polarArea' ? colors.opaque : colors.solid;
|
|
71
73
|
if (!dataset.borderColor) {
|
|
72
74
|
dataset.borderColor = borderColor;
|
|
@@ -75,10 +77,14 @@ let Chart = class Chart extends BasicElement {
|
|
|
75
77
|
dataset.backgroundColor = backgroundColor;
|
|
76
78
|
}
|
|
77
79
|
// Add more colors if items aren't enough
|
|
78
|
-
if (Array.isArray(dataset.borderColor) &&
|
|
80
|
+
if (Array.isArray(dataset.borderColor) &&
|
|
81
|
+
Array.isArray(borderColor) &&
|
|
82
|
+
dataset.borderColor.length < borderColor.length) {
|
|
79
83
|
merge(dataset.borderColor, borderColor);
|
|
80
84
|
}
|
|
81
|
-
if (Array.isArray(dataset.backgroundColor) &&
|
|
85
|
+
if (Array.isArray(dataset.backgroundColor) &&
|
|
86
|
+
Array.isArray(backgroundColor) &&
|
|
87
|
+
dataset.backgroundColor.length < backgroundColor.length) {
|
|
82
88
|
merge(dataset.backgroundColor, backgroundColor);
|
|
83
89
|
}
|
|
84
90
|
break;
|
|
@@ -95,10 +101,14 @@ let Chart = class Chart extends BasicElement {
|
|
|
95
101
|
dataset.backgroundColor = backgroundColor;
|
|
96
102
|
}
|
|
97
103
|
// Add more colors if items aren't enough
|
|
98
|
-
if (Array.isArray(dataset.borderColor) &&
|
|
104
|
+
if (Array.isArray(dataset.borderColor) &&
|
|
105
|
+
Array.isArray(borderColor) &&
|
|
106
|
+
dataset.borderColor.length < borderColor.length) {
|
|
99
107
|
merge(dataset.borderColor, borderColor);
|
|
100
108
|
}
|
|
101
|
-
if (Array.isArray(dataset.backgroundColor) &&
|
|
109
|
+
if (Array.isArray(dataset.backgroundColor) &&
|
|
110
|
+
Array.isArray(backgroundColor) &&
|
|
111
|
+
dataset.backgroundColor.length < backgroundColor.length) {
|
|
102
112
|
merge(dataset.backgroundColor, backgroundColor);
|
|
103
113
|
}
|
|
104
114
|
break;
|
|
@@ -149,10 +159,10 @@ let Chart = class Chart extends BasicElement {
|
|
|
149
159
|
}
|
|
150
160
|
let legends = [];
|
|
151
161
|
const datasets = chart.config.data.datasets;
|
|
152
|
-
if (datasets.length
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
162
|
+
if (datasets.length &&
|
|
163
|
+
chart?.config?.options?.plugins?.legend &&
|
|
164
|
+
Array.isArray(datasets[0].backgroundColor) &&
|
|
165
|
+
['pie', 'doughnut'].includes(chartType)) {
|
|
156
166
|
return this.generateArcLegendLabels(legends, chart);
|
|
157
167
|
}
|
|
158
168
|
if (ChartJS.defaults.plugins.legend.labels.generateLabels) {
|
|
@@ -202,7 +212,7 @@ let Chart = class Chart extends BasicElement {
|
|
|
202
212
|
min-height: 300px;
|
|
203
213
|
box-sizing: border-box;
|
|
204
214
|
}
|
|
205
|
-
[part=container] {
|
|
215
|
+
[part='container'] {
|
|
206
216
|
position: absolute;
|
|
207
217
|
top: 0;
|
|
208
218
|
right: 0;
|
|
@@ -211,11 +221,11 @@ let Chart = class Chart extends BasicElement {
|
|
|
211
221
|
display: flex;
|
|
212
222
|
flex-direction: column;
|
|
213
223
|
}
|
|
214
|
-
[part=chart] {
|
|
224
|
+
[part='chart'] {
|
|
215
225
|
flex: 1 1 auto;
|
|
216
226
|
position: relative;
|
|
217
227
|
}
|
|
218
|
-
[part=title] {
|
|
228
|
+
[part='title'] {
|
|
219
229
|
margin-bottom: 12px;
|
|
220
230
|
}
|
|
221
231
|
canvas {
|
|
@@ -379,7 +389,9 @@ let Chart = class Chart extends BasicElement {
|
|
|
379
389
|
ChartJS.defaults.font.style = cssStyle.getPropertyValue('font-style');
|
|
380
390
|
// Set global grid color
|
|
381
391
|
ChartJS.defaults.scale.grid.color = (line) => {
|
|
382
|
-
return line.index === 0
|
|
392
|
+
return line.index === 0
|
|
393
|
+
? this.getComputedVariable('--zero-line-color', 'transparent')
|
|
394
|
+
: this.getComputedVariable('--grid-line-color', 'transparent');
|
|
383
395
|
};
|
|
384
396
|
if (ChartJS.defaults.scales.radialLinear) {
|
|
385
397
|
ChartJS.defaults.scales.radialLinear.ticks.showLabelBackdrop = false;
|
|
@@ -412,14 +424,9 @@ let Chart = class Chart extends BasicElement {
|
|
|
412
424
|
if (!this.config) {
|
|
413
425
|
return;
|
|
414
426
|
}
|
|
415
|
-
let plugins = [
|
|
416
|
-
this.createPlugin()
|
|
417
|
-
];
|
|
427
|
+
let plugins = [this.createPlugin()];
|
|
418
428
|
if (Array.isArray(this.config.plugins) && this.config.plugins.length > 0) {
|
|
419
|
-
plugins = [
|
|
420
|
-
...plugins,
|
|
421
|
-
...this.config.plugins
|
|
422
|
-
];
|
|
429
|
+
plugins = [...plugins, ...this.config.plugins];
|
|
423
430
|
}
|
|
424
431
|
merge(this.config, {
|
|
425
432
|
plugins,
|
|
@@ -505,13 +512,12 @@ let Chart = class Chart extends BasicElement {
|
|
|
505
512
|
* @return Render template
|
|
506
513
|
*/
|
|
507
514
|
render() {
|
|
508
|
-
return html `
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
<
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
</div>`;
|
|
515
|
+
return html ` <div part="container">
|
|
516
|
+
${this.titleTemplate}
|
|
517
|
+
<div part="chart">
|
|
518
|
+
<canvas ${ref(this.canvas)}></canvas>
|
|
519
|
+
</div>
|
|
520
|
+
</div>`;
|
|
515
521
|
}
|
|
516
522
|
};
|
|
517
523
|
__decorate([
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Chart as ChartJS } from 'chart.js';
|
|
2
|
-
import type {
|
|
2
|
+
import type { ActiveElement, ChartType, Plugin } from 'chart.js';
|
|
3
3
|
export interface CenterLabel {
|
|
4
4
|
label: string;
|
|
5
5
|
bold?: boolean;
|
|
@@ -11,11 +11,11 @@ export interface Selected {
|
|
|
11
11
|
export interface CenterLabelConfig {
|
|
12
12
|
defaultText: CenterLabel[];
|
|
13
13
|
selected: Selected;
|
|
14
|
-
onRenderLabel(chart: ChartJS, chartItems: ActiveElement[]): CenterLabel[];
|
|
14
|
+
onRenderLabel(chart: ChartJS, chartItems: ActiveElement[]): CenterLabel[] | undefined;
|
|
15
15
|
}
|
|
16
16
|
declare module 'chart.js' {
|
|
17
17
|
interface PluginOptionsByType<TType extends ChartType = ChartType> {
|
|
18
|
-
|
|
18
|
+
centerLabel?: CenterLabelConfig;
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
21
|
declare const plugins: Plugin;
|
|
@@ -28,8 +28,11 @@ const drawItemBorder = function (chart, active) {
|
|
|
28
28
|
arcOptions.backgroundColor = datasets.backgroundColor[chartItem.index];
|
|
29
29
|
arcOptions.backgroundColor = getHoverColor(arcOptions.backgroundColor);
|
|
30
30
|
}
|
|
31
|
-
arcOptions.borderWidth =
|
|
32
|
-
|
|
31
|
+
arcOptions.borderWidth =
|
|
32
|
+
arcOptions.borderWidth ||
|
|
33
|
+
(datasets.borderWidth || chart.config.options?.elements?.arc?.borderWidth);
|
|
34
|
+
arcOptions.borderColor = (getComputedStyle(chart.canvas).getPropertyValue('--doughnut-border-color') ||
|
|
35
|
+
ChartJS.defaults.color);
|
|
33
36
|
const sA = element.startAngle;
|
|
34
37
|
const eA = element.endAngle;
|
|
35
38
|
if (ctx) {
|
|
@@ -60,8 +63,9 @@ const plugins = {
|
|
|
60
63
|
chart._select = [];
|
|
61
64
|
}
|
|
62
65
|
if (chart.getActiveElements().length) {
|
|
63
|
-
if (chart._select.length &&
|
|
64
|
-
|
|
66
|
+
if (chart._select.length &&
|
|
67
|
+
chart._select[0].datasetIndex === chart.getActiveElements()[0].datasetIndex &&
|
|
68
|
+
chart._select[0].index === chart.getActiveElements()[0].index) {
|
|
65
69
|
// reset value if user clicked on selected segment
|
|
66
70
|
chart._select = [];
|
|
67
71
|
}
|
|
@@ -95,9 +99,9 @@ const plugins = {
|
|
|
95
99
|
if (activeElements.length > 0) {
|
|
96
100
|
active = activeElements;
|
|
97
101
|
}
|
|
98
|
-
const
|
|
102
|
+
const labels = config.onRenderLabel(chart, active);
|
|
99
103
|
// Get Texts
|
|
100
|
-
const texts =
|
|
104
|
+
const texts = labels || config.defaultText;
|
|
101
105
|
if (!texts) {
|
|
102
106
|
return;
|
|
103
107
|
}
|
|
@@ -122,7 +126,7 @@ const plugins = {
|
|
|
122
126
|
ctx.fill();
|
|
123
127
|
}
|
|
124
128
|
// Base font size is 30% and minus 4% per text lines ( if text has multiple lines ) of text area
|
|
125
|
-
const baseFontSize = innerRadius * (0.3 -
|
|
129
|
+
const baseFontSize = innerRadius * (0.3 - 0.04 * (texts.length - 1));
|
|
126
130
|
// Keep minimum font size equal 5% of text area
|
|
127
131
|
const computedFontSize = Math.max(innerRadius * 0.05, baseFontSize);
|
|
128
132
|
// Use font size ratio from user if --doughnut-center-font-size CSS variable is provided
|
|
@@ -160,7 +164,7 @@ const plugins = {
|
|
|
160
164
|
targetText += '...';
|
|
161
165
|
}
|
|
162
166
|
}
|
|
163
|
-
ctx.fillText(targetText, centerX, offsetY +
|
|
167
|
+
ctx.fillText(targetText, centerX, offsetY + i * fontLineHeight);
|
|
164
168
|
}
|
|
165
169
|
},
|
|
166
170
|
afterDatasetUpdate: function (chart) {
|
|
@@ -177,7 +181,7 @@ const plugins = {
|
|
|
177
181
|
const datasetIndex = Number(config.selected.datasetIndex || 0);
|
|
178
182
|
const visibleIndex = chart.getVisibleDatasetCount() - 1;
|
|
179
183
|
// Validate index and datasetIndex
|
|
180
|
-
if (isNaN(selectedIndex) ||
|
|
184
|
+
if (isNaN(selectedIndex) || isNaN(datasetIndex) || datasetIndex < 0 || datasetIndex > visibleIndex) {
|
|
181
185
|
return;
|
|
182
186
|
}
|
|
183
187
|
// Set selected item to the chart
|
package/lib/checkbox/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { JSXInterface } from '../jsx';
|
|
2
|
-
import {
|
|
2
|
+
import { CSSResultGroup, ControlElement, PropertyValues, TemplateResult } from '@refinitiv-ui/core';
|
|
3
3
|
import '../icon/index.js';
|
|
4
4
|
/**
|
|
5
5
|
* Form control for selecting one or several options
|
package/lib/checkbox/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { __decorate } from "tslib";
|
|
2
|
-
import { ControlElement,
|
|
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
5
|
import { query } from '@refinitiv-ui/core/decorators/query.js';
|
|
6
|
-
import { VERSION } from '../version.js';
|
|
7
|
-
import { registerOverflowTooltip } from '../tooltip/index.js';
|
|
8
6
|
import '../icon/index.js';
|
|
7
|
+
import { registerOverflowTooltip } from '../tooltip/index.js';
|
|
8
|
+
import { VERSION } from '../version.js';
|
|
9
9
|
/**
|
|
10
10
|
* Form control for selecting one or several options
|
|
11
11
|
* @fires checked-changed - Fired when the user checks or unchecks the checkbox. The event is not fired if the `checked` property is changed programmatically.
|
|
@@ -47,24 +47,25 @@ let Checkbox = class Checkbox extends ControlElement {
|
|
|
47
47
|
:host {
|
|
48
48
|
display: inline-block;
|
|
49
49
|
}
|
|
50
|
-
[part=check] {
|
|
50
|
+
[part='check'] {
|
|
51
51
|
visibility: hidden;
|
|
52
52
|
}
|
|
53
|
-
:host([checked]) [part=check],
|
|
54
|
-
:host([indeterminate]) [part=check] {
|
|
53
|
+
:host([checked]) [part='check'],
|
|
54
|
+
:host([indeterminate]) [part='check'] {
|
|
55
55
|
visibility: inherit;
|
|
56
56
|
}
|
|
57
|
-
[part=label],
|
|
58
|
-
[part=container] {
|
|
57
|
+
[part='label'],
|
|
58
|
+
[part='container'] {
|
|
59
59
|
display: inline-block;
|
|
60
60
|
vertical-align: middle;
|
|
61
61
|
}
|
|
62
|
-
[part=label] {
|
|
62
|
+
[part='label'] {
|
|
63
63
|
white-space: nowrap;
|
|
64
64
|
text-overflow: ellipsis;
|
|
65
65
|
overflow: hidden;
|
|
66
66
|
}
|
|
67
|
-
:host(:empty) [part=label],
|
|
67
|
+
:host(:empty) [part='label'],
|
|
68
|
+
[part='label']:empty {
|
|
68
69
|
display: none;
|
|
69
70
|
}
|
|
70
71
|
`;
|
|
@@ -146,9 +147,7 @@ let Checkbox = class Checkbox extends ControlElement {
|
|
|
146
147
|
render() {
|
|
147
148
|
return html `
|
|
148
149
|
<div part="container">
|
|
149
|
-
<div part="check">
|
|
150
|
-
${!this.indeterminate ? html `<ef-icon icon="tick"></ef-icon>` : null}
|
|
151
|
-
</div>
|
|
150
|
+
<div part="check">${!this.indeterminate ? html `<ef-icon icon="tick"></ef-icon>` : null}</div>
|
|
152
151
|
</div>
|
|
153
152
|
<div part="label"><slot></slot></div>
|
|
154
153
|
`;
|
package/lib/clock/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { JSXInterface } from '../jsx';
|
|
2
|
-
import {
|
|
2
|
+
import { CSSResultGroup, ElementSize, PropertyValues, ResponsiveElement, TemplateResult } from '@refinitiv-ui/core';
|
|
3
3
|
import '@refinitiv-ui/phrasebook/locale/en/clock.js';
|
|
4
4
|
import { TranslatePromise } from '@refinitiv-ui/translate';
|
|
5
5
|
/**
|
|
@@ -92,8 +92,8 @@ export declare class Clock extends ResponsiveElement {
|
|
|
92
92
|
*/
|
|
93
93
|
showSeconds: boolean;
|
|
94
94
|
/**
|
|
95
|
-
|
|
96
|
-
|
|
95
|
+
* Display clock in analogue style.
|
|
96
|
+
*/
|
|
97
97
|
analogue: boolean;
|
|
98
98
|
/**
|
|
99
99
|
* Enable interactive mode. Allowing the user to offset the value.
|
|
@@ -104,16 +104,16 @@ export declare class Clock extends ResponsiveElement {
|
|
|
104
104
|
*/
|
|
105
105
|
private hoursPart;
|
|
106
106
|
/**
|
|
107
|
-
|
|
108
|
-
|
|
107
|
+
* Getter for minutes part.
|
|
108
|
+
*/
|
|
109
109
|
private minutesPart;
|
|
110
110
|
/**
|
|
111
|
-
|
|
112
|
-
|
|
111
|
+
* Getter for seconds part.
|
|
112
|
+
*/
|
|
113
113
|
private secondsPart;
|
|
114
114
|
/**
|
|
115
|
-
|
|
116
|
-
|
|
115
|
+
* Size of the clock.
|
|
116
|
+
*/
|
|
117
117
|
private size;
|
|
118
118
|
/**
|
|
119
119
|
* Get the display time in seconds.
|
|
@@ -208,11 +208,11 @@ export declare class Clock extends ResponsiveElement {
|
|
|
208
208
|
*/
|
|
209
209
|
private getShiftAmountFromSegment;
|
|
210
210
|
/**
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
211
|
+
* Returns `true` or `false` depends on the offset value's effect on giving segment
|
|
212
|
+
*
|
|
213
|
+
* @param segment segment
|
|
214
|
+
* @returns Result
|
|
215
|
+
*/
|
|
216
216
|
private isSegmentShifted;
|
|
217
217
|
/**
|
|
218
218
|
* Handles any keydown events
|
|
@@ -229,59 +229,59 @@ export declare class Clock extends ResponsiveElement {
|
|
|
229
229
|
*/
|
|
230
230
|
private onTapStart;
|
|
231
231
|
/**
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
232
|
+
* Handle valid control keys and execute their corresponding commands
|
|
233
|
+
* Will stop when readonly is set
|
|
234
|
+
* @param event Event Object
|
|
235
|
+
* @returns {void}
|
|
236
|
+
*/
|
|
237
237
|
private manageControlKeys;
|
|
238
238
|
/**
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
239
|
+
* Handles UP key press
|
|
240
|
+
* @returns {void}
|
|
241
|
+
*/
|
|
242
242
|
private handleUpKey;
|
|
243
243
|
/**
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
244
|
+
* Handle DOWN key press
|
|
245
|
+
* @returns {void}
|
|
246
|
+
*/
|
|
247
247
|
private handleDownKey;
|
|
248
248
|
/**
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
249
|
+
* Set aria-valuenow to display value and aria-valuetext to translated format
|
|
250
|
+
* @param updateAriaValueText condition to update aria-valueText
|
|
251
|
+
* @returns {void}
|
|
252
|
+
*/
|
|
253
253
|
private updateAriaValue;
|
|
254
254
|
/**
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
255
|
+
* Get template of segment
|
|
256
|
+
* @param segment segment
|
|
257
|
+
* @param value segment's value
|
|
258
|
+
* @returns {TemplateResult} template
|
|
259
|
+
*/
|
|
260
260
|
private generateSegmentTemplate;
|
|
261
261
|
/**
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
262
|
+
* Template of divider
|
|
263
|
+
* @returns {TemplateResult} template
|
|
264
|
+
*/
|
|
265
265
|
private get dividerTemplate();
|
|
266
266
|
/**
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
267
|
+
* Template of amPm segment
|
|
268
|
+
* @returns {TemplateResult} template
|
|
269
|
+
*/
|
|
270
270
|
private get amPmTemplate();
|
|
271
271
|
/**
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
272
|
+
* Template of hours segment
|
|
273
|
+
* @returns {TemplateResult} template
|
|
274
|
+
*/
|
|
275
275
|
private get hoursSegmentTemplate();
|
|
276
276
|
/**
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
277
|
+
* Template of minutes segment
|
|
278
|
+
* @returns {TemplateResult} template
|
|
279
|
+
*/
|
|
280
280
|
private get minutesSegmentTemplate();
|
|
281
281
|
/**
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
282
|
+
* Template of seconds segment
|
|
283
|
+
* @returns {TemplateResult} template
|
|
284
|
+
*/
|
|
285
285
|
private get secondsSegmentTemplate();
|
|
286
286
|
/**
|
|
287
287
|
* Called when the element's dimension have changed
|
|
@@ -317,14 +317,14 @@ export declare class Clock extends ResponsiveElement {
|
|
|
317
317
|
*/
|
|
318
318
|
protected willUpdate(changedProperties: PropertyValues): void;
|
|
319
319
|
/**
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
320
|
+
* Template for digital clock
|
|
321
|
+
* @returns {TemplateResult} template
|
|
322
|
+
*/
|
|
323
323
|
protected get digitalClockTemplate(): TemplateResult;
|
|
324
324
|
/**
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
325
|
+
* Template for analogue clock
|
|
326
|
+
* @returns {TemplateResult} template
|
|
327
|
+
*/
|
|
328
328
|
protected get analogueClockTemplate(): TemplateResult;
|
|
329
329
|
/**
|
|
330
330
|
* A `TemplateResult` that will be used
|