@refinitiv-ui/elements 6.16.5 → 6.17.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 +17 -0
- package/lib/combo-box/custom-elements.json +1 -1
- package/lib/combo-box/custom-elements.md +1 -1
- package/lib/combo-box/helpers/filter.d.ts +1 -1
- package/lib/combo-box/helpers/filter.js +1 -3
- package/lib/combo-box/index.js +4 -4
- package/lib/datetime-picker/index.d.ts +6 -0
- package/lib/datetime-picker/index.js +27 -0
- package/lib/datetime-picker/utils.js +1 -1
- package/lib/list/elements/list.js +1 -1
- package/lib/swing-gauge/index.js +1 -1
- package/lib/time-picker/custom-elements.json +40 -0
- package/lib/time-picker/custom-elements.md +18 -13
- package/lib/time-picker/index.d.ts +32 -3
- package/lib/time-picker/index.js +83 -5
- package/lib/time-picker/themes/halo/dark/index.js +1 -1
- package/lib/time-picker/themes/halo/light/index.js +1 -1
- package/lib/time-picker/themes/solar/charcoal/index.js +1 -1
- package/lib/time-picker/themes/solar/pearl/index.js +1 -1
- package/lib/tooltip/index.js +2 -2
- package/lib/tree/custom-elements.json +6 -0
- package/lib/tree/custom-elements.md +10 -9
- package/lib/tree/elements/tree.d.ts +2 -3
- package/lib/tree/elements/tree.js +5 -3
- package/lib/tree/helpers/filter.d.ts +1 -1
- package/lib/tree/helpers/filter.js +1 -3
- package/lib/tree/index.d.ts +1 -2
- package/lib/tree-select/custom-elements.json +22 -0
- package/lib/tree-select/custom-elements.md +19 -11
- package/lib/tree-select/index.d.ts +4 -1
- package/lib/tree-select/index.js +4 -1
- package/lib/version.js +1 -1
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,23 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [6.17.1](https://github.com/Refinitiv/refinitiv-ui/compare/@refinitiv-ui/elements@6.17.0...@refinitiv-ui/elements@6.17.1) (2024-06-17)
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
- **datetime-picker:** incorrect value with 2 digits year format ([#1175](https://github.com/Refinitiv/refinitiv-ui/issues/1175)) ([17b16c2](https://github.com/Refinitiv/refinitiv-ui/commit/17b16c2094b602667572b4bb16d10c7aae61589b))
|
|
11
|
+
|
|
12
|
+
# [6.17.0](https://github.com/Refinitiv/refinitiv-ui/compare/@refinitiv-ui/elements@6.16.5...@refinitiv-ui/elements@6.17.0) (2024-06-10)
|
|
13
|
+
|
|
14
|
+
### Bug Fixes
|
|
15
|
+
|
|
16
|
+
- **combo-box, list, tree:** make implicit type of renderer explicit ([#1170](https://github.com/Refinitiv/refinitiv-ui/issues/1170)) ([90e2136](https://github.com/Refinitiv/refinitiv-ui/commit/90e21362022eefa79e7359354084cc1677da5e87))
|
|
17
|
+
|
|
18
|
+
### Features
|
|
19
|
+
|
|
20
|
+
- **time-picker:** add build-in validation for partial input value ([#1166](https://github.com/Refinitiv/refinitiv-ui/issues/1166)) ([5473aad](https://github.com/Refinitiv/refinitiv-ui/commit/5473aad2f5651c1517ddb702059d8a200509e9aa))
|
|
21
|
+
- **tree:** enable custom filter of query ([#1172](https://github.com/Refinitiv/refinitiv-ui/issues/1172)) ([6e7f048](https://github.com/Refinitiv/refinitiv-ui/commit/6e7f048e3657cf1f52a000312034aa3a4c2f4082))
|
|
22
|
+
|
|
6
23
|
## [6.16.5](https://github.com/Refinitiv/refinitiv-ui/compare/@refinitiv-ui/elements@6.16.4...@refinitiv-ui/elements@6.16.5) (2024-05-20)
|
|
7
24
|
|
|
8
25
|
### Bug Fixes
|
|
@@ -77,7 +77,7 @@
|
|
|
77
77
|
"name": "filter",
|
|
78
78
|
"description": "Custom filter for static data\nSet this to null when data is filtered externally, eg XHR",
|
|
79
79
|
"type": "ComboBoxFilter<T> | null",
|
|
80
|
-
"default": "\"
|
|
80
|
+
"default": "\"createDefaultFilter<T>(this)\""
|
|
81
81
|
},
|
|
82
82
|
{
|
|
83
83
|
"name": "renderer",
|
|
@@ -10,7 +10,7 @@ Combines a popup with a filterable selection list
|
|
|
10
10
|
| `data` | | `ComboBoxData<T>` | [] | Data array to be displayed |
|
|
11
11
|
| `disabled` | `disabled` | `boolean` | false | Set disabled state |
|
|
12
12
|
| `error` | `error` | `boolean` | false | Set error state |
|
|
13
|
-
| `filter` | | `ComboBoxFilter<T> \| null` | "
|
|
13
|
+
| `filter` | | `ComboBoxFilter<T> \| null` | "createDefaultFilter<T>(this)" | Custom filter for static data<br />Set this to null when data is filtered externally, eg XHR |
|
|
14
14
|
| `freeText` | `free-text` | `boolean` | false | Allow to enter any value |
|
|
15
15
|
| `label (readonly)` | | `string` | "" | Label of selected value |
|
|
16
16
|
| `multiple` | `multiple` | `boolean` | false | Multiple selection mode |
|
|
@@ -7,4 +7,4 @@ import type { ComboBoxFilter } from './types';
|
|
|
7
7
|
* @param el ComboBox instance to filter
|
|
8
8
|
* @returns Filter accepting an item
|
|
9
9
|
*/
|
|
10
|
-
export declare const
|
|
10
|
+
export declare const createDefaultFilter: <T extends DataItem = ItemData>(el: ComboBox<T>) => ComboBoxFilter<T>;
|
|
@@ -4,7 +4,7 @@ import escapeStringRegexp from 'escape-string-regexp';
|
|
|
4
4
|
* @param el ComboBox instance to filter
|
|
5
5
|
* @returns Filter accepting an item
|
|
6
6
|
*/
|
|
7
|
-
export const
|
|
7
|
+
export const createDefaultFilter = (el) => {
|
|
8
8
|
// reference query string for validating queryRegExp cache state
|
|
9
9
|
let query = '';
|
|
10
10
|
// cache RegExp
|
|
@@ -23,8 +23,6 @@ export const defaultFilter = (el) => {
|
|
|
23
23
|
return (item) => {
|
|
24
24
|
const regex = getRegularExpressionOfQuery();
|
|
25
25
|
const result = regex.test(item.label);
|
|
26
|
-
// this example uses global scope, so the index needs resetting
|
|
27
|
-
regex.lastIndex = 0;
|
|
28
26
|
return result;
|
|
29
27
|
};
|
|
30
28
|
};
|
package/lib/combo-box/index.js
CHANGED
|
@@ -16,7 +16,7 @@ import '../list/index.js';
|
|
|
16
16
|
import '../overlay/index.js';
|
|
17
17
|
import { registerOverflowTooltip } from '../tooltip/index.js';
|
|
18
18
|
import { VERSION } from '../version.js';
|
|
19
|
-
import {
|
|
19
|
+
import { createDefaultFilter } from './helpers/filter.js';
|
|
20
20
|
import { CustomKeyboardEvent } from './helpers/keyboard-event.js';
|
|
21
21
|
import { ComboBoxRenderer, createComboBoxRenderer } from './helpers/renderer.js';
|
|
22
22
|
export { ComboBoxRenderer, createComboBoxRenderer };
|
|
@@ -53,7 +53,7 @@ let ComboBox = class ComboBox extends FormFieldElement {
|
|
|
53
53
|
* Set this to null when data is filtered externally, eg XHR
|
|
54
54
|
* @type {ComboBoxFilter<T> | null}
|
|
55
55
|
*/
|
|
56
|
-
this.filter =
|
|
56
|
+
this.filter = createDefaultFilter(this);
|
|
57
57
|
/**
|
|
58
58
|
* Renderer used to render list item elements
|
|
59
59
|
*/
|
|
@@ -1135,10 +1135,10 @@ let ComboBox = class ComboBox extends FormFieldElement {
|
|
|
1135
1135
|
}
|
|
1136
1136
|
};
|
|
1137
1137
|
__decorate([
|
|
1138
|
-
property({
|
|
1138
|
+
property({ attribute: false })
|
|
1139
1139
|
], ComboBox.prototype, "filter", void 0);
|
|
1140
1140
|
__decorate([
|
|
1141
|
-
property({
|
|
1141
|
+
property({ attribute: false })
|
|
1142
1142
|
], ComboBox.prototype, "renderer", void 0);
|
|
1143
1143
|
__decorate([
|
|
1144
1144
|
property({ type: Boolean })
|
|
@@ -228,6 +228,12 @@ export declare class DatetimePicker extends FormFieldElement implements MultiVal
|
|
|
228
228
|
* @returns promise
|
|
229
229
|
*/
|
|
230
230
|
protected performUpdate(): Promise<void>;
|
|
231
|
+
/**
|
|
232
|
+
* if the time-picker input(s) is invalid
|
|
233
|
+
* it will sync time-picker value to previous valid value that store in datetime-picker
|
|
234
|
+
* @returns {void}
|
|
235
|
+
*/
|
|
236
|
+
private syncTimePickerInput;
|
|
231
237
|
/**
|
|
232
238
|
* Overwrite validation method for value
|
|
233
239
|
*
|
|
@@ -354,6 +354,7 @@ let DatetimePicker = class DatetimePicker extends FormFieldElement {
|
|
|
354
354
|
update(changedProperties) {
|
|
355
355
|
if (changedProperties.has('opened') && this.opened) {
|
|
356
356
|
this.lazyRendered = true;
|
|
357
|
+
this.syncTimePickerInput();
|
|
357
358
|
}
|
|
358
359
|
// make sure to close popup for disabled
|
|
359
360
|
if (this.opened && !this.canOpenPopup) {
|
|
@@ -393,6 +394,31 @@ let DatetimePicker = class DatetimePicker extends FormFieldElement {
|
|
|
393
394
|
]);
|
|
394
395
|
void super.performUpdate();
|
|
395
396
|
}
|
|
397
|
+
/**
|
|
398
|
+
* if the time-picker input(s) is invalid
|
|
399
|
+
* it will sync time-picker value to previous valid value that store in datetime-picker
|
|
400
|
+
* @returns {void}
|
|
401
|
+
*/
|
|
402
|
+
syncTimePickerInput() {
|
|
403
|
+
if (!this.timepicker || !this.opened) {
|
|
404
|
+
return;
|
|
405
|
+
}
|
|
406
|
+
const validateAndFallback = (element, value) => {
|
|
407
|
+
if (!element) {
|
|
408
|
+
return;
|
|
409
|
+
}
|
|
410
|
+
if (!element.checkValidity() || (!element.value && value)) {
|
|
411
|
+
element.value = value;
|
|
412
|
+
}
|
|
413
|
+
};
|
|
414
|
+
if (this.range) {
|
|
415
|
+
validateAndFallback(this.timepickerFromEl, this.timepickerValues[0]);
|
|
416
|
+
validateAndFallback(this.timepickerToEl, this.timepickerValues[1]);
|
|
417
|
+
}
|
|
418
|
+
else {
|
|
419
|
+
validateAndFallback(this.timepickerEl, this.timepickerValues[0]);
|
|
420
|
+
}
|
|
421
|
+
}
|
|
396
422
|
/**
|
|
397
423
|
* Overwrite validation method for value
|
|
398
424
|
*
|
|
@@ -980,6 +1006,7 @@ let DatetimePicker = class DatetimePicker extends FormFieldElement {
|
|
|
980
1006
|
return html `<ef-time-picker
|
|
981
1007
|
id="${id}"
|
|
982
1008
|
part="time-picker"
|
|
1009
|
+
custom-validation
|
|
983
1010
|
.showSeconds=${this.showSeconds}
|
|
984
1011
|
.amPm=${this.amPm}
|
|
985
1012
|
.value=${value}
|
|
@@ -24,7 +24,7 @@ class DateTimeSegment {
|
|
|
24
24
|
* @returns {number} time
|
|
25
25
|
*/
|
|
26
26
|
getTime() {
|
|
27
|
-
const date = this.dateSegment ? parse(this.dateSegment) : new Date(
|
|
27
|
+
const date = this.dateSegment ? parse(this.dateSegment) : new Date();
|
|
28
28
|
const timeSegment = toTimeSegment(this.timeSegment);
|
|
29
29
|
date.setHours(timeSegment.hours);
|
|
30
30
|
date.setMinutes(timeSegment.minutes);
|
|
@@ -617,7 +617,7 @@ let List = class List extends ControlElement {
|
|
|
617
617
|
}
|
|
618
618
|
};
|
|
619
619
|
__decorate([
|
|
620
|
-
property({
|
|
620
|
+
property({ attribute: false })
|
|
621
621
|
], List.prototype, "renderer", void 0);
|
|
622
622
|
__decorate([
|
|
623
623
|
property({ type: Boolean })
|
package/lib/swing-gauge/index.js
CHANGED
|
@@ -748,7 +748,7 @@ __decorate([
|
|
|
748
748
|
property({ type: String, reflect: true, attribute: 'secondary-legend' })
|
|
749
749
|
], SwingGauge.prototype, "secondaryLegend", void 0);
|
|
750
750
|
__decorate([
|
|
751
|
-
property({
|
|
751
|
+
property({ attribute: false })
|
|
752
752
|
], SwingGauge.prototype, "valueFormatter", void 0);
|
|
753
753
|
__decorate([
|
|
754
754
|
state()
|
|
@@ -5,6 +5,12 @@
|
|
|
5
5
|
"name": "ef-time-picker",
|
|
6
6
|
"description": "Control the time input",
|
|
7
7
|
"attributes": [
|
|
8
|
+
{
|
|
9
|
+
"name": "custom-validation",
|
|
10
|
+
"description": "Disable automatic build-in validation checking for partial input of hour, minute & second (if applicable) segments",
|
|
11
|
+
"type": "boolean",
|
|
12
|
+
"default": "false"
|
|
13
|
+
},
|
|
8
14
|
{
|
|
9
15
|
"name": "hours",
|
|
10
16
|
"description": "Hours time segment in 24hr format",
|
|
@@ -49,9 +55,22 @@
|
|
|
49
55
|
"description": "Set disabled state",
|
|
50
56
|
"type": "boolean",
|
|
51
57
|
"default": "false"
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
"name": "error",
|
|
61
|
+
"description": "Set error state",
|
|
62
|
+
"type": "boolean",
|
|
63
|
+
"default": "false"
|
|
52
64
|
}
|
|
53
65
|
],
|
|
54
66
|
"properties": [
|
|
67
|
+
{
|
|
68
|
+
"name": "customValidation",
|
|
69
|
+
"attribute": "custom-validation",
|
|
70
|
+
"description": "Disable automatic build-in validation checking for partial input of hour, minute & second (if applicable) segments",
|
|
71
|
+
"type": "boolean",
|
|
72
|
+
"default": "false"
|
|
73
|
+
},
|
|
55
74
|
{
|
|
56
75
|
"name": "hours",
|
|
57
76
|
"attribute": "hours",
|
|
@@ -104,15 +123,36 @@
|
|
|
104
123
|
"description": "Set disabled state",
|
|
105
124
|
"type": "boolean",
|
|
106
125
|
"default": "false"
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
"name": "error",
|
|
129
|
+
"attribute": "error",
|
|
130
|
+
"description": "Set error state",
|
|
131
|
+
"type": "boolean",
|
|
132
|
+
"default": "false"
|
|
107
133
|
}
|
|
108
134
|
],
|
|
109
135
|
"events": [
|
|
110
136
|
{
|
|
111
137
|
"name": "value-changed",
|
|
112
138
|
"description": "Fired when the user commits a value change. The event is not triggered if `value` property is changed programmatically."
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
"name": "error-changed",
|
|
142
|
+
"description": "Fired when user inputs invalid value. The event is not triggered if `error` property is changed programmatically."
|
|
113
143
|
}
|
|
114
144
|
],
|
|
115
145
|
"methods": [
|
|
146
|
+
{
|
|
147
|
+
"name": "checkValidity",
|
|
148
|
+
"description": "Returns `true` if all input segments contain valid data or empty. Otherwise, returns false.",
|
|
149
|
+
"params": []
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
"name": "reportValidity",
|
|
153
|
+
"description": "Validate input. Mark as error if input is invalid",
|
|
154
|
+
"params": []
|
|
155
|
+
},
|
|
116
156
|
{
|
|
117
157
|
"name": "toggle",
|
|
118
158
|
"description": "Toggles the AM/PM state",
|
|
@@ -4,25 +4,30 @@ Control the time input
|
|
|
4
4
|
|
|
5
5
|
## Properties
|
|
6
6
|
|
|
7
|
-
| Property
|
|
8
|
-
|
|
9
|
-
| `amPm`
|
|
10
|
-
| `
|
|
11
|
-
| `
|
|
12
|
-
| `
|
|
13
|
-
| `
|
|
14
|
-
| `
|
|
15
|
-
| `
|
|
16
|
-
| `
|
|
7
|
+
| Property | Attribute | Type | Default | Description |
|
|
8
|
+
|--------------------|---------------------|------------------|---------|--------------------------------------------------|
|
|
9
|
+
| `amPm` | `am-pm` | `boolean` | false | Toggles 12hr time display |
|
|
10
|
+
| `customValidation` | `custom-validation` | `boolean` | false | Disable automatic build-in validation checking for partial input of hour, minute & second (if applicable) segments |
|
|
11
|
+
| `disabled` | `disabled` | `boolean` | false | Set disabled state |
|
|
12
|
+
| `error` | `error` | `boolean` | false | Set error state |
|
|
13
|
+
| `hours` | `hours` | `number \| null` | null | Hours time segment in 24hr format |
|
|
14
|
+
| `minutes` | `minutes` | `number \| null` | null | Minutes time segment |
|
|
15
|
+
| `readonly` | `readonly` | `boolean` | false | Set readonly state |
|
|
16
|
+
| `seconds` | `seconds` | `number \| null` | null | Seconds time segment |
|
|
17
|
+
| `showSeconds` | `show-seconds` | `boolean` | false | Flag to show seconds time segment in display.<br />Seconds are automatically shown when `hh:mm:ss` time format is provided as a value. |
|
|
18
|
+
| `value` | `value` | `string` | "" | Current time value |
|
|
17
19
|
|
|
18
20
|
## Methods
|
|
19
21
|
|
|
20
|
-
| Method
|
|
21
|
-
|
|
22
|
-
| `
|
|
22
|
+
| Method | Type | Description |
|
|
23
|
+
|------------------|---------------|--------------------------------------------------|
|
|
24
|
+
| `checkValidity` | `(): boolean` | Returns `true` if all input segments contain valid data or empty. Otherwise, returns false. |
|
|
25
|
+
| `reportValidity` | `(): boolean` | Validate input. Mark as error if input is invalid |
|
|
26
|
+
| `toggle` | `(): void` | Toggles the AM/PM state |
|
|
23
27
|
|
|
24
28
|
## Events
|
|
25
29
|
|
|
26
30
|
| Event | Description |
|
|
27
31
|
|-----------------|--------------------------------------------------|
|
|
32
|
+
| `error-changed` | Fired when user inputs invalid value. The event is not triggered if `error` property is changed programmatically. |
|
|
28
33
|
| `value-changed` | Fired when the user commits a value change. The event is not triggered if `value` property is changed programmatically. |
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { JSXInterface } from '../jsx';
|
|
2
|
-
import { CSSResultGroup,
|
|
2
|
+
import { CSSResultGroup, FormFieldElement, PropertyValues, TemplateResult } from '@refinitiv-ui/core';
|
|
3
3
|
import '@refinitiv-ui/phrasebook/locale/en/time-picker.js';
|
|
4
4
|
import { TranslateDirective } from '@refinitiv-ui/translate';
|
|
5
5
|
import '../number-field/index.js';
|
|
@@ -11,14 +11,18 @@ declare enum Segment {
|
|
|
11
11
|
/**
|
|
12
12
|
* Control the time input
|
|
13
13
|
* @event value-changed - Fired when the user commits a value change. The event is not triggered if `value` property is changed programmatically.
|
|
14
|
+
* @event error-changed - Fired when user inputs invalid value. The event is not triggered if `error` property is changed programmatically.
|
|
14
15
|
*
|
|
15
16
|
* @attr {boolean} readonly - Set readonly state
|
|
16
17
|
* @prop {boolean} [readonly=false] - Set readonly state
|
|
17
18
|
*
|
|
18
19
|
* @attr {boolean} disabled - Set disabled state
|
|
19
20
|
* @prop {boolean} [disabled=false] - Set disabled state
|
|
21
|
+
*
|
|
22
|
+
* @attr {boolean} error - Set error state
|
|
23
|
+
* @prop {boolean} [error=false] - Set error state
|
|
20
24
|
*/
|
|
21
|
-
export declare class TimePicker extends
|
|
25
|
+
export declare class TimePicker extends FormFieldElement {
|
|
22
26
|
/**
|
|
23
27
|
* Element version number
|
|
24
28
|
* @returns version number
|
|
@@ -46,6 +50,10 @@ export declare class TimePicker extends ControlElement {
|
|
|
46
50
|
* The flag is not relevant when withSecond is forced to be true
|
|
47
51
|
*/
|
|
48
52
|
private valueWithSeconds;
|
|
53
|
+
/**
|
|
54
|
+
* Disable automatic build-in validation checking for partial input of hour, minute & second (if applicable) segments
|
|
55
|
+
*/
|
|
56
|
+
customValidation: boolean;
|
|
49
57
|
/**
|
|
50
58
|
* Hours time segment in 24hr format
|
|
51
59
|
* @param hours hours value
|
|
@@ -243,6 +251,21 @@ export declare class TimePicker extends ControlElement {
|
|
|
243
251
|
* @returns {void}
|
|
244
252
|
*/
|
|
245
253
|
private onInputValueChanged;
|
|
254
|
+
/**
|
|
255
|
+
* Returns `true` if all input segments contain valid data or empty. Otherwise, returns false.
|
|
256
|
+
* @returns true if input is valid
|
|
257
|
+
*/
|
|
258
|
+
checkValidity(): boolean;
|
|
259
|
+
/**
|
|
260
|
+
* Validate input. Mark as error if input is invalid
|
|
261
|
+
* @returns false if there is an error
|
|
262
|
+
*/
|
|
263
|
+
reportValidity(): boolean;
|
|
264
|
+
/**
|
|
265
|
+
* Handle validation on input segments
|
|
266
|
+
* @returns {void}
|
|
267
|
+
*/
|
|
268
|
+
private onInputValidation;
|
|
246
269
|
/**
|
|
247
270
|
* Updates a time segment to the provided value
|
|
248
271
|
* @param segment Segment id
|
|
@@ -349,6 +372,12 @@ export declare class TimePicker extends ControlElement {
|
|
|
349
372
|
* @returns {void}
|
|
350
373
|
*/
|
|
351
374
|
toggle(): void;
|
|
375
|
+
/**
|
|
376
|
+
* Handle tap toggle between AP and PM state
|
|
377
|
+
* @param userInteraction indicates whether the toggle is triggered by user interaction or not
|
|
378
|
+
* @returns {void}
|
|
379
|
+
*/
|
|
380
|
+
private onToggle;
|
|
352
381
|
/**
|
|
353
382
|
* A `CSSResultGroup` that will be used
|
|
354
383
|
* to style the host, slotted children
|
|
@@ -417,7 +446,7 @@ declare global {
|
|
|
417
446
|
|
|
418
447
|
namespace JSX {
|
|
419
448
|
interface IntrinsicElements {
|
|
420
|
-
'ef-time-picker': Partial<TimePicker> | JSXInterface.
|
|
449
|
+
'ef-time-picker': Partial<TimePicker> | JSXInterface.HTMLAttributes<TimePicker>;
|
|
421
450
|
}
|
|
422
451
|
}
|
|
423
452
|
}
|
package/lib/time-picker/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
var TimePicker_1;
|
|
2
2
|
import { __decorate } from "tslib";
|
|
3
|
-
import {
|
|
3
|
+
import { FormFieldElement, css, html, nothing } from '@refinitiv-ui/core';
|
|
4
4
|
import { customElement } from '@refinitiv-ui/core/decorators/custom-element.js';
|
|
5
5
|
import { property } from '@refinitiv-ui/core/decorators/property.js';
|
|
6
6
|
import { query } from '@refinitiv-ui/core/decorators/query.js';
|
|
@@ -46,14 +46,18 @@ const Placeholder = {
|
|
|
46
46
|
/**
|
|
47
47
|
* Control the time input
|
|
48
48
|
* @event value-changed - Fired when the user commits a value change. The event is not triggered if `value` property is changed programmatically.
|
|
49
|
+
* @event error-changed - Fired when user inputs invalid value. The event is not triggered if `error` property is changed programmatically.
|
|
49
50
|
*
|
|
50
51
|
* @attr {boolean} readonly - Set readonly state
|
|
51
52
|
* @prop {boolean} [readonly=false] - Set readonly state
|
|
52
53
|
*
|
|
53
54
|
* @attr {boolean} disabled - Set disabled state
|
|
54
55
|
* @prop {boolean} [disabled=false] - Set disabled state
|
|
56
|
+
*
|
|
57
|
+
* @attr {boolean} error - Set error state
|
|
58
|
+
* @prop {boolean} [error=false] - Set error state
|
|
55
59
|
*/
|
|
56
|
-
let TimePicker = TimePicker_1 = class TimePicker extends
|
|
60
|
+
let TimePicker = TimePicker_1 = class TimePicker extends FormFieldElement {
|
|
57
61
|
constructor() {
|
|
58
62
|
super(...arguments);
|
|
59
63
|
this.defaultRole = 'group';
|
|
@@ -78,6 +82,10 @@ let TimePicker = TimePicker_1 = class TimePicker extends ControlElement {
|
|
|
78
82
|
* The flag is not relevant when withSecond is forced to be true
|
|
79
83
|
*/
|
|
80
84
|
this.valueWithSeconds = false;
|
|
85
|
+
/**
|
|
86
|
+
* Disable automatic build-in validation checking for partial input of hour, minute & second (if applicable) segments
|
|
87
|
+
*/
|
|
88
|
+
this.customValidation = false;
|
|
81
89
|
/**
|
|
82
90
|
* Toggles 12hr time display
|
|
83
91
|
*/
|
|
@@ -456,6 +464,9 @@ let TimePicker = TimePicker_1 = class TimePicker extends ControlElement {
|
|
|
456
464
|
this.updateTimeSegmentTo(segment, Number(value));
|
|
457
465
|
}
|
|
458
466
|
this.updateSegmentValue(segment);
|
|
467
|
+
if (!this.customValidation) {
|
|
468
|
+
this.reportValidity();
|
|
469
|
+
}
|
|
459
470
|
}
|
|
460
471
|
/**
|
|
461
472
|
* Handles action when input value changes
|
|
@@ -477,6 +488,50 @@ let TimePicker = TimePicker_1 = class TimePicker extends ControlElement {
|
|
|
477
488
|
}
|
|
478
489
|
}
|
|
479
490
|
}
|
|
491
|
+
/**
|
|
492
|
+
* Returns `true` if all input segments contain valid data or empty. Otherwise, returns false.
|
|
493
|
+
* @returns true if input is valid
|
|
494
|
+
*/
|
|
495
|
+
checkValidity() {
|
|
496
|
+
const hours = this.hoursInput?.value;
|
|
497
|
+
const minutes = this.minutesInput?.value;
|
|
498
|
+
const seconds = this.secondsInput?.value;
|
|
499
|
+
// If no values are provided in all segment, there is no error
|
|
500
|
+
if (!hours && !minutes && !seconds) {
|
|
501
|
+
return true;
|
|
502
|
+
}
|
|
503
|
+
const checkValues = (value, maxUnit) => {
|
|
504
|
+
if (!value) {
|
|
505
|
+
return false;
|
|
506
|
+
}
|
|
507
|
+
const _value = Number(value);
|
|
508
|
+
return TimePicker_1.validUnit(_value, MIN_UNIT, maxUnit, null) === _value;
|
|
509
|
+
};
|
|
510
|
+
const validHour = checkValues(hours, MAX_HOURS);
|
|
511
|
+
const validMinute = checkValues(minutes, MAX_MINUTES);
|
|
512
|
+
const validSecond = checkValues(seconds, MAX_SECONDS);
|
|
513
|
+
// Check second only when it's enabled
|
|
514
|
+
return validHour && validMinute && (!this.isShowSeconds || validSecond);
|
|
515
|
+
}
|
|
516
|
+
/**
|
|
517
|
+
* Validate input. Mark as error if input is invalid
|
|
518
|
+
* @returns false if there is an error
|
|
519
|
+
*/
|
|
520
|
+
reportValidity() {
|
|
521
|
+
const hasError = !this.checkValidity();
|
|
522
|
+
this.notifyErrorChange(hasError);
|
|
523
|
+
return !hasError;
|
|
524
|
+
}
|
|
525
|
+
/**
|
|
526
|
+
* Handle validation on input segments
|
|
527
|
+
* @returns {void}
|
|
528
|
+
*/
|
|
529
|
+
onInputValidation() {
|
|
530
|
+
if (this.customValidation) {
|
|
531
|
+
return;
|
|
532
|
+
}
|
|
533
|
+
this.reportValidity();
|
|
534
|
+
}
|
|
480
535
|
/**
|
|
481
536
|
* Updates a time segment to the provided value
|
|
482
537
|
* @param segment Segment id
|
|
@@ -544,7 +599,7 @@ let TimePicker = TimePicker_1 = class TimePicker extends ControlElement {
|
|
|
544
599
|
*/
|
|
545
600
|
handleEnterKey(event) {
|
|
546
601
|
if (event.target === this.toggleEl) {
|
|
547
|
-
this.
|
|
602
|
+
void this.onToggle();
|
|
548
603
|
event.preventDefault();
|
|
549
604
|
}
|
|
550
605
|
}
|
|
@@ -573,7 +628,7 @@ let TimePicker = TimePicker_1 = class TimePicker extends ControlElement {
|
|
|
573
628
|
*/
|
|
574
629
|
toggleOrModify(amount, target) {
|
|
575
630
|
if (target === this.toggleEl) {
|
|
576
|
-
this.
|
|
631
|
+
void this.onToggle();
|
|
577
632
|
}
|
|
578
633
|
else if (target === this.hoursInput) {
|
|
579
634
|
this.changeValueBy(amount, Segment.HOURS);
|
|
@@ -679,9 +734,26 @@ let TimePicker = TimePicker_1 = class TimePicker extends ControlElement {
|
|
|
679
734
|
* @returns {void}
|
|
680
735
|
*/
|
|
681
736
|
toggle() {
|
|
737
|
+
void this.onToggle(false);
|
|
738
|
+
}
|
|
739
|
+
/**
|
|
740
|
+
* Handle tap toggle between AP and PM state
|
|
741
|
+
* @param userInteraction indicates whether the toggle is triggered by user interaction or not
|
|
742
|
+
* @returns {void}
|
|
743
|
+
*/
|
|
744
|
+
async onToggle(userInteraction = true) {
|
|
682
745
|
if (this.amPm) {
|
|
683
746
|
const hours = this.hours === null ? new Date().getHours() : (this.hours + HOURS_IN_DAY / 2) % HOURS_IN_DAY;
|
|
747
|
+
if (!userInteraction) {
|
|
748
|
+
this.hours = hours; // set segment without notifying value change
|
|
749
|
+
return;
|
|
750
|
+
}
|
|
684
751
|
this.setSegmentAndNotify(Segment.HOURS, hours);
|
|
752
|
+
await this.updateComplete;
|
|
753
|
+
// The segment needs to be validated when its value has been changed
|
|
754
|
+
if (!this.customValidation) {
|
|
755
|
+
this.reportValidity();
|
|
756
|
+
}
|
|
685
757
|
}
|
|
686
758
|
}
|
|
687
759
|
/**
|
|
@@ -730,6 +802,7 @@ let TimePicker = TimePicker_1 = class TimePicker extends ControlElement {
|
|
|
730
802
|
?readonly="${this.readonly}"
|
|
731
803
|
@value-changed="${this.onInputValueChanged}"
|
|
732
804
|
@focused-changed=${this.onInputFocusedChanged}
|
|
805
|
+
@input=${this.onInputValidation}
|
|
733
806
|
></ef-number-field>`;
|
|
734
807
|
}
|
|
735
808
|
/**
|
|
@@ -752,6 +825,7 @@ let TimePicker = TimePicker_1 = class TimePicker extends ControlElement {
|
|
|
752
825
|
transparent
|
|
753
826
|
@value-changed="${this.onInputValueChanged}"
|
|
754
827
|
@focused-changed=${this.onInputFocusedChanged}
|
|
828
|
+
@input=${this.onInputValidation}
|
|
755
829
|
></ef-number-field>`;
|
|
756
830
|
}
|
|
757
831
|
/**
|
|
@@ -774,6 +848,7 @@ let TimePicker = TimePicker_1 = class TimePicker extends ControlElement {
|
|
|
774
848
|
transparent
|
|
775
849
|
@value-changed="${this.onInputValueChanged}"
|
|
776
850
|
@focused-changed=${this.onInputFocusedChanged}
|
|
851
|
+
@input=${this.onInputValidation}
|
|
777
852
|
></ef-number-field>`;
|
|
778
853
|
}
|
|
779
854
|
/**
|
|
@@ -790,7 +865,7 @@ let TimePicker = TimePicker_1 = class TimePicker extends ControlElement {
|
|
|
790
865
|
aria-activedescendant="${hasHours ? (this.isAM() ? 'toggle-am' : 'toggle-pm') : nothing}"
|
|
791
866
|
id="toggle"
|
|
792
867
|
part="toggle"
|
|
793
|
-
@tap=${this.
|
|
868
|
+
@tap=${this.onToggle}
|
|
794
869
|
tabindex="0"
|
|
795
870
|
>
|
|
796
871
|
<div
|
|
@@ -870,6 +945,9 @@ let TimePicker = TimePicker_1 = class TimePicker extends ControlElement {
|
|
|
870
945
|
* @returns Divider segment
|
|
871
946
|
*/
|
|
872
947
|
TimePicker.dividerTemplate = html `<span part="divider"></span>`;
|
|
948
|
+
__decorate([
|
|
949
|
+
property({ type: Boolean, attribute: 'custom-validation' })
|
|
950
|
+
], TimePicker.prototype, "customValidation", void 0);
|
|
873
951
|
__decorate([
|
|
874
952
|
property({ type: Number })
|
|
875
953
|
], TimePicker.prototype, "hours", null);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import '@refinitiv-ui/elements/number-field/themes/halo/dark';
|
|
2
2
|
import '@refinitiv-ui/elements/icon/themes/halo/dark';
|
|
3
3
|
import '@refinitiv-ui/elements/tooltip/themes/halo/dark';
|
|
4
|
-
dispatchEvent(new CustomEvent('ef.customStyles.define', { detail: { name: 'ef-time-picker', styles: ':host{display:none;-webkit-appearance:none;-moz-appearance:none;appearance:none;text-align:left;font-family:inherit;font-size:12px;font-weight:400;height:24px;max-width:100%;margin:1px 0;outline:0;box-sizing:border-box;display:inline-flex;align-items:center;position:relative;vertical-align:middle;color:#ccc;border-radius:0;background-color:#0d0d0d;text-overflow:ellipsis;border:1px solid #404040;width:auto;min-width:-moz-max-content;min-width:max-content;padding:0}:host([disabled]){color:rgba(204,204,204,.5);border:1px solid rgba(64,64,64,.5)}:host([focused]){background-size:100% 2px,100% 1px!important;background-position:center bottom!important;border-color:#334bff}:host [part=input]{margin:0;text-align:center;padding:0;color:inherit;width:24px}:host [part=divider]::before{content:\':\'}:host [part=toggle]{width:20px;font-size:50%;display:flex;flex-flow:column nowrap;align-items:center;justify-content:center;line-height:1.2;outline:0;cursor:pointer;touch-action:manipulation}:host [part=input],:host [part=toggle]{height:100%;position:relative}:host [part=input]:focus::after,:host [part=input][focused]::after,:host [part=toggle]:focus::after,:host [part=toggle][focused]::after{content:\'\';border-right:8px solid transparent;border-left:8px solid transparent;position:absolute;left:calc(50% - 8px);bottom:0;border-bottom:4px solid transparent;display:none}:host
|
|
4
|
+
dispatchEvent(new CustomEvent('ef.customStyles.define', { detail: { name: 'ef-time-picker', styles: ':host{display:none;-webkit-appearance:none;-moz-appearance:none;appearance:none;text-align:left;font-family:inherit;font-size:12px;font-weight:400;height:24px;max-width:100%;margin:1px 0;outline:0;box-sizing:border-box;display:inline-flex;align-items:center;position:relative;vertical-align:middle;color:#ccc;border-radius:0;background-color:#0d0d0d;text-overflow:ellipsis;border:1px solid #404040;width:auto;min-width:-moz-max-content;min-width:max-content;padding:0}:host([disabled]){color:rgba(204,204,204,.5);border:1px solid rgba(64,64,64,.5)}:host([error]){border:1px solid #a01c2b}:host([focused]){background-size:100% 2px,100% 1px!important;background-position:center bottom!important;border-color:#334bff}:host [part=input]{margin:0;text-align:center;padding:0;color:inherit;width:24px}:host [part=divider]::before{content:\':\'}:host [part=toggle]{width:20px;font-size:50%;display:flex;flex-flow:column nowrap;align-items:center;justify-content:center;line-height:1.2;outline:0;cursor:pointer;touch-action:manipulation}:host [part=input],:host [part=toggle]{height:100%;position:relative}:host [part=toggle-item]{opacity:.5}:host [part=toggle-item][active]{opacity:1}:host([error]) [part=input]:focus::after,:host([error]) [part=input][focused]::after,:host([error]) [part=toggle]:focus::after,:host([error]) [part=toggle][focused]::after{border-bottom-color:#a01c2b}:host [part=divider]{width:2px}:host [part=input]:focus::after,:host [part=input][focused]::after,:host [part=toggle]:focus::after,:host [part=toggle][focused]::after{content:\'\';border-right:8px solid transparent;border-left:8px solid transparent;position:absolute;left:calc(50% - 8px);bottom:0;border-bottom:4px solid transparent;display:none}:host([readonly]:not([focused])){border-color:rgba(64,64,64,.5)}:host(:hover:not([readonly]):not([focused])){border-color:grey}:host([error]:not([focused])){border-color:#f5475b}:host([error][readonly]:not([focused])){border-color:rgba(250,168,177,.5)}:host([error]:hover:not([readonly]):not([focused])){border-color:#faa8b1}' }}));
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import '@refinitiv-ui/elements/number-field/themes/halo/light';
|
|
2
2
|
import '@refinitiv-ui/elements/icon/themes/halo/light';
|
|
3
3
|
import '@refinitiv-ui/elements/tooltip/themes/halo/light';
|
|
4
|
-
dispatchEvent(new CustomEvent('ef.customStyles.define', { detail: { name: 'ef-time-picker', styles: ':host{display:none;-webkit-appearance:none;-moz-appearance:none;appearance:none;text-align:left;font-family:inherit;font-size:12px;font-weight:400;height:24px;max-width:100%;margin:1px 0;outline:0;box-sizing:border-box;display:inline-flex;align-items:center;position:relative;vertical-align:middle;color:#404040;border-radius:0;background-color:#fff;text-overflow:ellipsis;border:1px solid #595959;width:auto;min-width:-moz-max-content;min-width:max-content;padding:0}:host([disabled]){color:rgba(64,64,64,.5);border:1px solid rgba(89,89,89,.5)}:host([focused]){background-size:100% 2px,100% 1px!important;background-position:center bottom!important;border-color:#334bff}:host [part=input]{margin:0;text-align:center;padding:0;color:inherit;width:24px}:host [part=divider]::before{content:\':\'}:host [part=toggle]{width:20px;font-size:50%;display:flex;flex-flow:column nowrap;align-items:center;justify-content:center;line-height:1.2;outline:0;cursor:pointer;touch-action:manipulation}:host [part=input],:host [part=toggle]{height:100%;position:relative}:host [part=input]:focus::after,:host [part=input][focused]::after,:host [part=toggle]:focus::after,:host [part=toggle][focused]::after{content:\'\';border-right:8px solid transparent;border-left:8px solid transparent;position:absolute;left:calc(50% - 8px);bottom:0;border-bottom:4px solid transparent;display:none}:host
|
|
4
|
+
dispatchEvent(new CustomEvent('ef.customStyles.define', { detail: { name: 'ef-time-picker', styles: ':host{display:none;-webkit-appearance:none;-moz-appearance:none;appearance:none;text-align:left;font-family:inherit;font-size:12px;font-weight:400;height:24px;max-width:100%;margin:1px 0;outline:0;box-sizing:border-box;display:inline-flex;align-items:center;position:relative;vertical-align:middle;color:#404040;border-radius:0;background-color:#fff;text-overflow:ellipsis;border:1px solid #595959;width:auto;min-width:-moz-max-content;min-width:max-content;padding:0}:host([disabled]){color:rgba(64,64,64,.5);border:1px solid rgba(89,89,89,.5)}:host([error]){border:1px solid #b63243}:host([focused]){background-size:100% 2px,100% 1px!important;background-position:center bottom!important;border-color:#334bff}:host [part=input]{margin:0;text-align:center;padding:0;color:inherit;width:24px}:host [part=divider]::before{content:\':\'}:host [part=toggle]{width:20px;font-size:50%;display:flex;flex-flow:column nowrap;align-items:center;justify-content:center;line-height:1.2;outline:0;cursor:pointer;touch-action:manipulation}:host [part=input],:host [part=toggle]{height:100%;position:relative}:host [part=toggle-item]{opacity:.5}:host [part=toggle-item][active]{opacity:1}:host([error]) [part=input]:focus::after,:host([error]) [part=input][focused]::after,:host([error]) [part=toggle]:focus::after,:host([error]) [part=toggle][focused]::after{border-bottom-color:#b63243}:host [part=divider]{width:2px}:host [part=input]:focus::after,:host [part=input][focused]::after,:host [part=toggle]:focus::after,:host [part=toggle][focused]::after{content:\'\';border-right:8px solid transparent;border-left:8px solid transparent;position:absolute;left:calc(50% - 8px);bottom:0;border-bottom:4px solid transparent;display:none}:host([readonly]:not([focused])){border-color:rgba(89,89,89,.5)}:host(:hover:not([readonly]):not([focused])){border-color:#0d0d0d}:host([error]:not([focused])){border-color:#d94255}:host([error][readonly]:not([focused])){border-color:rgba(238,172,180,.5)}:host([error]:hover:not([readonly]):not([focused])){border-color:#eeacb4}' }}));
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import '@refinitiv-ui/elements/number-field/themes/solar/charcoal';
|
|
2
2
|
import '@refinitiv-ui/elements/icon/themes/solar/charcoal';
|
|
3
3
|
import '@refinitiv-ui/elements/tooltip/themes/solar/charcoal';
|
|
4
|
-
dispatchEvent(new CustomEvent('ef.customStyles.define', { detail: { name: 'ef-time-picker', styles: ':host{display:none;-webkit-appearance:none;-moz-appearance:none;appearance:none;text-align:left;font-family:inherit;font-size:13px;font-weight:400;height:23px;max-width:100%;margin:1px 0;outline:0;box-sizing:border-box;display:inline-flex;align-items:center;position:relative;vertical-align:middle;color:#c2c2c2;border-radius:0;text-overflow:ellipsis
|
|
4
|
+
dispatchEvent(new CustomEvent('ef.customStyles.define', { detail: { name: 'ef-time-picker', styles: ':host{display:none;-webkit-appearance:none;-moz-appearance:none;appearance:none;text-align:left;font-family:inherit;font-size:13px;font-weight:400;height:23px;max-width:100%;margin:1px 0;outline:0;box-sizing:border-box;display:inline-flex;align-items:center;position:relative;vertical-align:middle;color:#c2c2c2;border-radius:0;text-overflow:ellipsis}:host([error]){border:1px solid #f5475b}:host([focused]){background-size:100% 2px,100% 1px!important;background-position:center bottom!important;border-color:#f93;border-style:dotted}:host [part=input]{margin:0;text-align:center;padding:0;color:inherit;width:25px}:host [part=divider]::before{content:\':\'}:host [part=toggle]{width:20px;display:flex;flex-flow:column nowrap;align-items:center;justify-content:center;outline:0;cursor:pointer;touch-action:manipulation;font-size:70%;line-height:1}:host [part=input],:host [part=toggle]{height:100%;position:relative}:host [part=input]:focus::after,:host [part=input][focused]::after,:host [part=toggle]:focus::after,:host [part=toggle][focused]::after{content:\'\';border-right:8px solid transparent;border-bottom:4px solid #f93;border-left:8px solid transparent;position:absolute}:host [part=toggle-item]{opacity:.5}:host [part=toggle-item][active]{opacity:1}:host([error]) [part=input]:focus::after,:host([error]) [part=input][focused]::after,:host([error]) [part=toggle]:focus::after,:host([error]) [part=toggle][focused]::after{border-bottom-color:#f5475b}:host{width:auto;min-width:-moz-max-content;min-width:max-content;background-color:#000;border:1px solid #4a4a52;padding:0}:host([disabled]){border:1px solid rgba(74,74,82,.6);color:rgba(194,194,194,.6)}:host([readonly]){border:1px solid rgba(74,74,82,.6)}:host(:not([focused]):not(:focus):not([disabled]):not([readonly]):hover){border:1px solid #77777d}:host([warning]){background-color:#000;border:1px solid #f93}:host([warning][disabled]){border:1px solid rgba(255,153,51,.6);color:rgba(194,194,194,.6)}:host([warning][readonly]){border:1px solid rgba(255,153,51,.6)}:host([warning]:not([focused]):not(:focus):not([disabled]):not([readonly]):hover){border:1px solid #ffb366}:host([error]),:host([error][warning]:not([focused])){background-color:#000;border:1px solid #f5475b}:host([error][disabled]),:host([error][warning]:not([focused])[disabled]){border:1px solid rgba(245,71,91,.6);color:rgba(194,194,194,.6)}:host([error][readonly]),:host([error][warning]:not([focused])[readonly]){border:1px solid rgba(245,71,91,.6)}:host([error]:not([focused]):not(:focus):not([disabled]):not([readonly]):hover),:host([error][warning]:not([focused]):not([focused]):not(:focus):not([disabled]):not([readonly]):hover){border:1px solid #f87584}:host([highlight]){background-color:#1b252f;border:1px solid #4a4a52}:host([highlight][disabled]){border:1px solid rgba(74,74,82,.6);color:rgba(194,194,194,.6);background-color:rgba(27,37,47,.6)}:host([highlight][readonly]){border:1px solid rgba(74,74,82,.6)}:host([highlight]:not([focused]):not(:focus):not([disabled]):not([readonly]):hover){border:1px solid #77777d}:host([indirect]){color:#0fd;background-color:#000;border:1px solid #898623}:host([indirect][disabled]){border:1px solid rgba(137,134,35,.6);color:rgba(0,255,221,.6)}:host([indirect][readonly]){border:1px solid rgba(137,134,35,.6)}:host([indirect]:not([focused]):not(:focus):not([disabled]):not([readonly]):hover){border:1px solid #a7a45a}:host [part=input]:focus::after,:host [part=input][focused]::after,:host [part=toggle]:focus::after,:host [part=toggle][focused]::after{content:\'\';border:none;left:calc(50% - 7px);bottom:-1px;width:14px;height:1px;background:#f93}:host([focused][readonly]:not([error])){border-color:#f93;border-style:dotted}:host([focused][error]:not([readonly])){border-color:#f93;border-style:dotted}:host([focused][error]) [part=input]:focus::after,:host([focused][error]) [part=input][focused]::after,:host([focused][error]) [part=toggle]:focus::after,:host([focused][error]) [part=toggle][focused]::after{border-bottom:none}' }}));
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import '@refinitiv-ui/elements/number-field/themes/solar/pearl';
|
|
2
2
|
import '@refinitiv-ui/elements/icon/themes/solar/pearl';
|
|
3
3
|
import '@refinitiv-ui/elements/tooltip/themes/solar/pearl';
|
|
4
|
-
dispatchEvent(new CustomEvent('ef.customStyles.define', { detail: { name: 'ef-time-picker', styles: ':host{display:none;-webkit-appearance:none;-moz-appearance:none;appearance:none;text-align:left;font-family:inherit;font-size:13px;font-weight:400;height:23px;max-width:100%;margin:1px 0;outline:0;box-sizing:border-box;display:inline-flex;align-items:center;position:relative;vertical-align:middle;color:#484848;border-radius:0;text-overflow:ellipsis
|
|
4
|
+
dispatchEvent(new CustomEvent('ef.customStyles.define', { detail: { name: 'ef-time-picker', styles: ':host{display:none;-webkit-appearance:none;-moz-appearance:none;appearance:none;text-align:left;font-family:inherit;font-size:13px;font-weight:400;height:23px;max-width:100%;margin:1px 0;outline:0;box-sizing:border-box;display:inline-flex;align-items:center;position:relative;vertical-align:middle;color:#484848;border-radius:0;text-overflow:ellipsis}:host([error]){border:1px solid #d94255}:host([focused]){background-size:100% 2px,100% 1px!important;background-position:center bottom!important;border-color:#ffb266;border-style:dotted}:host [part=input]{margin:0;text-align:center;padding:0;color:inherit;width:25px}:host [part=divider]::before{content:\':\'}:host [part=toggle]{width:20px;display:flex;flex-flow:column nowrap;align-items:center;justify-content:center;outline:0;cursor:pointer;touch-action:manipulation;font-size:70%;line-height:1}:host [part=input],:host [part=toggle]{height:100%;position:relative}:host [part=input]:focus::after,:host [part=input][focused]::after,:host [part=toggle]:focus::after,:host [part=toggle][focused]::after{content:\'\';border-right:8px solid transparent;border-bottom:4px solid #ffb266;border-left:8px solid transparent;position:absolute}:host [part=toggle-item]{opacity:.5}:host [part=toggle-item][active]{opacity:1}:host([error]) [part=input]:focus::after,:host([error]) [part=input][focused]::after,:host([error]) [part=toggle]:focus::after,:host([error]) [part=toggle][focused]::after{border-bottom-color:#d94255}:host{width:auto;min-width:-moz-max-content;min-width:max-content;background-color:#fff;border:1px solid #a9afba;padding:0}:host([disabled]){border:1px solid rgba(169,175,186,.6);color:rgba(72,72,72,.6)}:host([readonly]){border:1px solid rgba(169,175,186,.6)}:host(:not([focused]):not(:focus):not([disabled]):not([readonly]):hover){border:1px solid #bfc3cb}:host([warning]){background-color:#fff;border:1px solid #f93}:host([warning][disabled]){border:1px solid rgba(255,153,51,.6);color:rgba(72,72,72,.6)}:host([warning][readonly]){border:1px solid rgba(255,153,51,.6)}:host([warning]:not([focused]):not(:focus):not([disabled]):not([readonly]):hover){border:1px solid #ffb366}:host([error]),:host([error][warning]:not([focused])){background-color:#fff;border:1px solid #d94255}:host([error][disabled]),:host([error][warning]:not([focused])[disabled]){border:1px solid rgba(217,66,85,.6);color:rgba(72,72,72,.6)}:host([error][readonly]),:host([error][warning]:not([focused])[readonly]){border:1px solid rgba(217,66,85,.6)}:host([error]:not([focused]):not(:focus):not([disabled]):not([readonly]):hover),:host([error][warning]:not([focused]):not([focused]):not(:focus):not([disabled]):not([readonly]):hover){border:1px solid #e37180}:host([highlight]){background-color:#b0ffff;border:1px solid #a9afba}:host([highlight][disabled]){border:1px solid rgba(169,175,186,.6);color:rgba(72,72,72,.6);background-color:rgba(176,255,255,.6)}:host([highlight][readonly]){border:1px solid rgba(169,175,186,.6)}:host([highlight]:not([focused]):not(:focus):not([disabled]):not([readonly]):hover){border:1px solid #bfc3cb}:host([indirect]){color:#009494;background-color:#effefe;border:1px solid #898623}:host([indirect][disabled]){border:1px solid rgba(137,134,35,.6);color:rgba(0,148,148,.6)}:host([indirect][readonly]){border:1px solid rgba(137,134,35,.6)}:host([indirect]:not([focused]):not(:focus):not([disabled]):not([readonly]):hover){border:1px solid #a7a45a}:host [part=input]:focus::after,:host [part=input][focused]::after,:host [part=toggle]:focus::after,:host [part=toggle][focused]::after{content:\'\';border:none;left:calc(50% - 7px);bottom:-1px;width:14px;height:1px;background:#ffb266}:host([focused][readonly]:not([error])){border-color:#ffb266;border-style:dotted}:host([focused][error]:not([readonly])){border-color:#ffb266;border-style:dotted}:host([focused][error]) [part=input]:focus::after,:host([focused][error]) [part=input][focused]::after,:host([focused][error]) [part=toggle]:focus::after,:host([focused][error]) [part=toggle][focused]::after{border-bottom:none}' }}));
|
package/lib/tooltip/index.js
CHANGED
|
@@ -451,10 +451,10 @@ __decorate([
|
|
|
451
451
|
property({ type: String })
|
|
452
452
|
], Tooltip.prototype, "selector", void 0);
|
|
453
453
|
__decorate([
|
|
454
|
-
property({
|
|
454
|
+
property({ attribute: false })
|
|
455
455
|
], Tooltip.prototype, "condition", void 0);
|
|
456
456
|
__decorate([
|
|
457
|
-
property({
|
|
457
|
+
property({ attribute: false })
|
|
458
458
|
], Tooltip.prototype, "renderer", void 0);
|
|
459
459
|
__decorate([
|
|
460
460
|
property({ type: String })
|
|
@@ -52,6 +52,12 @@
|
|
|
52
52
|
"type": "string",
|
|
53
53
|
"default": "\"\""
|
|
54
54
|
},
|
|
55
|
+
{
|
|
56
|
+
"name": "filter",
|
|
57
|
+
"description": "Custom filter for static data",
|
|
58
|
+
"type": "TreeFilter<T> | null",
|
|
59
|
+
"default": "\"createDefaultFilter<T>(this)\""
|
|
60
|
+
},
|
|
55
61
|
{
|
|
56
62
|
"name": "renderer",
|
|
57
63
|
"description": "Renderer used for generating tree items",
|
|
@@ -5,15 +5,16 @@ to be used for menus and group selections
|
|
|
5
5
|
|
|
6
6
|
## Properties
|
|
7
7
|
|
|
8
|
-
| Property | Attribute | Type
|
|
9
|
-
|
|
10
|
-
| `data` | | `TreeData<T>`
|
|
11
|
-
| `
|
|
12
|
-
| `
|
|
13
|
-
| `
|
|
14
|
-
| `
|
|
15
|
-
| `
|
|
16
|
-
| `
|
|
8
|
+
| Property | Attribute | Type | Default | Description |
|
|
9
|
+
|--------------|---------------|-------------------------|--------------------------------|--------------------------------------------------|
|
|
10
|
+
| `data` | | `TreeData<T>` | | Data object to be used for creating tree |
|
|
11
|
+
| `filter` | | `TreeFilter<T> \| null` | "createDefaultFilter<T>(this)" | Custom filter for static data |
|
|
12
|
+
| `multiple` | `multiple` | `boolean` | false | Allows multiple items to be selected |
|
|
13
|
+
| `noRelation` | `no-relation` | `boolean` | false | Breaks the relationship when multiple<br />selection mode is enabled |
|
|
14
|
+
| `query` | `query` | `string` | "" | Query string applied to tree |
|
|
15
|
+
| `renderer` | | `TreeRenderer` | "createTreeRenderer<T>(this)" | Renderer used for generating tree items |
|
|
16
|
+
| `stateless` | `stateless` | `boolean` | false | Disable selections |
|
|
17
|
+
| `values` | | `string[]` | [] | Selected items in tree |
|
|
17
18
|
|
|
18
19
|
## Methods
|
|
19
20
|
|
|
@@ -42,14 +42,13 @@ export declare class Tree<T extends TreeDataItem = TreeDataItem> extends List<T>
|
|
|
42
42
|
/**
|
|
43
43
|
* Custom filter for static data
|
|
44
44
|
* @type {TreeFilter<T> | null}
|
|
45
|
-
* @ignore set to protected for now and need to discuss before set to public API
|
|
46
45
|
*/
|
|
47
|
-
|
|
46
|
+
filter: TreeFilter<T> | null;
|
|
48
47
|
/**
|
|
49
48
|
* Renderer used for generating tree items
|
|
50
49
|
* @type {TreeRenderer}
|
|
51
50
|
*/
|
|
52
|
-
renderer: (item: T, composer: CollectionComposer<T>, element?: HTMLElement) => HTMLElement;
|
|
51
|
+
renderer: (item: T, composer: CollectionComposer<T>, element?: HTMLElement | undefined) => HTMLElement;
|
|
53
52
|
/**
|
|
54
53
|
* Expands all groups
|
|
55
54
|
* @returns {void}
|
|
@@ -3,7 +3,7 @@ import { customElement } from '@refinitiv-ui/core/decorators/custom-element.js';
|
|
|
3
3
|
import { property } from '@refinitiv-ui/core/decorators/property.js';
|
|
4
4
|
import { List, valueFormatWarning } from '../../list/index.js';
|
|
5
5
|
import { VERSION } from '../../version.js';
|
|
6
|
-
import {
|
|
6
|
+
import { createDefaultFilter } from '../helpers/filter.js';
|
|
7
7
|
import { createTreeRenderer } from '../helpers/renderer.js';
|
|
8
8
|
import { TreeManager, TreeManagerMode } from '../managers/tree-manager.js';
|
|
9
9
|
import './tree-item.js';
|
|
@@ -42,9 +42,8 @@ let Tree = class Tree extends List {
|
|
|
42
42
|
/**
|
|
43
43
|
* Custom filter for static data
|
|
44
44
|
* @type {TreeFilter<T> | null}
|
|
45
|
-
* @ignore set to protected for now and need to discuss before set to public API
|
|
46
45
|
*/
|
|
47
|
-
this.filter =
|
|
46
|
+
this.filter = createDefaultFilter(this);
|
|
48
47
|
/**
|
|
49
48
|
* Renderer used for generating tree items
|
|
50
49
|
* @type {TreeRenderer}
|
|
@@ -438,6 +437,9 @@ __decorate([
|
|
|
438
437
|
__decorate([
|
|
439
438
|
property({ type: String })
|
|
440
439
|
], Tree.prototype, "query", void 0);
|
|
440
|
+
__decorate([
|
|
441
|
+
property({ attribute: false })
|
|
442
|
+
], Tree.prototype, "filter", void 0);
|
|
441
443
|
__decorate([
|
|
442
444
|
property({ attribute: false })
|
|
443
445
|
], Tree.prototype, "renderer", void 0);
|
|
@@ -5,4 +5,4 @@ import type { TreeFilter } from './types';
|
|
|
5
5
|
* @param el Tree instance to filter
|
|
6
6
|
* @returns Filter accepting an item
|
|
7
7
|
*/
|
|
8
|
-
export declare const
|
|
8
|
+
export declare const createDefaultFilter: <T extends TreeDataItem = TreeDataItem>(el: Tree<T>) => TreeFilter<T>;
|
|
@@ -4,7 +4,7 @@ import escapeStringRegexp from 'escape-string-regexp';
|
|
|
4
4
|
* @param el Tree instance to filter
|
|
5
5
|
* @returns Filter accepting an item
|
|
6
6
|
*/
|
|
7
|
-
export const
|
|
7
|
+
export const createDefaultFilter = (el) => {
|
|
8
8
|
// reference query string for validating queryRegExp cache state
|
|
9
9
|
let query = '';
|
|
10
10
|
// cache RegExp
|
|
@@ -27,8 +27,6 @@ export const defaultFilter = (el) => {
|
|
|
27
27
|
}
|
|
28
28
|
const regex = getRegularExpressionOfQuery();
|
|
29
29
|
const result = regex.test(label);
|
|
30
|
-
// this regex uses global scope, so the index needs resetting
|
|
31
|
-
regex.lastIndex = 0;
|
|
32
30
|
return result;
|
|
33
31
|
};
|
|
34
32
|
};
|
package/lib/tree/index.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import type { TreeData, TreeDataItem } from './helpers/types';
|
|
2
1
|
export * from './elements/tree.js';
|
|
3
2
|
export * from './elements/tree-item.js';
|
|
4
3
|
export { TreeRenderer, createTreeRenderer } from './helpers/renderer.js';
|
|
5
4
|
export { TreeManager, TreeManagerMode, CheckedState } from './managers/tree-manager.js';
|
|
6
|
-
export type { TreeData, TreeDataItem };
|
|
5
|
+
export type { TreeData, TreeDataItem, TreeFilter } from './helpers/types';
|
|
@@ -23,6 +23,11 @@
|
|
|
23
23
|
"type": "string | null",
|
|
24
24
|
"default": "\"\""
|
|
25
25
|
},
|
|
26
|
+
{
|
|
27
|
+
"name": "query-debounce-rate",
|
|
28
|
+
"description": "Control query rate in milliseconds",
|
|
29
|
+
"type": "number"
|
|
30
|
+
},
|
|
26
31
|
{
|
|
27
32
|
"name": "opened",
|
|
28
33
|
"description": "Set dropdown to open",
|
|
@@ -34,6 +39,11 @@
|
|
|
34
39
|
"description": "Set placeholder text",
|
|
35
40
|
"type": "string",
|
|
36
41
|
"default": "\"\""
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
"name": "query-debounce-rate",
|
|
45
|
+
"description": "Control query rate in milliseconds",
|
|
46
|
+
"type": "number"
|
|
37
47
|
}
|
|
38
48
|
],
|
|
39
49
|
"properties": [
|
|
@@ -75,6 +85,18 @@
|
|
|
75
85
|
"type": "string | null",
|
|
76
86
|
"default": "\"\""
|
|
77
87
|
},
|
|
88
|
+
{
|
|
89
|
+
"name": "filter",
|
|
90
|
+
"description": "Custom filter for static data. Set this to null when data is filtered externally, eg XHR",
|
|
91
|
+
"type": "TreeSelectFilter<T> | null",
|
|
92
|
+
"default": "\"createDefaultFilter<T>(this)\""
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
"name": "queryDebounceRate",
|
|
96
|
+
"attribute": "query-debounce-rate",
|
|
97
|
+
"description": "Control query rate in milliseconds",
|
|
98
|
+
"type": "number"
|
|
99
|
+
},
|
|
78
100
|
{
|
|
79
101
|
"name": "opened",
|
|
80
102
|
"attribute": "opened",
|
|
@@ -2,19 +2,27 @@
|
|
|
2
2
|
|
|
3
3
|
Dropdown control that allows selection from the tree list
|
|
4
4
|
|
|
5
|
+
## Attributes
|
|
6
|
+
|
|
7
|
+
| Attribute | Type | Description |
|
|
8
|
+
|-----------------------|----------|------------------------------------|
|
|
9
|
+
| `query-debounce-rate` | `number` | Control query rate in milliseconds |
|
|
10
|
+
|
|
5
11
|
## Properties
|
|
6
12
|
|
|
7
|
-
| Property
|
|
8
|
-
|
|
9
|
-
| `data`
|
|
10
|
-
| `
|
|
11
|
-
| `
|
|
12
|
-
| `
|
|
13
|
-
| `
|
|
14
|
-
| `
|
|
15
|
-
| `
|
|
16
|
-
| `
|
|
17
|
-
| `
|
|
13
|
+
| Property | Attribute | Type | Default | Description |
|
|
14
|
+
|---------------------|-----------------------|-------------------------------|--------------------------------------------------|--------------------------------------------------|
|
|
15
|
+
| `data` | | `TreeSelectData[]` | [] | Data object to be used for creating tree |
|
|
16
|
+
| `filter` | | `TreeSelectFilter<T> \| null` | "createDefaultFilter<T>(this)" | Custom filter for static data. Set this to null when data is filtered externally, eg XHR |
|
|
17
|
+
| `filterCount` | | `number` | 0 | Tracks the number of filter matches<br /><br />Only needed if internal filtering is unused |
|
|
18
|
+
| `max` | `max` | `string \| null` | "" | Set maximum number of selected items |
|
|
19
|
+
| `noRelation` | `no-relation` | `boolean` | false | Breaks the relationship when multiple<br />selection mode is enabled |
|
|
20
|
+
| `opened` | `opened` | `boolean` | false | Set dropdown to open |
|
|
21
|
+
| `placeholder` | `placeholder` | `string` | "" | Set placeholder text |
|
|
22
|
+
| `queryDebounceRate` | `query-debounce-rate` | `number` | | Control query rate in milliseconds |
|
|
23
|
+
| `renderer` | | | "createTreeSelectRenderer<TreeSelectDataItem>(this)" | Renderer used to render tree item elements |
|
|
24
|
+
| `showPills` | `show-pills` | `boolean` | false | Should the control show pills |
|
|
25
|
+
| `values` | | `string[]` | [] | Returns a values collection of the currently<br />selected item values |
|
|
18
26
|
|
|
19
27
|
## Events
|
|
20
28
|
|
|
@@ -20,6 +20,9 @@ export type { TreeSelectFilter, TreeSelectDataItem, TreeSelectData };
|
|
|
20
20
|
/**
|
|
21
21
|
* Dropdown control that allows selection from the tree list
|
|
22
22
|
*
|
|
23
|
+
* @prop {TreeSelectFilter<T> | null} [filter=createDefaultFilter<T>(this)] - Custom filter for static data. Set this to null when data is filtered externally, eg XHR
|
|
24
|
+
* @attr {number} [query-debounce-rate] - Control query rate in milliseconds
|
|
25
|
+
* @prop {number} [queryDebounceRate] - Control query rate in milliseconds
|
|
23
26
|
* @attr {boolean} [opened=false] - Set dropdown to open
|
|
24
27
|
* @prop {boolean} [opened=false] - Set dropdown to open
|
|
25
28
|
* @attr {string} placeholder - Set placeholder text
|
|
@@ -112,7 +115,7 @@ export declare class TreeSelect extends ComboBox<TreeSelectDataItem> {
|
|
|
112
115
|
/**
|
|
113
116
|
* Renderer used to render tree item elements
|
|
114
117
|
*/
|
|
115
|
-
renderer: (item: import("../tree/index.js").TreeDataItem, composer: CollectionComposer<import("../tree/index.js").TreeDataItem>, element?: HTMLElement) => HTMLElement;
|
|
118
|
+
renderer: (item: import("../tree/index.js").TreeDataItem, composer: CollectionComposer<import("../tree/index.js").TreeDataItem>, element?: HTMLElement | undefined) => HTMLElement;
|
|
116
119
|
private _max;
|
|
117
120
|
/**
|
|
118
121
|
* Set maximum number of selected items
|
package/lib/tree-select/index.js
CHANGED
|
@@ -24,6 +24,9 @@ const valueFormatWarning = new WarningNotice("The specified 'values' format does
|
|
|
24
24
|
/**
|
|
25
25
|
* Dropdown control that allows selection from the tree list
|
|
26
26
|
*
|
|
27
|
+
* @prop {TreeSelectFilter<T> | null} [filter=createDefaultFilter<T>(this)] - Custom filter for static data. Set this to null when data is filtered externally, eg XHR
|
|
28
|
+
* @attr {number} [query-debounce-rate] - Control query rate in milliseconds
|
|
29
|
+
* @prop {number} [queryDebounceRate] - Control query rate in milliseconds
|
|
27
30
|
* @attr {boolean} [opened=false] - Set dropdown to open
|
|
28
31
|
* @prop {boolean} [opened=false] - Set dropdown to open
|
|
29
32
|
* @attr {string} placeholder - Set placeholder text
|
|
@@ -960,7 +963,7 @@ __decorate([
|
|
|
960
963
|
property({ type: Array, attribute: false })
|
|
961
964
|
], TreeSelect.prototype, "values", null);
|
|
962
965
|
__decorate([
|
|
963
|
-
property({
|
|
966
|
+
property({ attribute: false })
|
|
964
967
|
], TreeSelect.prototype, "renderer", void 0);
|
|
965
968
|
__decorate([
|
|
966
969
|
property({ type: String })
|
package/lib/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = '6.
|
|
1
|
+
export const VERSION = '6.17.1';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@refinitiv-ui/elements",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.17.1",
|
|
4
4
|
"description": "Element Framework Elements",
|
|
5
5
|
"author": "LSEG",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -339,8 +339,8 @@
|
|
|
339
339
|
},
|
|
340
340
|
"dependencies": {
|
|
341
341
|
"@lit-labs/context": "^0.3.1",
|
|
342
|
-
"@refinitiv-ui/halo-theme": "^6.
|
|
343
|
-
"@refinitiv-ui/solar-theme": "^6.
|
|
342
|
+
"@refinitiv-ui/halo-theme": "^6.8.0",
|
|
343
|
+
"@refinitiv-ui/solar-theme": "^6.5.0",
|
|
344
344
|
"@types/chart.js": "^2.9.31",
|
|
345
345
|
"chart.js": "~2.9.4",
|
|
346
346
|
"d3-interpolate": "^3.0.1",
|
|
@@ -351,7 +351,7 @@
|
|
|
351
351
|
},
|
|
352
352
|
"devDependencies": {
|
|
353
353
|
"@refinitiv-ui/core": "^6.5.7",
|
|
354
|
-
"@refinitiv-ui/demo-block": "^6.1.
|
|
354
|
+
"@refinitiv-ui/demo-block": "^6.1.25",
|
|
355
355
|
"@refinitiv-ui/i18n": "^6.0.21",
|
|
356
356
|
"@refinitiv-ui/phrasebook": "^6.3.9",
|
|
357
357
|
"@refinitiv-ui/test-helpers": "^6.0.15",
|
|
@@ -370,5 +370,5 @@
|
|
|
370
370
|
"publishConfig": {
|
|
371
371
|
"access": "public"
|
|
372
372
|
},
|
|
373
|
-
"gitHead": "
|
|
373
|
+
"gitHead": "ad1f34f084b6f91ba9b003ddf9270bd3132cc371"
|
|
374
374
|
}
|