@refinitiv-ui/elements 6.8.7 → 6.8.9
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 +180 -433
- package/LICENSE +1 -1
- package/README.md +13 -11
- 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 +85 -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 +160 -125
- package/lib/calendar/utils.js +2 -2
- 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/helpers/legend.js +10 -8
- package/lib/chart/index.d.ts +3 -3
- package/lib/chart/index.js +17 -17
- package/lib/chart/plugins/doughnut-center-label.js +6 -5
- 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 +28 -19
- 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.d.ts +1 -1
- 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 +151 -132
- 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 +6 -6
- package/lib/dialog/index.js +48 -38
- 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 +6 -8
- package/lib/icon/utils/IconLoader.d.ts +1 -0
- package/lib/icon/utils/IconLoader.js +9 -1
- package/lib/interactive-chart/helpers/types.d.ts +3 -3
- package/lib/interactive-chart/index.d.ts +34 -34
- package/lib/interactive-chart/index.js +72 -57
- 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 +11 -8
- 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 +22 -14
- 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 +154 -98
- 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 +15 -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 +4 -4
- 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 +70 -83
- 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 +36 -33
- package/lib/time-picker/index.d.ts +6 -6
- package/lib/time-picker/index.js +104 -90
- 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 +1 -1
- 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,11 +1,11 @@
|
|
|
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
|
-
import { translate } from '@refinitiv-ui/translate';
|
|
6
|
-
import { VERSION } from '../../version.js';
|
|
7
5
|
import '@refinitiv-ui/phrasebook/locale/en/notification.js';
|
|
6
|
+
import { translate } from '@refinitiv-ui/translate';
|
|
8
7
|
import '../../icon/index.js';
|
|
8
|
+
import { VERSION } from '../../version.js';
|
|
9
9
|
/**
|
|
10
10
|
* Used to show informative content when something happens in the application
|
|
11
11
|
*
|
|
@@ -60,7 +60,9 @@ let Notification = class Notification extends BasicElement {
|
|
|
60
60
|
update(changedProperties) {
|
|
61
61
|
super.update(changedProperties);
|
|
62
62
|
// Fix bg doesn't work on IE 11
|
|
63
|
-
if (changedProperties.has('confirm') ||
|
|
63
|
+
if (changedProperties.has('confirm') ||
|
|
64
|
+
changedProperties.has('warning') ||
|
|
65
|
+
changedProperties.has('error')) {
|
|
64
66
|
this.updateStyles();
|
|
65
67
|
}
|
|
66
68
|
}
|
|
@@ -112,7 +114,7 @@ let Notification = class Notification extends BasicElement {
|
|
|
112
114
|
:host {
|
|
113
115
|
display: block;
|
|
114
116
|
}
|
|
115
|
-
[part=label] {
|
|
117
|
+
[part='label'] {
|
|
116
118
|
color: red;
|
|
117
119
|
}
|
|
118
120
|
`;
|
|
@@ -125,15 +127,21 @@ let Notification = class Notification extends BasicElement {
|
|
|
125
127
|
*/
|
|
126
128
|
render() {
|
|
127
129
|
return html `
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
130
|
+
<style>
|
|
131
|
+
:host {
|
|
132
|
+
display: block;
|
|
133
|
+
}
|
|
134
|
+
</style>
|
|
135
|
+
<div part="container">
|
|
136
|
+
<div part="content"><slot>${this.message}</slot></div>
|
|
137
|
+
<ef-icon
|
|
138
|
+
part="clear"
|
|
139
|
+
icon="cross"
|
|
140
|
+
role="button"
|
|
141
|
+
aria-description="${this.t('CLOSE')}"
|
|
142
|
+
@click="${this.onClearClick.bind(this)}"
|
|
143
|
+
></ef-icon>
|
|
144
|
+
</div>
|
|
137
145
|
`;
|
|
138
146
|
}
|
|
139
147
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { NotificationTray } from '../elements/notification-tray.js';
|
|
2
2
|
// TODO: Add to utils?
|
|
3
|
-
const DEV_ENV =
|
|
3
|
+
const DEV_ENV = /^(localhost|127\.0\.0\.1)$/.test(location.hostname);
|
|
4
4
|
const NotificationType = {
|
|
5
5
|
INFO: 'INFO',
|
|
6
6
|
CONFIRM: 'CONFIRM',
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { JSXInterface } from '../jsx';
|
|
2
|
-
import {
|
|
2
|
+
import { CSSResultGroup, FormFieldElement, PropertyValues, TapEvent, TemplateResult } from '@refinitiv-ui/core';
|
|
3
3
|
import { TemplateMap } from '@refinitiv-ui/core/directives/template-map.js';
|
|
4
4
|
import '../icon/index.js';
|
|
5
5
|
type SelectionDirection = 'forward' | 'backward' | 'none';
|
|
@@ -67,10 +67,10 @@ export declare class NumberField extends FormFieldElement {
|
|
|
67
67
|
max: string | null;
|
|
68
68
|
private interimValueState;
|
|
69
69
|
/**
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
70
|
+
* The value of the number entered into the input.
|
|
71
|
+
* @param value number-field value
|
|
72
|
+
* @default -
|
|
73
|
+
*/
|
|
74
74
|
set value(value: string);
|
|
75
75
|
get value(): string;
|
|
76
76
|
/**
|
|
@@ -313,7 +313,6 @@ export declare class NumberField extends FormFieldElement {
|
|
|
313
313
|
* type="text" - always `text`
|
|
314
314
|
* part="input" - always "input", used for styling
|
|
315
315
|
* inputmode="decimal" - show decimals keyboard by default
|
|
316
|
-
* pattern="'^[-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?$'" - numbers only
|
|
317
316
|
* role="spinbutton" - number field is actually a spinner
|
|
318
317
|
* aria-valuenow - current value or 0
|
|
319
318
|
* @keydown - Listener for `keydown` event. Runs `this.onInputKeyDown`
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { __decorate } from "tslib";
|
|
2
|
-
import {
|
|
2
|
+
import { FocusedPropertyKey, FormFieldElement, 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
6
|
import '../icon/index.js';
|
|
8
|
-
|
|
7
|
+
import { VERSION } from '../version.js';
|
|
9
8
|
const DEFAULT_STEP_BASE = 1;
|
|
10
9
|
const ANY_STEP = 'any';
|
|
11
10
|
var Direction;
|
|
@@ -81,41 +80,43 @@ let NumberField = class NumberField extends FormFieldElement {
|
|
|
81
80
|
:host {
|
|
82
81
|
display: inline-block;
|
|
83
82
|
}
|
|
84
|
-
:host(:focus),
|
|
83
|
+
:host(:focus),
|
|
84
|
+
:host input:focus {
|
|
85
85
|
outline: none;
|
|
86
86
|
}
|
|
87
87
|
:host([transparent]) {
|
|
88
88
|
background: none !important;
|
|
89
89
|
border: none !important;
|
|
90
90
|
}
|
|
91
|
-
[part=input] {
|
|
91
|
+
[part='input'] {
|
|
92
92
|
font: inherit;
|
|
93
93
|
background: none;
|
|
94
94
|
color: currentColor;
|
|
95
95
|
border: none;
|
|
96
96
|
text-align: inherit;
|
|
97
97
|
}
|
|
98
|
-
[part=spinner]{
|
|
98
|
+
[part='spinner'] {
|
|
99
99
|
display: flex;
|
|
100
100
|
flex-direction: column;
|
|
101
101
|
}
|
|
102
|
-
[part=spinner-up],
|
|
102
|
+
[part='spinner-up'],
|
|
103
|
+
[part='spinner-down'] {
|
|
103
104
|
display: flex;
|
|
104
105
|
height: 50%;
|
|
105
106
|
cursor: pointer;
|
|
106
107
|
user-select: none;
|
|
107
108
|
}
|
|
108
|
-
[part^=spinner][disabled],
|
|
109
|
-
[part^=spinner][readonly] {
|
|
109
|
+
[part^='spinner'][disabled],
|
|
110
|
+
[part^='spinner'][readonly] {
|
|
110
111
|
cursor: default;
|
|
111
112
|
}
|
|
112
113
|
`;
|
|
113
114
|
}
|
|
114
115
|
/**
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
116
|
+
* The value of the number entered into the input.
|
|
117
|
+
* @param value number-field value
|
|
118
|
+
* @default -
|
|
119
|
+
*/
|
|
119
120
|
set value(value) {
|
|
120
121
|
this.interimValueState = true;
|
|
121
122
|
super.value = value;
|
|
@@ -194,7 +195,7 @@ let NumberField = class NumberField extends FormFieldElement {
|
|
|
194
195
|
if (Math.floor(value) === value || isNaN(value) || !isFinite(value)) {
|
|
195
196
|
return 0;
|
|
196
197
|
}
|
|
197
|
-
return new Intl.NumberFormat('en', { minimumSignificantDigits: 1 }).format(value).split('.')[1].length || 0;
|
|
198
|
+
return (new Intl.NumberFormat('en', { minimumSignificantDigits: 1 }).format(value).split('.')[1].length || 0);
|
|
198
199
|
}
|
|
199
200
|
/**
|
|
200
201
|
* Get number of decimals based on step base and allowed value step
|
|
@@ -307,7 +308,9 @@ let NumberField = class NumberField extends FormFieldElement {
|
|
|
307
308
|
const selectionEnd = inputEl.selectionEnd || 0;
|
|
308
309
|
const newInput = `${oldInput.substring(0, selectionStart)}${data}${oldInput.substring(selectionEnd)}`;
|
|
309
310
|
const validatedInput = this.stripeInvalidCharacters(newInput, oldInput, data);
|
|
310
|
-
const insertionData = validatedInput
|
|
311
|
+
const insertionData = validatedInput
|
|
312
|
+
.slice(0, validatedInput.length - (oldInput.length - selectionEnd))
|
|
313
|
+
.substring(selectionStart);
|
|
311
314
|
// Invalid characters or sequence of characters
|
|
312
315
|
if (!insertionData.length) {
|
|
313
316
|
event.preventDefault();
|
|
@@ -380,18 +383,18 @@ let NumberField = class NumberField extends FormFieldElement {
|
|
|
380
383
|
if (dotIndex !== -1) {
|
|
381
384
|
input = `${input.substring(0, dotIndex + 1)}${input.substring(dotIndex + 1).replace(/\./g, '')}`;
|
|
382
385
|
if (!valueHasE) {
|
|
383
|
-
input = `${input.substring(0, dotIndex).replace(/e/
|
|
386
|
+
input = `${input.substring(0, dotIndex).replace(/e/gi, '')}${input.substring(dotIndex)}`;
|
|
384
387
|
}
|
|
385
388
|
}
|
|
386
389
|
// stripe all dots after e and multiple e occurrences
|
|
387
390
|
if (eIndex !== -1) {
|
|
388
|
-
input = `${input.substring(0, eIndex + 1)}${input.substring(eIndex + 1).replace(/e/
|
|
391
|
+
input = `${input.substring(0, eIndex + 1)}${input.substring(eIndex + 1).replace(/e/gi, '')}`;
|
|
389
392
|
if (!valueHasDot) {
|
|
390
393
|
input = `${input.substring(0, eIndex)}${input.substring(eIndex).replace(/\./g, '')}`;
|
|
391
394
|
}
|
|
392
395
|
}
|
|
393
396
|
// stripe all other invalid characters and make sure that + and - signs are correct
|
|
394
|
-
return input.replace(/(^[-+]|[e][-+])|[-+]|[^0-9e.+-]/
|
|
397
|
+
return input.replace(/(^[-+]|[e][-+])|[-+]|[^0-9e.+-]/gi, '$1');
|
|
395
398
|
}
|
|
396
399
|
/**
|
|
397
400
|
* On *user-interaction* set the value and notify.
|
|
@@ -500,7 +503,7 @@ let NumberField = class NumberField extends FormFieldElement {
|
|
|
500
503
|
*/
|
|
501
504
|
findNearestSteppedValue(value, stepBase, allowedValueStep, direction) {
|
|
502
505
|
// TODO: there is probably much better way on how to implement this function
|
|
503
|
-
let newValue = this.toFixedNumber(value + (stepBase - value) % allowedValueStep);
|
|
506
|
+
let newValue = this.toFixedNumber(value + ((stepBase - value) % allowedValueStep));
|
|
504
507
|
if (direction === Direction.Up) {
|
|
505
508
|
// with float number rounding this may need to run more than once to find the valid value
|
|
506
509
|
while (newValue <= value) {
|
|
@@ -577,7 +580,9 @@ let NumberField = class NumberField extends FormFieldElement {
|
|
|
577
580
|
}
|
|
578
581
|
// If either the method invoked was the stepDown() method and value is greater than valueBeforeStepping
|
|
579
582
|
// or the method invoked was the stepUp() method and value is less than valueBeforeStepping, then return.
|
|
580
|
-
if (!isNaN(inputValue) &&
|
|
583
|
+
if (!isNaN(inputValue) &&
|
|
584
|
+
((direction === Direction.Up && value < valueBeforeStepping) ||
|
|
585
|
+
(direction === Direction.Down && value > valueBeforeStepping))) {
|
|
581
586
|
return;
|
|
582
587
|
}
|
|
583
588
|
this.inputValue = String(value);
|
|
@@ -651,7 +656,7 @@ let NumberField = class NumberField extends FormFieldElement {
|
|
|
651
656
|
*/
|
|
652
657
|
/* istanbul ignore next */
|
|
653
658
|
set selectionStart(index) {
|
|
654
|
-
throw new Error(
|
|
659
|
+
throw new Error("Failed to set the 'selectionStart' property on 'NumberField': The element does not support selection.");
|
|
655
660
|
}
|
|
656
661
|
/**
|
|
657
662
|
* @ignore
|
|
@@ -667,7 +672,7 @@ let NumberField = class NumberField extends FormFieldElement {
|
|
|
667
672
|
*/
|
|
668
673
|
/* istanbul ignore next */
|
|
669
674
|
set selectionEnd(index) {
|
|
670
|
-
throw new Error(
|
|
675
|
+
throw new Error("Failed to set the 'selectionEnd' property on 'NumberField': The element does not support selection.");
|
|
671
676
|
}
|
|
672
677
|
/**
|
|
673
678
|
* @ignore
|
|
@@ -683,7 +688,7 @@ let NumberField = class NumberField extends FormFieldElement {
|
|
|
683
688
|
*/
|
|
684
689
|
/* istanbul ignore next */
|
|
685
690
|
set selectionDirection(direction) {
|
|
686
|
-
throw new Error(
|
|
691
|
+
throw new Error("Failed to set the 'selectionDirection' property on 'NumberField': The element does not support selection.");
|
|
687
692
|
}
|
|
688
693
|
/**
|
|
689
694
|
* @ignore
|
|
@@ -692,7 +697,7 @@ let NumberField = class NumberField extends FormFieldElement {
|
|
|
692
697
|
/* istanbul ignore next */
|
|
693
698
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
694
699
|
setSelectionRange(startSelection, endSelection, selectionDirection) {
|
|
695
|
-
throw new Error(
|
|
700
|
+
throw new Error("Failed to execute 'setSelectionRange' on 'NumberField': The element does not support selection.");
|
|
696
701
|
}
|
|
697
702
|
/**
|
|
698
703
|
* Renders spinner
|
|
@@ -700,20 +705,9 @@ let NumberField = class NumberField extends FormFieldElement {
|
|
|
700
705
|
*/
|
|
701
706
|
renderSpinner() {
|
|
702
707
|
return html `
|
|
703
|
-
<div
|
|
704
|
-
part="spinner"
|
|
705
|
-
|
|
706
|
-
<ef-icon
|
|
707
|
-
icon="up"
|
|
708
|
-
part="spinner-up"
|
|
709
|
-
?readonly=${this.readonly}
|
|
710
|
-
?disabled=${this.disabled}>
|
|
711
|
-
</ef-icon>
|
|
712
|
-
<ef-icon
|
|
713
|
-
icon="down"
|
|
714
|
-
part="spinner-down"
|
|
715
|
-
?readonly=${this.readonly}
|
|
716
|
-
?disabled=${this.disabled}>
|
|
708
|
+
<div part="spinner" @tap=${this.onSpinnerTap}>
|
|
709
|
+
<ef-icon icon="up" part="spinner-up" ?readonly=${this.readonly} ?disabled=${this.disabled}> </ef-icon>
|
|
710
|
+
<ef-icon icon="down" part="spinner-down" ?readonly=${this.readonly} ?disabled=${this.disabled}>
|
|
717
711
|
</ef-icon>
|
|
718
712
|
</div>
|
|
719
713
|
`;
|
|
@@ -723,7 +717,6 @@ let NumberField = class NumberField extends FormFieldElement {
|
|
|
723
717
|
* type="text" - always `text`
|
|
724
718
|
* part="input" - always "input", used for styling
|
|
725
719
|
* inputmode="decimal" - show decimals keyboard by default
|
|
726
|
-
* pattern="'^[-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?$'" - numbers only
|
|
727
720
|
* role="spinbutton" - number field is actually a spinner
|
|
728
721
|
* aria-valuenow - current value or 0
|
|
729
722
|
* @keydown - Listener for `keydown` event. Runs `this.onInputKeyDown`
|
|
@@ -733,11 +726,10 @@ let NumberField = class NumberField extends FormFieldElement {
|
|
|
733
726
|
get decorateInputMap() {
|
|
734
727
|
return {
|
|
735
728
|
...super.decorateInputMap,
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
'
|
|
740
|
-
'role': 'spinbutton',
|
|
729
|
+
type: 'text',
|
|
730
|
+
part: 'input',
|
|
731
|
+
inputmode: 'decimal',
|
|
732
|
+
role: 'spinbutton',
|
|
741
733
|
'aria-valuenow': `${this.value || 0}`,
|
|
742
734
|
'@keydown': this.onInputKeyDown,
|
|
743
735
|
'@beforeinput': this.onBeforeInputChange
|
|
@@ -749,9 +741,7 @@ let NumberField = class NumberField extends FormFieldElement {
|
|
|
749
741
|
* @return {TemplateResult} Render template
|
|
750
742
|
*/
|
|
751
743
|
render() {
|
|
752
|
-
return html `
|
|
753
|
-
${super.render()}
|
|
754
|
-
${this.noSpinner ? null : this.renderSpinner()}`;
|
|
744
|
+
return html ` ${super.render()} ${this.noSpinner ? null : this.renderSpinner()}`;
|
|
755
745
|
}
|
|
756
746
|
};
|
|
757
747
|
__decorate([
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { JSXInterface } from '../../jsx';
|
|
2
|
-
import {
|
|
2
|
+
import { CSSResultGroup, ResponsiveElement, TemplateResult } from '@refinitiv-ui/core';
|
|
3
3
|
/**
|
|
4
4
|
* A private element to find overlay size boundaries
|
|
5
5
|
*/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { JSXInterface } from '../../jsx';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { CSSResultGroup, ElementSize, PropertyValues, ResponsiveElement, TemplateResult } from '@refinitiv-ui/core';
|
|
3
|
+
import { NullOrUndefined, Position, PositionTarget, PositionTargetStrategy, TransitionStyle } from '../helpers/types.js';
|
|
4
4
|
export type { TransitionStyle, PositionTarget, Position, PositionTargetStrategy };
|
|
5
5
|
/**
|
|
6
6
|
* Element to help building modals, dialogs and other overlay content
|