@sbb-esta/lyne-elements 3.2.0 → 3.3.0
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/calendar/calendar.component.d.ts +54 -8
- package/calendar/calendar.component.d.ts.map +1 -1
- package/calendar/calendar.component.js +543 -256
- package/core/i18n/i18n.d.ts +1 -0
- package/core/i18n/i18n.d.ts.map +1 -1
- package/core/i18n/i18n.js +22 -16
- package/core/i18n.js +79 -78
- package/custom-elements.json +226 -21
- package/development/calendar/calendar.component.d.ts +54 -8
- package/development/calendar/calendar.component.d.ts.map +1 -1
- package/development/calendar/calendar.component.js +496 -81
- package/development/core/i18n/i18n.d.ts +1 -0
- package/development/core/i18n/i18n.d.ts.map +1 -1
- package/development/core/i18n/i18n.js +8 -1
- package/development/core/i18n.js +2 -1
- package/development/icon/icon-request.js +2 -2
- package/icon/icon-request.js +3 -3
- package/package.json +1 -1
package/custom-elements.json
CHANGED
|
@@ -4555,7 +4555,7 @@
|
|
|
4555
4555
|
"declarations": [
|
|
4556
4556
|
{
|
|
4557
4557
|
"kind": "class",
|
|
4558
|
-
"description": "It displays a calendar which allows
|
|
4558
|
+
"description": "It displays a calendar which allows choosing a date.",
|
|
4559
4559
|
"name": "SbbCalendarElement",
|
|
4560
4560
|
"members": [
|
|
4561
4561
|
{
|
|
@@ -4613,23 +4613,36 @@
|
|
|
4613
4613
|
"description": "The maximum valid date. Accepts a date object or null.\nAccepts an ISO8601 formatted string (e.g. 2024-12-24) as attribute.",
|
|
4614
4614
|
"attribute": "max"
|
|
4615
4615
|
},
|
|
4616
|
+
{
|
|
4617
|
+
"kind": "field",
|
|
4618
|
+
"name": "multiple",
|
|
4619
|
+
"type": {
|
|
4620
|
+
"text": "boolean"
|
|
4621
|
+
},
|
|
4622
|
+
"privacy": "public",
|
|
4623
|
+
"default": "false",
|
|
4624
|
+
"description": "Whether the calendar allows for multiple date selection.",
|
|
4625
|
+
"attribute": "multiple"
|
|
4626
|
+
},
|
|
4616
4627
|
{
|
|
4617
4628
|
"kind": "field",
|
|
4618
4629
|
"name": "selected",
|
|
4619
4630
|
"privacy": "public",
|
|
4620
|
-
"description": "The selected date
|
|
4631
|
+
"description": "The selected date: accepts a date object, or, if `multiple`, an array of dates.",
|
|
4621
4632
|
"type": {
|
|
4622
|
-
"text": "T | null"
|
|
4633
|
+
"text": "T | T[] | null"
|
|
4623
4634
|
},
|
|
4624
|
-
"attribute": "selected"
|
|
4635
|
+
"attribute": "selected",
|
|
4636
|
+
"default": "null"
|
|
4625
4637
|
},
|
|
4626
4638
|
{
|
|
4627
4639
|
"kind": "field",
|
|
4628
|
-
"name": "
|
|
4640
|
+
"name": "_selected",
|
|
4629
4641
|
"type": {
|
|
4630
|
-
"text": "T |
|
|
4642
|
+
"text": "T | T[] | null"
|
|
4631
4643
|
},
|
|
4632
|
-
"privacy": "private"
|
|
4644
|
+
"privacy": "private",
|
|
4645
|
+
"default": "null"
|
|
4633
4646
|
},
|
|
4634
4647
|
{
|
|
4635
4648
|
"kind": "field",
|
|
@@ -4654,6 +4667,17 @@
|
|
|
4654
4667
|
"attribute": "orientation",
|
|
4655
4668
|
"reflects": true
|
|
4656
4669
|
},
|
|
4670
|
+
{
|
|
4671
|
+
"kind": "field",
|
|
4672
|
+
"name": "weekNumbers",
|
|
4673
|
+
"type": {
|
|
4674
|
+
"text": "boolean"
|
|
4675
|
+
},
|
|
4676
|
+
"privacy": "public",
|
|
4677
|
+
"default": "false",
|
|
4678
|
+
"description": "Whether it has to display the week numbers in addition to week days.",
|
|
4679
|
+
"attribute": "week-numbers"
|
|
4680
|
+
},
|
|
4657
4681
|
{
|
|
4658
4682
|
"kind": "field",
|
|
4659
4683
|
"name": "_dateAdapter",
|
|
@@ -4671,15 +4695,6 @@
|
|
|
4671
4695
|
"privacy": "private",
|
|
4672
4696
|
"description": "The currently active date."
|
|
4673
4697
|
},
|
|
4674
|
-
{
|
|
4675
|
-
"kind": "field",
|
|
4676
|
-
"name": "_selected",
|
|
4677
|
-
"type": {
|
|
4678
|
-
"text": "string | undefined"
|
|
4679
|
-
},
|
|
4680
|
-
"privacy": "private",
|
|
4681
|
-
"description": "The selected date as ISOString."
|
|
4682
|
-
},
|
|
4683
4698
|
{
|
|
4684
4699
|
"kind": "field",
|
|
4685
4700
|
"name": "_wide",
|
|
@@ -4781,6 +4796,24 @@
|
|
|
4781
4796
|
"privacy": "private",
|
|
4782
4797
|
"description": "An array containing all the month names in the current language."
|
|
4783
4798
|
},
|
|
4799
|
+
{
|
|
4800
|
+
"kind": "field",
|
|
4801
|
+
"name": "_weekNumbers",
|
|
4802
|
+
"type": {
|
|
4803
|
+
"text": "number[]"
|
|
4804
|
+
},
|
|
4805
|
+
"privacy": "private",
|
|
4806
|
+
"description": "An array containing the weeks' numbers for the current month."
|
|
4807
|
+
},
|
|
4808
|
+
{
|
|
4809
|
+
"kind": "field",
|
|
4810
|
+
"name": "_nextMonthWeekNumbers",
|
|
4811
|
+
"type": {
|
|
4812
|
+
"text": "number[]"
|
|
4813
|
+
},
|
|
4814
|
+
"privacy": "private",
|
|
4815
|
+
"description": "An array containing the weeks' numbers for the next month in wide mode."
|
|
4816
|
+
},
|
|
4784
4817
|
{
|
|
4785
4818
|
"kind": "field",
|
|
4786
4819
|
"name": "_cells",
|
|
@@ -4868,6 +4901,25 @@
|
|
|
4868
4901
|
},
|
|
4869
4902
|
"description": "Resets the active month according to the new state of the calendar."
|
|
4870
4903
|
},
|
|
4904
|
+
{
|
|
4905
|
+
"kind": "method",
|
|
4906
|
+
"name": "_onMultipleChanged",
|
|
4907
|
+
"privacy": "private",
|
|
4908
|
+
"return": {
|
|
4909
|
+
"type": {
|
|
4910
|
+
"text": "void"
|
|
4911
|
+
}
|
|
4912
|
+
},
|
|
4913
|
+
"parameters": [
|
|
4914
|
+
{
|
|
4915
|
+
"name": "isMultiple",
|
|
4916
|
+
"type": {
|
|
4917
|
+
"text": "boolean"
|
|
4918
|
+
}
|
|
4919
|
+
}
|
|
4920
|
+
],
|
|
4921
|
+
"description": "The `_selected` state should be adapted when the `multiple` property changes:\n - if it changes to true, the '_selected' is set to an array;\n - if it changes to false, the first available option is set as 'value' otherwise it's set to null."
|
|
4922
|
+
},
|
|
4871
4923
|
{
|
|
4872
4924
|
"kind": "method",
|
|
4873
4925
|
"name": "_init",
|
|
@@ -4910,6 +4962,25 @@
|
|
|
4910
4962
|
},
|
|
4911
4963
|
"description": "Creates the array of weekdays."
|
|
4912
4964
|
},
|
|
4965
|
+
{
|
|
4966
|
+
"kind": "method",
|
|
4967
|
+
"name": "_createWeekNumbers",
|
|
4968
|
+
"privacy": "private",
|
|
4969
|
+
"return": {
|
|
4970
|
+
"type": {
|
|
4971
|
+
"text": "number[]"
|
|
4972
|
+
}
|
|
4973
|
+
},
|
|
4974
|
+
"parameters": [
|
|
4975
|
+
{
|
|
4976
|
+
"name": "date",
|
|
4977
|
+
"type": {
|
|
4978
|
+
"text": "T"
|
|
4979
|
+
}
|
|
4980
|
+
}
|
|
4981
|
+
],
|
|
4982
|
+
"description": "Given a date, it returns the week numbers for the month the date belongs to.\nTODO: check if date-fns can be replaced with custom logic.\n\nSince the calculation is not simple (see https://en.wikipedia.org/wiki/Week#Numbering),\nthe date-fns library has been used this way:\nthe first and the last day of the month are calculated and then passed to the `eachWeekOfInterval` function,\nwhich returns an array containing the starting day of every ISO week of the month,\nconsidering Monday as the first day.\nThen, this array is mapped via the `getWeek` function, which returns the ISO week number for that date."
|
|
4983
|
+
},
|
|
4913
4984
|
{
|
|
4914
4985
|
"kind": "method",
|
|
4915
4986
|
"name": "_createWeekRows",
|
|
@@ -4931,7 +5002,7 @@
|
|
|
4931
5002
|
"default": "false"
|
|
4932
5003
|
}
|
|
4933
5004
|
],
|
|
4934
|
-
"description": "Creates the rows
|
|
5005
|
+
"description": "Creates the rows along the horizontal direction and sets the parameters used in keyboard navigation."
|
|
4935
5006
|
},
|
|
4936
5007
|
{
|
|
4937
5008
|
"kind": "method",
|
|
@@ -5164,15 +5235,96 @@
|
|
|
5164
5235
|
}
|
|
5165
5236
|
},
|
|
5166
5237
|
"parameters": [
|
|
5238
|
+
{
|
|
5239
|
+
"name": "event",
|
|
5240
|
+
"type": {
|
|
5241
|
+
"text": "PointerEvent"
|
|
5242
|
+
}
|
|
5243
|
+
},
|
|
5167
5244
|
{
|
|
5168
5245
|
"name": "day",
|
|
5169
5246
|
"type": {
|
|
5170
|
-
"text": "
|
|
5247
|
+
"text": "T"
|
|
5171
5248
|
}
|
|
5172
5249
|
}
|
|
5173
5250
|
],
|
|
5174
5251
|
"description": "Emits the selected date and sets it internally."
|
|
5175
5252
|
},
|
|
5253
|
+
{
|
|
5254
|
+
"kind": "method",
|
|
5255
|
+
"name": "_selectMultipleDates",
|
|
5256
|
+
"privacy": "private",
|
|
5257
|
+
"return": {
|
|
5258
|
+
"type": {
|
|
5259
|
+
"text": "void"
|
|
5260
|
+
}
|
|
5261
|
+
},
|
|
5262
|
+
"parameters": [
|
|
5263
|
+
{
|
|
5264
|
+
"name": "event",
|
|
5265
|
+
"type": {
|
|
5266
|
+
"text": "PointerEvent"
|
|
5267
|
+
}
|
|
5268
|
+
},
|
|
5269
|
+
{
|
|
5270
|
+
"name": "days",
|
|
5271
|
+
"type": {
|
|
5272
|
+
"text": "Day<T>[]"
|
|
5273
|
+
}
|
|
5274
|
+
}
|
|
5275
|
+
],
|
|
5276
|
+
"description": "Handle multiple dates selection via weekNumber / weekDay buttons:\n- if Cmd or Ctrl are pressed, add the new date to the current ones;\n- if not,\n - if the new dates are the same of the current ones, it means that the same button has been clicked twice, so do nothing;\n - if not, the selected dates are the new ones."
|
|
5277
|
+
},
|
|
5278
|
+
{
|
|
5279
|
+
"kind": "method",
|
|
5280
|
+
"name": "_emitDateSelectedEvent",
|
|
5281
|
+
"privacy": "private",
|
|
5282
|
+
"return": {
|
|
5283
|
+
"type": {
|
|
5284
|
+
"text": "void"
|
|
5285
|
+
}
|
|
5286
|
+
},
|
|
5287
|
+
"parameters": [
|
|
5288
|
+
{
|
|
5289
|
+
"name": "detail",
|
|
5290
|
+
"type": {
|
|
5291
|
+
"text": "T | T[]"
|
|
5292
|
+
}
|
|
5293
|
+
}
|
|
5294
|
+
],
|
|
5295
|
+
"description": "Emits the dateselected event given the detail (as T or T[] based on the value of the multiple flag)."
|
|
5296
|
+
},
|
|
5297
|
+
{
|
|
5298
|
+
"kind": "method",
|
|
5299
|
+
"name": "_updateSelectedWithMultipleDates",
|
|
5300
|
+
"privacy": "private",
|
|
5301
|
+
"return": {
|
|
5302
|
+
"type": {
|
|
5303
|
+
"text": "string[]"
|
|
5304
|
+
}
|
|
5305
|
+
},
|
|
5306
|
+
"parameters": [
|
|
5307
|
+
{
|
|
5308
|
+
"name": "daysToAdd",
|
|
5309
|
+
"type": {
|
|
5310
|
+
"text": "string[]"
|
|
5311
|
+
}
|
|
5312
|
+
},
|
|
5313
|
+
{
|
|
5314
|
+
"name": "daysToAddSet",
|
|
5315
|
+
"type": {
|
|
5316
|
+
"text": "Set<string>"
|
|
5317
|
+
}
|
|
5318
|
+
},
|
|
5319
|
+
{
|
|
5320
|
+
"name": "selectedSet",
|
|
5321
|
+
"type": {
|
|
5322
|
+
"text": "Set<string>"
|
|
5323
|
+
}
|
|
5324
|
+
}
|
|
5325
|
+
],
|
|
5326
|
+
"description": "In case of multiple selection, newly added days must be added to the existing ones, without duplication.\nIf the days to add are exactly the same as the selected ones, the set must be emptied."
|
|
5327
|
+
},
|
|
5176
5328
|
{
|
|
5177
5329
|
"kind": "method",
|
|
5178
5330
|
"name": "_setChosenYear",
|
|
@@ -5924,6 +6076,19 @@
|
|
|
5924
6076
|
"type": {
|
|
5925
6077
|
"text": "Day<T>[][]"
|
|
5926
6078
|
}
|
|
6079
|
+
},
|
|
6080
|
+
{
|
|
6081
|
+
"name": "weekNumbers",
|
|
6082
|
+
"type": {
|
|
6083
|
+
"text": "number[]"
|
|
6084
|
+
}
|
|
6085
|
+
},
|
|
6086
|
+
{
|
|
6087
|
+
"name": "isWideNextMonth",
|
|
6088
|
+
"default": "false",
|
|
6089
|
+
"type": {
|
|
6090
|
+
"text": "boolean"
|
|
6091
|
+
}
|
|
5927
6092
|
}
|
|
5928
6093
|
],
|
|
5929
6094
|
"description": "Creates the calendar table for the daily view."
|
|
@@ -5944,6 +6109,12 @@
|
|
|
5944
6109
|
"text": "Day<T>[][]"
|
|
5945
6110
|
}
|
|
5946
6111
|
},
|
|
6112
|
+
{
|
|
6113
|
+
"name": "weekNumbers",
|
|
6114
|
+
"type": {
|
|
6115
|
+
"text": "number[]"
|
|
6116
|
+
}
|
|
6117
|
+
},
|
|
5947
6118
|
{
|
|
5948
6119
|
"name": "nextMonthActiveDate",
|
|
5949
6120
|
"optional": true,
|
|
@@ -6250,7 +6421,7 @@
|
|
|
6250
6421
|
{
|
|
6251
6422
|
"name": "dateselected",
|
|
6252
6423
|
"type": {
|
|
6253
|
-
"text": "CustomEvent<T>"
|
|
6424
|
+
"text": "CustomEvent<T | T[]>"
|
|
6254
6425
|
},
|
|
6255
6426
|
"description": "Event emitted on date selection."
|
|
6256
6427
|
}
|
|
@@ -6292,11 +6463,20 @@
|
|
|
6292
6463
|
"description": "The maximum valid date. Accepts a date object or null.\nAccepts an ISO8601 formatted string (e.g. 2024-12-24) as attribute.",
|
|
6293
6464
|
"fieldName": "max"
|
|
6294
6465
|
},
|
|
6466
|
+
{
|
|
6467
|
+
"name": "multiple",
|
|
6468
|
+
"type": {
|
|
6469
|
+
"text": "boolean"
|
|
6470
|
+
},
|
|
6471
|
+
"default": "false",
|
|
6472
|
+
"description": "Whether the calendar allows for multiple date selection.",
|
|
6473
|
+
"fieldName": "multiple"
|
|
6474
|
+
},
|
|
6295
6475
|
{
|
|
6296
6476
|
"name": "selected",
|
|
6297
|
-
"description": "The selected date
|
|
6477
|
+
"description": "The selected date: accepts a date object, or, if `multiple`, an array of dates.",
|
|
6298
6478
|
"type": {
|
|
6299
|
-
"text": "T | null"
|
|
6479
|
+
"text": "T | T[] | null"
|
|
6300
6480
|
},
|
|
6301
6481
|
"fieldName": "selected"
|
|
6302
6482
|
},
|
|
@@ -6317,6 +6497,15 @@
|
|
|
6317
6497
|
"default": "'horizontal'",
|
|
6318
6498
|
"description": "The orientation of days in the calendar.",
|
|
6319
6499
|
"fieldName": "orientation"
|
|
6500
|
+
},
|
|
6501
|
+
{
|
|
6502
|
+
"name": "week-numbers",
|
|
6503
|
+
"type": {
|
|
6504
|
+
"text": "boolean"
|
|
6505
|
+
},
|
|
6506
|
+
"default": "false",
|
|
6507
|
+
"description": "Whether it has to display the week numbers in addition to week days.",
|
|
6508
|
+
"fieldName": "weekNumbers"
|
|
6320
6509
|
}
|
|
6321
6510
|
],
|
|
6322
6511
|
"mixins": [
|
|
@@ -48456,6 +48645,14 @@
|
|
|
48456
48645
|
"text": "Record<string, string>"
|
|
48457
48646
|
},
|
|
48458
48647
|
"default": "{ de: 'Ausgewählte Elemente:', en: 'Selected elements:', fr: 'Éléments sélectionnés:', it: 'Elementi selezionati:', }"
|
|
48648
|
+
},
|
|
48649
|
+
{
|
|
48650
|
+
"kind": "variable",
|
|
48651
|
+
"name": "i18nCalendarWeekNumber",
|
|
48652
|
+
"type": {
|
|
48653
|
+
"text": "Record<string, string>"
|
|
48654
|
+
},
|
|
48655
|
+
"default": "{ de: 'Woche', en: 'Week', fr: 'Semaine', it: 'Settimana', }"
|
|
48459
48656
|
}
|
|
48460
48657
|
],
|
|
48461
48658
|
"exports": [
|
|
@@ -49186,6 +49383,14 @@
|
|
|
49186
49383
|
"name": "i18nChipGroupInputDescription",
|
|
49187
49384
|
"module": "core/i18n/i18n.js"
|
|
49188
49385
|
}
|
|
49386
|
+
},
|
|
49387
|
+
{
|
|
49388
|
+
"kind": "js",
|
|
49389
|
+
"name": "i18nCalendarWeekNumber",
|
|
49390
|
+
"declaration": {
|
|
49391
|
+
"name": "i18nCalendarWeekNumber",
|
|
49392
|
+
"module": "core/i18n/i18n.js"
|
|
49393
|
+
}
|
|
49189
49394
|
}
|
|
49190
49395
|
]
|
|
49191
49396
|
},
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import { CSSResultGroup, LitElement, PropertyValues, TemplateResult } from 'lit';
|
|
2
2
|
export interface Day<T = Date> {
|
|
3
|
+
/** Date as ISO string. */
|
|
3
4
|
value: string;
|
|
4
5
|
dayValue: string;
|
|
5
6
|
monthValue: string;
|
|
6
7
|
yearValue: string;
|
|
7
8
|
dateValue?: T;
|
|
9
|
+
weekValue?: number;
|
|
10
|
+
weekDayValue?: number;
|
|
8
11
|
}
|
|
9
12
|
export interface Month {
|
|
10
13
|
value: string;
|
|
@@ -18,7 +21,7 @@ export interface Weekday {
|
|
|
18
21
|
export type CalendarView = 'day' | 'month' | 'year';
|
|
19
22
|
declare const SbbCalendarElement_base: import('../core/mixins.js').AbstractConstructor<import('../core/mixins.js').SbbHydrationMixinType> & typeof LitElement;
|
|
20
23
|
/**
|
|
21
|
-
* It displays a calendar which allows
|
|
24
|
+
* It displays a calendar which allows choosing a date.
|
|
22
25
|
*/
|
|
23
26
|
export declare class SbbCalendarElement<T = Date> extends SbbCalendarElement_base {
|
|
24
27
|
static styles: CSSResultGroup;
|
|
@@ -39,19 +42,23 @@ export declare class SbbCalendarElement<T = Date> extends SbbCalendarElement_bas
|
|
|
39
42
|
* Accepts an ISO8601 formatted string (e.g. 2024-12-24) as attribute.
|
|
40
43
|
*/
|
|
41
44
|
accessor max: T | null;
|
|
42
|
-
/**
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
45
|
+
/** Whether the calendar allows for multiple date selection. */
|
|
46
|
+
accessor multiple: boolean;
|
|
47
|
+
/**
|
|
48
|
+
* The selected date: accepts a date object, or, if `multiple`, an array of dates.
|
|
49
|
+
*/
|
|
50
|
+
set selected(value: T | T[] | null);
|
|
51
|
+
get selected(): T | T[] | null;
|
|
52
|
+
private accessor _selected;
|
|
46
53
|
/** A function used to filter out dates. */
|
|
47
54
|
accessor dateFilter: ((date: T | null) => boolean) | null;
|
|
48
55
|
/** The orientation of days in the calendar. */
|
|
49
56
|
accessor orientation: 'horizontal' | 'vertical';
|
|
57
|
+
/** Whether it has to display the week numbers in addition to week days. */
|
|
58
|
+
accessor weekNumbers: boolean;
|
|
50
59
|
private _dateAdapter;
|
|
51
60
|
/** The currently active date. */
|
|
52
61
|
private accessor _activeDate;
|
|
53
|
-
/** The selected date as ISOString. */
|
|
54
|
-
private accessor _selected;
|
|
55
62
|
/** The current wide property considering property value and breakpoints. From zero to small `wide` has always to be false. */
|
|
56
63
|
private set _wide(value);
|
|
57
64
|
private get _wide();
|
|
@@ -73,6 +80,10 @@ export declare class SbbCalendarElement<T = Date> extends SbbCalendarElement_bas
|
|
|
73
80
|
private _nextMonthWeeks;
|
|
74
81
|
/** An array containing all the month names in the current language. */
|
|
75
82
|
private _monthNames;
|
|
83
|
+
/** An array containing the weeks' numbers for the current month. */
|
|
84
|
+
private _weekNumbers;
|
|
85
|
+
/** An array containing the weeks' numbers for the next month in wide mode. */
|
|
86
|
+
private _nextMonthWeekNumbers;
|
|
76
87
|
/** A list of buttons corresponding to days, months or years depending on the view. */
|
|
77
88
|
private get _cells();
|
|
78
89
|
/** The chosen year in the year selection view. */
|
|
@@ -93,13 +104,31 @@ export declare class SbbCalendarElement<T = Date> extends SbbCalendarElement_bas
|
|
|
93
104
|
focus(): void;
|
|
94
105
|
protected willUpdate(changedProperties: PropertyValues<this>): void;
|
|
95
106
|
protected updated(changedProperties: PropertyValues<this>): void;
|
|
107
|
+
/**
|
|
108
|
+
* The `_selected` state should be adapted when the `multiple` property changes:
|
|
109
|
+
* - if it changes to true, the '_selected' is set to an array;
|
|
110
|
+
* - if it changes to false, the first available option is set as 'value' otherwise it's set to null.
|
|
111
|
+
*/
|
|
112
|
+
private _onMultipleChanged;
|
|
96
113
|
/** Initializes the component. */
|
|
97
114
|
private _init;
|
|
98
115
|
/** Focuses on a day cell prioritizing the selected day, the current day, and lastly, the first selectable day. */
|
|
99
116
|
private _focusCell;
|
|
100
117
|
/** Creates the array of weekdays. */
|
|
101
118
|
private _setWeekdays;
|
|
102
|
-
/**
|
|
119
|
+
/**
|
|
120
|
+
* Given a date, it returns the week numbers for the month the date belongs to.
|
|
121
|
+
* TODO: check if date-fns can be replaced with custom logic.
|
|
122
|
+
*
|
|
123
|
+
* Since the calculation is not simple (see https://en.wikipedia.org/wiki/Week#Numbering),
|
|
124
|
+
* the date-fns library has been used this way:
|
|
125
|
+
* the first and the last day of the month are calculated and then passed to the `eachWeekOfInterval` function,
|
|
126
|
+
* which returns an array containing the starting day of every ISO week of the month,
|
|
127
|
+
* considering Monday as the first day.
|
|
128
|
+
* Then, this array is mapped via the `getWeek` function, which returns the ISO week number for that date.
|
|
129
|
+
*/
|
|
130
|
+
private _createWeekNumbers;
|
|
131
|
+
/** Creates the rows along the horizontal direction and sets the parameters used in keyboard navigation. */
|
|
103
132
|
private _createWeekRows;
|
|
104
133
|
/**
|
|
105
134
|
* Creates the rows for each week in orientation='horizontal'.
|
|
@@ -150,6 +179,23 @@ export declare class SbbCalendarElement<T = Date> extends SbbCalendarElement_bas
|
|
|
150
179
|
private _isYearFilteredOut;
|
|
151
180
|
/** Emits the selected date and sets it internally. */
|
|
152
181
|
private _selectDate;
|
|
182
|
+
/**
|
|
183
|
+
* Handle multiple dates selection via weekNumber / weekDay buttons:
|
|
184
|
+
* - if Cmd or Ctrl are pressed, add the new date to the current ones;
|
|
185
|
+
* - if not,
|
|
186
|
+
* - if the new dates are the same of the current ones, it means that the same button has been clicked twice, so do nothing;
|
|
187
|
+
* - if not, the selected dates are the new ones.
|
|
188
|
+
*/
|
|
189
|
+
private _selectMultipleDates;
|
|
190
|
+
/**
|
|
191
|
+
* Emits the dateselected event given the detail (as T or T[] based on the value of the multiple flag).
|
|
192
|
+
*/
|
|
193
|
+
private _emitDateSelectedEvent;
|
|
194
|
+
/**
|
|
195
|
+
* In case of multiple selection, newly added days must be added to the existing ones, without duplication.
|
|
196
|
+
* If the days to add are exactly the same as the selected ones, the set must be emptied.
|
|
197
|
+
*/
|
|
198
|
+
private _updateSelectedWithMultipleDates;
|
|
153
199
|
private _setChosenYear;
|
|
154
200
|
private _assignActiveDate;
|
|
155
201
|
/** Goes to the month identified by the shift. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"calendar.component.d.ts","sourceRoot":"","sources":["../../../../src/elements/calendar/calendar.component.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"calendar.component.d.ts","sourceRoot":"","sources":["../../../../src/elements/calendar/calendar.component.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,cAAc,EAGnB,UAAU,EAEV,KAAK,cAAc,EACnB,KAAK,cAAc,EACpB,MAAM,KAAK,CAAC;AAoCb,OAAO,+BAA+B,CAAC;AACvC,OAAO,YAAY,CAAC;AACpB,OAAO,0BAA0B,CAAC;AAyClC,MAAM,WAAW,GAAG,CAAC,CAAC,GAAG,IAAI;IAC3B,0BAA0B;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,CAAC,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,KAAK;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,OAAO;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,MAAM,YAAY,GAAG,KAAK,GAAG,OAAO,GAAG,MAAM,CAAC;;AAEpD;;GAEG;AACH,qBAEM,kBAAkB,CAAC,CAAC,GAAG,IAAI,CAAE,SAAQ,uBAA6B;IACtE,OAAuB,MAAM,EAAE,cAAc,CAAS;IACtD,gBAA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