@melodicdev/components 3.1.0 → 4.0.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/assets/melodic-components.js +4269 -2377
- package/assets/melodic-components.js.map +1 -1
- package/assets/melodic-components.min.js +5477 -3831
- package/lib/components/data-display/calendar-view/calendar-view-month.template.d.ts.map +1 -1
- package/lib/components/data-display/calendar-view/calendar-view-month.template.js +17 -0
- package/lib/components/data-display/calendar-view/calendar-view.component.d.ts +23 -3
- package/lib/components/data-display/calendar-view/calendar-view.component.d.ts.map +1 -1
- package/lib/components/data-display/calendar-view/calendar-view.component.js +76 -21
- package/lib/components/data-display/calendar-view/calendar-view.utils.d.ts +9 -0
- package/lib/components/data-display/calendar-view/calendar-view.utils.d.ts.map +1 -1
- package/lib/components/data-display/calendar-view/calendar-view.utils.js +68 -19
- package/lib/components/data-display/data-grid/data-grid.component.d.ts +24 -0
- package/lib/components/data-display/data-grid/data-grid.component.d.ts.map +1 -1
- package/lib/components/data-display/data-grid/data-grid.component.js +104 -31
- package/lib/components/data-display/data-grid/data-grid.template.d.ts.map +1 -1
- package/lib/components/data-display/data-grid/data-grid.template.js +3 -0
- package/lib/components/data-display/table/table.component.d.ts +7 -0
- package/lib/components/data-display/table/table.component.d.ts.map +1 -1
- package/lib/components/data-display/table/table.component.js +20 -5
- package/lib/components/data-display/table/table.template.d.ts.map +1 -1
- package/lib/components/data-display/table/table.template.js +3 -0
- package/lib/components/data-display/table-core/index.d.ts +1 -0
- package/lib/components/data-display/table-core/index.d.ts.map +1 -1
- package/lib/components/data-display/table-core/index.js +1 -0
- package/lib/components/data-display/table-core/memo.d.ts +10 -0
- package/lib/components/data-display/table-core/memo.d.ts.map +1 -0
- package/lib/components/data-display/table-core/memo.js +20 -0
- package/lib/components/feedback/alert/alert.styles.d.ts.map +1 -1
- package/lib/components/feedback/alert/alert.styles.js +25 -0
- package/lib/components/feedback/progress/progress.styles.d.ts.map +1 -1
- package/lib/components/feedback/progress/progress.styles.js +8 -3
- package/lib/components/feedback/spinner/spinner.styles.d.ts.map +1 -1
- package/lib/components/feedback/spinner/spinner.styles.js +2 -11
- package/lib/components/feedback/toast/toast-container.template.d.ts.map +1 -1
- package/lib/components/feedback/toast/toast-container.template.js +4 -0
- package/lib/components/feedback/toast/toast.component.d.ts +3 -2
- package/lib/components/feedback/toast/toast.component.d.ts.map +1 -1
- package/lib/components/feedback/toast/toast.component.js +10 -0
- package/lib/components/feedback/toast/toast.service.d.ts +26 -6
- package/lib/components/feedback/toast/toast.service.d.ts.map +1 -1
- package/lib/components/feedback/toast/toast.service.js +53 -18
- package/lib/components/feedback/toast/toast.template.js +1 -1
- package/lib/components/forms/autocomplete/autocomplete.component.d.ts +7 -0
- package/lib/components/forms/autocomplete/autocomplete.component.d.ts.map +1 -1
- package/lib/components/forms/autocomplete/autocomplete.component.js +39 -0
- package/lib/components/forms/autocomplete/autocomplete.template.d.ts.map +1 -1
- package/lib/components/forms/autocomplete/autocomplete.template.js +5 -1
- package/lib/components/forms/button-group/button-group.component.d.ts +3 -2
- package/lib/components/forms/button-group/button-group.component.d.ts.map +1 -1
- package/lib/components/forms/button-group/button-group.component.js +11 -1
- package/lib/components/forms/checkbox/checkbox.component.d.ts +4 -0
- package/lib/components/forms/checkbox/checkbox.component.d.ts.map +1 -1
- package/lib/components/forms/checkbox/checkbox.component.js +5 -1
- package/lib/components/forms/checkbox/checkbox.template.d.ts.map +1 -1
- package/lib/components/forms/checkbox/checkbox.template.js +2 -0
- package/lib/components/forms/date-picker/calendar.component.d.ts +21 -0
- package/lib/components/forms/date-picker/calendar.component.d.ts.map +1 -1
- package/lib/components/forms/date-picker/calendar.component.js +69 -2
- package/lib/components/forms/date-picker/calendar.template.d.ts.map +1 -1
- package/lib/components/forms/date-picker/calendar.template.js +6 -3
- package/lib/components/forms/date-picker/date-picker.component.d.ts +6 -0
- package/lib/components/forms/date-picker/date-picker.component.d.ts.map +1 -1
- package/lib/components/forms/date-picker/date-picker.component.js +41 -12
- package/lib/components/forms/file-upload/file-upload.component.d.ts.map +1 -1
- package/lib/components/forms/file-upload/file-upload.component.js +15 -5
- package/lib/components/forms/form-field/form-field.component.d.ts +8 -0
- package/lib/components/forms/form-field/form-field.component.d.ts.map +1 -1
- package/lib/components/forms/form-field/form-field.component.js +41 -6
- package/lib/components/forms/form-field/form-field.template.js +1 -1
- package/lib/components/forms/input/input.component.d.ts +26 -3
- package/lib/components/forms/input/input.component.d.ts.map +1 -1
- package/lib/components/forms/input/input.component.js +46 -6
- package/lib/components/forms/input/input.template.d.ts.map +1 -1
- package/lib/components/forms/input/input.template.js +9 -0
- package/lib/components/forms/radio-card-group/radio-card-group.component.d.ts +6 -0
- package/lib/components/forms/radio-card-group/radio-card-group.component.d.ts.map +1 -1
- package/lib/components/forms/radio-card-group/radio-card-group.component.js +34 -0
- package/lib/components/forms/radio-card-group/radio-card.component.d.ts +6 -0
- package/lib/components/forms/radio-card-group/radio-card.component.d.ts.map +1 -1
- package/lib/components/forms/radio-card-group/radio-card.component.js +7 -1
- package/lib/components/forms/radio-card-group/radio-card.template.js +1 -1
- package/lib/components/forms/select/select.component.d.ts.map +1 -1
- package/lib/components/forms/select/select.component.js +13 -1
- package/lib/components/forms/select/select.template.d.ts.map +1 -1
- package/lib/components/forms/select/select.template.js +5 -1
- package/lib/components/forms/textarea/textarea.component.d.ts +10 -3
- package/lib/components/forms/textarea/textarea.component.d.ts.map +1 -1
- package/lib/components/forms/textarea/textarea.component.js +10 -5
- package/lib/components/forms/textarea/textarea.template.d.ts.map +1 -1
- package/lib/components/forms/textarea/textarea.template.js +2 -0
- package/lib/components/forms/time-picker/time-picker.component.d.ts +16 -0
- package/lib/components/forms/time-picker/time-picker.component.d.ts.map +1 -1
- package/lib/components/forms/time-picker/time-picker.component.js +43 -3
- package/lib/components/foundation/container/container.component.js +5 -5
- package/lib/components/foundation/container/container.styles.d.ts.map +1 -1
- package/lib/components/foundation/container/container.styles.js +10 -0
- package/lib/components/foundation/stack/stack.component.d.ts +6 -0
- package/lib/components/foundation/stack/stack.component.d.ts.map +1 -1
- package/lib/components/foundation/stack/stack.component.js +11 -5
- package/lib/components/foundation/stack/stack.styles.d.ts.map +1 -1
- package/lib/components/foundation/stack/stack.styles.js +14 -0
- package/lib/components/general/icon/icon.template.d.ts.map +1 -1
- package/lib/components/general/icon/icon.template.js +7 -1
- package/lib/components/navigation/breadcrumb/breadcrumb-item.template.d.ts.map +1 -1
- package/lib/components/navigation/breadcrumb/breadcrumb-item.template.js +2 -1
- package/lib/components/navigation/functions/match-by-route.function.d.ts +16 -0
- package/lib/components/navigation/functions/match-by-route.function.d.ts.map +1 -0
- package/lib/components/navigation/functions/match-by-route.function.js +34 -0
- package/lib/components/navigation/functions/route-link.function.d.ts +20 -0
- package/lib/components/navigation/functions/route-link.function.d.ts.map +1 -0
- package/lib/components/navigation/functions/route-link.function.js +34 -0
- package/lib/components/navigation/pagination/pagination.component.d.ts +8 -0
- package/lib/components/navigation/pagination/pagination.component.d.ts.map +1 -1
- package/lib/components/navigation/pagination/pagination.component.js +12 -2
- package/lib/components/navigation/pagination/pagination.styles.d.ts.map +1 -1
- package/lib/components/navigation/pagination/pagination.styles.js +10 -0
- package/lib/components/navigation/pagination/pagination.template.js +2 -2
- package/lib/components/navigation/sidebar/sidebar-item.template.d.ts.map +1 -1
- package/lib/components/navigation/sidebar/sidebar-item.template.js +5 -1
- package/lib/components/navigation/sidebar/sidebar.component.d.ts +12 -6
- package/lib/components/navigation/sidebar/sidebar.component.d.ts.map +1 -1
- package/lib/components/navigation/sidebar/sidebar.component.js +20 -12
- package/lib/components/navigation/sidebar/sidebar.template.d.ts.map +1 -1
- package/lib/components/navigation/sidebar/sidebar.template.js +5 -1
- package/lib/components/navigation/steps/step.component.d.ts.map +1 -1
- package/lib/components/navigation/steps/step.component.js +19 -1
- package/lib/components/navigation/steps/step.template.d.ts.map +1 -1
- package/lib/components/navigation/steps/step.template.js +6 -0
- package/lib/components/navigation/steps/steps.component.d.ts +10 -0
- package/lib/components/navigation/steps/steps.component.d.ts.map +1 -1
- package/lib/components/navigation/steps/steps.component.js +42 -9
- package/lib/components/navigation/steps/steps.template.js +9 -0
- package/lib/components/navigation/tabs/tab-panel.styles.d.ts.map +1 -1
- package/lib/components/navigation/tabs/tab-panel.styles.js +7 -2
- package/lib/components/navigation/tabs/tabs.component.d.ts +10 -0
- package/lib/components/navigation/tabs/tabs.component.d.ts.map +1 -1
- package/lib/components/navigation/tabs/tabs.component.js +36 -7
- package/lib/components/overlays/dialog/dialog-ref.class.d.ts +19 -9
- package/lib/components/overlays/dialog/dialog-ref.class.d.ts.map +1 -1
- package/lib/components/overlays/dialog/dialog-ref.class.js +37 -5
- package/lib/components/overlays/dropdown/dropdown.component.d.ts +7 -0
- package/lib/components/overlays/dropdown/dropdown.component.d.ts.map +1 -1
- package/lib/components/overlays/dropdown/dropdown.component.js +26 -11
- package/lib/components/overlays/popover/popover.component.d.ts +8 -0
- package/lib/components/overlays/popover/popover.component.d.ts.map +1 -1
- package/lib/components/overlays/popover/popover.component.js +17 -0
- package/lib/components/overlays/tooltip/tooltip.component.d.ts +6 -5
- package/lib/components/overlays/tooltip/tooltip.component.d.ts.map +1 -1
- package/lib/components/overlays/tooltip/tooltip.component.js +14 -10
- package/lib/components/sections/app-shell/app-shell.component.d.ts +13 -0
- package/lib/components/sections/app-shell/app-shell.component.d.ts.map +1 -1
- package/lib/components/sections/app-shell/app-shell.component.js +45 -1
- package/lib/components/sections/app-shell/app-shell.styles.d.ts.map +1 -1
- package/lib/components/sections/app-shell/app-shell.styles.js +15 -0
- package/lib/components/sections/app-shell/app-shell.template.d.ts.map +1 -1
- package/lib/components/sections/app-shell/app-shell.template.js +5 -0
- package/lib/components/sections/page-section/page-section.template.d.ts.map +1 -1
- package/lib/components/sections/page-section/page-section.template.js +6 -1
- package/lib/directives/tooltip.directive.d.ts.map +1 -1
- package/lib/directives/tooltip.directive.js +39 -6
- package/lib/theme/functions/apply-theme.function.d.ts +4 -1
- package/lib/theme/functions/apply-theme.function.d.ts.map +1 -1
- package/lib/theme/functions/apply-theme.function.js +20 -4
- package/lib/theme/functions/create-theme.function.js +0 -1
- package/lib/utils/accessibility/cross-root-aria.d.ts +40 -0
- package/lib/utils/accessibility/cross-root-aria.d.ts.map +1 -0
- package/lib/utils/accessibility/cross-root-aria.js +97 -0
- package/lib/utils/accessibility/index.d.ts +1 -0
- package/lib/utils/accessibility/index.d.ts.map +1 -1
- package/lib/utils/accessibility/index.js +1 -0
- package/lib/utils/directives/index.d.ts +1 -0
- package/lib/utils/directives/index.d.ts.map +1 -1
- package/lib/utils/directives/index.js +1 -0
- package/lib/utils/directives/watch-light-slots.d.ts +20 -0
- package/lib/utils/directives/watch-light-slots.d.ts.map +1 -0
- package/lib/utils/directives/watch-light-slots.js +36 -0
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"calendar-view-month.template.d.ts","sourceRoot":"","sources":["../../../../src/components/data-display/calendar-view/calendar-view-month.template.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;
|
|
1
|
+
{"version":3,"file":"calendar-view-month.template.d.ts","sourceRoot":"","sources":["../../../../src/components/data-display/calendar-view/calendar-view-month.template.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AAiC1E,wBAAgB,eAAe,CAAC,CAAC,EAAE,qBAAqB,6CAmEvD"}
|
|
@@ -2,13 +2,25 @@ import { html, repeat, when, classMap } from '@melodicdev/core';
|
|
|
2
2
|
import { formatTime } from './calendar-view.utils.js';
|
|
3
3
|
function renderEventPill(c, event) {
|
|
4
4
|
const color = event.color || 'blue';
|
|
5
|
+
// A click-only <div> is invisible to keyboard and assistive tech; give the
|
|
6
|
+
// pill a button role, a tab stop and Enter/Space activation.
|
|
5
7
|
return html `
|
|
6
8
|
<div
|
|
7
9
|
class=${classMap({
|
|
8
10
|
'ml-cv__event-pill': true,
|
|
9
11
|
[`ml-cv__event-pill--${color}`]: true
|
|
10
12
|
})}
|
|
13
|
+
role="button"
|
|
14
|
+
tabindex="0"
|
|
15
|
+
aria-label=${event.title}
|
|
11
16
|
@click=${(e) => { e.stopPropagation(); c.handleEventClick(event); }}
|
|
17
|
+
@keydown=${(e) => {
|
|
18
|
+
if (e.key !== 'Enter' && e.key !== ' ')
|
|
19
|
+
return;
|
|
20
|
+
e.preventDefault();
|
|
21
|
+
e.stopPropagation();
|
|
22
|
+
c.handleEventClick(event);
|
|
23
|
+
}}
|
|
12
24
|
>
|
|
13
25
|
${when(!event.allDay, () => html `
|
|
14
26
|
<span class="ml-cv__event-pill-time">${formatTime(event.start)}</span>
|
|
@@ -47,7 +59,12 @@ export function renderMonthView(c) {
|
|
|
47
59
|
'ml-cv__day-cell': true,
|
|
48
60
|
'ml-cv__day-cell--other-month': !day.isCurrentMonth
|
|
49
61
|
})}
|
|
62
|
+
role="gridcell"
|
|
63
|
+
tabindex=${day.iso === c.dayTabStop ? '0' : '-1'}
|
|
64
|
+
data-key=${day.iso}
|
|
65
|
+
aria-label=${day.iso}
|
|
50
66
|
@click=${() => c.handleDateClick(day.iso)}
|
|
67
|
+
@keydown=${(e) => c.handleDayKeyDown(day.iso, e)}
|
|
51
68
|
>
|
|
52
69
|
<div class=${classMap({
|
|
53
70
|
'ml-cv__day-number': true,
|
|
@@ -20,6 +20,13 @@ export declare class CalendarViewComponent implements IElementRef, OnCreate, OnD
|
|
|
20
20
|
view: CalendarViewMode;
|
|
21
21
|
/** Navigated date (ISO date string) */
|
|
22
22
|
date: string;
|
|
23
|
+
/**
|
|
24
|
+
* BCP 47 locale for month and weekday names. Defaults to the document's
|
|
25
|
+
* `lang` (then the browser's) — these used to be hardcoded English arrays,
|
|
26
|
+
* so the calendar showed "January" and "Mon" on every page regardless of
|
|
27
|
+
* language.
|
|
28
|
+
*/
|
|
29
|
+
locale: string;
|
|
23
30
|
/** Day the week starts on (0=Sunday, 1=Monday) */
|
|
24
31
|
weekStartsOn: number;
|
|
25
32
|
/** Maximum visible events per day cell in month view */
|
|
@@ -42,9 +49,15 @@ export declare class CalendarViewComponent implements IElementRef, OnCreate, OnD
|
|
|
42
49
|
get hasHeaderLeftSlot(): boolean;
|
|
43
50
|
/** Check if header-actions slot has consumer content */
|
|
44
51
|
get hasHeaderActionsSlot(): boolean;
|
|
45
|
-
/**
|
|
46
|
-
|
|
47
|
-
|
|
52
|
+
/**
|
|
53
|
+
* Mini calendar state for the day-view sidebar.
|
|
54
|
+
*
|
|
55
|
+
* Public (not `_`-prefixed) on purpose: `_` fields are excluded from
|
|
56
|
+
* reactivity, so the previous/next buttons changed the month and nothing
|
|
57
|
+
* re-rendered — the mini calendar simply never moved.
|
|
58
|
+
*/
|
|
59
|
+
miniCalYear: number;
|
|
60
|
+
miniCalMonth: number;
|
|
48
61
|
private _hasScrolledToTime;
|
|
49
62
|
private _boundCloseDropdown;
|
|
50
63
|
private get _currentDate();
|
|
@@ -81,6 +94,13 @@ export declare class CalendarViewComponent implements IElementRef, OnCreate, OnD
|
|
|
81
94
|
toggleViewDropdown: () => void;
|
|
82
95
|
setView: (view: CalendarViewMode) => void;
|
|
83
96
|
handleEventClick: (event: CalendarEvent) => void;
|
|
97
|
+
/**
|
|
98
|
+
* Key of the single tabbable day cell. A month grid is one tab stop;
|
|
99
|
+
* arrows move within it (the cells were previously not focusable at all).
|
|
100
|
+
*/
|
|
101
|
+
rovingDay: string;
|
|
102
|
+
get dayTabStop(): string;
|
|
103
|
+
handleDayKeyDown: (iso: string, event: KeyboardEvent) => void;
|
|
84
104
|
handleDateClick: (iso: string) => void;
|
|
85
105
|
handleAddEvent: () => void;
|
|
86
106
|
handleAddEventOnDate: (iso: string) => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"calendar-view.component.d.ts","sourceRoot":"","sources":["../../../../src/components/data-display/calendar-view/calendar-view.component.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACnF,OAAO,KAAK,EAAE,gBAAgB,EAAE,aAAa,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"calendar-view.component.d.ts","sourceRoot":"","sources":["../../../../src/components/data-display/calendar-view/calendar-view.component.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACnF,OAAO,KAAK,EAAE,gBAAgB,EAAE,aAAa,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAyBrH;;;;;;;;;;;;;GAaG;AACH,qBAiBa,qBAAsB,YAAW,WAAW,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ;IAChF,UAAU,EAAG,WAAW,CAAC;IAEhC,wBAAwB;IACjB,IAAI,EAAE,gBAAgB,CAAW;IAExC,uCAAuC;IAChC,IAAI,SAAM;IAEjB;;;;;OAKG;IACI,MAAM,SAAM;IAEnB,kDAAkD;IAC3C,YAAY,SAAK;IAExB,wDAAwD;IACjD,gBAAgB,SAAK;IAE5B,qCAAqC;IAC9B,aAAa,SAAe;IAEnC,uCAAuC;IAChC,OAAO,UAAS;IAEvB,8BAA8B;IACvB,eAAe,UAAS;IAE/B,6BAA6B;IACtB,gBAAgB,UAAS;IAEhC,gCAAgC;IACzB,aAAa,UAAS;IAE7B,sCAAsC;IAC/B,MAAM,EAAE,aAAa,EAAE,CAAM;IAEpC,wCAAwC;IACjC,kBAAkB,UAAS;IAElC,qDAAqD;IACrD,IAAW,iBAAiB,IAAI,OAAO,CAEtC;IAED,wDAAwD;IACxD,IAAW,oBAAoB,IAAI,OAAO,CAEzC;IAED;;;;;;OAMG;IACI,WAAW,SAAK;IAChB,YAAY,SAAK;IACx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G,IAAI,CAQpD;IAEF;;;OAGG;IACI,SAAS,SAAM;IAEtB,IAAW,UAAU,IAAI,MAAM,CAW9B;IAEM,gBAAgB,GAAI,KAAK,MAAM,EAAE,OAAO,aAAa,KAAG,IAAI,CAyBjE;IAEK,eAAe,GAAI,KAAK,MAAM,KAAG,IAAI,CAQ1C;IAEK,cAAc,QAAO,IAAI,CAQ9B;IAEK,oBAAoB,GAAI,KAAK,MAAM,KAAG,IAAI,CAQ/C;IAEK,cAAc,GAAI,KAAK,MAAM,KAAG,IAAI,CAIzC;IAIK,gBAAgB,QAAO,IAAI,CAOhC;IAEK,gBAAgB,QAAO,IAAI,CAOhC;IAEK,mBAAmB,GAAI,KAAK,MAAM,KAAG,IAAI,CAE9C;IAIF,OAAO,CAAC,OAAO;CAYf"}
|
|
@@ -5,7 +5,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
5
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
7
|
import { MelodicComponent } from '@melodicdev/core';
|
|
8
|
-
import { toIsoDate, parseDate, addDays, addMonths, startOfWeek, getMonthGrid, getWeekColumns, getDayColumn, getWeekdayHeaders, getISOWeekNumber, formatMonthYear, formatDateRange, getMonthAbbrev, getDayName, getEventsForDate, getTimeSlots, getMonthGrid as getMiniGrid, getMiniCalendarDots } from './calendar-view.utils.js';
|
|
8
|
+
import { setCalendarLocale, toIsoDate, parseDate, addDays, addMonths, startOfWeek, getMonthGrid, getWeekColumns, getDayColumn, getWeekdayHeaders, getISOWeekNumber, formatMonthYear, formatDateRange, getMonthAbbrev, getDayName, getEventsForDate, getTimeSlots, getMonthGrid as getMiniGrid, getMiniCalendarDots } from './calendar-view.utils.js';
|
|
9
9
|
import { calendarViewTemplate } from './calendar-view.template.js';
|
|
10
10
|
import { calendarViewStyles } from './calendar-view.styles.js';
|
|
11
11
|
/**
|
|
@@ -28,6 +28,13 @@ let CalendarViewComponent = class CalendarViewComponent {
|
|
|
28
28
|
this.view = 'month';
|
|
29
29
|
/** Navigated date (ISO date string) */
|
|
30
30
|
this.date = '';
|
|
31
|
+
/**
|
|
32
|
+
* BCP 47 locale for month and weekday names. Defaults to the document's
|
|
33
|
+
* `lang` (then the browser's) — these used to be hardcoded English arrays,
|
|
34
|
+
* so the calendar showed "January" and "Mon" on every page regardless of
|
|
35
|
+
* language.
|
|
36
|
+
*/
|
|
37
|
+
this.locale = '';
|
|
31
38
|
/** Day the week starts on (0=Sunday, 1=Monday) */
|
|
32
39
|
this.weekStartsOn = 0;
|
|
33
40
|
/** Maximum visible events per day cell in month view */
|
|
@@ -46,9 +53,15 @@ let CalendarViewComponent = class CalendarViewComponent {
|
|
|
46
53
|
this.events = [];
|
|
47
54
|
/** Whether the view dropdown is open */
|
|
48
55
|
this.isViewDropdownOpen = false;
|
|
49
|
-
/**
|
|
50
|
-
|
|
51
|
-
|
|
56
|
+
/**
|
|
57
|
+
* Mini calendar state for the day-view sidebar.
|
|
58
|
+
*
|
|
59
|
+
* Public (not `_`-prefixed) on purpose: `_` fields are excluded from
|
|
60
|
+
* reactivity, so the previous/next buttons changed the month and nothing
|
|
61
|
+
* re-rendered — the mini calendar simply never moved.
|
|
62
|
+
*/
|
|
63
|
+
this.miniCalYear = 0;
|
|
64
|
+
this.miniCalMonth = 0;
|
|
52
65
|
this._hasScrolledToTime = false;
|
|
53
66
|
this._boundCloseDropdown = null;
|
|
54
67
|
/* ── Navigation handlers ── */
|
|
@@ -105,6 +118,33 @@ let CalendarViewComponent = class CalendarViewComponent {
|
|
|
105
118
|
detail: { event }
|
|
106
119
|
}));
|
|
107
120
|
};
|
|
121
|
+
/**
|
|
122
|
+
* Key of the single tabbable day cell. A month grid is one tab stop;
|
|
123
|
+
* arrows move within it (the cells were previously not focusable at all).
|
|
124
|
+
*/
|
|
125
|
+
this.rovingDay = '';
|
|
126
|
+
this.handleDayKeyDown = (iso, event) => {
|
|
127
|
+
if (event.key === 'Enter' || event.key === ' ') {
|
|
128
|
+
event.preventDefault();
|
|
129
|
+
this.handleDateClick(iso);
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
132
|
+
const deltas = { ArrowLeft: -1, ArrowRight: 1, ArrowUp: -7, ArrowDown: 7 };
|
|
133
|
+
const delta = deltas[event.key];
|
|
134
|
+
if (delta === undefined) {
|
|
135
|
+
return;
|
|
136
|
+
}
|
|
137
|
+
const grid = this.monthGrid;
|
|
138
|
+
const index = grid.findIndex((day) => day.iso === iso);
|
|
139
|
+
const next = grid[index + delta];
|
|
140
|
+
if (index === -1 || !next) {
|
|
141
|
+
return;
|
|
142
|
+
}
|
|
143
|
+
event.preventDefault();
|
|
144
|
+
this.rovingDay = next.iso;
|
|
145
|
+
const cell = this.elementRef.shadowRoot?.querySelector(`.ml-cv__day-cell[data-key="${next.iso}"]`);
|
|
146
|
+
cell?.focus();
|
|
147
|
+
};
|
|
108
148
|
this.handleDateClick = (iso) => {
|
|
109
149
|
this.elementRef.dispatchEvent(new CustomEvent('ml:date-click', {
|
|
110
150
|
bubbles: true,
|
|
@@ -133,21 +173,21 @@ let CalendarViewComponent = class CalendarViewComponent {
|
|
|
133
173
|
};
|
|
134
174
|
/* ── Mini calendar handlers ── */
|
|
135
175
|
this.miniCalPrevMonth = () => {
|
|
136
|
-
if (this.
|
|
137
|
-
this.
|
|
138
|
-
this.
|
|
176
|
+
if (this.miniCalMonth === 0) {
|
|
177
|
+
this.miniCalMonth = 11;
|
|
178
|
+
this.miniCalYear--;
|
|
139
179
|
}
|
|
140
180
|
else {
|
|
141
|
-
this.
|
|
181
|
+
this.miniCalMonth--;
|
|
142
182
|
}
|
|
143
183
|
};
|
|
144
184
|
this.miniCalNextMonth = () => {
|
|
145
|
-
if (this.
|
|
146
|
-
this.
|
|
147
|
-
this.
|
|
185
|
+
if (this.miniCalMonth === 11) {
|
|
186
|
+
this.miniCalMonth = 0;
|
|
187
|
+
this.miniCalYear++;
|
|
148
188
|
}
|
|
149
189
|
else {
|
|
150
|
-
this.
|
|
190
|
+
this.miniCalMonth++;
|
|
151
191
|
}
|
|
152
192
|
};
|
|
153
193
|
this.handleMiniCalSelect = (iso) => {
|
|
@@ -169,6 +209,7 @@ let CalendarViewComponent = class CalendarViewComponent {
|
|
|
169
209
|
return new Date();
|
|
170
210
|
}
|
|
171
211
|
onCreate() {
|
|
212
|
+
setCalendarLocale(this.locale);
|
|
172
213
|
// Initialize date if not set
|
|
173
214
|
if (!this.date) {
|
|
174
215
|
const now = new Date();
|
|
@@ -176,8 +217,8 @@ let CalendarViewComponent = class CalendarViewComponent {
|
|
|
176
217
|
}
|
|
177
218
|
// Init mini cal to current date's month
|
|
178
219
|
const d = this._currentDate;
|
|
179
|
-
this.
|
|
180
|
-
this.
|
|
220
|
+
this.miniCalYear = d.getFullYear();
|
|
221
|
+
this.miniCalMonth = d.getMonth();
|
|
181
222
|
// Close dropdown on outside click
|
|
182
223
|
this._boundCloseDropdown = (e) => {
|
|
183
224
|
if (!this.isViewDropdownOpen)
|
|
@@ -199,6 +240,9 @@ let CalendarViewComponent = class CalendarViewComponent {
|
|
|
199
240
|
}
|
|
200
241
|
}
|
|
201
242
|
onRender() {
|
|
243
|
+
// Re-apply before every render, so a later `locale` write is picked up
|
|
244
|
+
// by the month/weekday getters the template is about to read.
|
|
245
|
+
setCalendarLocale(this.locale);
|
|
202
246
|
// Auto-scroll time grid to ~6 AM on initial load
|
|
203
247
|
if ((this.view === 'week' || this.view === 'day') && !this._hasScrolledToTime) {
|
|
204
248
|
const shadow = this.elementRef.shadowRoot;
|
|
@@ -270,26 +314,36 @@ let CalendarViewComponent = class CalendarViewComponent {
|
|
|
270
314
|
}
|
|
271
315
|
get dayViewDateLabel() {
|
|
272
316
|
const d = this._currentDate;
|
|
273
|
-
return d.toLocaleDateString(
|
|
317
|
+
return d.toLocaleDateString(this.locale || undefined, { weekday: 'long', month: 'long', day: 'numeric' });
|
|
274
318
|
}
|
|
275
319
|
/* ── Mini calendar getters (day view sidebar) ── */
|
|
276
320
|
get miniCalendarTitle() {
|
|
277
|
-
return formatMonthYear(new Date(this.
|
|
321
|
+
return formatMonthYear(new Date(this.miniCalYear, this.miniCalMonth, 1));
|
|
278
322
|
}
|
|
279
323
|
get miniCalendarWeekdays() {
|
|
280
324
|
return getWeekdayHeaders(this.weekStartsOn).map((h) => h.short.charAt(0));
|
|
281
325
|
}
|
|
282
326
|
get miniCalendarGrid() {
|
|
283
|
-
return getMiniGrid(this.
|
|
327
|
+
return getMiniGrid(this.miniCalYear, this.miniCalMonth, this.weekStartsOn);
|
|
284
328
|
}
|
|
285
329
|
get miniCalendarDots() {
|
|
286
|
-
return getMiniCalendarDots(this.
|
|
330
|
+
return getMiniCalendarDots(this.miniCalYear, this.miniCalMonth, this.events);
|
|
331
|
+
}
|
|
332
|
+
get dayTabStop() {
|
|
333
|
+
const grid = this.monthGrid;
|
|
334
|
+
if (grid.length === 0) {
|
|
335
|
+
return '';
|
|
336
|
+
}
|
|
337
|
+
if (this.rovingDay && grid.some((day) => day.iso === this.rovingDay)) {
|
|
338
|
+
return this.rovingDay;
|
|
339
|
+
}
|
|
340
|
+
return (grid.find((day) => day.isToday) ?? grid.find((day) => day.isCurrentMonth) ?? grid[0]).iso;
|
|
287
341
|
}
|
|
288
342
|
/* ── Private helpers ── */
|
|
289
343
|
setDate(d) {
|
|
290
344
|
this.date = toIsoDate(d.getFullYear(), d.getMonth(), d.getDate());
|
|
291
|
-
this.
|
|
292
|
-
this.
|
|
345
|
+
this.miniCalYear = d.getFullYear();
|
|
346
|
+
this.miniCalMonth = d.getMonth();
|
|
293
347
|
this.elementRef.dispatchEvent(new CustomEvent('ml:date-change', {
|
|
294
348
|
bubbles: true,
|
|
295
349
|
composed: true,
|
|
@@ -311,7 +365,8 @@ CalendarViewComponent = __decorate([
|
|
|
311
365
|
'hide-nav',
|
|
312
366
|
'hide-today-button',
|
|
313
367
|
'hide-view-selector',
|
|
314
|
-
'hide-add-button'
|
|
368
|
+
'hide-add-button',
|
|
369
|
+
'locale'
|
|
315
370
|
]
|
|
316
371
|
})
|
|
317
372
|
], CalendarViewComponent);
|
|
@@ -1,4 +1,13 @@
|
|
|
1
1
|
import type { CalendarEvent, CalendarDayCell, CalendarTimeColumn, PositionedEvent } from './calendar-view.types.js';
|
|
2
|
+
export declare function setCalendarLocale(locale: string | undefined): void;
|
|
3
|
+
/** Full month names for the active locale ("January"). */
|
|
4
|
+
export declare function monthNames(): string[];
|
|
5
|
+
/** Abbreviated month names for the active locale ("Jan"). */
|
|
6
|
+
export declare function monthAbbrevs(): string[];
|
|
7
|
+
/** Full weekday names, Sunday first, for the active locale. */
|
|
8
|
+
export declare function dayNames(): string[];
|
|
9
|
+
/** Abbreviated weekday names, Sunday first, for the active locale. */
|
|
10
|
+
export declare function dayAbbrevs(): string[];
|
|
2
11
|
/** 30-minute time slots = 48 rows for 24 hours */
|
|
3
12
|
export declare const TIME_INCREMENT = 30;
|
|
4
13
|
export declare const TOTAL_ROWS = 48;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"calendar-view.utils.d.ts","sourceRoot":"","sources":["../../../../src/components/data-display/calendar-view/calendar-view.utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,eAAe,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAepH,kDAAkD;AAClD,eAAO,MAAM,cAAc,KAAK,CAAC;AACjC,eAAO,MAAM,UAAU,KAAK,CAAC;AAE7B,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAE1E;AAED,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAG3C;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAEhD;AAED,mEAAmE;AACnE,wBAAgB,cAAc,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM,CAEjD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,aAAa,EAAE,CAKtF;AAED,wBAAgB,cAAc,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM,CAEjD;AAED,wBAAgB,YAAY,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM,CAE/C;AAED,wBAAgB,UAAU,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM,CAE7C;AA6BD,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,aAAa,EAAE,GAAG,eAAe,EAAE,CAsFlF;AAED,wBAAgB,YAAY,IAAI;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,EAAE,CAWhF;AAED,wBAAgB,cAAc,CAAC,IAAI,EAAE,IAAI,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,EAAE,aAAa,EAAE,GAAG,kBAAkB,EAAE,CAa9G;AAED,wBAAgB,YAAY,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,aAAa,EAAE,GAAG,kBAAkB,CAUpF;AAED,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,aAAa,EAAE,GAAG,GAAG,CAAC,MAAM,CAAC,CAUrG"}
|
|
1
|
+
{"version":3,"file":"calendar-view.utils.d.ts","sourceRoot":"","sources":["../../../../src/components/data-display/calendar-view/calendar-view.utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,eAAe,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAepH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,CAElE;AAuCD,0DAA0D;AAC1D,wBAAgB,UAAU,IAAI,MAAM,EAAE,CAErC;AAED,6DAA6D;AAC7D,wBAAgB,YAAY,IAAI,MAAM,EAAE,CAEvC;AAED,+DAA+D;AAC/D,wBAAgB,QAAQ,IAAI,MAAM,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AAG,GAAG,CAAC,MAAM,CAAC,CAUrG"}
|
|
@@ -1,13 +1,62 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Month and weekday names, resolved through `Intl` for the active locale.
|
|
3
|
+
*
|
|
4
|
+
* These were hardcoded English arrays, so the calendar rendered "January" and
|
|
5
|
+
* "Mon" no matter what language the page was in. `setCalendarLocale()` (or
|
|
6
|
+
* `<ml-calendar-view locale="fr-FR">`) changes them; the default follows
|
|
7
|
+
* `document.documentElement.lang`, falling back to the browser locale.
|
|
8
|
+
*
|
|
9
|
+
* The formatters are built once per locale — constructing an `Intl` formatter
|
|
10
|
+
* is expensive and these run inside render.
|
|
11
|
+
*/
|
|
12
|
+
let activeLocale;
|
|
13
|
+
export function setCalendarLocale(locale) {
|
|
14
|
+
activeLocale = locale || undefined;
|
|
15
|
+
}
|
|
16
|
+
function resolvedLocale() {
|
|
17
|
+
if (activeLocale) {
|
|
18
|
+
return activeLocale;
|
|
19
|
+
}
|
|
20
|
+
if (typeof document !== 'undefined') {
|
|
21
|
+
const lang = document.documentElement.lang?.trim();
|
|
22
|
+
if (lang) {
|
|
23
|
+
return lang;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
return undefined;
|
|
27
|
+
}
|
|
28
|
+
const nameCache = new Map();
|
|
29
|
+
function names(kind, width) {
|
|
30
|
+
const locale = resolvedLocale() ?? 'default';
|
|
31
|
+
const key = `${locale}:${kind}:${width}`;
|
|
32
|
+
const cached = nameCache.get(key);
|
|
33
|
+
if (cached) {
|
|
34
|
+
return cached;
|
|
35
|
+
}
|
|
36
|
+
const formatter = new Intl.DateTimeFormat(resolvedLocale(), kind === 'month' ? { month: width } : { weekday: width });
|
|
37
|
+
// 2021-01-03 was a Sunday, so index 0 is Sunday, matching Date#getDay().
|
|
38
|
+
const values = kind === 'month'
|
|
39
|
+
? Array.from({ length: 12 }, (_, i) => formatter.format(new Date(2021, i, 1)))
|
|
40
|
+
: Array.from({ length: 7 }, (_, i) => formatter.format(new Date(2021, 0, 3 + i)));
|
|
41
|
+
nameCache.set(key, values);
|
|
42
|
+
return values;
|
|
43
|
+
}
|
|
44
|
+
/** Full month names for the active locale ("January"). */
|
|
45
|
+
export function monthNames() {
|
|
46
|
+
return names('month', 'long');
|
|
47
|
+
}
|
|
48
|
+
/** Abbreviated month names for the active locale ("Jan"). */
|
|
49
|
+
export function monthAbbrevs() {
|
|
50
|
+
return names('month', 'short');
|
|
51
|
+
}
|
|
52
|
+
/** Full weekday names, Sunday first, for the active locale. */
|
|
53
|
+
export function dayNames() {
|
|
54
|
+
return names('weekday', 'long');
|
|
55
|
+
}
|
|
56
|
+
/** Abbreviated weekday names, Sunday first, for the active locale. */
|
|
57
|
+
export function dayAbbrevs() {
|
|
58
|
+
return names('weekday', 'short');
|
|
59
|
+
}
|
|
11
60
|
/** 30-minute time slots = 48 rows for 24 hours */
|
|
12
61
|
export const TIME_INCREMENT = 30;
|
|
13
62
|
export const TOTAL_ROWS = 48;
|
|
@@ -76,11 +125,11 @@ export function formatTime(iso) {
|
|
|
76
125
|
return m === 0 ? `${hour} ${ampm}` : `${hour}:${String(m).padStart(2, '0')} ${ampm}`;
|
|
77
126
|
}
|
|
78
127
|
export function formatMonthYear(date) {
|
|
79
|
-
return `${
|
|
128
|
+
return `${monthNames()[date.getMonth()]} ${date.getFullYear()}`;
|
|
80
129
|
}
|
|
81
130
|
export function formatDateRange(start, end) {
|
|
82
|
-
const sMonth =
|
|
83
|
-
const eMonth =
|
|
131
|
+
const sMonth = monthAbbrevs()[start.getMonth()];
|
|
132
|
+
const eMonth = monthAbbrevs()[end.getMonth()];
|
|
84
133
|
if (start.getMonth() === end.getMonth() && start.getFullYear() === end.getFullYear()) {
|
|
85
134
|
return `${sMonth} ${start.getDate()} – ${end.getDate()}, ${start.getFullYear()}`;
|
|
86
135
|
}
|
|
@@ -143,7 +192,7 @@ export function getWeekDays(date, weekStartsOn = 0) {
|
|
|
143
192
|
export function getWeekdayHeaders(weekStartsOn = 0) {
|
|
144
193
|
return Array.from({ length: 7 }, (_, i) => {
|
|
145
194
|
const idx = (weekStartsOn + i) % 7;
|
|
146
|
-
return { short:
|
|
195
|
+
return { short: dayAbbrevs()[idx], full: dayNames()[idx] };
|
|
147
196
|
});
|
|
148
197
|
}
|
|
149
198
|
export function getEventsForDate(events, iso) {
|
|
@@ -153,13 +202,13 @@ export function getEventsForDate(events, iso) {
|
|
|
153
202
|
return events.filter(e => toLocalIsoDate(parseEventDate(e.start)) === iso);
|
|
154
203
|
}
|
|
155
204
|
export function getMonthAbbrev(date) {
|
|
156
|
-
return
|
|
205
|
+
return monthAbbrevs()[date.getMonth()];
|
|
157
206
|
}
|
|
158
207
|
export function getDayAbbrev(date) {
|
|
159
|
-
return
|
|
208
|
+
return dayAbbrevs()[date.getDay()];
|
|
160
209
|
}
|
|
161
210
|
export function getDayName(date) {
|
|
162
|
-
return
|
|
211
|
+
return dayNames()[date.getDay()];
|
|
163
212
|
}
|
|
164
213
|
/** Convert minutes from midnight to a 1-based grid row (30-min increments, 48 rows) */
|
|
165
214
|
function minutesToGridRow(minutes) {
|
|
@@ -279,7 +328,7 @@ export function getWeekColumns(date, weekStartsOn, events) {
|
|
|
279
328
|
const dayEvents = getEventsForDate(events, iso).filter(e => !e.allDay);
|
|
280
329
|
return {
|
|
281
330
|
date: iso,
|
|
282
|
-
dayLabel:
|
|
331
|
+
dayLabel: dayAbbrevs()[d.getDay()],
|
|
283
332
|
dayNumber: d.getDate(),
|
|
284
333
|
isToday: isToday(d),
|
|
285
334
|
events: layoutOverlappingEvents(dayEvents)
|
|
@@ -291,7 +340,7 @@ export function getDayColumn(date, events) {
|
|
|
291
340
|
const dayEvents = getEventsForDate(events, iso).filter(e => !e.allDay);
|
|
292
341
|
return {
|
|
293
342
|
date: iso,
|
|
294
|
-
dayLabel:
|
|
343
|
+
dayLabel: dayAbbrevs()[date.getDay()],
|
|
295
344
|
dayNumber: date.getDate(),
|
|
296
345
|
isToday: isToday(date),
|
|
297
346
|
events: layoutOverlappingEvents(dayEvents)
|
|
@@ -76,8 +76,22 @@ export declare class DataGridComponent implements IElementRef, OnCreate, OnDestr
|
|
|
76
76
|
onPropertyChange(name: string, _oldVal: unknown, newVal: unknown): void;
|
|
77
77
|
onCreate(): void;
|
|
78
78
|
onRender(): void;
|
|
79
|
+
/**
|
|
80
|
+
* Publish the header height as a CSS variable for the sticky filter row.
|
|
81
|
+
*
|
|
82
|
+
* `getBoundingClientRect()` forces a synchronous layout, and this ran on
|
|
83
|
+
* every render — including the render each `pointermove` of a column
|
|
84
|
+
* resize produced. Only write when the value actually changed, and skip
|
|
85
|
+
* entirely while resizing (the header height cannot change then).
|
|
86
|
+
*/
|
|
87
|
+
private _headerHeight;
|
|
88
|
+
private syncHeaderHeight;
|
|
79
89
|
onDestroy(): void;
|
|
80
90
|
private _syncColumnState;
|
|
91
|
+
private readonly _filteredRowsMemo;
|
|
92
|
+
private readonly _sortedRowsMemo;
|
|
93
|
+
private readonly _pagedRowsMemo;
|
|
94
|
+
private get _filterKey();
|
|
81
95
|
get filteredRows(): Record<string, unknown>[];
|
|
82
96
|
get sortedRows(): Record<string, unknown>[];
|
|
83
97
|
get pagedRows(): Record<string, unknown>[];
|
|
@@ -105,7 +119,17 @@ export declare class DataGridComponent implements IElementRef, OnCreate, OnDestr
|
|
|
105
119
|
handleRowClick: (row: Record<string, unknown>, index: number) => void;
|
|
106
120
|
handleResizeStart: (key: string, e: PointerEvent) => void;
|
|
107
121
|
handleResizeMove: (key: string, e: PointerEvent) => void;
|
|
122
|
+
private _pendingResizeWidth;
|
|
108
123
|
handleResizeEnd: () => void;
|
|
124
|
+
/**
|
|
125
|
+
* Keyboard equivalents for the header's mouse-only interactions.
|
|
126
|
+
*
|
|
127
|
+
* Enter/Space sorts; Ctrl/Cmd + Arrow moves the column. Drag-and-drop
|
|
128
|
+
* reordering and click-to-sort were otherwise unreachable without a mouse.
|
|
129
|
+
*/
|
|
130
|
+
handleHeaderKeyDown: (col: DataGridColumn, event: KeyboardEvent) => void;
|
|
131
|
+
/** Move a column `delta` positions and announce the new order. */
|
|
132
|
+
moveColumn: (key: string, delta: number) => void;
|
|
109
133
|
handleDragStart: (key: string, e: DragEvent) => void;
|
|
110
134
|
handleDragOver: (key: string, e: DragEvent) => void;
|
|
111
135
|
handleDragEnd: () => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"data-grid.component.d.ts","sourceRoot":"","sources":["../../../../src/components/data-display/data-grid/data-grid.component.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACrG,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"data-grid.component.d.ts","sourceRoot":"","sources":["../../../../src/components/data-display/data-grid/data-grid.component.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACrG,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAM1E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,qBAiBa,iBAAkB,YAAW,WAAW,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE,gBAAgB;IAC9F,UAAU,EAAG,WAAW,CAAC;IAIhC,0CAA0C;IACnC,UAAU,UAAS;IAE1B,kCAAkC;IAC3B,OAAO,UAAS;IAEvB,8BAA8B;IACvB,SAAS,UAAQ;IAExB,wBAAwB;IACjB,IAAI,EAAE,IAAI,GAAG,IAAI,CAAQ;IAEhC,2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