@refinitiv-ui/elements 5.10.0 → 5.10.2-build.1841524222.1.59
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 +25 -0
- package/README.md +4 -4
- package/lib/accordion/index.js +2 -2
- package/lib/appstate-bar/index.js +2 -2
- package/lib/autosuggest/index.js +6 -6
- package/lib/button/index.d.ts +10 -4
- package/lib/button/index.js +26 -8
- package/lib/button-bar/index.d.ts +49 -0
- package/lib/button-bar/index.js +151 -11
- package/lib/calendar/constants.js +1 -1
- package/lib/calendar/index.d.ts +1 -1
- package/lib/calendar/index.js +11 -11
- package/lib/calendar/types.d.ts +1 -1
- package/lib/calendar/utils.js +1 -1
- package/lib/canvas/index.js +2 -2
- package/lib/card/index.js +5 -5
- package/lib/chart/index.js +4 -4
- package/lib/checkbox/index.js +3 -4
- package/lib/checkbox/themes/halo/dark/index.js +1 -1
- package/lib/checkbox/themes/halo/light/index.js +1 -1
- package/lib/clock/index.js +6 -6
- package/lib/clock/utils/TickManager.js +2 -2
- package/lib/collapse/index.js +3 -3
- package/lib/color-dialog/elements/color-palettes.js +1 -1
- package/lib/color-dialog/elements/grayscale-palettes.js +2 -2
- package/lib/color-dialog/elements/palettes.js +3 -3
- package/lib/color-dialog/helpers/value-model.js +1 -1
- package/lib/color-dialog/index.d.ts +1 -1
- package/lib/color-dialog/index.js +6 -6
- package/lib/combo-box/helpers/filter.d.ts +1 -1
- package/lib/combo-box/helpers/types.d.ts +1 -1
- package/lib/combo-box/index.d.ts +4 -4
- package/lib/combo-box/index.js +9 -9
- package/lib/counter/index.js +2 -2
- package/lib/datetime-picker/index.js +5 -5
- package/lib/datetime-picker/utils.js +1 -1
- package/lib/dialog/custom-elements.json +11 -0
- package/lib/dialog/custom-elements.md +4 -3
- package/lib/dialog/index.d.ts +18 -1
- package/lib/dialog/index.js +35 -10
- package/lib/email-field/index.d.ts +1 -1
- package/lib/email-field/index.js +2 -2
- package/lib/flag/index.js +3 -3
- package/lib/flag/utils/FlagLoader.d.ts +1 -1
- package/lib/flag/utils/FlagLoader.js +1 -1
- package/lib/header/index.js +2 -2
- package/lib/heatmap/helpers/color.d.ts +1 -1
- package/lib/heatmap/helpers/color.js +1 -1
- package/lib/heatmap/index.js +5 -5
- package/lib/icon/index.js +3 -3
- package/lib/icon/utils/IconLoader.d.ts +1 -1
- package/lib/icon/utils/IconLoader.js +1 -1
- package/lib/interactive-chart/helpers/types.d.ts +1 -1
- package/lib/interactive-chart/index.js +4 -4
- package/lib/item/helpers/types.d.ts +1 -1
- package/lib/item/index.js +3 -3
- package/lib/label/index.js +4 -4
- package/lib/layout/index.js +2 -2
- package/lib/led-gauge/index.js +2 -2
- package/lib/list/custom-elements.json +13 -0
- package/lib/list/custom-elements.md +10 -9
- package/lib/list/helpers/types.d.ts +1 -1
- package/lib/list/index.d.ts +5 -1
- package/lib/list/index.js +10 -3
- package/lib/list/renderer.d.ts +1 -1
- package/lib/loader/index.js +1 -1
- package/lib/multi-input/helpers/types.d.ts +1 -1
- package/lib/multi-input/index.js +6 -6
- package/lib/notification/elements/notification-tray.js +3 -3
- package/lib/notification/elements/notification.js +2 -2
- package/lib/number-field/index.d.ts +1 -1
- package/lib/number-field/index.js +4 -3
- package/lib/overlay/elements/overlay-backdrop.js +2 -2
- package/lib/overlay/elements/overlay-viewport.js +1 -1
- package/lib/overlay/elements/overlay.js +4 -4
- package/lib/overlay/managers/focus-manager.js +1 -1
- package/lib/overlay/managers/interaction-lock-manager.js +1 -1
- package/lib/overlay/managers/viewport-manager.js +1 -1
- package/lib/overlay/managers/zindex-manager.js +1 -1
- package/lib/overlay-menu/helpers/types.d.ts +1 -1
- package/lib/overlay-menu/index.js +6 -6
- package/lib/overlay-menu/managers/menu-manager.js +1 -1
- package/lib/pagination/index.d.ts +2 -2
- package/lib/pagination/index.js +9 -11
- package/lib/panel/index.js +2 -2
- package/lib/password-field/index.d.ts +2 -2
- package/lib/password-field/index.js +3 -3
- package/lib/pill/index.js +3 -3
- package/lib/progress-bar/index.js +3 -3
- package/lib/radio-button/index.d.ts +2 -2
- package/lib/radio-button/index.js +10 -7
- package/lib/radio-button/themes/halo/dark/index.js +1 -1
- package/lib/radio-button/themes/halo/light/index.js +1 -1
- package/lib/rating/index.js +4 -4
- package/lib/search-field/index.d.ts +2 -2
- package/lib/search-field/index.js +3 -3
- package/lib/select/index.js +6 -6
- package/lib/sidebar-layout/index.js +4 -4
- package/lib/slider/index.js +14 -4
- package/lib/sparkline/index.js +4 -4
- package/lib/swing-gauge/index.js +5 -5
- package/lib/tab/custom-elements.json +13 -0
- package/lib/tab/custom-elements.md +1 -0
- package/lib/tab/index.d.ts +13 -15
- package/lib/tab/index.js +28 -35
- package/lib/tab-bar/custom-elements.json +12 -0
- package/lib/tab-bar/custom-elements.md +7 -0
- package/lib/tab-bar/index.d.ts +56 -7
- package/lib/tab-bar/index.js +139 -40
- package/lib/text-field/index.d.ts +1 -1
- package/lib/text-field/index.js +4 -4
- package/lib/time-picker/index.d.ts +1 -1
- package/lib/time-picker/index.js +9 -9
- package/lib/toggle/index.js +2 -2
- package/lib/tooltip/index.js +4 -4
- package/lib/tooltip/managers/tooltip-manager.js +2 -2
- package/lib/tornado-chart/elements/tornado-chart.js +2 -2
- package/lib/tornado-chart/elements/tornado-item.js +3 -3
- package/lib/tree/elements/tree-item.d.ts +33 -0
- package/lib/tree/elements/tree-item.js +83 -24
- package/lib/tree/elements/tree.d.ts +2 -1
- package/lib/tree/elements/tree.js +3 -2
- package/lib/tree/helpers/types.d.ts +1 -1
- package/lib/tree/managers/tree-manager.d.ts +1 -1
- package/lib/tree-select/index.d.ts +3 -3
- package/lib/tree-select/index.js +9 -9
- package/lib/tree-select/themes/halo/dark/index.js +1 -1
- package/lib/tree-select/themes/halo/light/index.js +1 -1
- package/lib/version.js +1 -1
- package/package.json +24 -295
package/lib/tab-bar/index.js
CHANGED
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
import { __decorate } from "tslib";
|
|
2
2
|
import { html, css, ResponsiveElement } from '@refinitiv-ui/core';
|
|
3
|
-
import { customElement } from '@refinitiv-ui/core/
|
|
4
|
-
import { property } from '@refinitiv-ui/core/
|
|
5
|
-
import { query } from '@refinitiv-ui/core/
|
|
3
|
+
import { customElement } from '@refinitiv-ui/core/decorators/custom-element.js';
|
|
4
|
+
import { property } from '@refinitiv-ui/core/decorators/property.js';
|
|
5
|
+
import { query } from '@refinitiv-ui/core/decorators/query.js';
|
|
6
6
|
import { VERSION } from '../version.js';
|
|
7
7
|
import { tweenAnimate } from './helpers/animate.js';
|
|
8
|
+
import { Tab } from '../tab/index.js';
|
|
8
9
|
import '../button/index.js';
|
|
9
10
|
const BAR_TRAVEL_DISTANCE = 150; // scroll distance
|
|
10
11
|
/**
|
|
11
12
|
* Container for tabs
|
|
13
|
+
*
|
|
14
|
+
* @fires value-changed - Fired when the `value` changes.
|
|
12
15
|
*/
|
|
13
16
|
let TabBar = class TabBar extends ResponsiveElement {
|
|
14
17
|
constructor() {
|
|
@@ -25,6 +28,11 @@ let TabBar = class TabBar extends ResponsiveElement {
|
|
|
25
28
|
* Use to switch from horizontal to vertical layout.
|
|
26
29
|
*/
|
|
27
30
|
this.vertical = false;
|
|
31
|
+
/**
|
|
32
|
+
* Internal value of tab bar.
|
|
33
|
+
* Controlled by public setter and getter
|
|
34
|
+
*/
|
|
35
|
+
this._value = '';
|
|
28
36
|
}
|
|
29
37
|
/**
|
|
30
38
|
* Element version number
|
|
@@ -52,6 +60,23 @@ let TabBar = class TabBar extends ResponsiveElement {
|
|
|
52
60
|
}
|
|
53
61
|
`;
|
|
54
62
|
}
|
|
63
|
+
/**
|
|
64
|
+
* Value of tab-bar, derived from value of an active tab.
|
|
65
|
+
* @param value Element value
|
|
66
|
+
* @default -
|
|
67
|
+
*/
|
|
68
|
+
set value(value) {
|
|
69
|
+
value = typeof value === 'string' ? value : String(value);
|
|
70
|
+
const oldValue = this._value;
|
|
71
|
+
if (value !== oldValue && this.isValidValue(value)) {
|
|
72
|
+
this._value = value;
|
|
73
|
+
this.activateTab(value);
|
|
74
|
+
this.requestUpdate('value', oldValue);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
get value() {
|
|
78
|
+
return this._value;
|
|
79
|
+
}
|
|
55
80
|
/**
|
|
56
81
|
* Called after the element’s DOM has been updated the first time.
|
|
57
82
|
* register scroll event on content element to toggle scroll button
|
|
@@ -68,6 +93,7 @@ let TabBar = class TabBar extends ResponsiveElement {
|
|
|
68
93
|
this.toggleScrollButton(this.content.clientWidth);
|
|
69
94
|
}, 66); // equal 15 fps for compatibility
|
|
70
95
|
});
|
|
96
|
+
this.addEventListener('tap', this.onTap);
|
|
71
97
|
}
|
|
72
98
|
/**
|
|
73
99
|
* Called when the element’s DOM has been updated and rendered
|
|
@@ -75,16 +101,9 @@ let TabBar = class TabBar extends ResponsiveElement {
|
|
|
75
101
|
* @returns {void}
|
|
76
102
|
*/
|
|
77
103
|
updated(changedProperties) {
|
|
78
|
-
/* istanbul ignore else */
|
|
79
104
|
if (changedProperties.has('level')) {
|
|
80
105
|
this.setLevel();
|
|
81
106
|
}
|
|
82
|
-
if (changedProperties.has('vertical')) {
|
|
83
|
-
// if tab bar changed from horizontal to vertical
|
|
84
|
-
if (this.vertical) {
|
|
85
|
-
this.hideScrollButtons();
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
107
|
super.updated(changedProperties);
|
|
89
108
|
}
|
|
90
109
|
/**
|
|
@@ -100,54 +119,131 @@ let TabBar = class TabBar extends ResponsiveElement {
|
|
|
100
119
|
}
|
|
101
120
|
}
|
|
102
121
|
/**
|
|
103
|
-
*
|
|
104
|
-
* @
|
|
122
|
+
* Return true if incoming value matches one of the existing tabs
|
|
123
|
+
* @param value Value to check
|
|
124
|
+
* @returns true if incoming value matches one of the existing tabs
|
|
105
125
|
*/
|
|
106
|
-
|
|
107
|
-
this.
|
|
108
|
-
this.
|
|
126
|
+
isValidValue(value) {
|
|
127
|
+
const tabList = this.getFocusableTabs();
|
|
128
|
+
return tabList.some(tab => this.getTabValue(tab) === value);
|
|
109
129
|
}
|
|
110
130
|
/**
|
|
111
|
-
*
|
|
112
|
-
* @param elementWidth width of element
|
|
131
|
+
* When the slot changes, set the level, toggle the scroll button, and set the value
|
|
113
132
|
* @returns {void}
|
|
114
133
|
*/
|
|
115
|
-
|
|
116
|
-
const
|
|
117
|
-
if (
|
|
134
|
+
onSlotChange() {
|
|
135
|
+
const tabList = this.getFocusableTabs();
|
|
136
|
+
if (tabList.length < 1) {
|
|
118
137
|
return;
|
|
119
138
|
}
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
139
|
+
this.setLevel();
|
|
140
|
+
// get tab value from active tab
|
|
141
|
+
const activeTab = tabList.find(tab => tab.active) || tabList[0];
|
|
142
|
+
if (activeTab) {
|
|
143
|
+
this.value = this.getTabValue(activeTab);
|
|
123
144
|
}
|
|
124
|
-
|
|
125
|
-
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Mark tab as active
|
|
148
|
+
* @param value value of tab to select
|
|
149
|
+
* @returns {void}
|
|
150
|
+
*/
|
|
151
|
+
activateTab(value) {
|
|
152
|
+
if (!value) {
|
|
153
|
+
return;
|
|
126
154
|
}
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
155
|
+
let hasActiveTab = false;
|
|
156
|
+
const tabList = this.getTabElements(); // get all tab elements include disabled tab
|
|
157
|
+
tabList.forEach(tab => {
|
|
158
|
+
const tabValue = this.getTabValue(tab);
|
|
159
|
+
// only mark tab as active once
|
|
160
|
+
if (tabValue === value && !hasActiveTab && !tab.disabled) {
|
|
161
|
+
tab.active = true;
|
|
162
|
+
hasActiveTab = true;
|
|
163
|
+
}
|
|
164
|
+
else {
|
|
165
|
+
tab.active = false;
|
|
166
|
+
}
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* Set tab value and fires `tab-changed` event
|
|
171
|
+
* @param event - Event
|
|
172
|
+
* @returns {void}
|
|
173
|
+
*/
|
|
174
|
+
onTap(event) {
|
|
175
|
+
if (event.defaultPrevented) {
|
|
176
|
+
return;
|
|
177
|
+
}
|
|
178
|
+
const element = event.target;
|
|
179
|
+
if (element instanceof Tab) {
|
|
180
|
+
const tabValue = this.getTabValue(element);
|
|
181
|
+
if (tabValue !== this.value) {
|
|
182
|
+
this.value = this.getTabValue(element);
|
|
183
|
+
this.notifyPropertyChange('value', tabValue);
|
|
184
|
+
}
|
|
130
185
|
}
|
|
131
|
-
|
|
132
|
-
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* Get the value of a tab
|
|
189
|
+
* @param tab - The tab element.
|
|
190
|
+
* @returns The value of the tab.
|
|
191
|
+
*/
|
|
192
|
+
getTabValue(tab) {
|
|
193
|
+
return tab.value || (tab.hasAttribute('value') ? '' : this.getTabLabel(tab));
|
|
194
|
+
}
|
|
195
|
+
/**
|
|
196
|
+
* Return the tab's label, or its textContent, or an empty string
|
|
197
|
+
* @param tab - The tab element.
|
|
198
|
+
* @returns The tab label.
|
|
199
|
+
*/
|
|
200
|
+
getTabLabel(tab) {
|
|
201
|
+
return tab.label || tab.textContent || '';
|
|
202
|
+
}
|
|
203
|
+
/**
|
|
204
|
+
* Get Tab elements from slot
|
|
205
|
+
* @returns the array of Tab
|
|
206
|
+
*/
|
|
207
|
+
getTabElements() {
|
|
208
|
+
const tabs = [];
|
|
209
|
+
for (const child of this.children) {
|
|
210
|
+
if (child instanceof Tab) {
|
|
211
|
+
tabs.push(child);
|
|
212
|
+
}
|
|
133
213
|
}
|
|
214
|
+
return tabs;
|
|
215
|
+
}
|
|
216
|
+
/**
|
|
217
|
+
* Get focusable tab elements
|
|
218
|
+
* @returns the array of focusable tab
|
|
219
|
+
*/
|
|
220
|
+
getFocusableTabs() {
|
|
221
|
+
return this.getTabElements().filter(tab => !tab.disabled);
|
|
134
222
|
}
|
|
135
223
|
/**
|
|
136
224
|
* Set tab level attribute accordingly
|
|
137
225
|
* @returns {void}
|
|
138
226
|
*/
|
|
139
227
|
setLevel() {
|
|
140
|
-
const tabList = this.
|
|
141
|
-
tabList.forEach((tab) => {
|
|
228
|
+
const tabList = this.getTabElements(); // get all tab elements include disabled tab
|
|
229
|
+
tabList === null || tabList === void 0 ? void 0 : tabList.forEach((tab) => {
|
|
142
230
|
tab.level = this.level;
|
|
143
231
|
});
|
|
144
232
|
}
|
|
145
233
|
/**
|
|
146
|
-
*
|
|
234
|
+
* Hide/Show scroll button when element is overflow.
|
|
235
|
+
* @param elementWidth width of element
|
|
147
236
|
* @returns {void}
|
|
148
237
|
*/
|
|
149
|
-
|
|
150
|
-
this.
|
|
238
|
+
toggleScrollButton(elementWidth) {
|
|
239
|
+
if (this.vertical) {
|
|
240
|
+
return;
|
|
241
|
+
}
|
|
242
|
+
const { scrollLeft, scrollWidth } = this.content;
|
|
243
|
+
const leftBtnStyle = scrollLeft > 0 ? 'flex' : 'none';
|
|
244
|
+
const rightBtnStyle = scrollWidth - scrollLeft - elementWidth > 1 ? 'flex' : 'none';
|
|
245
|
+
this.leftBtn.style.setProperty('display', leftBtnStyle);
|
|
246
|
+
this.rightBtn.style.setProperty('display', rightBtnStyle);
|
|
151
247
|
}
|
|
152
248
|
/**
|
|
153
249
|
* Update scroll position when clicked on left button
|
|
@@ -184,11 +280,11 @@ let TabBar = class TabBar extends ResponsiveElement {
|
|
|
184
280
|
*/
|
|
185
281
|
render() {
|
|
186
282
|
return html `
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
283
|
+
${!this.vertical ? html `<ef-button icon="left" part="left-btn" @tap=${this.handleScrollLeft}></ef-button>` : null}
|
|
284
|
+
<div part="content">
|
|
285
|
+
<slot @slotchange=${this.onSlotChange}></slot>
|
|
286
|
+
</div>
|
|
287
|
+
${!this.vertical ? html `<ef-button icon="right" part="right-btn" @tap=${this.handleScrollRight}></ef-button>` : null}
|
|
192
288
|
`;
|
|
193
289
|
}
|
|
194
290
|
};
|
|
@@ -201,6 +297,9 @@ __decorate([
|
|
|
201
297
|
__decorate([
|
|
202
298
|
property({ type: Boolean, reflect: true })
|
|
203
299
|
], TabBar.prototype, "vertical", void 0);
|
|
300
|
+
__decorate([
|
|
301
|
+
property({ type: String, attribute: false })
|
|
302
|
+
], TabBar.prototype, "value", null);
|
|
204
303
|
__decorate([
|
|
205
304
|
query('[part="content"')
|
|
206
305
|
], TabBar.prototype, "content", void 0);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { JSXInterface } from '../jsx';
|
|
2
2
|
import { FormFieldElement, CSSResultGroup, PropertyValues, TemplateResult } from '@refinitiv-ui/core';
|
|
3
|
-
import { TemplateMap } from '@refinitiv-ui/core/
|
|
3
|
+
import { TemplateMap } from '@refinitiv-ui/core/directives/template-map.js';
|
|
4
4
|
import '../icon/index.js';
|
|
5
5
|
/**
|
|
6
6
|
* Form control element for text.
|
package/lib/text-field/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { __decorate } from "tslib";
|
|
2
2
|
import { FormFieldElement, css, html } from '@refinitiv-ui/core';
|
|
3
|
-
import { customElement } from '@refinitiv-ui/core/
|
|
4
|
-
import { property } from '@refinitiv-ui/core/
|
|
5
|
-
import { ifDefined } from '@refinitiv-ui/core/
|
|
3
|
+
import { customElement } from '@refinitiv-ui/core/decorators/custom-element.js';
|
|
4
|
+
import { property } from '@refinitiv-ui/core/decorators/property.js';
|
|
5
|
+
import { ifDefined } from '@refinitiv-ui/core/directives/if-defined.js';
|
|
6
6
|
import { VERSION } from '../version.js';
|
|
7
|
-
import { isIE } from '@refinitiv-ui/utils/
|
|
7
|
+
import { isIE } from '@refinitiv-ui/utils/browser.js';
|
|
8
8
|
import '../icon/index.js';
|
|
9
9
|
import { registerOverflowTooltip } from '../tooltip/index.js';
|
|
10
10
|
const hasChanged = (newVal, oldVal) => oldVal === undefined ? false : newVal !== oldVal;
|
|
@@ -2,7 +2,7 @@ import { JSXInterface } from '../jsx';
|
|
|
2
2
|
import { ControlElement, TemplateResult, CSSResultGroup, PropertyValues } from '@refinitiv-ui/core';
|
|
3
3
|
import '../number-field/index.js';
|
|
4
4
|
import { TranslateDirective } from '@refinitiv-ui/translate';
|
|
5
|
-
import '@refinitiv-ui/phrasebook/
|
|
5
|
+
import '@refinitiv-ui/phrasebook/locale/en/time-picker.js';
|
|
6
6
|
declare enum Segment {
|
|
7
7
|
HOURS = "hours",
|
|
8
8
|
MINUTES = "minutes",
|
package/lib/time-picker/index.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
var TimePicker_1;
|
|
2
2
|
import { __decorate } from "tslib";
|
|
3
3
|
import { ControlElement, html, css } from '@refinitiv-ui/core';
|
|
4
|
-
import { ifDefined } from '@refinitiv-ui/core/
|
|
5
|
-
import { guard } from '@refinitiv-ui/core/
|
|
6
|
-
import { customElement } from '@refinitiv-ui/core/
|
|
7
|
-
import { property } from '@refinitiv-ui/core/
|
|
8
|
-
import { state } from '@refinitiv-ui/core/
|
|
9
|
-
import { query } from '@refinitiv-ui/core/
|
|
4
|
+
import { ifDefined } from '@refinitiv-ui/core/directives/if-defined.js';
|
|
5
|
+
import { guard } from '@refinitiv-ui/core/directives/guard.js';
|
|
6
|
+
import { customElement } from '@refinitiv-ui/core/decorators/custom-element.js';
|
|
7
|
+
import { property } from '@refinitiv-ui/core/decorators/property.js';
|
|
8
|
+
import { state } from '@refinitiv-ui/core/decorators/state.js';
|
|
9
|
+
import { query } from '@refinitiv-ui/core/decorators/query.js';
|
|
10
10
|
import { VERSION } from '../version.js';
|
|
11
|
-
import { isValidTime, toTimeSegment, TimeFormat, getFormat, format, isAM, isPM, MILLISECONDS_IN_SECOND, MILLISECONDS_IN_MINUTE, MILLISECONDS_IN_HOUR, addOffset, padNumber, parse } from '@refinitiv-ui/utils/
|
|
12
|
-
import { isIE } from '@refinitiv-ui/utils/
|
|
11
|
+
import { isValidTime, toTimeSegment, TimeFormat, getFormat, format, isAM, isPM, MILLISECONDS_IN_SECOND, MILLISECONDS_IN_MINUTE, MILLISECONDS_IN_HOUR, addOffset, padNumber, parse } from '@refinitiv-ui/utils/date.js';
|
|
12
|
+
import { isIE } from '@refinitiv-ui/utils/browser.js';
|
|
13
13
|
import '../number-field/index.js';
|
|
14
14
|
import { translate } from '@refinitiv-ui/translate';
|
|
15
|
-
import '@refinitiv-ui/phrasebook/
|
|
15
|
+
import '@refinitiv-ui/phrasebook/locale/en/time-picker.js';
|
|
16
16
|
var Segment;
|
|
17
17
|
(function (Segment) {
|
|
18
18
|
Segment["HOURS"] = "hours";
|
package/lib/toggle/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { __decorate } from "tslib";
|
|
2
2
|
import { ControlElement, html, css } from '@refinitiv-ui/core';
|
|
3
|
-
import { customElement } from '@refinitiv-ui/core/
|
|
4
|
-
import { property } from '@refinitiv-ui/core/
|
|
3
|
+
import { customElement } from '@refinitiv-ui/core/decorators/custom-element.js';
|
|
4
|
+
import { property } from '@refinitiv-ui/core/decorators/property.js';
|
|
5
5
|
import { VERSION } from '../version.js';
|
|
6
6
|
/**
|
|
7
7
|
* Return the attribute that converted from the property
|
package/lib/tooltip/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
var Tooltip_1;
|
|
2
2
|
import { __decorate } from "tslib";
|
|
3
3
|
import { BasicElement, html, css, matches } from '@refinitiv-ui/core';
|
|
4
|
-
import { customElement } from '@refinitiv-ui/core/
|
|
5
|
-
import { property } from '@refinitiv-ui/core/
|
|
6
|
-
import { query } from '@refinitiv-ui/core/
|
|
4
|
+
import { customElement } from '@refinitiv-ui/core/decorators/custom-element.js';
|
|
5
|
+
import { property } from '@refinitiv-ui/core/decorators/property.js';
|
|
6
|
+
import { query } from '@refinitiv-ui/core/decorators/query.js';
|
|
7
7
|
import { VERSION } from '../version.js';
|
|
8
|
-
import { isSlotEmpty } from '@refinitiv-ui/utils/
|
|
8
|
+
import { isSlotEmpty } from '@refinitiv-ui/utils/is-slot-empty.js';
|
|
9
9
|
import '../overlay/index.js';
|
|
10
10
|
import './elements/title-tooltip.js';
|
|
11
11
|
import { register, deregister } from './managers/tooltip-manager.js';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { TimeoutTaskRunner } from '@refinitiv-ui/utils/
|
|
2
|
-
import { isIE } from '@refinitiv-ui/utils/
|
|
1
|
+
import { TimeoutTaskRunner } from '@refinitiv-ui/utils/async.js';
|
|
2
|
+
import { isIE } from '@refinitiv-ui/utils/browser.js';
|
|
3
3
|
/**
|
|
4
4
|
* Tooltip manager is here to avoid setting multiple
|
|
5
5
|
* events on document and do expensive pre-processing
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { __decorate } from "tslib";
|
|
2
2
|
import { ResponsiveElement, html, css } from '@refinitiv-ui/core';
|
|
3
|
-
import { customElement } from '@refinitiv-ui/core/
|
|
4
|
-
import { property } from '@refinitiv-ui/core/
|
|
3
|
+
import { customElement } from '@refinitiv-ui/core/decorators/custom-element.js';
|
|
4
|
+
import { property } from '@refinitiv-ui/core/decorators/property.js';
|
|
5
5
|
import { VERSION } from '../../version.js';
|
|
6
6
|
import './tornado-item.js';
|
|
7
7
|
/**
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { __decorate } from "tslib";
|
|
2
2
|
import { BasicElement, html, css } from '@refinitiv-ui/core';
|
|
3
|
-
import { customElement } from '@refinitiv-ui/core/
|
|
4
|
-
import { property } from '@refinitiv-ui/core/
|
|
5
|
-
import { ifDefined } from '@refinitiv-ui/core/
|
|
3
|
+
import { customElement } from '@refinitiv-ui/core/decorators/custom-element.js';
|
|
4
|
+
import { property } from '@refinitiv-ui/core/decorators/property.js';
|
|
5
|
+
import { ifDefined } from '@refinitiv-ui/core/directives/if-defined.js';
|
|
6
6
|
import { VERSION } from '../../version.js';
|
|
7
7
|
import '../../progress-bar/index.js';
|
|
8
8
|
import '../../layout/index.js';
|
|
@@ -14,6 +14,7 @@ export declare class TreeItem<T extends TreeDataItem = TreeDataItem> extends Con
|
|
|
14
14
|
* @returns version number
|
|
15
15
|
*/
|
|
16
16
|
static get version(): string;
|
|
17
|
+
protected readonly defaultRole: string | null;
|
|
17
18
|
/**
|
|
18
19
|
* Checked state of the item
|
|
19
20
|
*/
|
|
@@ -77,7 +78,39 @@ export declare class TreeItem<T extends TreeDataItem = TreeDataItem> extends Con
|
|
|
77
78
|
* Is the checked state indeterminate?
|
|
78
79
|
*/
|
|
79
80
|
protected get indeterminate(): boolean;
|
|
81
|
+
/**
|
|
82
|
+
* Handles aria-checked and aria-selected when mode changes
|
|
83
|
+
* aria-checked is used for multiple mode due to tri-state support
|
|
84
|
+
* @returns {void}
|
|
85
|
+
**/
|
|
86
|
+
private multipleChanged;
|
|
87
|
+
/**
|
|
88
|
+
* Handles selected and aria attribute changes
|
|
89
|
+
* @returns {void}
|
|
90
|
+
*/
|
|
91
|
+
private checkedChanged;
|
|
92
|
+
/**
|
|
93
|
+
* Handles aria-expanded when expanded state changes
|
|
94
|
+
* @returns {void}
|
|
95
|
+
*/
|
|
96
|
+
private expandedChanged;
|
|
97
|
+
/**
|
|
98
|
+
* Called after the component is first rendered
|
|
99
|
+
* @param changedProperties Properties which have changed
|
|
100
|
+
* @returns {void}
|
|
101
|
+
*/
|
|
102
|
+
protected firstUpdated(changedProperties: PropertyValues): void;
|
|
103
|
+
/**
|
|
104
|
+
* Invoked whenever the element is updated
|
|
105
|
+
* @param changedProperties Map of changed properties with old values
|
|
106
|
+
* @returns {void}
|
|
107
|
+
*/
|
|
80
108
|
protected update(changedProperties: PropertyValues): void;
|
|
109
|
+
/**
|
|
110
|
+
* A `TemplateResult` that will be used
|
|
111
|
+
* to render the updated internal template.
|
|
112
|
+
* @returns Render template
|
|
113
|
+
*/
|
|
81
114
|
protected render(): TemplateResult;
|
|
82
115
|
}
|
|
83
116
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { __decorate } from "tslib";
|
|
2
2
|
import { html, ControlElement } from '@refinitiv-ui/core';
|
|
3
|
-
import { customElement } from '@refinitiv-ui/core/
|
|
4
|
-
import { property } from '@refinitiv-ui/core/
|
|
3
|
+
import { customElement } from '@refinitiv-ui/core/decorators/custom-element.js';
|
|
4
|
+
import { property } from '@refinitiv-ui/core/decorators/property.js';
|
|
5
5
|
import { VERSION } from '../../version.js';
|
|
6
6
|
import '../../icon/index.js';
|
|
7
7
|
import { preload } from '../../icon/index.js';
|
|
@@ -16,6 +16,7 @@ const emptyTemplate = html ``;
|
|
|
16
16
|
let TreeItem = class TreeItem extends ControlElement {
|
|
17
17
|
constructor() {
|
|
18
18
|
super(...arguments);
|
|
19
|
+
this.defaultRole = 'treeitem';
|
|
19
20
|
/**
|
|
20
21
|
* Checked state of the item
|
|
21
22
|
*/
|
|
@@ -70,10 +71,7 @@ let TreeItem = class TreeItem extends ControlElement {
|
|
|
70
71
|
*/
|
|
71
72
|
get toggleTemplate() {
|
|
72
73
|
return html `
|
|
73
|
-
<div
|
|
74
|
-
expand-toggle
|
|
75
|
-
part="toggle"
|
|
76
|
-
style="pointer-events:all;visibility:${this.parent ? 'visible' : 'hidden'}">
|
|
74
|
+
<div expand-toggle part="toggle" style="pointer-events:all;visibility:${this.parent ? 'visible' : 'hidden'}">
|
|
77
75
|
<ef-icon part="toggle-icon${this.expanded ? ' toggle-icon-expanded' : ''}" icon="right"></ef-icon>
|
|
78
76
|
</div>
|
|
79
77
|
`;
|
|
@@ -87,13 +85,14 @@ let TreeItem = class TreeItem extends ControlElement {
|
|
|
87
85
|
}
|
|
88
86
|
return html `
|
|
89
87
|
<ef-checkbox
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
88
|
+
part="checkbox"
|
|
89
|
+
tabindex="-1"
|
|
90
|
+
.disabled="${this.disabled}"
|
|
91
|
+
.readonly="${this.readonly}"
|
|
92
|
+
.indeterminate="${this.indeterminate}"
|
|
93
|
+
.checked="${this.checked}"
|
|
94
|
+
style="pointer-events:none">
|
|
95
|
+
</ef-checkbox>
|
|
97
96
|
`;
|
|
98
97
|
}
|
|
99
98
|
/**
|
|
@@ -117,21 +116,81 @@ let TreeItem = class TreeItem extends ControlElement {
|
|
|
117
116
|
get indeterminate() {
|
|
118
117
|
return this.checkedState === CheckedState.INDETERMINATE;
|
|
119
118
|
}
|
|
119
|
+
/**
|
|
120
|
+
* Handles aria-checked and aria-selected when mode changes
|
|
121
|
+
* aria-checked is used for multiple mode due to tri-state support
|
|
122
|
+
* @returns {void}
|
|
123
|
+
**/
|
|
124
|
+
multipleChanged() {
|
|
125
|
+
this.removeAttribute(this.multiple ? 'aria-selected' : 'aria-checked');
|
|
126
|
+
this.checkedChanged();
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Handles selected and aria attribute changes
|
|
130
|
+
* @returns {void}
|
|
131
|
+
*/
|
|
132
|
+
checkedChanged() {
|
|
133
|
+
switch (this.checkedState) {
|
|
134
|
+
case CheckedState.CHECKED:
|
|
135
|
+
this.setAttribute('selected', '');
|
|
136
|
+
this.setAttribute(this.multiple ? 'aria-checked' : 'aria-selected', 'true');
|
|
137
|
+
break;
|
|
138
|
+
case CheckedState.INDETERMINATE:
|
|
139
|
+
this.setAttribute('selected', 'indeterminate');
|
|
140
|
+
this.setAttribute('aria-checked', 'mixed');
|
|
141
|
+
break;
|
|
142
|
+
default:
|
|
143
|
+
this.removeAttribute('selected');
|
|
144
|
+
// In single mode, only children nodes are selectable
|
|
145
|
+
if (this.parent && !this.multiple) {
|
|
146
|
+
this.removeAttribute('aria-selected');
|
|
147
|
+
}
|
|
148
|
+
else {
|
|
149
|
+
this.setAttribute(this.multiple ? 'aria-checked' : 'aria-selected', 'false');
|
|
150
|
+
}
|
|
151
|
+
break;
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* Handles aria-expanded when expanded state changes
|
|
156
|
+
* @returns {void}
|
|
157
|
+
*/
|
|
158
|
+
expandedChanged() {
|
|
159
|
+
if (this.parent) {
|
|
160
|
+
this.setAttribute('aria-expanded', this.expanded ? 'true' : 'false');
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* Called after the component is first rendered
|
|
165
|
+
* @param changedProperties Properties which have changed
|
|
166
|
+
* @returns {void}
|
|
167
|
+
*/
|
|
168
|
+
firstUpdated(changedProperties) {
|
|
169
|
+
super.firstUpdated(changedProperties);
|
|
170
|
+
this.setAttribute('aria-level', String(this.depth + 1));
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* Invoked whenever the element is updated
|
|
174
|
+
* @param changedProperties Map of changed properties with old values
|
|
175
|
+
* @returns {void}
|
|
176
|
+
*/
|
|
120
177
|
update(changedProperties) {
|
|
121
178
|
super.update(changedProperties);
|
|
122
179
|
if (changedProperties.has('checkedState')) {
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
default:
|
|
131
|
-
this.removeAttribute('selected');
|
|
132
|
-
}
|
|
180
|
+
this.checkedChanged();
|
|
181
|
+
}
|
|
182
|
+
if (changedProperties.has('multiple') && changedProperties.get('multiple') !== undefined) {
|
|
183
|
+
this.multipleChanged();
|
|
184
|
+
}
|
|
185
|
+
if (changedProperties.has('expanded')) {
|
|
186
|
+
this.expandedChanged();
|
|
133
187
|
}
|
|
134
188
|
}
|
|
189
|
+
/**
|
|
190
|
+
* A `TemplateResult` that will be used
|
|
191
|
+
* to render the updated internal template.
|
|
192
|
+
* @returns Render template
|
|
193
|
+
*/
|
|
135
194
|
render() {
|
|
136
195
|
return html `
|
|
137
196
|
${this.indentTemplate}
|
|
@@ -157,7 +216,7 @@ __decorate([
|
|
|
157
216
|
property({ type: Boolean })
|
|
158
217
|
], TreeItem.prototype, "expanded", void 0);
|
|
159
218
|
__decorate([
|
|
160
|
-
property({
|
|
219
|
+
property({ type: Number, reflect: true })
|
|
161
220
|
], TreeItem.prototype, "depth", void 0);
|
|
162
221
|
__decorate([
|
|
163
222
|
property({ type: String })
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { JSXInterface } from '../../jsx';
|
|
2
2
|
import { PropertyValues, TapEvent } from '@refinitiv-ui/core';
|
|
3
|
-
import { CollectionComposer } from '@refinitiv-ui/utils/
|
|
3
|
+
import { CollectionComposer } from '@refinitiv-ui/utils/collection.js';
|
|
4
4
|
import { List } from '../../list/index.js';
|
|
5
5
|
import { TreeRenderer } from '../helpers/renderer.js';
|
|
6
6
|
import type { TreeData, TreeDataItem, TreeFilter } from '../helpers/types';
|
|
@@ -22,6 +22,7 @@ export declare class Tree<T extends TreeDataItem = TreeDataItem> extends List<T>
|
|
|
22
22
|
* @returns version number
|
|
23
23
|
*/
|
|
24
24
|
static get version(): string;
|
|
25
|
+
protected readonly defaultRole: string | null;
|
|
25
26
|
/**
|
|
26
27
|
* Tree manager used for manipulation
|
|
27
28
|
*/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { __decorate } from "tslib";
|
|
2
|
-
import { customElement } from '@refinitiv-ui/core/
|
|
3
|
-
import { property } from '@refinitiv-ui/core/
|
|
2
|
+
import { customElement } from '@refinitiv-ui/core/decorators/custom-element.js';
|
|
3
|
+
import { property } from '@refinitiv-ui/core/decorators/property.js';
|
|
4
4
|
import { VERSION } from '../../version.js';
|
|
5
5
|
import { List } from '../../list/index.js';
|
|
6
6
|
import { TreeRenderer } from '../helpers/renderer.js';
|
|
@@ -21,6 +21,7 @@ const EXPAND_TOGGLE_ATTR = 'expand-toggle';
|
|
|
21
21
|
let Tree = class Tree extends List {
|
|
22
22
|
constructor() {
|
|
23
23
|
super(...arguments);
|
|
24
|
+
this.defaultRole = 'tree';
|
|
24
25
|
/**
|
|
25
26
|
* Tree manager used for manipulation
|
|
26
27
|
*/
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { CollectionComposer, DataItem } from '@refinitiv-ui/utils/
|
|
1
|
+
import type { CollectionComposer, DataItem } from '@refinitiv-ui/utils/collection.js';
|
|
2
2
|
export declare type TreeData<T extends TreeDataItem = TreeDataItem> = T[] | CollectionComposer<T> | null;
|
|
3
3
|
export interface TreeDataItem extends DataItem {
|
|
4
4
|
/**
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { JSXInterface } from '../jsx';
|
|
2
2
|
import { TemplateResult, CSSResultGroup } from '@refinitiv-ui/core';
|
|
3
|
-
import { CollectionComposer } from '@refinitiv-ui/utils/
|
|
4
|
-
import { TimeoutTaskRunner } from '@refinitiv-ui/utils/
|
|
3
|
+
import { CollectionComposer } from '@refinitiv-ui/utils/collection.js';
|
|
4
|
+
import { TimeoutTaskRunner } from '@refinitiv-ui/utils/async.js';
|
|
5
5
|
import '../icon/index.js';
|
|
6
6
|
import '../text-field/index.js';
|
|
7
7
|
import '../pill/index.js';
|
|
@@ -15,7 +15,7 @@ import { TreeRenderer as TreeSelectRenderer } from '../tree/index.js';
|
|
|
15
15
|
import { TreeManager, TreeManagerMode } from '../tree/managers/tree-manager.js';
|
|
16
16
|
import type { TreeSelectData, TreeSelectDataItem } from './helpers/types';
|
|
17
17
|
import { TranslateDirective } from '@refinitiv-ui/translate';
|
|
18
|
-
import '@refinitiv-ui/phrasebook/
|
|
18
|
+
import '@refinitiv-ui/phrasebook/locale/en/tree-select.js';
|
|
19
19
|
export { TreeSelectRenderer };
|
|
20
20
|
export type { TreeSelectFilter, TreeSelectDataItem, TreeSelectData };
|
|
21
21
|
/**
|