@refinitiv-ui/elements 6.8.7 → 6.8.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +180 -433
- package/LICENSE +1 -1
- package/README.md +13 -11
- package/lib/accordion/index.d.ts +1 -1
- package/lib/accordion/index.js +4 -7
- package/lib/appstate-bar/index.d.ts +2 -2
- package/lib/appstate-bar/index.js +10 -4
- package/lib/autosuggest/index.d.ts +7 -7
- package/lib/autosuggest/index.js +85 -80
- package/lib/autosuggest/themes/solar/charcoal/index.js +1 -1
- package/lib/autosuggest/themes/solar/pearl/index.js +1 -1
- package/lib/button/index.js +7 -10
- package/lib/button-bar/index.d.ts +1 -1
- package/lib/button-bar/index.js +12 -12
- package/lib/calendar/index.d.ts +39 -39
- package/lib/calendar/index.js +160 -125
- package/lib/calendar/utils.js +2 -2
- package/lib/canvas/index.d.ts +1 -1
- package/lib/canvas/index.js +2 -4
- package/lib/card/helpers/types.d.ts +2 -2
- package/lib/card/index.d.ts +5 -5
- package/lib/card/index.js +34 -28
- package/lib/chart/helpers/legend.js +10 -8
- package/lib/chart/index.d.ts +3 -3
- package/lib/chart/index.js +17 -17
- package/lib/chart/plugins/doughnut-center-label.js +6 -5
- package/lib/checkbox/index.d.ts +1 -1
- package/lib/checkbox/index.js +12 -13
- package/lib/clock/index.d.ts +55 -55
- package/lib/clock/index.js +84 -95
- package/lib/clock/themes/halo/dark/index.js +1 -1
- package/lib/clock/themes/halo/light/index.js +1 -1
- package/lib/clock/themes/solar/charcoal/index.js +1 -1
- package/lib/clock/themes/solar/pearl/index.js +1 -1
- package/lib/collapse/index.d.ts +1 -1
- package/lib/collapse/index.js +28 -19
- package/lib/collapse/themes/halo/dark/index.js +1 -1
- package/lib/collapse/themes/halo/light/index.js +1 -1
- package/lib/color-dialog/elements/color-palettes.d.ts +1 -1
- package/lib/color-dialog/elements/color-palettes.js +5 -6
- package/lib/color-dialog/elements/grayscale-palettes.d.ts +1 -1
- package/lib/color-dialog/elements/grayscale-palettes.js +9 -9
- package/lib/color-dialog/elements/palettes.js +5 -4
- package/lib/color-dialog/helpers/value-model.js +7 -9
- package/lib/color-dialog/index.d.ts +6 -6
- package/lib/color-dialog/index.js +53 -37
- package/lib/color-picker/index.d.ts +2 -2
- package/lib/color-picker/index.js +40 -34
- package/lib/combo-box/helpers/filter.d.ts +2 -2
- package/lib/combo-box/helpers/types.d.ts +1 -1
- package/lib/combo-box/index.d.ts +9 -9
- package/lib/combo-box/index.js +61 -55
- package/lib/configuration/elements/configuration.d.ts +1 -1
- package/lib/configuration/elements/configuration.js +2 -2
- package/lib/counter/index.d.ts +4 -4
- package/lib/counter/index.js +9 -7
- package/lib/datetime-field/index.d.ts +4 -5
- package/lib/datetime-field/index.js +32 -23
- package/lib/datetime-field/utils.js +11 -1
- package/lib/datetime-picker/index.d.ts +75 -75
- package/lib/datetime-picker/index.js +151 -132
- package/lib/datetime-picker/locales.js +5 -5
- package/lib/datetime-picker/utils.js +9 -9
- package/lib/dialog/draggable-element.js +1 -2
- package/lib/dialog/index.d.ts +6 -6
- package/lib/dialog/index.js +48 -38
- package/lib/email-field/index.d.ts +1 -1
- package/lib/email-field/index.js +6 -6
- package/lib/events.d.ts +1 -1
- package/lib/flag/index.d.ts +1 -1
- package/lib/flag/index.js +6 -5
- package/lib/flag/utils/FlagLoader.js +1 -1
- package/lib/header/index.d.ts +1 -1
- package/lib/header/index.js +2 -2
- package/lib/header/themes/halo/dark/index.js +1 -1
- package/lib/header/themes/halo/light/index.js +1 -1
- package/lib/header/themes/solar/charcoal/index.js +1 -1
- package/lib/header/themes/solar/pearl/index.js +1 -1
- package/lib/heatmap/helpers/color.d.ts +1 -1
- package/lib/heatmap/helpers/color.js +11 -5
- package/lib/heatmap/helpers/track.js +3 -3
- package/lib/heatmap/index.d.ts +9 -9
- package/lib/heatmap/index.js +51 -42
- package/lib/icon/index.d.ts +2 -2
- package/lib/icon/index.js +6 -8
- package/lib/icon/utils/IconLoader.d.ts +1 -0
- package/lib/icon/utils/IconLoader.js +9 -1
- package/lib/interactive-chart/helpers/types.d.ts +3 -3
- package/lib/interactive-chart/index.d.ts +34 -34
- package/lib/interactive-chart/index.js +72 -57
- package/lib/item/helpers/types.d.ts +1 -1
- package/lib/item/index.d.ts +3 -3
- package/lib/item/index.js +24 -20
- package/lib/jsx.d.ts +6 -4
- package/lib/label/index.d.ts +1 -1
- package/lib/label/index.js +11 -8
- package/lib/layout/index.d.ts +7 -7
- package/lib/layout/index.js +7 -7
- package/lib/led-gauge/index.d.ts +1 -1
- package/lib/led-gauge/index.js +10 -10
- package/lib/list/elements/list.d.ts +3 -3
- package/lib/list/elements/list.js +10 -12
- package/lib/list/helpers/renderer.js +2 -2
- package/lib/list/helpers/types.d.ts +1 -1
- package/lib/list/index.d.ts +1 -1
- package/lib/list/renderer.d.ts +7 -7
- package/lib/loader/index.js +7 -8
- package/lib/multi-input/index.d.ts +6 -6
- package/lib/multi-input/index.js +39 -45
- package/lib/notification/elements/notification-tray.d.ts +2 -2
- package/lib/notification/elements/notification-tray.js +3 -3
- package/lib/notification/elements/notification.d.ts +2 -2
- package/lib/notification/elements/notification.js +22 -14
- package/lib/notification/helpers/status.js +1 -1
- package/lib/number-field/index.d.ts +5 -6
- package/lib/number-field/index.js +37 -47
- package/lib/overlay/elements/overlay-viewport.d.ts +1 -1
- package/lib/overlay/elements/overlay.d.ts +2 -2
- package/lib/overlay/elements/overlay.js +154 -98
- package/lib/overlay/helpers/types.d.ts +1 -1
- package/lib/overlay/managers/backdrop-manager.d.ts +1 -1
- package/lib/overlay/managers/backdrop-manager.js +2 -2
- package/lib/overlay/managers/close-manager.js +2 -1
- package/lib/overlay/managers/focus-manager.js +23 -13
- package/lib/overlay/managers/interaction-lock-manager.d.ts +4 -4
- package/lib/overlay/managers/interaction-lock-manager.js +33 -25
- package/lib/overlay/managers/viewport-manager.d.ts +2 -2
- package/lib/overlay/managers/viewport-manager.js +3 -2
- package/lib/overlay/managers/zindex-manager.js +4 -2
- package/lib/overlay-menu/helpers/types.d.ts +2 -2
- package/lib/overlay-menu/index.d.ts +1 -1
- package/lib/overlay-menu/index.js +44 -33
- package/lib/overlay-menu/managers/menu-manager.d.ts +10 -10
- package/lib/overlay-menu/managers/menu-manager.js +15 -13
- package/lib/pagination/index.d.ts +4 -4
- package/lib/pagination/index.js +39 -14
- package/lib/panel/index.js +1 -1
- package/lib/password-field/index.d.ts +2 -2
- package/lib/password-field/index.js +4 -4
- package/lib/pill/index.d.ts +1 -1
- package/lib/pill/index.js +22 -19
- package/lib/progress-bar/index.d.ts +1 -1
- package/lib/progress-bar/index.js +38 -37
- package/lib/radio-button/index.d.ts +2 -2
- package/lib/radio-button/index.js +17 -12
- package/lib/radio-button/radio-button-registry.js +8 -5
- package/lib/rating/index.d.ts +1 -1
- package/lib/rating/index.js +2 -5
- package/lib/rating/utils.d.ts +6 -6
- package/lib/rating/utils.js +6 -6
- package/lib/search-field/index.d.ts +2 -2
- package/lib/search-field/index.js +4 -4
- package/lib/select/index.d.ts +34 -34
- package/lib/select/index.js +70 -83
- package/lib/sidebar-layout/index.d.ts +2 -2
- package/lib/sidebar-layout/index.js +7 -9
- package/lib/slider/index.d.ts +2 -2
- package/lib/slider/index.js +57 -45
- package/lib/slider/utils.d.ts +10 -10
- package/lib/slider/utils.js +10 -10
- package/lib/sparkline/index.d.ts +1 -1
- package/lib/sparkline/index.js +7 -8
- package/lib/swing-gauge/helpers.js +2 -2
- package/lib/swing-gauge/index.d.ts +19 -19
- package/lib/swing-gauge/index.js +91 -81
- package/lib/tab/index.d.ts +1 -1
- package/lib/tab/index.js +16 -27
- package/lib/tab/themes/halo/dark/index.js +1 -1
- package/lib/tab/themes/halo/light/index.js +1 -1
- package/lib/tab/themes/solar/charcoal/index.js +1 -1
- package/lib/tab/themes/solar/pearl/index.js +1 -1
- package/lib/tab-bar/helpers/animate.js +1 -1
- package/lib/tab-bar/index.d.ts +1 -1
- package/lib/tab-bar/index.js +34 -18
- package/lib/tab-bar/themes/halo/dark/index.js +1 -1
- package/lib/tab-bar/themes/halo/light/index.js +1 -1
- package/lib/text-field/index.d.ts +1 -1
- package/lib/text-field/index.js +36 -33
- package/lib/time-picker/index.d.ts +6 -6
- package/lib/time-picker/index.js +104 -90
- package/lib/toggle/index.d.ts +1 -1
- package/lib/toggle/index.js +4 -3
- package/lib/tooltip/elements/title-tooltip.js +2 -2
- package/lib/tooltip/index.d.ts +27 -27
- package/lib/tooltip/index.js +42 -38
- package/lib/tooltip/managers/tooltip-manager.d.ts +1 -1
- package/lib/tornado-chart/elements/tornado-chart.d.ts +1 -1
- package/lib/tornado-chart/elements/tornado-chart.js +1 -1
- package/lib/tornado-chart/elements/tornado-item.d.ts +2 -2
- package/lib/tornado-chart/elements/tornado-item.js +12 -10
- package/lib/tree/elements/tree-item.d.ts +3 -3
- package/lib/tree/elements/tree-item.js +21 -19
- package/lib/tree/elements/tree.d.ts +1 -1
- package/lib/tree/elements/tree.js +12 -11
- package/lib/tree/helpers/renderer.js +4 -3
- package/lib/tree/index.d.ts +1 -1
- package/lib/tree/managers/tree-manager.d.ts +1 -1
- package/lib/tree/managers/tree-manager.js +17 -18
- package/lib/tree/themes/solar/charcoal/index.js +1 -1
- package/lib/tree/themes/solar/pearl/index.js +1 -1
- package/lib/tree-select/index.d.ts +9 -9
- package/lib/tree-select/index.js +91 -82
- package/lib/tree-select/themes/halo/dark/index.js +1 -1
- package/lib/tree-select/themes/halo/light/index.js +1 -1
- package/lib/tree-select/themes/solar/charcoal/index.js +1 -1
- package/lib/tree-select/themes/solar/pearl/index.js +1 -1
- package/lib/version.js +1 -1
- package/package.json +16 -16
- package/tsconfig.tsbuildinfo +1 -1
package/lib/calendar/index.js
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
import { __decorate } from "tslib";
|
|
2
|
-
import { ControlElement,
|
|
2
|
+
import { ControlElement, WarningNotice, css, html, nothing } from '@refinitiv-ui/core';
|
|
3
3
|
import { customElement } from '@refinitiv-ui/core/decorators/custom-element.js';
|
|
4
4
|
import { property } from '@refinitiv-ui/core/decorators/property.js';
|
|
5
5
|
import { state } from '@refinitiv-ui/core/decorators/state.js';
|
|
6
6
|
import { cache } from '@refinitiv-ui/core/directives/cache.js';
|
|
7
7
|
import { guard } from '@refinitiv-ui/core/directives/guard.js';
|
|
8
|
-
import {
|
|
9
|
-
import
|
|
8
|
+
import { createRef, ref } from '@refinitiv-ui/core/directives/ref.js';
|
|
9
|
+
import '@refinitiv-ui/phrasebook/locale/en/calendar.js';
|
|
10
|
+
import { TranslatePropertyKey, getLocale, translate } from '@refinitiv-ui/translate';
|
|
10
11
|
import { isIE } from '@refinitiv-ui/utils/browser.js';
|
|
11
|
-
import { DateFormat,
|
|
12
|
-
import {
|
|
13
|
-
import { monthInfo, weekdaysNames, monthsNames, formatLocaleDate, ViewFormatTranslateParams } from './utils.js';
|
|
14
|
-
import { translate, getLocale, TranslatePropertyKey } from '@refinitiv-ui/translate';
|
|
15
|
-
import { RenderView, CalendarLocaleScope, FIRST_DAY_OF_WEEK, YEARS_PER_YEAR_VIEW, DAY_VIEW, YEAR_VIEW, MONTH_VIEW } from './constants.js';
|
|
16
|
-
import './locales.js';
|
|
12
|
+
import { DateFormat, addMonths, format, isAfter, isBefore, isSameDay, isSameMonth, isSameYear, isThisMonth, isThisYear, isToday, isValidDate, isWeekend, parse, subMonths, toDateSegment, utcFormat, utcParse } from '@refinitiv-ui/utils/date.js';
|
|
13
|
+
import { down, first, last, left, right, up } from '@refinitiv-ui/utils/navigation.js';
|
|
17
14
|
import '../button/index.js';
|
|
18
|
-
import '
|
|
15
|
+
import { VERSION } from '../version.js';
|
|
16
|
+
import { CalendarLocaleScope, DAY_VIEW, FIRST_DAY_OF_WEEK, MONTH_VIEW, RenderView, YEARS_PER_YEAR_VIEW, YEAR_VIEW } from './constants.js';
|
|
17
|
+
import './locales.js';
|
|
18
|
+
import { ViewFormatTranslateParams, formatLocaleDate, monthInfo, monthsNames, weekdaysNames } from './utils.js';
|
|
19
19
|
/**
|
|
20
20
|
* Standard calendar element
|
|
21
21
|
*
|
|
@@ -41,28 +41,28 @@ let Calendar = class Calendar extends ControlElement {
|
|
|
41
41
|
this._min = '';
|
|
42
42
|
this._max = '';
|
|
43
43
|
/**
|
|
44
|
-
|
|
45
|
-
|
|
44
|
+
* Only enable weekdays
|
|
45
|
+
*/
|
|
46
46
|
this.weekdaysOnly = false;
|
|
47
47
|
/**
|
|
48
|
-
|
|
49
|
-
|
|
48
|
+
* Only enable weekends
|
|
49
|
+
*/
|
|
50
50
|
this.weekendsOnly = false;
|
|
51
51
|
/**
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
52
|
+
* Custom filter, used for enabling/disabling certain dates
|
|
53
|
+
* @type {CalendarFilter | null}
|
|
54
|
+
*/
|
|
55
55
|
this.filter = null;
|
|
56
56
|
this._view = '';
|
|
57
57
|
this.localFirstDayOfWeek = FIRST_DAY_OF_WEEK; // used from locales. 0 stands for Sunday
|
|
58
58
|
this._firstDayOfWeek = null; // used from setter
|
|
59
59
|
/**
|
|
60
|
-
|
|
61
|
-
|
|
60
|
+
* Set to switch to range select mode
|
|
61
|
+
*/
|
|
62
62
|
this.range = false;
|
|
63
63
|
/**
|
|
64
|
-
|
|
65
|
-
|
|
64
|
+
* Set to switch to multiple select mode
|
|
65
|
+
*/
|
|
66
66
|
this.multiple = false;
|
|
67
67
|
this._values = [];
|
|
68
68
|
/**
|
|
@@ -105,19 +105,20 @@ let Calendar = class Calendar extends ControlElement {
|
|
|
105
105
|
:host {
|
|
106
106
|
display: inline-block;
|
|
107
107
|
}
|
|
108
|
-
[part~=navigation],
|
|
108
|
+
[part~='navigation'],
|
|
109
|
+
[part~='navigation'] section {
|
|
109
110
|
display: flex;
|
|
110
111
|
flex-flow: row nowrap;
|
|
111
112
|
}
|
|
112
|
-
[part~=navigation] {
|
|
113
|
+
[part~='navigation'] {
|
|
113
114
|
justify-content: space-between;
|
|
114
115
|
}
|
|
115
|
-
[part~=navigation] > div {
|
|
116
|
+
[part~='navigation'] > div {
|
|
116
117
|
display: flex;
|
|
117
118
|
flex: 1;
|
|
118
119
|
justify-content: center;
|
|
119
120
|
}
|
|
120
|
-
[part~=cell-content] {
|
|
121
|
+
[part~='cell-content'] {
|
|
121
122
|
position: absolute;
|
|
122
123
|
top: 0;
|
|
123
124
|
bottom: 0;
|
|
@@ -127,44 +128,45 @@ let Calendar = class Calendar extends ControlElement {
|
|
|
127
128
|
align-items: center;
|
|
128
129
|
justify-content: center;
|
|
129
130
|
}
|
|
130
|
-
[part=navigation] [part] {
|
|
131
|
+
[part='navigation'] [part] {
|
|
131
132
|
flex: none;
|
|
132
133
|
}
|
|
133
|
-
[part=table] {
|
|
134
|
+
[part='table'] {
|
|
134
135
|
width: 100%;
|
|
135
136
|
}
|
|
136
|
-
[part~=row] {
|
|
137
|
+
[part~='row'] {
|
|
137
138
|
display: flex;
|
|
138
139
|
width: 100%;
|
|
139
140
|
}
|
|
140
|
-
[part~=cell] {
|
|
141
|
+
[part~='cell'] {
|
|
141
142
|
position: relative;
|
|
142
143
|
}
|
|
143
|
-
[part~=cell][part~=year] {
|
|
144
|
+
[part~='cell'][part~='year'] {
|
|
144
145
|
width: calc(100% / ${YEAR_VIEW.columnCount});
|
|
145
146
|
padding-top: calc(100% / ${YEAR_VIEW.columnCount});
|
|
146
147
|
}
|
|
147
|
-
[part~=cell][part~=month] {
|
|
148
|
+
[part~='cell'][part~='month'] {
|
|
148
149
|
width: calc(100% / ${MONTH_VIEW.columnCount});
|
|
149
150
|
padding-top: calc(100% / ${MONTH_VIEW.columnCount});
|
|
150
151
|
}
|
|
151
|
-
[part~=cell][part~=day],
|
|
152
|
+
[part~='cell'][part~='day'],
|
|
153
|
+
[part~='cell'][part~='day-name'] {
|
|
152
154
|
width: calc(100% / ${DAY_VIEW.columnCount});
|
|
153
155
|
padding-top: calc(100% / ${DAY_VIEW.columnCount});
|
|
154
156
|
}
|
|
155
|
-
[part~=cell-content]:not([tabindex]) {
|
|
157
|
+
[part~='cell-content']:not([tabindex]) {
|
|
156
158
|
pointer-events: none;
|
|
157
159
|
}
|
|
158
|
-
[part~=selectable] {
|
|
160
|
+
[part~='selectable'] {
|
|
159
161
|
cursor: pointer;
|
|
160
162
|
}
|
|
161
163
|
`;
|
|
162
164
|
}
|
|
163
165
|
/**
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
166
|
+
* Set minimum date
|
|
167
|
+
* @param min min date
|
|
168
|
+
* @default -
|
|
169
|
+
*/
|
|
168
170
|
set min(min) {
|
|
169
171
|
const oldMin = this._min;
|
|
170
172
|
if (!this.isValidValue(min)) {
|
|
@@ -180,10 +182,10 @@ let Calendar = class Calendar extends ControlElement {
|
|
|
180
182
|
return this._min;
|
|
181
183
|
}
|
|
182
184
|
/**
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
185
|
+
* Set maximum date
|
|
186
|
+
* @param max max date
|
|
187
|
+
* @default -
|
|
188
|
+
*/
|
|
187
189
|
set max(max) {
|
|
188
190
|
const oldMax = this._max;
|
|
189
191
|
if (!this.isValidValue(max)) {
|
|
@@ -199,10 +201,10 @@ let Calendar = class Calendar extends ControlElement {
|
|
|
199
201
|
return this._max;
|
|
200
202
|
}
|
|
201
203
|
/**
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
204
|
+
* Current calendar view date
|
|
205
|
+
* @param view view date
|
|
206
|
+
* @default -
|
|
207
|
+
*/
|
|
206
208
|
set view(view) {
|
|
207
209
|
if (view && !isValidDate(view, DateFormat.yyyyMM)) {
|
|
208
210
|
this.warnInvalidView(view);
|
|
@@ -217,7 +219,10 @@ let Calendar = class Calendar extends ControlElement {
|
|
|
217
219
|
}
|
|
218
220
|
get view() {
|
|
219
221
|
/* as soon as user interaction has happened, always rely on view */
|
|
220
|
-
return this._view ||
|
|
222
|
+
return (this._view ||
|
|
223
|
+
(this.value
|
|
224
|
+
? utcFormat(toDateSegment(this.value), DateFormat.yyyyMM)
|
|
225
|
+
: format(new Date(), DateFormat.yyyyMM)));
|
|
221
226
|
}
|
|
222
227
|
/**
|
|
223
228
|
* Set the first day of the week.
|
|
@@ -238,10 +243,10 @@ let Calendar = class Calendar extends ControlElement {
|
|
|
238
243
|
return this._firstDayOfWeek === null ? this.localFirstDayOfWeek : this._firstDayOfWeek;
|
|
239
244
|
}
|
|
240
245
|
/**
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
246
|
+
* Current date time value
|
|
247
|
+
* @param value Calendar value
|
|
248
|
+
* @default -
|
|
249
|
+
*/
|
|
245
250
|
set value(value) {
|
|
246
251
|
this.values = [value];
|
|
247
252
|
}
|
|
@@ -341,7 +346,7 @@ let Calendar = class Calendar extends ControlElement {
|
|
|
341
346
|
*/
|
|
342
347
|
async performUpdate() {
|
|
343
348
|
const localFirstDayOfWeek = Number(await this.dateTPromise('FIRST_DAY_OF_WEEK'));
|
|
344
|
-
this.localFirstDayOfWeek = isNaN(localFirstDayOfWeek) ? FIRST_DAY_OF_WEEK :
|
|
349
|
+
this.localFirstDayOfWeek = isNaN(localFirstDayOfWeek) ? FIRST_DAY_OF_WEEK : localFirstDayOfWeek % 7;
|
|
345
350
|
void super.performUpdate();
|
|
346
351
|
}
|
|
347
352
|
/**
|
|
@@ -354,15 +359,18 @@ let Calendar = class Calendar extends ControlElement {
|
|
|
354
359
|
super.willUpdate(changedProperties);
|
|
355
360
|
// This code is here to ensure that focus is not lost
|
|
356
361
|
// while navigating through the render views using keyboard
|
|
357
|
-
if (this.focused &&
|
|
362
|
+
if (this.focused &&
|
|
363
|
+
changedProperties.has('renderView') &&
|
|
364
|
+
this.viewBtnRef.value &&
|
|
365
|
+
this.activeElement !== this.viewBtnRef.value) {
|
|
358
366
|
this.viewBtnRef.value.focus();
|
|
359
367
|
}
|
|
360
368
|
}
|
|
361
369
|
/**
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
370
|
+
* Updates the element
|
|
371
|
+
* @param changedProperties Properties that has changed
|
|
372
|
+
* @returns {void}
|
|
373
|
+
*/
|
|
366
374
|
update(changedProperties) {
|
|
367
375
|
if (!this.localMonthsNames || changedProperties.has(TranslatePropertyKey)) {
|
|
368
376
|
const locale = getLocale(this);
|
|
@@ -400,7 +408,7 @@ let Calendar = class Calendar extends ControlElement {
|
|
|
400
408
|
*/
|
|
401
409
|
firstUpdated(changedProperties) {
|
|
402
410
|
super.firstUpdated(changedProperties);
|
|
403
|
-
this.renderRoot.addEventListener('keydown', event => this.onKeyDown(event));
|
|
411
|
+
this.renderRoot.addEventListener('keydown', (event) => this.onKeyDown(event));
|
|
404
412
|
}
|
|
405
413
|
/**
|
|
406
414
|
* Show invalid view message
|
|
@@ -419,10 +427,10 @@ let Calendar = class Calendar extends ControlElement {
|
|
|
419
427
|
new WarningNotice(`The specified value "${value}" does not conform to the required format. The format is "yyyy-MM-dd".`).once();
|
|
420
428
|
}
|
|
421
429
|
/**
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
430
|
+
* Validate that the value confirms the control type
|
|
431
|
+
* @param value Value to check
|
|
432
|
+
* @returns false if value is invalid
|
|
433
|
+
*/
|
|
426
434
|
isValidValue(value) {
|
|
427
435
|
return value === '' || isValidDate(value);
|
|
428
436
|
}
|
|
@@ -434,7 +442,7 @@ let Calendar = class Calendar extends ControlElement {
|
|
|
434
442
|
*/
|
|
435
443
|
filterAndWarnInvalidValues(values) {
|
|
436
444
|
const filtered = [];
|
|
437
|
-
values.forEach(value => {
|
|
445
|
+
values.forEach((value) => {
|
|
438
446
|
if (this.isValidValue(value)) {
|
|
439
447
|
value && filtered.push(value);
|
|
440
448
|
}
|
|
@@ -450,11 +458,11 @@ let Calendar = class Calendar extends ControlElement {
|
|
|
450
458
|
* @returns true if filter needs to be constructed
|
|
451
459
|
*/
|
|
452
460
|
shouldConstructFilters(changedProperties) {
|
|
453
|
-
return changedProperties.has('min')
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
461
|
+
return (changedProperties.has('min') ||
|
|
462
|
+
changedProperties.has('max') ||
|
|
463
|
+
changedProperties.has('weekdaysOnly') ||
|
|
464
|
+
changedProperties.has('weekendsOnly') ||
|
|
465
|
+
changedProperties.has('filter'));
|
|
458
466
|
}
|
|
459
467
|
/**
|
|
460
468
|
* Construct and store a collection of filters
|
|
@@ -463,13 +471,13 @@ let Calendar = class Calendar extends ControlElement {
|
|
|
463
471
|
*/
|
|
464
472
|
constructFilters() {
|
|
465
473
|
const filters = [];
|
|
466
|
-
this.min && filters.push(date => isSameDay(date, this.min) || isAfter(date, this.min));
|
|
467
|
-
this.max && filters.push(date => isSameDay(date, this.max) || isBefore(date, this.max));
|
|
474
|
+
this.min && filters.push((date) => isSameDay(date, this.min) || isAfter(date, this.min));
|
|
475
|
+
this.max && filters.push((date) => isSameDay(date, this.max) || isBefore(date, this.max));
|
|
468
476
|
if (this.weekdaysOnly) {
|
|
469
|
-
filters.push(date => !isWeekend(date));
|
|
477
|
+
filters.push((date) => !isWeekend(date));
|
|
470
478
|
}
|
|
471
479
|
if (this.weekendsOnly) {
|
|
472
|
-
filters.push(date => isWeekend(date));
|
|
480
|
+
filters.push((date) => isWeekend(date));
|
|
473
481
|
}
|
|
474
482
|
if (this.filter) {
|
|
475
483
|
filters.push(this.filter);
|
|
@@ -538,7 +546,7 @@ let Calendar = class Calendar extends ControlElement {
|
|
|
538
546
|
* @returns {void}
|
|
539
547
|
*/
|
|
540
548
|
setNavigationMap(rows) {
|
|
541
|
-
this.navigationGrid = rows.map(row => row.map(cell => cell.value && !cell.disabled ? 1 : 0));
|
|
549
|
+
this.navigationGrid = rows.map((row) => row.map((cell) => (cell.value && !cell.disabled ? 1 : 0)));
|
|
542
550
|
}
|
|
543
551
|
/**
|
|
544
552
|
* Run when next button is tapped.
|
|
@@ -632,14 +640,16 @@ let Calendar = class Calendar extends ControlElement {
|
|
|
632
640
|
this.activeCellIndex = cell.index;
|
|
633
641
|
const cellSegment = toDateSegment(cell.value);
|
|
634
642
|
const viewSegment = toDateSegment(this.view);
|
|
635
|
-
if (this.renderView === RenderView.YEAR) {
|
|
643
|
+
if (this.renderView === RenderView.YEAR) {
|
|
644
|
+
/* YEAR -> MONTH */
|
|
636
645
|
viewSegment.year = cellSegment.year;
|
|
637
646
|
if (this.notifyViewChange(viewSegment)) {
|
|
638
647
|
this.renderView = RenderView.MONTH;
|
|
639
648
|
}
|
|
640
649
|
return;
|
|
641
650
|
}
|
|
642
|
-
if (this.renderView === RenderView.MONTH) {
|
|
651
|
+
if (this.renderView === RenderView.MONTH) {
|
|
652
|
+
/* MONTH -> DAY */
|
|
643
653
|
viewSegment.year = cellSegment.year;
|
|
644
654
|
viewSegment.month = cellSegment.month;
|
|
645
655
|
if (this.notifyViewChange(viewSegment)) {
|
|
@@ -785,7 +795,8 @@ let Calendar = class Calendar extends ControlElement {
|
|
|
785
795
|
if (!this.values.length) {
|
|
786
796
|
values = [value];
|
|
787
797
|
}
|
|
788
|
-
else if (this.values.length === 1) {
|
|
798
|
+
else if (this.values.length === 1) {
|
|
799
|
+
/* from is populated */
|
|
789
800
|
const from = this.values[0];
|
|
790
801
|
const to = value;
|
|
791
802
|
if (isAfter(to, from) || isSameDay(to, from)) {
|
|
@@ -860,7 +871,9 @@ let Calendar = class Calendar extends ControlElement {
|
|
|
860
871
|
const day = segment.day;
|
|
861
872
|
const fromYear = Math.floor(segment.year / YEARS_PER_YEAR_VIEW) * YEARS_PER_YEAR_VIEW;
|
|
862
873
|
const toYear = fromYear + YEARS_PER_YEAR_VIEW - 1;
|
|
863
|
-
|
|
874
|
+
const fromView = this.viewFormattedDate({ year: fromYear, month, day });
|
|
875
|
+
const toView = this.viewFormattedDate({ year: toYear, month, day });
|
|
876
|
+
return html `${fromView} - ${toView}`;
|
|
864
877
|
case RenderView.DAY:
|
|
865
878
|
default:
|
|
866
879
|
return this.viewFormattedDate(segment, true);
|
|
@@ -957,7 +970,7 @@ let Calendar = class Calendar extends ControlElement {
|
|
|
957
970
|
const totalCount = MONTH_VIEW.totalCount;
|
|
958
971
|
const monthsNames = this.localMonthsNames;
|
|
959
972
|
const before = (totalCount - monthCount) / 2;
|
|
960
|
-
const startIdx = monthCount - before % monthCount;
|
|
973
|
+
const startIdx = monthCount - (before % monthCount);
|
|
961
974
|
const after = before + monthCount;
|
|
962
975
|
const months = [];
|
|
963
976
|
const rows = [];
|
|
@@ -1063,8 +1076,7 @@ let Calendar = class Calendar extends ControlElement {
|
|
|
1063
1076
|
this.setActiveCell(rows);
|
|
1064
1077
|
this.setNavigationMap(rows);
|
|
1065
1078
|
return html `
|
|
1066
|
-
${guard([this.firstDayOfWeek, this.lang], () => this.renderWeekdayNames)}
|
|
1067
|
-
${this.renderRows(rows)}
|
|
1079
|
+
${guard([this.firstDayOfWeek, this.lang], () => this.renderWeekdayNames)} ${this.renderRows(rows)}
|
|
1068
1080
|
`;
|
|
1069
1081
|
}
|
|
1070
1082
|
/**
|
|
@@ -1072,14 +1084,16 @@ let Calendar = class Calendar extends ControlElement {
|
|
|
1072
1084
|
*/
|
|
1073
1085
|
get renderWeekdayNames() {
|
|
1074
1086
|
const firstDayOfWeek = this.firstDayOfWeek;
|
|
1075
|
-
const weekdaysNames = this.localWeekdaysNames
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
<div part="cell-
|
|
1081
|
-
|
|
1082
|
-
|
|
1087
|
+
const weekdaysNames = this.localWeekdaysNames
|
|
1088
|
+
.slice(firstDayOfWeek)
|
|
1089
|
+
.concat(this.localWeekdaysNames.slice(0, firstDayOfWeek));
|
|
1090
|
+
return html ` <div role="row" part="row day-name-row">
|
|
1091
|
+
${weekdaysNames.map((day) => html `
|
|
1092
|
+
<div scope="col" role="columnheader" part="cell day-name" abbr="${day.long}">
|
|
1093
|
+
<div part="cell-content">${day.narrow}</div>
|
|
1094
|
+
</div>
|
|
1095
|
+
`)}
|
|
1096
|
+
</div>`;
|
|
1083
1097
|
}
|
|
1084
1098
|
/**
|
|
1085
1099
|
* Render a view based on the current render view
|
|
@@ -1139,17 +1153,25 @@ let Calendar = class Calendar extends ControlElement {
|
|
|
1139
1153
|
?selected=${cell.selected}
|
|
1140
1154
|
?range=${cell.range}
|
|
1141
1155
|
?range-from=${cell.rangeFrom}
|
|
1142
|
-
?range-to=${cell.rangeTo}
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1156
|
+
?range-to=${cell.rangeTo}
|
|
1157
|
+
>
|
|
1158
|
+
<div
|
|
1159
|
+
role="${cell.value ? 'button' : nothing}"
|
|
1160
|
+
tabindex=${isSelectable ? isActive : nothing}
|
|
1161
|
+
aria-label="${isSelectable && !isIE
|
|
1162
|
+
? this.t(this.getCellLabelKey(cell), {
|
|
1163
|
+
/* IE11 has significant performance hit, disable */
|
|
1164
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
1165
|
+
value: parse(cell.value),
|
|
1166
|
+
view: this.renderView
|
|
1167
|
+
})
|
|
1168
|
+
: nothing}"
|
|
1169
|
+
part="cell-content${isSelection ? ' selection' : ''}${isSelectable ? ' selectable' : ''}"
|
|
1170
|
+
.value=${cell.value}
|
|
1171
|
+
.index=${cell.index}
|
|
1172
|
+
>
|
|
1173
|
+
${cell.text}
|
|
1174
|
+
</div>
|
|
1153
1175
|
</div>`;
|
|
1154
1176
|
}
|
|
1155
1177
|
/**
|
|
@@ -1158,7 +1180,7 @@ let Calendar = class Calendar extends ControlElement {
|
|
|
1158
1180
|
* @returns template result
|
|
1159
1181
|
*/
|
|
1160
1182
|
renderRows(rows) {
|
|
1161
|
-
return rows.map(row => html `<div role="row" part="row">${row.map(cell => this.renderCell(cell))}</div>`);
|
|
1183
|
+
return rows.map((row) => html `<div role="row" part="row">${row.map((cell) => this.renderCell(cell))}</div>`);
|
|
1162
1184
|
}
|
|
1163
1185
|
/**
|
|
1164
1186
|
* Render button navigation template
|
|
@@ -1183,31 +1205,36 @@ let Calendar = class Calendar extends ControlElement {
|
|
|
1183
1205
|
// no default
|
|
1184
1206
|
}
|
|
1185
1207
|
return html `<div part="navigation">
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1208
|
+
<ef-button
|
|
1209
|
+
part="btn-prev"
|
|
1210
|
+
aria-label="${prevBtnAriaLabel}"
|
|
1211
|
+
icon="left"
|
|
1212
|
+
@tap=${this.onPreviousTap}
|
|
1213
|
+
></ef-button>
|
|
1214
|
+
<ef-button
|
|
1215
|
+
${ref(this.viewBtnRef)}
|
|
1216
|
+
aria-description="${viewBtnAriaLabel}"
|
|
1217
|
+
part="btn-view"
|
|
1218
|
+
textpos="before"
|
|
1219
|
+
.icon="${this.renderView === RenderView.DAY ? 'down' : 'up'}"
|
|
1220
|
+
@tap="${this.onRenderViewTap}"
|
|
1221
|
+
>${this.formattedViewRender}</ef-button
|
|
1222
|
+
>
|
|
1223
|
+
<ef-button
|
|
1224
|
+
part="btn-next"
|
|
1225
|
+
aria-label="${nextBtnAriaLabel}"
|
|
1226
|
+
icon="right"
|
|
1227
|
+
@tap=${this.onNextTap}
|
|
1228
|
+
></ef-button>
|
|
1229
|
+
</div>`;
|
|
1204
1230
|
}
|
|
1205
1231
|
/**
|
|
1206
1232
|
* A template used to notify currently selected value for screen readers
|
|
1207
1233
|
* @returns template result
|
|
1208
1234
|
*/
|
|
1209
1235
|
get selectionTemplate() {
|
|
1210
|
-
if (isIE || !this.announceValues) {
|
|
1236
|
+
if (isIE || !this.announceValues) {
|
|
1237
|
+
/* IE11 has significant performance complications */
|
|
1211
1238
|
return;
|
|
1212
1239
|
}
|
|
1213
1240
|
return html `<div
|
|
@@ -1216,9 +1243,13 @@ let Calendar = class Calendar extends ControlElement {
|
|
|
1216
1243
|
aria-live="polite"
|
|
1217
1244
|
aria-label="${this.value
|
|
1218
1245
|
? this.range
|
|
1219
|
-
? this.t('SELECTED_RANGE', {
|
|
1246
|
+
? this.t('SELECTED_RANGE', {
|
|
1247
|
+
from: parse(this.values[0]),
|
|
1248
|
+
to: this.values[1] ? parse(this.values[1]) : null
|
|
1249
|
+
})
|
|
1220
1250
|
: this.t('SELECTED_DATE', { value: parse(this.value), count: this.values.length })
|
|
1221
|
-
: this.t('SELECTED_NONE', { multiple: this.multiple, range: this.range })}"
|
|
1251
|
+
: this.t('SELECTED_NONE', { multiple: this.multiple, range: this.range })}"
|
|
1252
|
+
></div>`;
|
|
1222
1253
|
}
|
|
1223
1254
|
/**
|
|
1224
1255
|
* A `TemplateResult` that will be used
|
|
@@ -1229,10 +1260,14 @@ let Calendar = class Calendar extends ControlElement {
|
|
|
1229
1260
|
return html `
|
|
1230
1261
|
${guard([this.values, this.lang, this.range, this.multiple, this.announceValues], () => this.selectionTemplate)}
|
|
1231
1262
|
${guard([this.view, this.renderView, this.lang], () => this.buttonNavigationTemplate)}
|
|
1232
|
-
<div
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1263
|
+
<div
|
|
1264
|
+
role="grid"
|
|
1265
|
+
aria-multiselectable="${this.range || this.multiple}"
|
|
1266
|
+
part="table"
|
|
1267
|
+
@tap=${this.onTableTap}
|
|
1268
|
+
>
|
|
1269
|
+
${this.viewRender}
|
|
1270
|
+
</div>
|
|
1236
1271
|
<div part="footer"><slot name="footer"></slot></div>
|
|
1237
1272
|
`;
|
|
1238
1273
|
}
|
package/lib/calendar/utils.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { toDateSegment, getDaysInMonth, utcParse } from '@refinitiv-ui/utils/date.js';
|
|
2
1
|
import { DEFAULT_LOCALE, resolveLocale } from '@refinitiv-ui/i18n';
|
|
2
|
+
import { getDaysInMonth, toDateSegment, utcParse } from '@refinitiv-ui/utils/date.js';
|
|
3
3
|
import { CalendarLocaleScope } from './constants.js';
|
|
4
4
|
/**
|
|
5
5
|
* Get information about number of days, month number and year from date object
|
|
@@ -102,7 +102,7 @@ const formatLocaleDate = (date, locale, includeMonth = false, includeEra = false
|
|
|
102
102
|
const year = date.getUTCFullYear();
|
|
103
103
|
const month = date.getUTCMonth();
|
|
104
104
|
// BC flags are not supported. Always use English
|
|
105
|
-
return `${includeMonth ? `${monthNames[month]} ` : ''} ${year > 0 ? year : year === 0 ? '1' : Math.abs(year - 1)}${includeEra ? year <= 0 ? ' BC' : ' AD' : ''}`;
|
|
105
|
+
return `${includeMonth ? `${monthNames[month]} ` : ''} ${year > 0 ? year : year === 0 ? '1' : Math.abs(year - 1)}${includeEra ? (year <= 0 ? ' BC' : ' AD') : ''}`;
|
|
106
106
|
};
|
|
107
107
|
/**
|
|
108
108
|
* Used to format views
|
package/lib/canvas/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { JSXInterface } from '../jsx';
|
|
2
|
-
import {
|
|
2
|
+
import { CSSResultGroup, ElementSize, ResponsiveElement, TemplateResult } from '@refinitiv-ui/core';
|
|
3
3
|
/**
|
|
4
4
|
* A Component uses to draw graphics on a web page,
|
|
5
5
|
* it works similarly to the normal HTML5 Canvas element.
|
package/lib/canvas/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { __decorate } from "tslib";
|
|
2
|
-
import { ResponsiveElement,
|
|
2
|
+
import { ResponsiveElement, css, html } from '@refinitiv-ui/core';
|
|
3
3
|
import { customElement } from '@refinitiv-ui/core/decorators/custom-element.js';
|
|
4
4
|
import { property } from '@refinitiv-ui/core/decorators/property.js';
|
|
5
5
|
import { VERSION } from '../version.js';
|
|
@@ -156,9 +156,7 @@ let Canvas = class Canvas extends ResponsiveElement {
|
|
|
156
156
|
* @return Render template
|
|
157
157
|
*/
|
|
158
158
|
render() {
|
|
159
|
-
return html `
|
|
160
|
-
<canvas id="canvas"></canvas>
|
|
161
|
-
`;
|
|
159
|
+
return html ` <canvas id="canvas"></canvas> `;
|
|
162
160
|
}
|
|
163
161
|
};
|
|
164
162
|
__decorate([
|
package/lib/card/index.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { JSXInterface } from '../jsx';
|
|
2
|
-
import { BasicElement,
|
|
3
|
-
import type { CardConfig } from './helpers/types';
|
|
4
|
-
import '../label/index.js';
|
|
5
|
-
import '../button/index.js';
|
|
6
|
-
import '../overlay-menu/index.js';
|
|
2
|
+
import { BasicElement, CSSResultGroup, PropertyValues, TemplateResult } from '@refinitiv-ui/core';
|
|
7
3
|
import '@refinitiv-ui/phrasebook/locale/en/card.js';
|
|
8
4
|
import { Translate } from '@refinitiv-ui/translate';
|
|
5
|
+
import '../button/index.js';
|
|
6
|
+
import '../label/index.js';
|
|
7
|
+
import '../overlay-menu/index.js';
|
|
8
|
+
import type { CardConfig } from './helpers/types';
|
|
9
9
|
export type { CardConfig };
|
|
10
10
|
/**
|
|
11
11
|
* A card frame component.
|