@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
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { JSXInterface } from '../jsx';
|
|
2
|
-
import { ControlElement, PropertyValues, TemplateResult
|
|
3
|
-
import '../color-dialog/index.js';
|
|
2
|
+
import { CSSResult, ControlElement, PropertyValues, TemplateResult } from '@refinitiv-ui/core';
|
|
4
3
|
import '@refinitiv-ui/phrasebook/locale/en/color-picker.js';
|
|
5
4
|
import { TranslatePromise } from '@refinitiv-ui/translate';
|
|
5
|
+
import '../color-dialog/index.js';
|
|
6
6
|
/**
|
|
7
7
|
*
|
|
8
8
|
* Color picker control
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { __decorate } from "tslib";
|
|
2
|
-
import { ControlElement,
|
|
2
|
+
import { ControlElement, WarningNotice, css, html, nothing } 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 { state } from '@refinitiv-ui/core/decorators/state.js';
|
|
6
|
+
import { createRef, ref } from '@refinitiv-ui/core/directives/ref.js';
|
|
5
7
|
import { styleMap } from '@refinitiv-ui/core/directives/style-map.js';
|
|
6
|
-
import
|
|
8
|
+
import '@refinitiv-ui/phrasebook/locale/en/color-picker.js';
|
|
9
|
+
import { TranslatePropertyKey, translate } from '@refinitiv-ui/translate';
|
|
7
10
|
import { isHex, readableColor } from '@refinitiv-ui/utils/color.js';
|
|
8
|
-
import { ref, createRef } from '@refinitiv-ui/core/directives/ref.js';
|
|
9
11
|
import '../color-dialog/index.js';
|
|
10
|
-
import '
|
|
11
|
-
import { state } from '@refinitiv-ui/core/decorators/state.js';
|
|
12
|
-
import { translate, TranslatePropertyKey } from '@refinitiv-ui/translate';
|
|
12
|
+
import { VERSION } from '../version.js';
|
|
13
13
|
const DIALOG_POSITION = ['right-start', 'right-end', 'right-middle', 'left-start', 'left-end', 'left-middle'];
|
|
14
14
|
/**
|
|
15
15
|
*
|
|
@@ -67,11 +67,14 @@ let ColorPicker = class ColorPicker extends ControlElement {
|
|
|
67
67
|
:host {
|
|
68
68
|
display: inline-block;
|
|
69
69
|
}
|
|
70
|
-
[part=color-item][no-color] {
|
|
71
|
-
background: linear-gradient(
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
70
|
+
[part='color-item'][no-color] {
|
|
71
|
+
background: linear-gradient(
|
|
72
|
+
to bottom right,
|
|
73
|
+
transparent calc(50% - 1px),
|
|
74
|
+
var(--no-color-line-color, #ff0000) calc(50% - 1px),
|
|
75
|
+
var(--no-color-line-color, #ff0000) calc(50% + 1px),
|
|
76
|
+
transparent calc(50% + 1px)
|
|
77
|
+
);
|
|
75
78
|
}
|
|
76
79
|
`;
|
|
77
80
|
}
|
|
@@ -172,7 +175,8 @@ let ColorPicker = class ColorPicker extends ControlElement {
|
|
|
172
175
|
* @returns {void}
|
|
173
176
|
*/
|
|
174
177
|
setOpened(opened) {
|
|
175
|
-
if (opened && !this.canOpenPopup) {
|
|
178
|
+
if (opened && !this.canOpenPopup) {
|
|
179
|
+
/* never allow to open popup if cannot do so */
|
|
176
180
|
return;
|
|
177
181
|
}
|
|
178
182
|
if (this.opened !== opened) {
|
|
@@ -208,10 +212,11 @@ let ColorPicker = class ColorPicker extends ControlElement {
|
|
|
208
212
|
return null;
|
|
209
213
|
}
|
|
210
214
|
return html `<div
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
+
part="aria-selection"
|
|
216
|
+
role="status"
|
|
217
|
+
aria-live="polite"
|
|
218
|
+
aria-label="${this.colorAriaLabel}"
|
|
219
|
+
></div>`;
|
|
215
220
|
}
|
|
216
221
|
/**
|
|
217
222
|
* Helper method, used to set the color description.
|
|
@@ -243,25 +248,30 @@ let ColorPicker = class ColorPicker extends ControlElement {
|
|
|
243
248
|
get dialogTemplate() {
|
|
244
249
|
if (this.lazyRendered) {
|
|
245
250
|
return html `<ef-color-dialog
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
251
|
+
offset="4"
|
|
252
|
+
${ref(this.dialogRef)}
|
|
253
|
+
.lang=${this.lang || nothing}
|
|
254
|
+
.value=${this.value}
|
|
255
|
+
.focusBoundary=${this}
|
|
256
|
+
.positionTarget=${this}
|
|
257
|
+
.position=${DIALOG_POSITION}
|
|
258
|
+
.withBackdrop=${false}
|
|
259
|
+
?opened=${this.opened}
|
|
260
|
+
?allow-nocolor=${this.allowNocolor}
|
|
261
|
+
@opened-changed=${this.onColorDialogOpenedChanged}
|
|
262
|
+
@value-changed=${this.onColorDialogValueChanged}
|
|
263
|
+
></ef-color-dialog>`;
|
|
258
264
|
}
|
|
259
265
|
}
|
|
260
266
|
/**
|
|
261
267
|
* Color item template
|
|
262
268
|
*/
|
|
263
269
|
get colorItemTemplate() {
|
|
264
|
-
return html `<div
|
|
270
|
+
return html `<div
|
|
271
|
+
part="color-item"
|
|
272
|
+
?no-color=${!this.value}
|
|
273
|
+
style=${styleMap({ backgroundColor: this.value })}
|
|
274
|
+
></div>`;
|
|
265
275
|
}
|
|
266
276
|
/**
|
|
267
277
|
* A `TemplateResult` that will be used
|
|
@@ -269,11 +279,7 @@ let ColorPicker = class ColorPicker extends ControlElement {
|
|
|
269
279
|
* @return Render template
|
|
270
280
|
*/
|
|
271
281
|
render() {
|
|
272
|
-
return html `
|
|
273
|
-
${this.selectionTemplate}
|
|
274
|
-
${this.colorItemTemplate}
|
|
275
|
-
${this.dialogTemplate}
|
|
276
|
-
`;
|
|
282
|
+
return html ` ${this.selectionTemplate} ${this.colorItemTemplate} ${this.dialogTemplate} `;
|
|
277
283
|
}
|
|
278
284
|
};
|
|
279
285
|
__decorate([
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ItemData } from '../../item';
|
|
2
2
|
import type { ComboBox } from '../index';
|
|
3
3
|
import type { ComboBoxFilter } from './types';
|
|
4
|
-
import type {
|
|
4
|
+
import type { DataItem } from '@refinitiv-ui/utils/collection.js';
|
|
5
5
|
/**
|
|
6
6
|
* Default filter used by combo box
|
|
7
7
|
* @param el ComboBox instance to filter
|
package/lib/combo-box/index.d.ts
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import { JSXInterface } from '../jsx';
|
|
2
|
-
import {
|
|
2
|
+
import { CSSResultGroup, FormFieldElement, PropertyValues, StyleMap, TapEvent, TemplateResult } from '@refinitiv-ui/core';
|
|
3
3
|
import { TemplateMap } from '@refinitiv-ui/core/directives/template-map.js';
|
|
4
|
-
import
|
|
4
|
+
import '@refinitiv-ui/phrasebook/locale/en/combo-box.js';
|
|
5
|
+
import { TranslateDirective } from '@refinitiv-ui/translate';
|
|
5
6
|
import { AnimationTaskRunner } from '@refinitiv-ui/utils/async.js';
|
|
6
|
-
import {
|
|
7
|
-
import
|
|
7
|
+
import { CollectionComposer, DataItem } from '@refinitiv-ui/utils/collection.js';
|
|
8
|
+
import '../counter/index.js';
|
|
8
9
|
import '../icon/index.js';
|
|
9
|
-
import '../overlay/index.js';
|
|
10
10
|
import '../list/index.js';
|
|
11
|
-
import '../
|
|
11
|
+
import '../overlay/index.js';
|
|
12
|
+
import { CustomKeyboardEvent } from './helpers/keyboard-event.js';
|
|
13
|
+
import { ComboBoxRenderer } from './helpers/renderer.js';
|
|
12
14
|
import type { ItemData } from '../item';
|
|
13
|
-
import type { ComboBoxData, ComboBoxFilter } from './helpers/types';
|
|
14
15
|
import type { List } from '../list';
|
|
15
|
-
import {
|
|
16
|
-
import '@refinitiv-ui/phrasebook/locale/en/combo-box.js';
|
|
16
|
+
import type { ComboBoxData, ComboBoxFilter } from './helpers/types';
|
|
17
17
|
export type { ComboBoxFilter, ComboBoxData };
|
|
18
18
|
export { ComboBoxRenderer };
|
|
19
19
|
/**
|
package/lib/combo-box/index.js
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
import { __decorate } from "tslib";
|
|
2
|
-
import { FormFieldElement, css, html,
|
|
2
|
+
import { FocusedPropertyKey, FormFieldElement, WarningNotice, css, html, nothing, triggerResize } from '@refinitiv-ui/core';
|
|
3
3
|
import { customElement } from '@refinitiv-ui/core/decorators/custom-element.js';
|
|
4
|
+
import { eventOptions } from '@refinitiv-ui/core/decorators/event-options.js';
|
|
4
5
|
import { property } from '@refinitiv-ui/core/decorators/property.js';
|
|
5
6
|
import { query } from '@refinitiv-ui/core/decorators/query.js';
|
|
6
|
-
import { eventOptions } from '@refinitiv-ui/core/decorators/event-options.js';
|
|
7
7
|
import { styleMap } from '@refinitiv-ui/core/directives/style-map.js';
|
|
8
|
-
import
|
|
9
|
-
import {
|
|
8
|
+
import '@refinitiv-ui/phrasebook/locale/en/combo-box.js';
|
|
9
|
+
import { translate } from '@refinitiv-ui/translate';
|
|
10
10
|
import { AnimationTaskRunner, TimeoutTaskRunner } from '@refinitiv-ui/utils/async.js';
|
|
11
|
-
import {
|
|
11
|
+
import { CollectionComposer } from '@refinitiv-ui/utils/collection.js';
|
|
12
12
|
import { isElementOverflown } from '@refinitiv-ui/utils/element.js';
|
|
13
|
-
import
|
|
14
|
-
import { defaultFilter } from './helpers/filter.js';
|
|
15
|
-
import { CustomKeyboardEvent } from './helpers/keyboard-event.js';
|
|
13
|
+
import '../counter/index.js';
|
|
16
14
|
import '../icon/index.js';
|
|
17
|
-
import '../overlay/index.js';
|
|
18
15
|
import '../list/index.js';
|
|
19
|
-
import '../
|
|
20
|
-
import {
|
|
21
|
-
import '
|
|
16
|
+
import '../overlay/index.js';
|
|
17
|
+
import { registerOverflowTooltip } from '../tooltip/index.js';
|
|
18
|
+
import { VERSION } from '../version.js';
|
|
19
|
+
import { defaultFilter } from './helpers/filter.js';
|
|
20
|
+
import { CustomKeyboardEvent } from './helpers/keyboard-event.js';
|
|
21
|
+
import { ComboBoxRenderer } from './helpers/renderer.js';
|
|
22
22
|
export { ComboBoxRenderer };
|
|
23
23
|
const QUERY_DEBOUNCE_RATE = 0;
|
|
24
24
|
// Maximum number of characters to display in multiple mode
|
|
@@ -27,7 +27,7 @@ const MULTIPLE_LABEL_MAX_SIZE = 250;
|
|
|
27
27
|
// Double space is expected
|
|
28
28
|
const MULTIPLE_LABEL_SEPARATOR = '; ';
|
|
29
29
|
const POPUP_POSITION = ['bottom-start', 'top-start'];
|
|
30
|
-
const valueFormatWarning = new WarningNotice(
|
|
30
|
+
const valueFormatWarning = new WarningNotice("The specified 'values' format does not conform to the required format.");
|
|
31
31
|
const freeTextMultipleWarning = new WarningNotice('"free-text" mode is not compatible with "multiple" mode');
|
|
32
32
|
/**
|
|
33
33
|
* Combines a popup with a filterable selection list
|
|
@@ -153,13 +153,13 @@ let ComboBox = class ComboBox extends FormFieldElement {
|
|
|
153
153
|
user-select: none;
|
|
154
154
|
outline: none;
|
|
155
155
|
}
|
|
156
|
-
[part~=input-wrapper] {
|
|
156
|
+
[part~='input-wrapper'] {
|
|
157
157
|
cursor: pointer;
|
|
158
158
|
}
|
|
159
|
-
[part~=input] {
|
|
159
|
+
[part~='input'] {
|
|
160
160
|
cursor: text;
|
|
161
161
|
}
|
|
162
|
-
[part~=input]::-ms-clear {
|
|
162
|
+
[part~='input']::-ms-clear {
|
|
163
163
|
display: none;
|
|
164
164
|
}
|
|
165
165
|
`;
|
|
@@ -329,7 +329,9 @@ let ComboBox = class ComboBox extends FormFieldElement {
|
|
|
329
329
|
}
|
|
330
330
|
// multiple mode, do according to UX specs
|
|
331
331
|
const output = labels.join(MULTIPLE_LABEL_SEPARATOR);
|
|
332
|
-
return output.length > MULTIPLE_LABEL_MAX_SIZE
|
|
332
|
+
return output.length > MULTIPLE_LABEL_MAX_SIZE
|
|
333
|
+
? `${output.slice(0, MULTIPLE_LABEL_MAX_SIZE - 3)}...`
|
|
334
|
+
: output;
|
|
333
335
|
}
|
|
334
336
|
/**
|
|
335
337
|
* Get resolved data (if possible)
|
|
@@ -369,7 +371,7 @@ let ComboBox = class ComboBox extends FormFieldElement {
|
|
|
369
371
|
* @returns Promise<void>
|
|
370
372
|
*/
|
|
371
373
|
async resolveDataPromise(data) {
|
|
372
|
-
const dataPromiseCounter = this.dataPromiseCounter += 1;
|
|
374
|
+
const dataPromiseCounter = (this.dataPromiseCounter += 1);
|
|
373
375
|
let resolvedData;
|
|
374
376
|
if (data instanceof Promise) {
|
|
375
377
|
this.loading = true;
|
|
@@ -392,8 +394,7 @@ let ComboBox = class ComboBox extends FormFieldElement {
|
|
|
392
394
|
* The the values from composer ignoring freeTextValue
|
|
393
395
|
*/
|
|
394
396
|
get composerValues() {
|
|
395
|
-
return this.queryItemsByPropertyValue('selected', true)
|
|
396
|
-
.map(item => this.getItemPropertyValue(item, 'value'));
|
|
397
|
+
return this.queryItemsByPropertyValue('selected', true).map((item) => this.getItemPropertyValue(item, 'value'));
|
|
397
398
|
}
|
|
398
399
|
/**
|
|
399
400
|
* Get the first value of highlighted item
|
|
@@ -402,7 +403,7 @@ let ComboBox = class ComboBox extends FormFieldElement {
|
|
|
402
403
|
if (!this.opened) {
|
|
403
404
|
return null;
|
|
404
405
|
}
|
|
405
|
-
return this.highlightedItems.map(item => this.getItemPropertyValue(item, 'value'))[0] || '';
|
|
406
|
+
return this.highlightedItems.map((item) => this.getItemPropertyValue(item, 'value'))[0] || '';
|
|
406
407
|
}
|
|
407
408
|
/**
|
|
408
409
|
* Return currently selected items
|
|
@@ -425,7 +426,7 @@ let ComboBox = class ComboBox extends FormFieldElement {
|
|
|
425
426
|
* @returns List has visible items or not
|
|
426
427
|
*/
|
|
427
428
|
get listHasVisibleItems() {
|
|
428
|
-
return this.resolvedData.some(item => !this.getItemPropertyValue(item, 'hidden'));
|
|
429
|
+
return this.resolvedData.some((item) => !this.getItemPropertyValue(item, 'hidden'));
|
|
429
430
|
}
|
|
430
431
|
/**
|
|
431
432
|
* Selected item
|
|
@@ -439,7 +440,7 @@ let ComboBox = class ComboBox extends FormFieldElement {
|
|
|
439
440
|
* @returns Has selection
|
|
440
441
|
*/
|
|
441
442
|
get selectedLabels() {
|
|
442
|
-
return this.selection.map(selected => this.getItemPropertyValue(selected, 'label') || '');
|
|
443
|
+
return this.selection.map((selected) => this.getItemPropertyValue(selected, 'label') || '');
|
|
443
444
|
}
|
|
444
445
|
/**
|
|
445
446
|
* Utility method - ensures correct composer is being listened to
|
|
@@ -469,10 +470,10 @@ let ComboBox = class ComboBox extends FormFieldElement {
|
|
|
469
470
|
this.shouldOpenOnFocus = false;
|
|
470
471
|
}
|
|
471
472
|
/*
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
473
|
+
* data can be visible and opened changed = open
|
|
474
|
+
* or, opened is true and data; and contains visible data = open
|
|
475
|
+
* queries local properties first to short circuit querying map iteration
|
|
476
|
+
*/
|
|
476
477
|
if (changedProperties.has('opened')) {
|
|
477
478
|
if (this.opened) {
|
|
478
479
|
// fulfil any queries if opened is changed
|
|
@@ -496,7 +497,8 @@ let ComboBox = class ComboBox extends FormFieldElement {
|
|
|
496
497
|
this.inputElement.select();
|
|
497
498
|
}
|
|
498
499
|
// Make sure that the first item is always highlighted
|
|
499
|
-
if (this.opened &&
|
|
500
|
+
if (this.opened &&
|
|
501
|
+
(changedProperties.has('opened') || changedProperties.has('data') || changedProperties.has('query'))) {
|
|
500
502
|
this.highlightFirstItem();
|
|
501
503
|
}
|
|
502
504
|
// If data is set asynchronously while popup is opened
|
|
@@ -515,7 +517,7 @@ let ComboBox = class ComboBox extends FormFieldElement {
|
|
|
515
517
|
super.firstUpdated(changedProperties);
|
|
516
518
|
this.addEventListener('keydown', this.onKeyDown);
|
|
517
519
|
this.addEventListener('tapstart', this.onTapStart);
|
|
518
|
-
registerOverflowTooltip(this, () => this.inputValue, () => this.inputElement ? isElementOverflown(this.inputElement) : false);
|
|
520
|
+
registerOverflowTooltip(this, () => this.inputValue, () => (this.inputElement ? isElementOverflown(this.inputElement) : false));
|
|
519
521
|
}
|
|
520
522
|
/**
|
|
521
523
|
* Sets opened state and fires event
|
|
@@ -610,7 +612,7 @@ let ComboBox = class ComboBox extends FormFieldElement {
|
|
|
610
612
|
* @returns {void}
|
|
611
613
|
*/
|
|
612
614
|
clearHighlighted() {
|
|
613
|
-
this.highlightedItems.forEach(item => this.setItemPropertyValue(item, 'highlighted', false));
|
|
615
|
+
this.highlightedItems.forEach((item) => this.setItemPropertyValue(item, 'highlighted', false));
|
|
614
616
|
}
|
|
615
617
|
/**
|
|
616
618
|
* Popup has to use max width if --list-max-width specified
|
|
@@ -623,7 +625,8 @@ let ComboBox = class ComboBox extends FormFieldElement {
|
|
|
623
625
|
// this code might happen only when opened has been set during initialisation
|
|
624
626
|
// or when display is set to none
|
|
625
627
|
this.resizeThrottler.schedule(() => {
|
|
626
|
-
if (this.offsetWidth) {
|
|
628
|
+
if (this.offsetWidth) {
|
|
629
|
+
/* must be here to avoid infinitive loop */
|
|
627
630
|
this.restrictPopupWidth();
|
|
628
631
|
this.requestUpdate();
|
|
629
632
|
}
|
|
@@ -657,7 +660,7 @@ let ComboBox = class ComboBox extends FormFieldElement {
|
|
|
657
660
|
*/
|
|
658
661
|
resetInput() {
|
|
659
662
|
this.setQuery('');
|
|
660
|
-
this.inputText = this.multiple ? '' :
|
|
663
|
+
this.inputText = this.multiple ? '' : this.freeTextValue || this.label;
|
|
661
664
|
}
|
|
662
665
|
/**
|
|
663
666
|
* Filter the internal items by query
|
|
@@ -689,7 +692,9 @@ let ComboBox = class ComboBox extends FormFieldElement {
|
|
|
689
692
|
}
|
|
690
693
|
composer.setItemPropertyValue(item, 'hidden', !result);
|
|
691
694
|
composer.updateItemTimestamp(item);
|
|
692
|
-
if (result &&
|
|
695
|
+
if (result &&
|
|
696
|
+
groupHeaderItem &&
|
|
697
|
+
composer.getItemParent(groupHeaderItem) === composer.getItemParent(item)) {
|
|
693
698
|
composer.setItemPropertyValue(groupHeaderItem, 'hidden', false);
|
|
694
699
|
composer.updateItemTimestamp(groupHeaderItem);
|
|
695
700
|
groupHeaderItem = null;
|
|
@@ -723,10 +728,10 @@ let ComboBox = class ComboBox extends FormFieldElement {
|
|
|
723
728
|
* @returns can highlight
|
|
724
729
|
*/
|
|
725
730
|
canHighlightItem(item, composer) {
|
|
726
|
-
let canHighlight = !(composer.getItemPropertyValue(item, 'hidden') === true
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
731
|
+
let canHighlight = !(composer.getItemPropertyValue(item, 'hidden') === true ||
|
|
732
|
+
(composer.getItemPropertyValue(item, 'type') || 'text') !== 'text' ||
|
|
733
|
+
composer.getItemPropertyValue(item, 'disabled') === true ||
|
|
734
|
+
composer.isItemLocked(item) === true);
|
|
730
735
|
// check ancestors
|
|
731
736
|
if (canHighlight) {
|
|
732
737
|
const parent = composer.getItemParent(item);
|
|
@@ -1004,12 +1009,11 @@ let ComboBox = class ComboBox extends FormFieldElement {
|
|
|
1004
1009
|
* @returns Popup template or undefined
|
|
1005
1010
|
*/
|
|
1006
1011
|
get clearButtonTemplate() {
|
|
1007
|
-
const hasText =
|
|
1012
|
+
const hasText = this.label || this.query || this.freeTextValue || this.inputText;
|
|
1008
1013
|
if (this.clears && hasText) {
|
|
1009
1014
|
return html `
|
|
1010
|
-
<div
|
|
1011
|
-
|
|
1012
|
-
part="button button-clear"><ef-icon part="icon icon-clear" icon="cross"></ef-icon>
|
|
1015
|
+
<div id="clears-button" part="button button-clear">
|
|
1016
|
+
<ef-icon part="icon icon-clear" icon="cross"></ef-icon>
|
|
1013
1017
|
</div>
|
|
1014
1018
|
`;
|
|
1015
1019
|
}
|
|
@@ -1025,8 +1029,14 @@ let ComboBox = class ComboBox extends FormFieldElement {
|
|
|
1025
1029
|
// benefit of being localised too
|
|
1026
1030
|
if (this.focused || selectionLength > 1) {
|
|
1027
1031
|
return html `
|
|
1028
|
-
|
|
1029
|
-
|
|
1032
|
+
<ef-counter
|
|
1033
|
+
part="selection-badge"
|
|
1034
|
+
tabindex="-1"
|
|
1035
|
+
.value=${selectionLength}
|
|
1036
|
+
title=${selectionLength > 999 ? selectionLength.toLocaleString() : nothing}
|
|
1037
|
+
max="999"
|
|
1038
|
+
></ef-counter>
|
|
1039
|
+
`;
|
|
1030
1040
|
}
|
|
1031
1041
|
}
|
|
1032
1042
|
}
|
|
@@ -1043,7 +1053,7 @@ let ComboBox = class ComboBox extends FormFieldElement {
|
|
|
1043
1053
|
.data="${this.composer}"
|
|
1044
1054
|
.multiple="${this.multiple}"
|
|
1045
1055
|
.renderer="${this.renderer}"
|
|
1046
|
-
|
|
1056
|
+
></ef-list>
|
|
1047
1057
|
`;
|
|
1048
1058
|
}
|
|
1049
1059
|
/**
|
|
@@ -1077,7 +1087,8 @@ let ComboBox = class ComboBox extends FormFieldElement {
|
|
|
1077
1087
|
no-focus-management
|
|
1078
1088
|
no-autofocus
|
|
1079
1089
|
@focusin="${this.shiftFocus}"
|
|
1080
|
-
|
|
1090
|
+
>${hasVisibleItems ? this.listTemplate : this.noItemsTemplate}</ef-overlay
|
|
1091
|
+
>`;
|
|
1081
1092
|
}
|
|
1082
1093
|
}
|
|
1083
1094
|
/**
|
|
@@ -1087,9 +1098,9 @@ let ComboBox = class ComboBox extends FormFieldElement {
|
|
|
1087
1098
|
get decorateInputMap() {
|
|
1088
1099
|
return {
|
|
1089
1100
|
...super.decorateInputMap,
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1101
|
+
part: 'input',
|
|
1102
|
+
type: 'text',
|
|
1103
|
+
role: 'combobox',
|
|
1093
1104
|
'.value': this.focused ? this.inputText : this.freeTextValue || this.label,
|
|
1094
1105
|
'aria-expanded': this.opened ? 'true' : 'false',
|
|
1095
1106
|
'aria-haspopup': 'listbox',
|
|
@@ -1104,9 +1115,7 @@ let ComboBox = class ComboBox extends FormFieldElement {
|
|
|
1104
1115
|
*/
|
|
1105
1116
|
get inputTemplate() {
|
|
1106
1117
|
return html `<div part="input-wrapper">
|
|
1107
|
-
${this.renderInput()}
|
|
1108
|
-
${this.selectionBadgeTemplate}
|
|
1109
|
-
${this.clearButtonTemplate}
|
|
1118
|
+
${this.renderInput()} ${this.selectionBadgeTemplate} ${this.clearButtonTemplate}
|
|
1110
1119
|
<div id="toggle-button" part="button button-toggle">
|
|
1111
1120
|
<ef-icon part="icon icon-toggle" icon="down"></ef-icon>
|
|
1112
1121
|
</div>
|
|
@@ -1118,10 +1127,7 @@ let ComboBox = class ComboBox extends FormFieldElement {
|
|
|
1118
1127
|
* @returns Render template
|
|
1119
1128
|
*/
|
|
1120
1129
|
render() {
|
|
1121
|
-
return html `
|
|
1122
|
-
${this.inputTemplate}
|
|
1123
|
-
${this.popupTemplate}
|
|
1124
|
-
`;
|
|
1130
|
+
return html ` ${this.inputTemplate} ${this.popupTemplate} `;
|
|
1125
1131
|
}
|
|
1126
1132
|
};
|
|
1127
1133
|
__decorate([
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { __decorate } from "tslib";
|
|
2
|
+
import { provide } from '@lit-labs/context';
|
|
2
3
|
import { BasicElement, html } from '@refinitiv-ui/core';
|
|
3
4
|
import { customElement } from '@refinitiv-ui/core/decorators/custom-element.js';
|
|
4
5
|
import { state } from '@refinitiv-ui/core/decorators/state.js';
|
|
5
6
|
import { VERSION } from '../../version.js';
|
|
6
|
-
import {
|
|
7
|
-
import { provide } from '@lit-labs/context';
|
|
7
|
+
import { DEFAULT_CONFIG, efConfig } from '../helpers/context.js';
|
|
8
8
|
let Configuration = class Configuration extends BasicElement {
|
|
9
9
|
constructor() {
|
|
10
10
|
super(...arguments);
|
package/lib/counter/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { JSXInterface } from '../jsx';
|
|
2
|
-
import { BasicElement,
|
|
2
|
+
import { BasicElement, CSSResultGroup, TemplateResult } from '@refinitiv-ui/core';
|
|
3
3
|
/**
|
|
4
4
|
* Counter is an item count badge,
|
|
5
5
|
* support maximun display number and notation of large numbers.
|
|
@@ -25,9 +25,9 @@ export declare class Counter extends BasicElement {
|
|
|
25
25
|
*/
|
|
26
26
|
set value(value: string);
|
|
27
27
|
/**
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
28
|
+
* The value of counter as string number
|
|
29
|
+
* @returns {string} counter value
|
|
30
|
+
*/
|
|
31
31
|
get value(): string;
|
|
32
32
|
/**
|
|
33
33
|
* Set maximum counter value.
|
package/lib/counter/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { __decorate } from "tslib";
|
|
2
|
-
import { BasicElement,
|
|
2
|
+
import { BasicElement, WarningNotice, 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 { VERSION } from '../version.js';
|
|
6
|
-
import {
|
|
6
|
+
import { convertToCompactNotation, truncateDecimal } from './utils.js';
|
|
7
7
|
/**
|
|
8
8
|
* Counter is an item count badge,
|
|
9
9
|
* support maximun display number and notation of large numbers.
|
|
@@ -41,9 +41,9 @@ let Counter = class Counter extends BasicElement {
|
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
43
|
/**
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
44
|
+
* The value of counter as string number
|
|
45
|
+
* @returns {string} counter value
|
|
46
|
+
*/
|
|
47
47
|
get value() {
|
|
48
48
|
return this._value;
|
|
49
49
|
}
|
|
@@ -110,7 +110,9 @@ let Counter = class Counter extends BasicElement {
|
|
|
110
110
|
const maxValue = this.max ? truncateDecimal(this.max) : Infinity;
|
|
111
111
|
// Format value if value greater than max
|
|
112
112
|
// If max is null, it will show the value
|
|
113
|
-
return countValue > maxValue
|
|
113
|
+
return countValue > maxValue
|
|
114
|
+
? `${convertToCompactNotation(maxValue)}+`
|
|
115
|
+
: convertToCompactNotation(countValue);
|
|
114
116
|
}
|
|
115
117
|
/**
|
|
116
118
|
* A `CSSResultGroup` that will be used
|
|
@@ -124,7 +126,7 @@ let Counter = class Counter extends BasicElement {
|
|
|
124
126
|
display: inline-block;
|
|
125
127
|
position: relative;
|
|
126
128
|
}
|
|
127
|
-
[part=
|
|
129
|
+
[part='number'] {
|
|
128
130
|
text-overflow: ellipsis;
|
|
129
131
|
white-space: nowrap;
|
|
130
132
|
overflow: hidden;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { JSXInterface } from '../jsx';
|
|
2
2
|
import { PropertyValues, TemplateResult } from '@refinitiv-ui/core';
|
|
3
3
|
import { TemplateMap } from '@refinitiv-ui/core/directives/template-map.js';
|
|
4
|
-
import
|
|
4
|
+
import '@refinitiv-ui/phrasebook/locale/en/datetime-field.js';
|
|
5
5
|
import { TranslateDirective } from '@refinitiv-ui/translate';
|
|
6
|
-
import
|
|
6
|
+
import { Locale } from '@refinitiv-ui/utils/date.js';
|
|
7
7
|
import { TextField } from '../text-field/index.js';
|
|
8
|
-
import '
|
|
8
|
+
import type { DateTimeFormatPart, NavigationKeys } from './types';
|
|
9
9
|
/**
|
|
10
10
|
* A form control element for datetime input.
|
|
11
11
|
*
|
|
@@ -185,8 +185,7 @@ export declare class DatetimeField extends TextField {
|
|
|
185
185
|
* @param changedProperties Properties that has changed
|
|
186
186
|
* @returns {void}
|
|
187
187
|
*/
|
|
188
|
-
protected syncInputValue(changedProperties
|
|
189
|
-
protected syncInputValue(): void;
|
|
188
|
+
protected syncInputValue(changedProperties?: PropertyValues): void;
|
|
190
189
|
/**
|
|
191
190
|
* Check if input should be re-validated
|
|
192
191
|
* @param changedProperties Properties that has changed
|