@refinitiv-ui/elements 7.0.0 → 7.0.2
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 +195 -449
- package/LICENSE +2 -2
- package/README.md +12 -10
- package/cli.mjs +5 -3
- package/lib/accordion/index.d.ts +1 -1
- package/lib/accordion/index.js +4 -7
- package/lib/appstate-bar/index.d.ts +2 -2
- package/lib/appstate-bar/index.js +10 -4
- package/lib/autosuggest/index.d.ts +7 -7
- package/lib/autosuggest/index.js +80 -80
- package/lib/autosuggest/themes/solar/charcoal/index.js +1 -1
- package/lib/autosuggest/themes/solar/pearl/index.js +1 -1
- package/lib/button/index.js +7 -10
- package/lib/button-bar/index.d.ts +1 -1
- package/lib/button-bar/index.js +12 -12
- package/lib/calendar/index.d.ts +39 -39
- package/lib/calendar/index.js +156 -123
- package/lib/calendar/utils.js +1 -1
- package/lib/canvas/index.d.ts +1 -1
- package/lib/canvas/index.js +2 -4
- package/lib/card/helpers/types.d.ts +2 -2
- package/lib/card/index.d.ts +5 -5
- package/lib/card/index.js +34 -28
- package/lib/chart/elements/chart.d.ts +4 -4
- package/lib/chart/elements/chart.js +39 -33
- package/lib/chart/plugins/doughnut-center-label.d.ts +3 -3
- package/lib/chart/plugins/doughnut-center-label.js +13 -9
- package/lib/checkbox/index.d.ts +1 -1
- package/lib/checkbox/index.js +12 -13
- package/lib/clock/index.d.ts +55 -55
- package/lib/clock/index.js +84 -95
- package/lib/clock/themes/halo/dark/index.js +1 -1
- package/lib/clock/themes/halo/light/index.js +1 -1
- package/lib/clock/themes/solar/charcoal/index.js +1 -1
- package/lib/clock/themes/solar/pearl/index.js +1 -1
- package/lib/collapse/index.d.ts +1 -1
- package/lib/collapse/index.js +27 -18
- package/lib/collapse/themes/halo/dark/index.js +1 -1
- package/lib/collapse/themes/halo/light/index.js +1 -1
- package/lib/color-dialog/elements/color-palettes.d.ts +1 -1
- package/lib/color-dialog/elements/color-palettes.js +5 -6
- package/lib/color-dialog/elements/grayscale-palettes.d.ts +1 -1
- package/lib/color-dialog/elements/grayscale-palettes.js +9 -9
- package/lib/color-dialog/elements/palettes.js +5 -4
- package/lib/color-dialog/helpers/value-model.js +7 -9
- package/lib/color-dialog/index.d.ts +6 -6
- package/lib/color-dialog/index.js +53 -37
- package/lib/color-picker/index.d.ts +2 -2
- package/lib/color-picker/index.js +40 -34
- package/lib/combo-box/helpers/filter.d.ts +2 -2
- package/lib/combo-box/helpers/types.d.ts +1 -1
- package/lib/combo-box/index.d.ts +9 -9
- package/lib/combo-box/index.js +61 -55
- package/lib/configuration/elements/configuration.js +2 -2
- package/lib/counter/index.d.ts +4 -4
- package/lib/counter/index.js +9 -7
- package/lib/datetime-field/index.d.ts +4 -5
- package/lib/datetime-field/index.js +32 -23
- package/lib/datetime-field/utils.js +11 -1
- package/lib/datetime-picker/index.d.ts +75 -75
- package/lib/datetime-picker/index.js +150 -131
- package/lib/datetime-picker/locales.js +5 -5
- package/lib/datetime-picker/utils.js +9 -9
- package/lib/dialog/draggable-element.js +1 -2
- package/lib/dialog/index.d.ts +5 -5
- package/lib/dialog/index.js +51 -47
- package/lib/email-field/index.d.ts +1 -1
- package/lib/email-field/index.js +6 -6
- package/lib/events.d.ts +1 -1
- package/lib/flag/index.d.ts +1 -1
- package/lib/flag/index.js +6 -5
- package/lib/flag/utils/FlagLoader.js +1 -1
- package/lib/header/index.d.ts +1 -1
- package/lib/header/index.js +2 -2
- package/lib/header/themes/halo/dark/index.js +1 -1
- package/lib/header/themes/halo/light/index.js +1 -1
- package/lib/header/themes/solar/charcoal/index.js +1 -1
- package/lib/header/themes/solar/pearl/index.js +1 -1
- package/lib/heatmap/helpers/color.d.ts +1 -1
- package/lib/heatmap/helpers/color.js +11 -5
- package/lib/heatmap/helpers/track.js +3 -3
- package/lib/heatmap/index.d.ts +9 -9
- package/lib/heatmap/index.js +51 -42
- package/lib/icon/index.d.ts +2 -2
- package/lib/icon/index.js +8 -10
- package/lib/interactive-chart/helpers/types.d.ts +3 -3
- package/lib/interactive-chart/index.d.ts +29 -29
- package/lib/interactive-chart/index.js +69 -55
- package/lib/item/helpers/types.d.ts +1 -1
- package/lib/item/index.d.ts +3 -3
- package/lib/item/index.js +24 -20
- package/lib/jsx.d.ts +6 -4
- package/lib/label/index.d.ts +1 -1
- package/lib/label/index.js +10 -7
- package/lib/layout/index.d.ts +7 -7
- package/lib/layout/index.js +7 -7
- package/lib/led-gauge/index.d.ts +1 -1
- package/lib/led-gauge/index.js +10 -10
- package/lib/list/elements/list.d.ts +3 -3
- package/lib/list/elements/list.js +10 -12
- package/lib/list/helpers/renderer.js +2 -2
- package/lib/list/helpers/types.d.ts +1 -1
- package/lib/list/index.d.ts +1 -1
- package/lib/list/renderer.d.ts +7 -7
- package/lib/loader/index.js +7 -8
- package/lib/multi-input/index.d.ts +6 -6
- package/lib/multi-input/index.js +39 -45
- package/lib/notification/elements/notification-tray.d.ts +2 -2
- package/lib/notification/elements/notification-tray.js +3 -3
- package/lib/notification/elements/notification.d.ts +2 -2
- package/lib/notification/elements/notification.js +14 -13
- package/lib/notification/helpers/status.js +1 -1
- package/lib/notification/themes/halo/dark/index.js +1 -1
- package/lib/notification/themes/halo/light/index.js +1 -1
- package/lib/notification/themes/solar/charcoal/index.js +1 -1
- package/lib/notification/themes/solar/pearl/index.js +1 -1
- package/lib/number-field/index.d.ts +5 -6
- package/lib/number-field/index.js +37 -47
- package/lib/overlay/elements/overlay-viewport.d.ts +1 -1
- package/lib/overlay/elements/overlay.d.ts +2 -2
- package/lib/overlay/elements/overlay.js +152 -96
- package/lib/overlay/helpers/types.d.ts +1 -1
- package/lib/overlay/managers/backdrop-manager.d.ts +1 -1
- package/lib/overlay/managers/backdrop-manager.js +2 -2
- package/lib/overlay/managers/close-manager.js +2 -1
- package/lib/overlay/managers/focus-manager.js +23 -13
- package/lib/overlay/managers/interaction-lock-manager.d.ts +4 -4
- package/lib/overlay/managers/interaction-lock-manager.js +33 -25
- package/lib/overlay/managers/viewport-manager.d.ts +2 -2
- package/lib/overlay/managers/viewport-manager.js +3 -2
- package/lib/overlay/managers/zindex-manager.js +4 -2
- package/lib/overlay-menu/helpers/types.d.ts +2 -2
- package/lib/overlay-menu/index.d.ts +1 -1
- package/lib/overlay-menu/index.js +44 -33
- package/lib/overlay-menu/managers/menu-manager.d.ts +10 -10
- package/lib/overlay-menu/managers/menu-manager.js +14 -13
- package/lib/pagination/index.d.ts +4 -4
- package/lib/pagination/index.js +39 -14
- package/lib/panel/index.js +1 -1
- package/lib/password-field/index.d.ts +2 -2
- package/lib/password-field/index.js +3 -3
- package/lib/pill/index.d.ts +1 -1
- package/lib/pill/index.js +22 -19
- package/lib/progress-bar/index.d.ts +1 -1
- package/lib/progress-bar/index.js +38 -37
- package/lib/radio-button/index.d.ts +2 -2
- package/lib/radio-button/index.js +17 -12
- package/lib/radio-button/radio-button-registry.js +8 -5
- package/lib/rating/index.d.ts +1 -1
- package/lib/rating/index.js +2 -5
- package/lib/rating/utils.d.ts +6 -6
- package/lib/rating/utils.js +6 -6
- package/lib/search-field/index.d.ts +2 -2
- package/lib/search-field/index.js +4 -4
- package/lib/select/index.d.ts +34 -34
- package/lib/select/index.js +68 -81
- package/lib/sidebar-layout/index.d.ts +2 -2
- package/lib/sidebar-layout/index.js +7 -9
- package/lib/slider/index.d.ts +2 -2
- package/lib/slider/index.js +57 -45
- package/lib/slider/utils.d.ts +10 -10
- package/lib/slider/utils.js +10 -10
- package/lib/sparkline/index.d.ts +1 -1
- package/lib/sparkline/index.js +7 -8
- package/lib/swing-gauge/helpers.js +2 -2
- package/lib/swing-gauge/index.d.ts +19 -19
- package/lib/swing-gauge/index.js +91 -81
- package/lib/tab/index.d.ts +1 -1
- package/lib/tab/index.js +16 -27
- package/lib/tab/themes/halo/dark/index.js +1 -1
- package/lib/tab/themes/halo/light/index.js +1 -1
- package/lib/tab/themes/solar/charcoal/index.js +1 -1
- package/lib/tab/themes/solar/pearl/index.js +1 -1
- package/lib/tab-bar/helpers/animate.js +1 -1
- package/lib/tab-bar/index.d.ts +1 -1
- package/lib/tab-bar/index.js +34 -18
- package/lib/tab-bar/themes/halo/dark/index.js +1 -1
- package/lib/tab-bar/themes/halo/light/index.js +1 -1
- package/lib/text-field/index.d.ts +1 -1
- package/lib/text-field/index.js +34 -31
- package/lib/time-picker/index.d.ts +6 -6
- package/lib/time-picker/index.js +103 -89
- package/lib/toggle/index.d.ts +1 -1
- package/lib/toggle/index.js +4 -3
- package/lib/toggle/themes/halo/dark/index.js +1 -1
- package/lib/toggle/themes/halo/light/index.js +1 -1
- package/lib/toggle/themes/solar/charcoal/index.js +1 -1
- package/lib/toggle/themes/solar/pearl/index.js +1 -1
- package/lib/tooltip/elements/title-tooltip.js +2 -2
- package/lib/tooltip/index.d.ts +27 -27
- package/lib/tooltip/index.js +42 -38
- package/lib/tooltip/managers/tooltip-manager.d.ts +1 -1
- package/lib/tornado-chart/elements/tornado-chart.d.ts +1 -1
- package/lib/tornado-chart/elements/tornado-chart.js +2 -2
- package/lib/tornado-chart/elements/tornado-item.d.ts +2 -2
- package/lib/tornado-chart/elements/tornado-item.js +12 -10
- package/lib/tree/elements/tree-item.d.ts +3 -3
- package/lib/tree/elements/tree-item.js +21 -19
- package/lib/tree/elements/tree.d.ts +1 -1
- package/lib/tree/elements/tree.js +12 -11
- package/lib/tree/helpers/renderer.js +4 -3
- package/lib/tree/index.d.ts +1 -1
- package/lib/tree/managers/tree-manager.d.ts +1 -1
- package/lib/tree/managers/tree-manager.js +17 -18
- package/lib/tree/themes/solar/charcoal/index.js +1 -1
- package/lib/tree/themes/solar/pearl/index.js +1 -1
- package/lib/tree-select/index.d.ts +9 -9
- package/lib/tree-select/index.js +91 -82
- package/lib/tree-select/themes/halo/dark/index.js +1 -1
- package/lib/tree-select/themes/halo/light/index.js +1 -1
- package/lib/tree-select/themes/solar/charcoal/index.js +1 -1
- package/lib/tree-select/themes/solar/pearl/index.js +1 -1
- package/lib/version.js +1 -1
- package/package.json +17 -17
- package/tsconfig.tsbuildinfo +1 -1
package/lib/calendar/index.js
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
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 {
|
|
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';
|
|
11
|
+
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';
|
|
12
|
+
import { down, first, last, left, right, up } from '@refinitiv-ui/utils/navigation.js';
|
|
13
|
+
import '../button/index.js';
|
|
9
14
|
import { VERSION } from '../version.js';
|
|
10
|
-
import {
|
|
11
|
-
import { left, right, up, down, first, last } from '@refinitiv-ui/utils/navigation.js';
|
|
12
|
-
import { monthInfo, weekdaysNames, monthsNames, ViewFormatTranslateParams } from './utils.js';
|
|
13
|
-
import { translate, getLocale, TranslatePropertyKey } from '@refinitiv-ui/translate';
|
|
14
|
-
import { RenderView, CalendarLocaleScope, FIRST_DAY_OF_WEEK, YEARS_PER_YEAR_VIEW, DAY_VIEW, YEAR_VIEW, MONTH_VIEW } from './constants.js';
|
|
15
|
+
import { CalendarLocaleScope, DAY_VIEW, FIRST_DAY_OF_WEEK, MONTH_VIEW, RenderView, YEARS_PER_YEAR_VIEW, YEAR_VIEW } from './constants.js';
|
|
15
16
|
import './locales.js';
|
|
16
|
-
import '
|
|
17
|
-
import '@refinitiv-ui/phrasebook/locale/en/calendar.js';
|
|
17
|
+
import { ViewFormatTranslateParams, monthInfo, monthsNames, weekdaysNames } from './utils.js';
|
|
18
18
|
/**
|
|
19
19
|
* Standard calendar element
|
|
20
20
|
*
|
|
@@ -40,28 +40,28 @@ let Calendar = class Calendar extends ControlElement {
|
|
|
40
40
|
this._min = '';
|
|
41
41
|
this._max = '';
|
|
42
42
|
/**
|
|
43
|
-
|
|
44
|
-
|
|
43
|
+
* Only enable weekdays
|
|
44
|
+
*/
|
|
45
45
|
this.weekdaysOnly = false;
|
|
46
46
|
/**
|
|
47
|
-
|
|
48
|
-
|
|
47
|
+
* Only enable weekends
|
|
48
|
+
*/
|
|
49
49
|
this.weekendsOnly = false;
|
|
50
50
|
/**
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
51
|
+
* Custom filter, used for enabling/disabling certain dates
|
|
52
|
+
* @type {CalendarFilter | null}
|
|
53
|
+
*/
|
|
54
54
|
this.filter = null;
|
|
55
55
|
this._view = '';
|
|
56
56
|
this.localFirstDayOfWeek = FIRST_DAY_OF_WEEK; // used from locales. 0 stands for Sunday
|
|
57
57
|
this._firstDayOfWeek = null; // used from setter
|
|
58
58
|
/**
|
|
59
|
-
|
|
60
|
-
|
|
59
|
+
* Set to switch to range select mode
|
|
60
|
+
*/
|
|
61
61
|
this.range = false;
|
|
62
62
|
/**
|
|
63
|
-
|
|
64
|
-
|
|
63
|
+
* Set to switch to multiple select mode
|
|
64
|
+
*/
|
|
65
65
|
this.multiple = false;
|
|
66
66
|
this._values = [];
|
|
67
67
|
/**
|
|
@@ -104,19 +104,20 @@ let Calendar = class Calendar extends ControlElement {
|
|
|
104
104
|
:host {
|
|
105
105
|
display: inline-block;
|
|
106
106
|
}
|
|
107
|
-
[part~=navigation],
|
|
107
|
+
[part~='navigation'],
|
|
108
|
+
[part~='navigation'] section {
|
|
108
109
|
display: flex;
|
|
109
110
|
flex-flow: row nowrap;
|
|
110
111
|
}
|
|
111
|
-
[part~=navigation] {
|
|
112
|
+
[part~='navigation'] {
|
|
112
113
|
justify-content: space-between;
|
|
113
114
|
}
|
|
114
|
-
[part~=navigation] > div {
|
|
115
|
+
[part~='navigation'] > div {
|
|
115
116
|
display: flex;
|
|
116
117
|
flex: 1;
|
|
117
118
|
justify-content: center;
|
|
118
119
|
}
|
|
119
|
-
[part~=cell-content] {
|
|
120
|
+
[part~='cell-content'] {
|
|
120
121
|
position: absolute;
|
|
121
122
|
top: 0;
|
|
122
123
|
bottom: 0;
|
|
@@ -126,44 +127,45 @@ let Calendar = class Calendar extends ControlElement {
|
|
|
126
127
|
align-items: center;
|
|
127
128
|
justify-content: center;
|
|
128
129
|
}
|
|
129
|
-
[part=navigation] [part] {
|
|
130
|
+
[part='navigation'] [part] {
|
|
130
131
|
flex: none;
|
|
131
132
|
}
|
|
132
|
-
[part=table] {
|
|
133
|
+
[part='table'] {
|
|
133
134
|
width: 100%;
|
|
134
135
|
}
|
|
135
|
-
[part~=row] {
|
|
136
|
+
[part~='row'] {
|
|
136
137
|
display: flex;
|
|
137
138
|
width: 100%;
|
|
138
139
|
}
|
|
139
|
-
[part~=cell] {
|
|
140
|
+
[part~='cell'] {
|
|
140
141
|
position: relative;
|
|
141
142
|
}
|
|
142
|
-
[part~=cell][part~=year] {
|
|
143
|
+
[part~='cell'][part~='year'] {
|
|
143
144
|
width: calc(100% / ${YEAR_VIEW.columnCount});
|
|
144
145
|
padding-top: calc(100% / ${YEAR_VIEW.columnCount});
|
|
145
146
|
}
|
|
146
|
-
[part~=cell][part~=month] {
|
|
147
|
+
[part~='cell'][part~='month'] {
|
|
147
148
|
width: calc(100% / ${MONTH_VIEW.columnCount});
|
|
148
149
|
padding-top: calc(100% / ${MONTH_VIEW.columnCount});
|
|
149
150
|
}
|
|
150
|
-
[part~=cell][part~=day],
|
|
151
|
+
[part~='cell'][part~='day'],
|
|
152
|
+
[part~='cell'][part~='day-name'] {
|
|
151
153
|
width: calc(100% / ${DAY_VIEW.columnCount});
|
|
152
154
|
padding-top: calc(100% / ${DAY_VIEW.columnCount});
|
|
153
155
|
}
|
|
154
|
-
[part~=cell-content]:not([tabindex]) {
|
|
156
|
+
[part~='cell-content']:not([tabindex]) {
|
|
155
157
|
pointer-events: none;
|
|
156
158
|
}
|
|
157
|
-
[part~=selectable] {
|
|
159
|
+
[part~='selectable'] {
|
|
158
160
|
cursor: pointer;
|
|
159
161
|
}
|
|
160
162
|
`;
|
|
161
163
|
}
|
|
162
164
|
/**
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
165
|
+
* Set minimum date
|
|
166
|
+
* @param min min date
|
|
167
|
+
* @default -
|
|
168
|
+
*/
|
|
167
169
|
set min(min) {
|
|
168
170
|
const oldMin = this._min;
|
|
169
171
|
if (!this.isValidValue(min)) {
|
|
@@ -179,10 +181,10 @@ let Calendar = class Calendar extends ControlElement {
|
|
|
179
181
|
return this._min;
|
|
180
182
|
}
|
|
181
183
|
/**
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
184
|
+
* Set maximum date
|
|
185
|
+
* @param max max date
|
|
186
|
+
* @default -
|
|
187
|
+
*/
|
|
186
188
|
set max(max) {
|
|
187
189
|
const oldMax = this._max;
|
|
188
190
|
if (!this.isValidValue(max)) {
|
|
@@ -198,10 +200,10 @@ let Calendar = class Calendar extends ControlElement {
|
|
|
198
200
|
return this._max;
|
|
199
201
|
}
|
|
200
202
|
/**
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
203
|
+
* Current calendar view date
|
|
204
|
+
* @param view view date
|
|
205
|
+
* @default -
|
|
206
|
+
*/
|
|
205
207
|
set view(view) {
|
|
206
208
|
if (view && !isValidDate(view, DateFormat.yyyyMM)) {
|
|
207
209
|
this.warnInvalidView(view);
|
|
@@ -216,7 +218,10 @@ let Calendar = class Calendar extends ControlElement {
|
|
|
216
218
|
}
|
|
217
219
|
get view() {
|
|
218
220
|
/* as soon as user interaction has happened, always rely on view */
|
|
219
|
-
return this._view ||
|
|
221
|
+
return (this._view ||
|
|
222
|
+
(this.value
|
|
223
|
+
? utcFormat(toDateSegment(this.value), DateFormat.yyyyMM)
|
|
224
|
+
: format(new Date(), DateFormat.yyyyMM)));
|
|
220
225
|
}
|
|
221
226
|
/**
|
|
222
227
|
* Set the first day of the week.
|
|
@@ -237,10 +242,10 @@ let Calendar = class Calendar extends ControlElement {
|
|
|
237
242
|
return this._firstDayOfWeek === null ? this.localFirstDayOfWeek : this._firstDayOfWeek;
|
|
238
243
|
}
|
|
239
244
|
/**
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
245
|
+
* Current date time value
|
|
246
|
+
* @param value Calendar value
|
|
247
|
+
* @default -
|
|
248
|
+
*/
|
|
244
249
|
set value(value) {
|
|
245
250
|
this.values = [value];
|
|
246
251
|
}
|
|
@@ -340,7 +345,7 @@ let Calendar = class Calendar extends ControlElement {
|
|
|
340
345
|
*/
|
|
341
346
|
async performUpdate() {
|
|
342
347
|
const localFirstDayOfWeek = Number(await this.dateTPromise('FIRST_DAY_OF_WEEK'));
|
|
343
|
-
this.localFirstDayOfWeek = isNaN(localFirstDayOfWeek) ? FIRST_DAY_OF_WEEK :
|
|
348
|
+
this.localFirstDayOfWeek = isNaN(localFirstDayOfWeek) ? FIRST_DAY_OF_WEEK : localFirstDayOfWeek % 7;
|
|
344
349
|
void super.performUpdate();
|
|
345
350
|
}
|
|
346
351
|
/**
|
|
@@ -353,15 +358,18 @@ let Calendar = class Calendar extends ControlElement {
|
|
|
353
358
|
super.willUpdate(changedProperties);
|
|
354
359
|
// This code is here to ensure that focus is not lost
|
|
355
360
|
// while navigating through the render views using keyboard
|
|
356
|
-
if (this.focused &&
|
|
361
|
+
if (this.focused &&
|
|
362
|
+
changedProperties.has('renderView') &&
|
|
363
|
+
this.viewBtnRef.value &&
|
|
364
|
+
this.activeElement !== this.viewBtnRef.value) {
|
|
357
365
|
this.viewBtnRef.value.focus();
|
|
358
366
|
}
|
|
359
367
|
}
|
|
360
368
|
/**
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
369
|
+
* Updates the element
|
|
370
|
+
* @param changedProperties Properties that has changed
|
|
371
|
+
* @returns {void}
|
|
372
|
+
*/
|
|
365
373
|
update(changedProperties) {
|
|
366
374
|
if (!this.localMonthsNames || changedProperties.has(TranslatePropertyKey)) {
|
|
367
375
|
const locale = getLocale(this);
|
|
@@ -399,7 +407,7 @@ let Calendar = class Calendar extends ControlElement {
|
|
|
399
407
|
*/
|
|
400
408
|
firstUpdated(changedProperties) {
|
|
401
409
|
super.firstUpdated(changedProperties);
|
|
402
|
-
this.renderRoot.addEventListener('keydown', event => this.onKeyDown(event));
|
|
410
|
+
this.renderRoot.addEventListener('keydown', (event) => this.onKeyDown(event));
|
|
403
411
|
}
|
|
404
412
|
/**
|
|
405
413
|
* Show invalid view message
|
|
@@ -418,10 +426,10 @@ let Calendar = class Calendar extends ControlElement {
|
|
|
418
426
|
new WarningNotice(`The specified value "${value}" does not conform to the required format. The format is "yyyy-MM-dd".`).once();
|
|
419
427
|
}
|
|
420
428
|
/**
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
429
|
+
* Validate that the value confirms the control type
|
|
430
|
+
* @param value Value to check
|
|
431
|
+
* @returns false if value is invalid
|
|
432
|
+
*/
|
|
425
433
|
isValidValue(value) {
|
|
426
434
|
return value === '' || isValidDate(value);
|
|
427
435
|
}
|
|
@@ -433,7 +441,7 @@ let Calendar = class Calendar extends ControlElement {
|
|
|
433
441
|
*/
|
|
434
442
|
filterAndWarnInvalidValues(values) {
|
|
435
443
|
const filtered = [];
|
|
436
|
-
values.forEach(value => {
|
|
444
|
+
values.forEach((value) => {
|
|
437
445
|
if (this.isValidValue(value)) {
|
|
438
446
|
value && filtered.push(value);
|
|
439
447
|
}
|
|
@@ -449,11 +457,11 @@ let Calendar = class Calendar extends ControlElement {
|
|
|
449
457
|
* @returns true if filter needs to be constructed
|
|
450
458
|
*/
|
|
451
459
|
shouldConstructFilters(changedProperties) {
|
|
452
|
-
return changedProperties.has('min')
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
460
|
+
return (changedProperties.has('min') ||
|
|
461
|
+
changedProperties.has('max') ||
|
|
462
|
+
changedProperties.has('weekdaysOnly') ||
|
|
463
|
+
changedProperties.has('weekendsOnly') ||
|
|
464
|
+
changedProperties.has('filter'));
|
|
457
465
|
}
|
|
458
466
|
/**
|
|
459
467
|
* Construct and store a collection of filters
|
|
@@ -462,13 +470,13 @@ let Calendar = class Calendar extends ControlElement {
|
|
|
462
470
|
*/
|
|
463
471
|
constructFilters() {
|
|
464
472
|
const filters = [];
|
|
465
|
-
this.min && filters.push(date => isSameDay(date, this.min) || isAfter(date, this.min));
|
|
466
|
-
this.max && filters.push(date => isSameDay(date, this.max) || isBefore(date, this.max));
|
|
473
|
+
this.min && filters.push((date) => isSameDay(date, this.min) || isAfter(date, this.min));
|
|
474
|
+
this.max && filters.push((date) => isSameDay(date, this.max) || isBefore(date, this.max));
|
|
467
475
|
if (this.weekdaysOnly) {
|
|
468
|
-
filters.push(date => !isWeekend(date));
|
|
476
|
+
filters.push((date) => !isWeekend(date));
|
|
469
477
|
}
|
|
470
478
|
if (this.weekendsOnly) {
|
|
471
|
-
filters.push(date => isWeekend(date));
|
|
479
|
+
filters.push((date) => isWeekend(date));
|
|
472
480
|
}
|
|
473
481
|
if (this.filter) {
|
|
474
482
|
filters.push(this.filter);
|
|
@@ -537,7 +545,7 @@ let Calendar = class Calendar extends ControlElement {
|
|
|
537
545
|
* @returns {void}
|
|
538
546
|
*/
|
|
539
547
|
setNavigationMap(rows) {
|
|
540
|
-
this.navigationGrid = rows.map(row => row.map(cell => cell.value && !cell.disabled ? 1 : 0));
|
|
548
|
+
this.navigationGrid = rows.map((row) => row.map((cell) => (cell.value && !cell.disabled ? 1 : 0)));
|
|
541
549
|
}
|
|
542
550
|
/**
|
|
543
551
|
* Run when next button is tapped.
|
|
@@ -626,14 +634,16 @@ let Calendar = class Calendar extends ControlElement {
|
|
|
626
634
|
this.activeCellIndex = cell.index;
|
|
627
635
|
const cellSegment = toDateSegment(cell.value);
|
|
628
636
|
const viewSegment = toDateSegment(this.view);
|
|
629
|
-
if (this.renderView === RenderView.YEAR) {
|
|
637
|
+
if (this.renderView === RenderView.YEAR) {
|
|
638
|
+
/* YEAR -> MONTH */
|
|
630
639
|
viewSegment.year = cellSegment.year;
|
|
631
640
|
if (this.notifyViewChange(viewSegment)) {
|
|
632
641
|
this.renderView = RenderView.MONTH;
|
|
633
642
|
}
|
|
634
643
|
return;
|
|
635
644
|
}
|
|
636
|
-
if (this.renderView === RenderView.MONTH) {
|
|
645
|
+
if (this.renderView === RenderView.MONTH) {
|
|
646
|
+
/* MONTH -> DAY */
|
|
637
647
|
viewSegment.year = cellSegment.year;
|
|
638
648
|
viewSegment.month = cellSegment.month;
|
|
639
649
|
if (this.notifyViewChange(viewSegment)) {
|
|
@@ -779,7 +789,8 @@ let Calendar = class Calendar extends ControlElement {
|
|
|
779
789
|
if (!this.values.length) {
|
|
780
790
|
values = [value];
|
|
781
791
|
}
|
|
782
|
-
else if (this.values.length === 1) {
|
|
792
|
+
else if (this.values.length === 1) {
|
|
793
|
+
/* from is populated */
|
|
783
794
|
const from = this.values[0];
|
|
784
795
|
const to = value;
|
|
785
796
|
if (isAfter(to, from) || isSameDay(to, from)) {
|
|
@@ -848,7 +859,9 @@ let Calendar = class Calendar extends ControlElement {
|
|
|
848
859
|
const day = segment.day;
|
|
849
860
|
const fromYear = Math.floor(segment.year / YEARS_PER_YEAR_VIEW) * YEARS_PER_YEAR_VIEW;
|
|
850
861
|
const toYear = fromYear + YEARS_PER_YEAR_VIEW - 1;
|
|
851
|
-
|
|
862
|
+
const fromView = this.viewFormattedDate({ year: fromYear, month, day });
|
|
863
|
+
const toView = this.viewFormattedDate({ year: toYear, month, day });
|
|
864
|
+
return html `${fromView} - ${toView}`;
|
|
852
865
|
case RenderView.DAY:
|
|
853
866
|
default:
|
|
854
867
|
return this.viewFormattedDate(segment, true);
|
|
@@ -945,7 +958,7 @@ let Calendar = class Calendar extends ControlElement {
|
|
|
945
958
|
const totalCount = MONTH_VIEW.totalCount;
|
|
946
959
|
const monthsNames = this.localMonthsNames;
|
|
947
960
|
const before = (totalCount - monthCount) / 2;
|
|
948
|
-
const startIdx = monthCount - before % monthCount;
|
|
961
|
+
const startIdx = monthCount - (before % monthCount);
|
|
949
962
|
const after = before + monthCount;
|
|
950
963
|
const months = [];
|
|
951
964
|
const rows = [];
|
|
@@ -1051,8 +1064,7 @@ let Calendar = class Calendar extends ControlElement {
|
|
|
1051
1064
|
this.setActiveCell(rows);
|
|
1052
1065
|
this.setNavigationMap(rows);
|
|
1053
1066
|
return html `
|
|
1054
|
-
${guard([this.firstDayOfWeek, this.lang], () => this.renderWeekdayNames)}
|
|
1055
|
-
${this.renderRows(rows)}
|
|
1067
|
+
${guard([this.firstDayOfWeek, this.lang], () => this.renderWeekdayNames)} ${this.renderRows(rows)}
|
|
1056
1068
|
`;
|
|
1057
1069
|
}
|
|
1058
1070
|
/**
|
|
@@ -1060,14 +1072,16 @@ let Calendar = class Calendar extends ControlElement {
|
|
|
1060
1072
|
*/
|
|
1061
1073
|
get renderWeekdayNames() {
|
|
1062
1074
|
const firstDayOfWeek = this.firstDayOfWeek;
|
|
1063
|
-
const weekdaysNames = this.localWeekdaysNames
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
<div part="cell-
|
|
1069
|
-
|
|
1070
|
-
|
|
1075
|
+
const weekdaysNames = this.localWeekdaysNames
|
|
1076
|
+
.slice(firstDayOfWeek)
|
|
1077
|
+
.concat(this.localWeekdaysNames.slice(0, firstDayOfWeek));
|
|
1078
|
+
return html ` <div role="row" part="row day-name-row">
|
|
1079
|
+
${weekdaysNames.map((day) => html `
|
|
1080
|
+
<div scope="col" role="columnheader" part="cell day-name" abbr="${day.long}">
|
|
1081
|
+
<div part="cell-content">${day.narrow}</div>
|
|
1082
|
+
</div>
|
|
1083
|
+
`)}
|
|
1084
|
+
</div>`;
|
|
1071
1085
|
}
|
|
1072
1086
|
/**
|
|
1073
1087
|
* Render a view based on the current render view
|
|
@@ -1127,17 +1141,24 @@ let Calendar = class Calendar extends ControlElement {
|
|
|
1127
1141
|
?selected=${cell.selected}
|
|
1128
1142
|
?range=${cell.range}
|
|
1129
1143
|
?range-from=${cell.rangeFrom}
|
|
1130
|
-
?range-to=${cell.rangeTo}
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1144
|
+
?range-to=${cell.rangeTo}
|
|
1145
|
+
>
|
|
1146
|
+
<div
|
|
1147
|
+
role="${cell.value ? 'button' : nothing}"
|
|
1148
|
+
tabindex="${isSelectable ? String(isActive) : nothing}"
|
|
1149
|
+
aria-label="${isSelectable
|
|
1150
|
+
? this.t(this.getCellLabelKey(cell), {
|
|
1151
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
1152
|
+
value: parse(cell.value),
|
|
1153
|
+
view: this.renderView
|
|
1154
|
+
})
|
|
1155
|
+
: nothing}"
|
|
1156
|
+
part="cell-content${isSelection ? ' selection' : ''}${isSelectable ? ' selectable' : ''}"
|
|
1157
|
+
.value=${cell.value}
|
|
1158
|
+
.index=${cell.index}
|
|
1159
|
+
>
|
|
1160
|
+
${cell.text}
|
|
1161
|
+
</div>
|
|
1141
1162
|
</div>`;
|
|
1142
1163
|
}
|
|
1143
1164
|
/**
|
|
@@ -1146,7 +1167,7 @@ let Calendar = class Calendar extends ControlElement {
|
|
|
1146
1167
|
* @returns template result
|
|
1147
1168
|
*/
|
|
1148
1169
|
renderRows(rows) {
|
|
1149
|
-
return rows.map(row => html `<div role="row" part="row">${row.map(cell => this.renderCell(cell))}</div>`);
|
|
1170
|
+
return rows.map((row) => html `<div role="row" part="row">${row.map((cell) => this.renderCell(cell))}</div>`);
|
|
1150
1171
|
}
|
|
1151
1172
|
/**
|
|
1152
1173
|
* Render button navigation template
|
|
@@ -1171,24 +1192,28 @@ let Calendar = class Calendar extends ControlElement {
|
|
|
1171
1192
|
// no default
|
|
1172
1193
|
}
|
|
1173
1194
|
return html `<div part="navigation">
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1195
|
+
<ef-button
|
|
1196
|
+
part="btn-prev"
|
|
1197
|
+
aria-label="${prevBtnAriaLabel}"
|
|
1198
|
+
icon="left"
|
|
1199
|
+
@tap=${this.onPreviousTap}
|
|
1200
|
+
></ef-button>
|
|
1201
|
+
<ef-button
|
|
1202
|
+
${ref(this.viewBtnRef)}
|
|
1203
|
+
aria-description="${viewBtnAriaLabel}"
|
|
1204
|
+
part="btn-view"
|
|
1205
|
+
textpos="before"
|
|
1206
|
+
.icon="${this.renderView === RenderView.DAY ? 'down' : 'up'}"
|
|
1207
|
+
@tap="${this.onRenderViewTap}"
|
|
1208
|
+
>${this.formattedViewRender}</ef-button
|
|
1209
|
+
>
|
|
1210
|
+
<ef-button
|
|
1211
|
+
part="btn-next"
|
|
1212
|
+
aria-label="${nextBtnAriaLabel}"
|
|
1213
|
+
icon="right"
|
|
1214
|
+
@tap=${this.onNextTap}
|
|
1215
|
+
></ef-button>
|
|
1216
|
+
</div>`;
|
|
1192
1217
|
}
|
|
1193
1218
|
/**
|
|
1194
1219
|
* A template used to notify currently selected value for screen readers
|
|
@@ -1204,9 +1229,13 @@ let Calendar = class Calendar extends ControlElement {
|
|
|
1204
1229
|
aria-live="polite"
|
|
1205
1230
|
aria-label="${this.value
|
|
1206
1231
|
? this.range
|
|
1207
|
-
? this.t('SELECTED_RANGE', {
|
|
1232
|
+
? this.t('SELECTED_RANGE', {
|
|
1233
|
+
from: parse(this.values[0]),
|
|
1234
|
+
to: this.values[1] ? parse(this.values[1]) : null
|
|
1235
|
+
})
|
|
1208
1236
|
: this.t('SELECTED_DATE', { value: parse(this.value), count: this.values.length })
|
|
1209
|
-
: this.t('SELECTED_NONE', { multiple: this.multiple, range: this.range })}"
|
|
1237
|
+
: this.t('SELECTED_NONE', { multiple: this.multiple, range: this.range })}"
|
|
1238
|
+
></div>`;
|
|
1210
1239
|
}
|
|
1211
1240
|
/**
|
|
1212
1241
|
* A `TemplateResult` that will be used
|
|
@@ -1217,10 +1246,14 @@ let Calendar = class Calendar extends ControlElement {
|
|
|
1217
1246
|
return html `
|
|
1218
1247
|
${guard([this.values, this.lang, this.range, this.multiple, this.announceValues], () => this.selectionTemplate)}
|
|
1219
1248
|
${guard([this.view, this.renderView, this.lang], () => this.buttonNavigationTemplate)}
|
|
1220
|
-
<div
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1249
|
+
<div
|
|
1250
|
+
role="grid"
|
|
1251
|
+
aria-multiselectable="${this.range || this.multiple}"
|
|
1252
|
+
part="table"
|
|
1253
|
+
@tap=${this.onTableTap}
|
|
1254
|
+
>
|
|
1255
|
+
${this.viewRender}
|
|
1256
|
+
</div>
|
|
1224
1257
|
<div part="footer"><slot name="footer"></slot></div>
|
|
1225
1258
|
`;
|
|
1226
1259
|
}
|
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
|
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';
|
|
@@ -157,9 +157,7 @@ let Canvas = class Canvas extends ResponsiveElement {
|
|
|
157
157
|
* @return Render template
|
|
158
158
|
*/
|
|
159
159
|
render() {
|
|
160
|
-
return html `
|
|
161
|
-
<canvas id="canvas"></canvas>
|
|
162
|
-
`;
|
|
160
|
+
return html ` <canvas id="canvas"></canvas> `;
|
|
163
161
|
}
|
|
164
162
|
};
|
|
165
163
|
__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.
|