@vonage/vivid 3.39.0 → 3.41.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/accordion/index.js +2 -2
- package/accordion-item/index.js +2 -2
- package/alert/index.js +7 -5
- package/audio-player/index.js +33 -0
- package/avatar/index.js +2 -2
- package/badge/index.js +2 -2
- package/banner/index.js +9 -5
- package/breadcrumb/index.js +1 -1
- package/breadcrumb-item/index.js +3 -3
- package/button/index.js +5 -4
- package/calendar/index.js +1 -1
- package/calendar-event/index.js +1 -1
- package/card/index.js +4 -3
- package/checkbox/index.js +3 -3
- package/combobox/index.js +9 -7
- package/custom-elements.json +809 -5
- package/data-grid/index.js +3 -2
- package/date-picker/index.js +11 -9
- package/date-range-picker/index.js +11 -9
- package/dialog/index.js +10 -6
- package/divider/index.js +1 -1
- package/elevation/index.js +1 -1
- package/empty-state/index.js +2 -2
- package/fab/index.js +3 -3
- package/file-picker/index.js +6 -5
- package/focus/index.js +1 -1
- package/header/index.js +2 -2
- package/icon/index.js +1 -1
- package/index.js +60 -55
- package/layout/index.js +1 -1
- package/lib/alert/alert.d.ts +3 -1
- package/lib/alert/locale.d.ts +3 -0
- package/lib/audio-player/audio-player.d.ts +17 -0
- package/lib/audio-player/audio-player.template.d.ts +4 -0
- package/lib/audio-player/definition.d.ts +4 -0
- package/lib/audio-player/locale.d.ts +5 -0
- package/lib/banner/banner.d.ts +3 -1
- package/lib/banner/locale.d.ts +3 -0
- package/lib/card/card.d.ts +3 -0
- package/lib/card/card.template.d.ts +1 -1
- package/lib/card/definition.d.ts +1 -0
- package/lib/checkbox/checkbox.d.ts +2 -0
- package/lib/components.d.ts +2 -0
- package/lib/dialog/dialog.d.ts +4 -0
- package/lib/dialog/locale.d.ts +3 -0
- package/lib/enums.d.ts +2 -1
- package/lib/menu/menu.d.ts +1 -0
- package/lib/number-field/locale.d.ts +4 -0
- package/lib/number-field/number-field.d.ts +4 -2
- package/lib/progress/progress.d.ts +1 -0
- package/lib/progress-ring/progress-ring.d.ts +1 -0
- package/lib/radio/radio.d.ts +1 -0
- package/lib/selectable-box/definition.d.ts +3 -0
- package/lib/selectable-box/selectable-box.d.ts +12 -0
- package/lib/selectable-box/selectable-box.template.d.ts +4 -0
- package/lib/slider/definition.d.ts +1 -0
- package/lib/slider/slider.d.ts +5 -0
- package/lib/split-button/locale.d.ts +3 -0
- package/lib/split-button/split-button.d.ts +3 -1
- package/lib/text-area/text-area.d.ts +3 -0
- package/lib/text-field/text-field.d.ts +5 -2
- package/listbox/index.js +5 -4
- package/locales/en-GB.js +21 -0
- package/locales/en-US.js +21 -0
- package/locales/ja-JP.js +21 -0
- package/locales/zh-CN.js +21 -0
- package/menu/index.js +9 -8
- package/menu-item/index.js +3 -3
- package/nav/index.js +1 -1
- package/nav-disclosure/index.js +3 -3
- package/nav-item/index.js +3 -3
- package/note/index.js +2 -2
- package/number-field/index.js +8 -6
- package/option/index.js +3 -3
- package/package.json +1 -1
- package/pagination/index.js +6 -5
- package/popup/index.js +7 -6
- package/progress/index.js +1 -1
- package/progress-ring/index.js +1 -1
- package/radio/index.js +2 -2
- package/radio-group/index.js +2 -2
- package/select/index.js +10 -8
- package/selectable-box/index.js +23 -0
- package/shared/Reflector.js +65 -0
- package/shared/date-picker/calendar/segment.d.ts +21 -0
- package/shared/date-picker/date-picker-base.d.ts +1 -0
- package/shared/definition.js +3 -3
- package/shared/definition10.js +89 -227
- package/shared/definition11.js +151 -29
- package/shared/definition12.js +37 -766
- package/shared/definition13.js +747 -106
- package/shared/definition14.js +122 -192
- package/shared/definition15.js +156 -664
- package/shared/definition16.js +576 -1123
- package/shared/definition17.js +1278 -143
- package/shared/definition18.js +64 -298
- package/shared/definition19.js +358 -211
- package/shared/definition2.js +2 -2
- package/shared/definition20.js +259 -67
- package/shared/definition21.js +66 -58
- package/shared/definition22.js +43 -84
- package/shared/definition23.js +76 -2352
- package/shared/definition24.js +2362 -45
- package/shared/definition25.js +63 -27
- package/shared/definition26.js +24 -51
- package/shared/definition27.js +36 -813
- package/shared/definition28.js +837 -49
- package/shared/definition29.js +52 -89
- package/shared/definition3.js +1 -1
- package/shared/definition30.js +88 -24
- package/shared/definition31.js +25 -12
- package/shared/definition32.js +12 -52
- package/shared/definition33.js +28 -487
- package/shared/definition34.js +442 -197
- package/shared/definition35.js +260 -185
- package/shared/definition36.js +188 -69
- package/shared/definition37.js +72 -52
- package/shared/definition38.js +65 -421
- package/shared/definition39.js +435 -35
- package/shared/definition4.js +44 -16
- package/shared/definition40.js +32 -680
- package/shared/definition41.js +661 -77
- package/shared/definition42.js +103 -555
- package/shared/definition43.js +76 -103
- package/shared/definition44.js +522 -87
- package/shared/definition45.js +133 -22
- package/shared/definition46.js +131 -58
- package/shared/definition47.js +16 -501
- package/shared/definition48.js +69 -23
- package/shared/definition49.js +477 -108
- package/shared/definition5.js +160 -44
- package/shared/definition50.js +25 -271
- package/shared/definition51.js +103 -122
- package/shared/definition52.js +277 -122
- package/shared/definition53.js +274 -103
- package/shared/definition54.js +126 -71
- package/shared/definition55.js +128 -294
- package/shared/definition56.js +91 -13
- package/shared/definition57.js +298 -39
- package/shared/definition58.js +11 -175
- package/shared/definition59.js +47 -0
- package/shared/definition6.js +43 -33
- package/shared/definition60.js +181 -0
- package/shared/definition7.js +39 -105
- package/shared/definition8.js +122 -38
- package/shared/definition9.js +56 -89
- package/shared/enums.js +72 -0
- package/shared/icon.js +2 -2
- package/shared/index2.js +28 -1
- package/shared/key-codes.js +1 -1
- package/shared/key-codes2.js +9 -0
- package/shared/listbox.js +3 -8
- package/shared/localization/Locale.d.ts +12 -0
- package/shared/patterns/form-elements/form-elements.d.ts +6 -6
- package/shared/presentationDate.js +196 -143
- package/shared/radio.js +7 -0
- package/shared/text-field.js +1 -1
- package/shared/utils/Reflector.d.ts +8 -0
- package/shared/utils/randomId.d.ts +1 -0
- package/side-drawer/index.js +1 -1
- package/slider/index.js +3 -3
- package/split-button/index.js +6 -3
- package/style.css +889 -722
- package/styles/core/all.css +1 -1
- package/styles/core/theme.css +1 -1
- package/styles/core/typography.css +1 -1
- package/styles/tokens/theme-dark.css +4 -4
- package/styles/tokens/theme-light.css +4 -4
- package/styles/tokens/vivid-2-compat.css +1 -1
- package/switch/index.js +3 -3
- package/tab/index.js +3 -3
- package/tab-panel/index.js +1 -1
- package/tabs/index.js +5 -5
- package/tag/index.js +3 -3
- package/tag-group/index.js +1 -1
- package/text-area/index.js +4 -3
- package/text-field/index.js +4 -3
- package/toggletip/index.js +8 -7
- package/tooltip/index.js +8 -7
- package/tree-item/index.js +3 -3
- package/tree-view/index.js +1 -1
- package/vivid.api.json +392 -0
package/shared/definition16.js
CHANGED
|
@@ -1,1137 +1,627 @@
|
|
|
1
|
-
import { a as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
1
|
+
import { D as DOM, O as Observable, _ as __decorate, a as attr, o as observable, h as html, r as registerFactory } from './index.js';
|
|
2
|
+
import { a as iconRegistries } from './definition26.js';
|
|
3
|
+
import { P as Popup, p as popupRegistries } from './definition60.js';
|
|
4
|
+
import { f as focusRegistries } from './definition58.js';
|
|
5
|
+
import { a as listboxOptionRegistries } from './definition35.js';
|
|
6
|
+
import { s as styles$1 } from './text-field.js';
|
|
7
|
+
import { A as AffixIcon, a as affixIconTemplateFactory } from './affix.js';
|
|
8
|
+
import { f as formElements } from './index2.js';
|
|
9
|
+
import { b as Listbox, D as DelegatesARIAListbox, a as Listbox$1 } from './listbox.js';
|
|
10
|
+
import { S as StartEnd } from './start-end.js';
|
|
11
|
+
import { S as SelectPosition } from './select.options.js';
|
|
12
|
+
import { a as applyMixins } from './apply-mixins.js';
|
|
13
|
+
import { F as FormAssociated } from './form-associated.js';
|
|
14
|
+
import { l as limit } from './numbers.js';
|
|
15
|
+
import { u as uniqueId } from './strings.js';
|
|
8
16
|
import { f as focusTemplateFactory } from './focus2.js';
|
|
17
|
+
import { r as ref } from './ref.js';
|
|
18
|
+
import { s as slotted } from './slotted.js';
|
|
9
19
|
import { w as when } from './when.js';
|
|
20
|
+
import { c as classNames } from './class-names.js';
|
|
10
21
|
|
|
22
|
+
class _Combobox extends Listbox {
|
|
23
|
+
}
|
|
11
24
|
/**
|
|
12
|
-
*
|
|
13
|
-
*
|
|
25
|
+
* A form-associated base class for the {@link (Combobox:class)} component.
|
|
26
|
+
*
|
|
27
|
+
* @internal
|
|
14
28
|
*/
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
29
|
+
class FormAssociatedCombobox extends FormAssociated(_Combobox) {
|
|
30
|
+
constructor() {
|
|
31
|
+
super(...arguments);
|
|
32
|
+
this.proxy = document.createElement("input");
|
|
33
|
+
}
|
|
34
|
+
}
|
|
19
35
|
|
|
20
36
|
/**
|
|
21
|
-
*
|
|
22
|
-
* default option generates a non-sticky header row
|
|
23
|
-
*
|
|
37
|
+
* Autocomplete values for combobox.
|
|
24
38
|
* @public
|
|
25
39
|
*/
|
|
26
|
-
const
|
|
40
|
+
const ComboboxAutocomplete = {
|
|
41
|
+
inline: "inline",
|
|
42
|
+
list: "list",
|
|
43
|
+
both: "both",
|
|
27
44
|
none: "none",
|
|
28
|
-
default: "default",
|
|
29
|
-
sticky: "sticky",
|
|
30
|
-
};
|
|
31
|
-
/**
|
|
32
|
-
* Enumerates possible data grid cell types.
|
|
33
|
-
*
|
|
34
|
-
* @public
|
|
35
|
-
*/
|
|
36
|
-
const DataGridCellTypes = {
|
|
37
|
-
default: "default",
|
|
38
|
-
columnHeader: "columnheader",
|
|
39
|
-
rowHeader: "rowheader",
|
|
40
|
-
};
|
|
41
|
-
/**
|
|
42
|
-
* Enumerates possible data grid row types
|
|
43
|
-
*
|
|
44
|
-
* @public
|
|
45
|
-
*/
|
|
46
|
-
const DataGridRowTypes$1 = {
|
|
47
|
-
default: "default",
|
|
48
|
-
header: "header",
|
|
49
|
-
stickyHeader: "sticky-header",
|
|
50
45
|
};
|
|
51
46
|
|
|
52
47
|
/**
|
|
53
|
-
* A
|
|
48
|
+
* A Combobox Custom HTML Element.
|
|
49
|
+
* Implements the {@link https://w3c.github.io/aria-practices/#combobox | ARIA combobox }.
|
|
50
|
+
*
|
|
51
|
+
* @slot start - Content which can be provided before the input
|
|
52
|
+
* @slot end - Content which can be provided after the input
|
|
53
|
+
* @slot control - Used to replace the input element representing the combobox
|
|
54
|
+
* @slot indicator - The visual indicator representing the expanded state
|
|
55
|
+
* @slot - The default slot for the options
|
|
56
|
+
* @csspart control - The wrapper element containing the input area, including start and end
|
|
57
|
+
* @csspart selected-value - The input element representing the selected value
|
|
58
|
+
* @csspart indicator - The element wrapping the indicator slot
|
|
59
|
+
* @csspart listbox - The wrapper for the listbox slotted options
|
|
60
|
+
* @fires change - Fires a custom 'change' event when the value updates
|
|
54
61
|
*
|
|
55
|
-
* @fires row-focused - Fires a custom 'row-focused' event when focus is on an element (usually a cell or its contents) in the row
|
|
56
|
-
* @slot - The default slot for custom cell elements
|
|
57
62
|
* @public
|
|
58
63
|
*/
|
|
59
|
-
let
|
|
64
|
+
let Combobox$1 = class Combobox extends FormAssociatedCombobox {
|
|
60
65
|
constructor() {
|
|
61
66
|
super(...arguments);
|
|
62
67
|
/**
|
|
63
|
-
* The
|
|
68
|
+
* The internal value property.
|
|
64
69
|
*
|
|
65
|
-
* @
|
|
66
|
-
* @remarks
|
|
67
|
-
* HTML Attribute: row-type
|
|
70
|
+
* @internal
|
|
68
71
|
*/
|
|
69
|
-
this.
|
|
72
|
+
this._value = "";
|
|
70
73
|
/**
|
|
71
|
-
* The
|
|
74
|
+
* The collection of currently filtered options.
|
|
72
75
|
*
|
|
73
76
|
* @public
|
|
74
77
|
*/
|
|
75
|
-
this.
|
|
78
|
+
this.filteredOptions = [];
|
|
76
79
|
/**
|
|
77
|
-
* The
|
|
80
|
+
* The current filter value.
|
|
78
81
|
*
|
|
79
|
-
* @
|
|
82
|
+
* @internal
|
|
83
|
+
*/
|
|
84
|
+
this.filter = "";
|
|
85
|
+
/**
|
|
86
|
+
* The initial state of the position attribute.
|
|
87
|
+
*
|
|
88
|
+
* @internal
|
|
80
89
|
*/
|
|
81
|
-
this.
|
|
90
|
+
this.forcedPosition = false;
|
|
82
91
|
/**
|
|
83
|
-
*
|
|
92
|
+
* The unique id for the internal listbox element.
|
|
84
93
|
*
|
|
85
94
|
* @internal
|
|
86
95
|
*/
|
|
87
|
-
this.
|
|
88
|
-
this.cellsRepeatBehavior = null;
|
|
89
|
-
this.cellsPlaceholder = null;
|
|
96
|
+
this.listboxId = uniqueId("listbox-");
|
|
90
97
|
/**
|
|
98
|
+
* The max height for the listbox when opened.
|
|
99
|
+
*
|
|
91
100
|
* @internal
|
|
92
101
|
*/
|
|
93
|
-
this.
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
102
|
+
this.maxHeight = 0;
|
|
103
|
+
/**
|
|
104
|
+
* The open attribute.
|
|
105
|
+
*
|
|
106
|
+
* @public
|
|
107
|
+
* @remarks
|
|
108
|
+
* HTML Attribute: open
|
|
109
|
+
*/
|
|
110
|
+
this.open = false;
|
|
98
111
|
}
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
112
|
+
/**
|
|
113
|
+
* Reset the element to its first selectable option when its parent form is reset.
|
|
114
|
+
*
|
|
115
|
+
* @internal
|
|
116
|
+
*/
|
|
117
|
+
formResetCallback() {
|
|
118
|
+
super.formResetCallback();
|
|
119
|
+
this.setDefaultSelectedOption();
|
|
120
|
+
this.updateValue();
|
|
103
121
|
}
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
}
|
|
122
|
+
/** {@inheritDoc (FormAssociated:interface).validate} */
|
|
123
|
+
validate() {
|
|
124
|
+
super.validate(this.control);
|
|
108
125
|
}
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
this.refocusOnLoad = true;
|
|
112
|
-
return;
|
|
113
|
-
}
|
|
126
|
+
get isAutocompleteInline() {
|
|
127
|
+
return (this.autocomplete === ComboboxAutocomplete.inline || this.isAutocompleteBoth);
|
|
114
128
|
}
|
|
115
|
-
|
|
116
|
-
this.
|
|
129
|
+
get isAutocompleteList() {
|
|
130
|
+
return this.autocomplete === ComboboxAutocomplete.list || this.isAutocompleteBoth;
|
|
117
131
|
}
|
|
118
|
-
|
|
119
|
-
this.
|
|
132
|
+
get isAutocompleteBoth() {
|
|
133
|
+
return this.autocomplete === ComboboxAutocomplete.both;
|
|
120
134
|
}
|
|
121
135
|
/**
|
|
136
|
+
* Sets focus and synchronize ARIA attributes when the open property changes.
|
|
137
|
+
*
|
|
138
|
+
* @param prev - the previous open value
|
|
139
|
+
* @param next - the current open value
|
|
140
|
+
*
|
|
122
141
|
* @internal
|
|
123
142
|
*/
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
this.
|
|
130
|
-
|
|
131
|
-
this.
|
|
132
|
-
|
|
133
|
-
/* eslint-disable-next-line @typescript-eslint/no-non-null-assertion */
|
|
134
|
-
this.$fastController.addBehaviors([this.cellsRepeatBehavior]);
|
|
135
|
-
}
|
|
136
|
-
this.addEventListener("cell-focused", this.handleCellFocus);
|
|
137
|
-
this.addEventListener(eventFocusOut, this.handleFocusout);
|
|
138
|
-
this.addEventListener(eventKeyDown, this.handleKeydown);
|
|
139
|
-
this.updateRowStyle();
|
|
140
|
-
if (this.refocusOnLoad) {
|
|
141
|
-
// if focus was on the row when data changed try to refocus on same cell
|
|
142
|
-
this.refocusOnLoad = false;
|
|
143
|
-
if (this.cellElements.length > this.focusColumnIndex) {
|
|
144
|
-
this.cellElements[this.focusColumnIndex].focus();
|
|
145
|
-
}
|
|
143
|
+
openChanged() {
|
|
144
|
+
if (this.open) {
|
|
145
|
+
this.ariaControls = this.listboxId;
|
|
146
|
+
this.ariaExpanded = "true";
|
|
147
|
+
this.setPositioning();
|
|
148
|
+
this.focusAndScrollOptionIntoView();
|
|
149
|
+
// focus is directed to the element when `open` is changed programmatically
|
|
150
|
+
DOM.queueUpdate(() => this.focus());
|
|
151
|
+
return;
|
|
146
152
|
}
|
|
153
|
+
this.ariaControls = "";
|
|
154
|
+
this.ariaExpanded = "false";
|
|
147
155
|
}
|
|
148
156
|
/**
|
|
149
|
-
*
|
|
157
|
+
* The list of options.
|
|
158
|
+
*
|
|
159
|
+
* @public
|
|
160
|
+
* @remarks
|
|
161
|
+
* Overrides `Listbox.options`.
|
|
150
162
|
*/
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
this.
|
|
154
|
-
this.removeEventListener(eventFocusOut, this.handleFocusout);
|
|
155
|
-
this.removeEventListener(eventKeyDown, this.handleKeydown);
|
|
156
|
-
}
|
|
157
|
-
handleFocusout(e) {
|
|
158
|
-
if (!this.contains(e.target)) {
|
|
159
|
-
this.isActiveRow = false;
|
|
160
|
-
this.focusColumnIndex = 0;
|
|
161
|
-
}
|
|
163
|
+
get options() {
|
|
164
|
+
Observable.track(this, "options");
|
|
165
|
+
return this.filteredOptions.length ? this.filteredOptions : this._options;
|
|
162
166
|
}
|
|
163
|
-
|
|
164
|
-
this.
|
|
165
|
-
this
|
|
166
|
-
this.$emit("row-focused", this);
|
|
167
|
-
}
|
|
168
|
-
handleKeydown(e) {
|
|
169
|
-
if (e.defaultPrevented) {
|
|
170
|
-
return;
|
|
171
|
-
}
|
|
172
|
-
let newFocusColumnIndex = 0;
|
|
173
|
-
switch (e.key) {
|
|
174
|
-
case keyArrowLeft:
|
|
175
|
-
// focus left one cell
|
|
176
|
-
newFocusColumnIndex = Math.max(0, this.focusColumnIndex - 1);
|
|
177
|
-
this.cellElements[newFocusColumnIndex].focus();
|
|
178
|
-
e.preventDefault();
|
|
179
|
-
break;
|
|
180
|
-
case keyArrowRight:
|
|
181
|
-
// focus right one cell
|
|
182
|
-
newFocusColumnIndex = Math.min(this.cellElements.length - 1, this.focusColumnIndex + 1);
|
|
183
|
-
this.cellElements[newFocusColumnIndex].focus();
|
|
184
|
-
e.preventDefault();
|
|
185
|
-
break;
|
|
186
|
-
case keyHome:
|
|
187
|
-
if (!e.ctrlKey) {
|
|
188
|
-
this.cellElements[0].focus();
|
|
189
|
-
e.preventDefault();
|
|
190
|
-
}
|
|
191
|
-
break;
|
|
192
|
-
case keyEnd:
|
|
193
|
-
if (!e.ctrlKey) {
|
|
194
|
-
// focus last cell of the row
|
|
195
|
-
this.cellElements[this.cellElements.length - 1].focus();
|
|
196
|
-
e.preventDefault();
|
|
197
|
-
}
|
|
198
|
-
break;
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
updateItemTemplate() {
|
|
202
|
-
this.activeCellItemTemplate =
|
|
203
|
-
this.rowType === DataGridRowTypes$1.default &&
|
|
204
|
-
this.cellItemTemplate !== undefined
|
|
205
|
-
? this.cellItemTemplate
|
|
206
|
-
: this.rowType === DataGridRowTypes$1.default &&
|
|
207
|
-
this.cellItemTemplate === undefined
|
|
208
|
-
? this.defaultCellItemTemplate
|
|
209
|
-
: this.headerCellItemTemplate !== undefined
|
|
210
|
-
? this.headerCellItemTemplate
|
|
211
|
-
: this.defaultHeaderCellItemTemplate;
|
|
212
|
-
}
|
|
213
|
-
};
|
|
214
|
-
__decorate([
|
|
215
|
-
attr({ attribute: "grid-template-columns" })
|
|
216
|
-
], DataGridRow$1.prototype, "gridTemplateColumns", void 0);
|
|
217
|
-
__decorate([
|
|
218
|
-
attr({ attribute: "row-type" })
|
|
219
|
-
], DataGridRow$1.prototype, "rowType", void 0);
|
|
220
|
-
__decorate([
|
|
221
|
-
observable
|
|
222
|
-
], DataGridRow$1.prototype, "rowData", void 0);
|
|
223
|
-
__decorate([
|
|
224
|
-
observable
|
|
225
|
-
], DataGridRow$1.prototype, "columnDefinitions", void 0);
|
|
226
|
-
__decorate([
|
|
227
|
-
observable
|
|
228
|
-
], DataGridRow$1.prototype, "cellItemTemplate", void 0);
|
|
229
|
-
__decorate([
|
|
230
|
-
observable
|
|
231
|
-
], DataGridRow$1.prototype, "headerCellItemTemplate", void 0);
|
|
232
|
-
__decorate([
|
|
233
|
-
observable
|
|
234
|
-
], DataGridRow$1.prototype, "rowIndex", void 0);
|
|
235
|
-
__decorate([
|
|
236
|
-
observable
|
|
237
|
-
], DataGridRow$1.prototype, "isActiveRow", void 0);
|
|
238
|
-
__decorate([
|
|
239
|
-
observable
|
|
240
|
-
], DataGridRow$1.prototype, "activeCellItemTemplate", void 0);
|
|
241
|
-
__decorate([
|
|
242
|
-
observable
|
|
243
|
-
], DataGridRow$1.prototype, "defaultCellItemTemplate", void 0);
|
|
244
|
-
__decorate([
|
|
245
|
-
observable
|
|
246
|
-
], DataGridRow$1.prototype, "defaultHeaderCellItemTemplate", void 0);
|
|
247
|
-
__decorate([
|
|
248
|
-
observable
|
|
249
|
-
], DataGridRow$1.prototype, "cellElements", void 0);
|
|
250
|
-
|
|
251
|
-
/**
|
|
252
|
-
* A Data Grid Custom HTML Element.
|
|
253
|
-
*
|
|
254
|
-
* @slot - The default slot for custom row elements
|
|
255
|
-
* @public
|
|
256
|
-
*/
|
|
257
|
-
let DataGrid$1 = class DataGrid extends FoundationElement {
|
|
258
|
-
constructor() {
|
|
259
|
-
super();
|
|
260
|
-
/**
|
|
261
|
-
* When true the component will not add itself to the tab queue.
|
|
262
|
-
* Default is false.
|
|
263
|
-
*
|
|
264
|
-
* @public
|
|
265
|
-
* @remarks
|
|
266
|
-
* HTML Attribute: no-tabbing
|
|
267
|
-
*/
|
|
268
|
-
this.noTabbing = false;
|
|
269
|
-
/**
|
|
270
|
-
* Whether the grid should automatically generate a header row and its type
|
|
271
|
-
*
|
|
272
|
-
* @public
|
|
273
|
-
* @remarks
|
|
274
|
-
* HTML Attribute: generate-header
|
|
275
|
-
*/
|
|
276
|
-
this.generateHeader = GenerateHeaderOptions$1.default;
|
|
277
|
-
/**
|
|
278
|
-
* The data being displayed in the grid
|
|
279
|
-
*
|
|
280
|
-
* @public
|
|
281
|
-
*/
|
|
282
|
-
this.rowsData = [];
|
|
283
|
-
/**
|
|
284
|
-
* The column definitions of the grid
|
|
285
|
-
*
|
|
286
|
-
* @public
|
|
287
|
-
*/
|
|
288
|
-
this.columnDefinitions = null;
|
|
289
|
-
/**
|
|
290
|
-
* The index of the row that will receive focus the next time the
|
|
291
|
-
* grid is focused. This value changes as focus moves to different
|
|
292
|
-
* rows within the grid. Changing this value when focus is already
|
|
293
|
-
* within the grid moves focus to the specified row.
|
|
294
|
-
*
|
|
295
|
-
* @public
|
|
296
|
-
*/
|
|
297
|
-
this.focusRowIndex = 0;
|
|
298
|
-
/**
|
|
299
|
-
* The index of the column that will receive focus the next time the
|
|
300
|
-
* grid is focused. This value changes as focus moves to different rows
|
|
301
|
-
* within the grid. Changing this value when focus is already within
|
|
302
|
-
* the grid moves focus to the specified column.
|
|
303
|
-
*
|
|
304
|
-
* @public
|
|
305
|
-
*/
|
|
306
|
-
this.focusColumnIndex = 0;
|
|
307
|
-
this.rowsPlaceholder = null;
|
|
308
|
-
this.generatedHeader = null;
|
|
309
|
-
this.isUpdatingFocus = false;
|
|
310
|
-
this.pendingFocusUpdate = false;
|
|
311
|
-
this.rowindexUpdateQueued = false;
|
|
312
|
-
this.columnDefinitionsStale = true;
|
|
313
|
-
this.generatedGridTemplateColumns = "";
|
|
314
|
-
this.focusOnCell = (rowIndex, columnIndex, scrollIntoView) => {
|
|
315
|
-
if (this.rowElements.length === 0) {
|
|
316
|
-
this.focusRowIndex = 0;
|
|
317
|
-
this.focusColumnIndex = 0;
|
|
318
|
-
return;
|
|
319
|
-
}
|
|
320
|
-
const focusRowIndex = Math.max(0, Math.min(this.rowElements.length - 1, rowIndex));
|
|
321
|
-
const focusRow = this.rowElements[focusRowIndex];
|
|
322
|
-
const cells = focusRow.querySelectorAll('[role="cell"], [role="gridcell"], [role="columnheader"], [role="rowheader"]');
|
|
323
|
-
const focusColumnIndex = Math.max(0, Math.min(cells.length - 1, columnIndex));
|
|
324
|
-
const focusTarget = cells[focusColumnIndex];
|
|
325
|
-
if (scrollIntoView &&
|
|
326
|
-
this.scrollHeight !== this.clientHeight &&
|
|
327
|
-
((focusRowIndex < this.focusRowIndex && this.scrollTop > 0) ||
|
|
328
|
-
(focusRowIndex > this.focusRowIndex &&
|
|
329
|
-
this.scrollTop < this.scrollHeight - this.clientHeight))) {
|
|
330
|
-
focusTarget.scrollIntoView({ block: "center", inline: "center" });
|
|
331
|
-
}
|
|
332
|
-
focusTarget.focus();
|
|
333
|
-
};
|
|
334
|
-
this.onChildListChange = (mutations,
|
|
335
|
-
/* eslint-disable-next-line @typescript-eslint/no-unused-vars */
|
|
336
|
-
observer) => {
|
|
337
|
-
if (mutations && mutations.length) {
|
|
338
|
-
mutations.forEach((mutation) => {
|
|
339
|
-
mutation.addedNodes.forEach((newNode) => {
|
|
340
|
-
if (newNode.nodeType === 1 &&
|
|
341
|
-
newNode.getAttribute("role") === "row") {
|
|
342
|
-
newNode.columnDefinitions = this.columnDefinitions;
|
|
343
|
-
}
|
|
344
|
-
});
|
|
345
|
-
});
|
|
346
|
-
this.queueRowIndexUpdate();
|
|
347
|
-
}
|
|
348
|
-
};
|
|
349
|
-
this.queueRowIndexUpdate = () => {
|
|
350
|
-
if (!this.rowindexUpdateQueued) {
|
|
351
|
-
this.rowindexUpdateQueued = true;
|
|
352
|
-
DOM.queueUpdate(this.updateRowIndexes);
|
|
353
|
-
}
|
|
354
|
-
};
|
|
355
|
-
this.updateRowIndexes = () => {
|
|
356
|
-
let newGridTemplateColumns = this.gridTemplateColumns;
|
|
357
|
-
if (newGridTemplateColumns === undefined) {
|
|
358
|
-
// try to generate columns based on manual rows
|
|
359
|
-
if (this.generatedGridTemplateColumns === "" && this.rowElements.length > 0) {
|
|
360
|
-
const firstRow = this.rowElements[0];
|
|
361
|
-
this.generatedGridTemplateColumns = new Array(firstRow.cellElements.length)
|
|
362
|
-
.fill("1fr")
|
|
363
|
-
.join(" ");
|
|
364
|
-
}
|
|
365
|
-
newGridTemplateColumns = this.generatedGridTemplateColumns;
|
|
366
|
-
}
|
|
367
|
-
this.rowElements.forEach((element, index) => {
|
|
368
|
-
const thisRow = element;
|
|
369
|
-
thisRow.rowIndex = index;
|
|
370
|
-
thisRow.gridTemplateColumns = newGridTemplateColumns;
|
|
371
|
-
if (this.columnDefinitionsStale) {
|
|
372
|
-
thisRow.columnDefinitions = this.columnDefinitions;
|
|
373
|
-
}
|
|
374
|
-
});
|
|
375
|
-
this.rowindexUpdateQueued = false;
|
|
376
|
-
this.columnDefinitionsStale = false;
|
|
377
|
-
};
|
|
167
|
+
set options(value) {
|
|
168
|
+
this._options = value;
|
|
169
|
+
Observable.notify(this, "options");
|
|
378
170
|
}
|
|
379
171
|
/**
|
|
380
|
-
*
|
|
172
|
+
* Updates the placeholder on the proxy element.
|
|
173
|
+
* @internal
|
|
381
174
|
*/
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
templateColumns = `${templateColumns}${templateColumns === "" ? "" : " "}${"1fr"}`;
|
|
386
|
-
});
|
|
387
|
-
return templateColumns;
|
|
388
|
-
}
|
|
389
|
-
noTabbingChanged() {
|
|
390
|
-
if (this.$fastController.isConnected) {
|
|
391
|
-
if (this.noTabbing) {
|
|
392
|
-
this.setAttribute("tabIndex", "-1");
|
|
393
|
-
}
|
|
394
|
-
else {
|
|
395
|
-
this.setAttribute("tabIndex", this.contains(document.activeElement) ||
|
|
396
|
-
this === document.activeElement
|
|
397
|
-
? "-1"
|
|
398
|
-
: "0");
|
|
399
|
-
}
|
|
175
|
+
placeholderChanged() {
|
|
176
|
+
if (this.proxy instanceof HTMLInputElement) {
|
|
177
|
+
this.proxy.placeholder = this.placeholder;
|
|
400
178
|
}
|
|
401
179
|
}
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
}
|
|
180
|
+
positionChanged(prev, next) {
|
|
181
|
+
this.positionAttribute = next;
|
|
182
|
+
this.setPositioning();
|
|
406
183
|
}
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
184
|
+
/**
|
|
185
|
+
* The value property.
|
|
186
|
+
*
|
|
187
|
+
* @public
|
|
188
|
+
*/
|
|
189
|
+
get value() {
|
|
190
|
+
Observable.track(this, "value");
|
|
191
|
+
return this._value;
|
|
192
|
+
}
|
|
193
|
+
set value(next) {
|
|
194
|
+
var _a, _b, _c;
|
|
195
|
+
const prev = `${this._value}`;
|
|
196
|
+
if (this.$fastController.isConnected && this.options) {
|
|
197
|
+
const selectedIndex = this.options.findIndex(el => el.text.toLowerCase() === next.toLowerCase());
|
|
198
|
+
const prevSelectedValue = (_a = this.options[this.selectedIndex]) === null || _a === void 0 ? void 0 : _a.text;
|
|
199
|
+
const nextSelectedValue = (_b = this.options[selectedIndex]) === null || _b === void 0 ? void 0 : _b.text;
|
|
200
|
+
this.selectedIndex =
|
|
201
|
+
prevSelectedValue !== nextSelectedValue
|
|
202
|
+
? selectedIndex
|
|
203
|
+
: this.selectedIndex;
|
|
204
|
+
next = ((_c = this.firstSelectedOption) === null || _c === void 0 ? void 0 : _c.text) || next;
|
|
205
|
+
}
|
|
206
|
+
if (prev !== next) {
|
|
207
|
+
this._value = next;
|
|
208
|
+
super.valueChanged(prev, next);
|
|
209
|
+
Observable.notify(this, "value");
|
|
418
210
|
}
|
|
419
211
|
}
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
212
|
+
/**
|
|
213
|
+
* Handle opening and closing the listbox when the combobox is clicked.
|
|
214
|
+
*
|
|
215
|
+
* @param e - the mouse event
|
|
216
|
+
* @internal
|
|
217
|
+
*/
|
|
218
|
+
clickHandler(e) {
|
|
219
|
+
if (this.disabled) {
|
|
423
220
|
return;
|
|
424
221
|
}
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
}
|
|
430
|
-
}
|
|
431
|
-
headerCellItemTemplateChanged() {
|
|
432
|
-
if (this.$fastController.isConnected) {
|
|
433
|
-
if (this.generatedHeader !== null) {
|
|
434
|
-
this.generatedHeader.headerCellItemTemplate = this.headerCellItemTemplate;
|
|
222
|
+
if (this.open) {
|
|
223
|
+
const captured = e.target.closest(`option,[role=option]`);
|
|
224
|
+
if (!captured || captured.disabled) {
|
|
225
|
+
return;
|
|
435
226
|
}
|
|
227
|
+
this.selectedOptions = [captured];
|
|
228
|
+
this.control.value = captured.text;
|
|
229
|
+
this.clearSelectionRange();
|
|
230
|
+
this.updateValue(true);
|
|
436
231
|
}
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
this.queueFocusUpdate();
|
|
232
|
+
this.open = !this.open;
|
|
233
|
+
if (this.open) {
|
|
234
|
+
this.control.focus();
|
|
441
235
|
}
|
|
236
|
+
return true;
|
|
442
237
|
}
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
238
|
+
connectedCallback() {
|
|
239
|
+
super.connectedCallback();
|
|
240
|
+
this.forcedPosition = !!this.positionAttribute;
|
|
241
|
+
if (this.value) {
|
|
242
|
+
this.initialValue = this.value;
|
|
446
243
|
}
|
|
447
244
|
}
|
|
448
245
|
/**
|
|
246
|
+
* Synchronize the `aria-disabled` property when the `disabled` property changes.
|
|
247
|
+
*
|
|
248
|
+
* @param prev - The previous disabled value
|
|
249
|
+
* @param next - The next disabled value
|
|
250
|
+
*
|
|
449
251
|
* @internal
|
|
450
252
|
*/
|
|
451
|
-
|
|
452
|
-
super.
|
|
453
|
-
|
|
454
|
-
this.rowItemTemplate = this.defaultRowItemTemplate;
|
|
455
|
-
}
|
|
456
|
-
this.rowsPlaceholder = document.createComment("");
|
|
457
|
-
this.appendChild(this.rowsPlaceholder);
|
|
458
|
-
this.toggleGeneratedHeader();
|
|
459
|
-
this.rowsRepeatBehavior = new RepeatDirective(x => x.rowsData, x => x.rowItemTemplate, { positioning: true }).createBehavior(this.rowsPlaceholder);
|
|
460
|
-
/* eslint-disable-next-line @typescript-eslint/no-non-null-assertion */
|
|
461
|
-
this.$fastController.addBehaviors([this.rowsRepeatBehavior]);
|
|
462
|
-
this.addEventListener("row-focused", this.handleRowFocus);
|
|
463
|
-
this.addEventListener(eventFocus, this.handleFocus);
|
|
464
|
-
this.addEventListener(eventKeyDown, this.handleKeydown);
|
|
465
|
-
this.addEventListener(eventFocusOut, this.handleFocusOut);
|
|
466
|
-
this.observer = new MutationObserver(this.onChildListChange);
|
|
467
|
-
// only observe if nodes are added or removed
|
|
468
|
-
this.observer.observe(this, { childList: true });
|
|
469
|
-
if (this.noTabbing) {
|
|
470
|
-
this.setAttribute("tabindex", "-1");
|
|
253
|
+
disabledChanged(prev, next) {
|
|
254
|
+
if (super.disabledChanged) {
|
|
255
|
+
super.disabledChanged(prev, next);
|
|
471
256
|
}
|
|
472
|
-
|
|
257
|
+
this.ariaDisabled = this.disabled ? "true" : "false";
|
|
473
258
|
}
|
|
474
259
|
/**
|
|
475
|
-
*
|
|
260
|
+
* Filter available options by text value.
|
|
261
|
+
*
|
|
262
|
+
* @public
|
|
476
263
|
*/
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
this.
|
|
482
|
-
this.
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
264
|
+
filterOptions() {
|
|
265
|
+
if (!this.autocomplete || this.autocomplete === ComboboxAutocomplete.none) {
|
|
266
|
+
this.filter = "";
|
|
267
|
+
}
|
|
268
|
+
const filter = this.filter.toLowerCase();
|
|
269
|
+
this.filteredOptions = this._options.filter(o => o.text.toLowerCase().startsWith(this.filter.toLowerCase()));
|
|
270
|
+
if (this.isAutocompleteList) {
|
|
271
|
+
if (!this.filteredOptions.length && !filter) {
|
|
272
|
+
this.filteredOptions = this._options;
|
|
273
|
+
}
|
|
274
|
+
this._options.forEach(o => {
|
|
275
|
+
o.hidden = !this.filteredOptions.includes(o);
|
|
276
|
+
});
|
|
277
|
+
}
|
|
487
278
|
}
|
|
488
279
|
/**
|
|
280
|
+
* Focus the control and scroll the first selected option into view.
|
|
281
|
+
*
|
|
489
282
|
* @internal
|
|
283
|
+
* @remarks
|
|
284
|
+
* Overrides: `Listbox.focusAndScrollOptionIntoView`
|
|
490
285
|
*/
|
|
491
|
-
|
|
492
|
-
this.
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
286
|
+
focusAndScrollOptionIntoView() {
|
|
287
|
+
if (this.contains(document.activeElement)) {
|
|
288
|
+
this.control.focus();
|
|
289
|
+
if (this.firstSelectedOption) {
|
|
290
|
+
requestAnimationFrame(() => {
|
|
291
|
+
var _a;
|
|
292
|
+
(_a = this.firstSelectedOption) === null || _a === void 0 ? void 0 : _a.scrollIntoView({ block: "nearest" });
|
|
293
|
+
});
|
|
294
|
+
}
|
|
295
|
+
}
|
|
498
296
|
}
|
|
499
297
|
/**
|
|
298
|
+
* Handle focus state when the element or its children lose focus.
|
|
299
|
+
*
|
|
300
|
+
* @param e - The focus event
|
|
500
301
|
* @internal
|
|
501
302
|
*/
|
|
502
|
-
|
|
503
|
-
this.
|
|
303
|
+
focusoutHandler(e) {
|
|
304
|
+
this.syncValue();
|
|
305
|
+
if (!this.open) {
|
|
306
|
+
return true;
|
|
307
|
+
}
|
|
308
|
+
const focusTarget = e.relatedTarget;
|
|
309
|
+
if (this.isSameNode(focusTarget)) {
|
|
310
|
+
this.focus();
|
|
311
|
+
return;
|
|
312
|
+
}
|
|
313
|
+
if (!this.options || !this.options.includes(focusTarget)) {
|
|
314
|
+
this.open = false;
|
|
315
|
+
}
|
|
504
316
|
}
|
|
505
317
|
/**
|
|
318
|
+
* Handle content changes on the control input.
|
|
319
|
+
*
|
|
320
|
+
* @param e - the input event
|
|
506
321
|
* @internal
|
|
507
322
|
*/
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
323
|
+
inputHandler(e) {
|
|
324
|
+
this.filter = this.control.value;
|
|
325
|
+
this.filterOptions();
|
|
326
|
+
if (!this.isAutocompleteInline) {
|
|
327
|
+
this.selectedIndex = this.options
|
|
328
|
+
.map(option => option.text)
|
|
329
|
+
.indexOf(this.control.value);
|
|
330
|
+
}
|
|
331
|
+
if (e.inputType.includes("deleteContent") || !this.filter.length) {
|
|
332
|
+
return true;
|
|
333
|
+
}
|
|
334
|
+
if (this.isAutocompleteList && !this.open) {
|
|
335
|
+
this.open = true;
|
|
336
|
+
}
|
|
337
|
+
if (this.isAutocompleteInline) {
|
|
338
|
+
if (this.filteredOptions.length) {
|
|
339
|
+
this.selectedOptions = [this.filteredOptions[0]];
|
|
340
|
+
this.selectedIndex = this.options.indexOf(this.firstSelectedOption);
|
|
341
|
+
this.setInlineSelection();
|
|
342
|
+
}
|
|
343
|
+
else {
|
|
344
|
+
this.selectedIndex = -1;
|
|
345
|
+
}
|
|
511
346
|
}
|
|
347
|
+
return;
|
|
512
348
|
}
|
|
513
349
|
/**
|
|
350
|
+
* Handle keydown actions for listbox navigation.
|
|
351
|
+
*
|
|
352
|
+
* @param e - the keyboard event
|
|
514
353
|
* @internal
|
|
515
354
|
*/
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
e.preventDefault();
|
|
527
|
-
// focus up one row
|
|
528
|
-
this.focusOnCell(this.focusRowIndex - 1, this.focusColumnIndex, true);
|
|
529
|
-
break;
|
|
530
|
-
case keyArrowDown:
|
|
531
|
-
e.preventDefault();
|
|
532
|
-
// focus down one row
|
|
533
|
-
this.focusOnCell(this.focusRowIndex + 1, this.focusColumnIndex, true);
|
|
534
|
-
break;
|
|
535
|
-
case keyPageUp:
|
|
536
|
-
e.preventDefault();
|
|
537
|
-
if (this.rowElements.length === 0) {
|
|
538
|
-
this.focusOnCell(0, 0, false);
|
|
539
|
-
break;
|
|
355
|
+
keydownHandler(e) {
|
|
356
|
+
const key = e.key;
|
|
357
|
+
if (e.ctrlKey || e.shiftKey) {
|
|
358
|
+
return true;
|
|
359
|
+
}
|
|
360
|
+
switch (key) {
|
|
361
|
+
case "Enter": {
|
|
362
|
+
this.syncValue();
|
|
363
|
+
if (this.isAutocompleteInline) {
|
|
364
|
+
this.filter = this.value;
|
|
540
365
|
}
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
366
|
+
this.open = false;
|
|
367
|
+
this.clearSelectionRange();
|
|
368
|
+
break;
|
|
369
|
+
}
|
|
370
|
+
case "Escape": {
|
|
371
|
+
if (!this.isAutocompleteInline) {
|
|
372
|
+
this.selectedIndex = -1;
|
|
544
373
|
}
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
if (thisRow.offsetTop < this.scrollTop) {
|
|
549
|
-
this.scrollTop =
|
|
550
|
-
thisRow.offsetTop + thisRow.clientHeight - this.clientHeight;
|
|
551
|
-
break;
|
|
552
|
-
}
|
|
374
|
+
if (this.open) {
|
|
375
|
+
this.open = false;
|
|
376
|
+
break;
|
|
553
377
|
}
|
|
554
|
-
this.
|
|
378
|
+
this.value = "";
|
|
379
|
+
this.control.value = "";
|
|
380
|
+
this.filter = "";
|
|
381
|
+
this.filterOptions();
|
|
555
382
|
break;
|
|
556
|
-
|
|
383
|
+
}
|
|
384
|
+
case "Tab": {
|
|
385
|
+
this.setInputToSelection();
|
|
386
|
+
if (!this.open) {
|
|
387
|
+
return true;
|
|
388
|
+
}
|
|
557
389
|
e.preventDefault();
|
|
558
|
-
|
|
559
|
-
|
|
390
|
+
this.open = false;
|
|
391
|
+
break;
|
|
392
|
+
}
|
|
393
|
+
case "ArrowUp":
|
|
394
|
+
case "ArrowDown": {
|
|
395
|
+
this.filterOptions();
|
|
396
|
+
if (!this.open) {
|
|
397
|
+
this.open = true;
|
|
560
398
|
break;
|
|
561
399
|
}
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
lastRow.offsetTop + lastRow.offsetHeight <= currentGridBottom) {
|
|
565
|
-
this.focusOnCell(maxIndex, this.focusColumnIndex, false);
|
|
566
|
-
return;
|
|
567
|
-
}
|
|
568
|
-
newFocusRowIndex = this.focusRowIndex + 1;
|
|
569
|
-
for (newFocusRowIndex; newFocusRowIndex <= maxIndex; newFocusRowIndex++) {
|
|
570
|
-
const thisRow = this.rowElements[newFocusRowIndex];
|
|
571
|
-
if (thisRow.offsetTop + thisRow.offsetHeight > currentGridBottom) {
|
|
572
|
-
let stickyHeaderOffset = 0;
|
|
573
|
-
if (this.generateHeader === GenerateHeaderOptions$1.sticky &&
|
|
574
|
-
this.generatedHeader !== null) {
|
|
575
|
-
stickyHeaderOffset = this.generatedHeader.clientHeight;
|
|
576
|
-
}
|
|
577
|
-
this.scrollTop = thisRow.offsetTop - stickyHeaderOffset;
|
|
578
|
-
break;
|
|
579
|
-
}
|
|
580
|
-
}
|
|
581
|
-
this.focusOnCell(newFocusRowIndex, this.focusColumnIndex, false);
|
|
582
|
-
break;
|
|
583
|
-
case keyHome:
|
|
584
|
-
if (e.ctrlKey) {
|
|
585
|
-
e.preventDefault();
|
|
586
|
-
// focus first cell of first row
|
|
587
|
-
this.focusOnCell(0, 0, true);
|
|
400
|
+
if (this.filteredOptions.length > 0) {
|
|
401
|
+
super.keydownHandler(e);
|
|
588
402
|
}
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
if (e.ctrlKey && this.columnDefinitions !== null) {
|
|
592
|
-
e.preventDefault();
|
|
593
|
-
// focus last cell of last row
|
|
594
|
-
this.focusOnCell(this.rowElements.length - 1, this.columnDefinitions.length - 1, true);
|
|
403
|
+
if (this.isAutocompleteInline) {
|
|
404
|
+
this.setInlineSelection();
|
|
595
405
|
}
|
|
596
406
|
break;
|
|
407
|
+
}
|
|
408
|
+
default: {
|
|
409
|
+
return true;
|
|
410
|
+
}
|
|
597
411
|
}
|
|
598
412
|
}
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
413
|
+
/**
|
|
414
|
+
* Handle keyup actions for value input and text field manipulations.
|
|
415
|
+
*
|
|
416
|
+
* @param e - the keyboard event
|
|
417
|
+
* @internal
|
|
418
|
+
*/
|
|
419
|
+
keyupHandler(e) {
|
|
420
|
+
const key = e.key;
|
|
421
|
+
switch (key) {
|
|
422
|
+
case "ArrowLeft":
|
|
423
|
+
case "ArrowRight":
|
|
424
|
+
case "Backspace":
|
|
425
|
+
case "Delete":
|
|
426
|
+
case "Home":
|
|
427
|
+
case "End": {
|
|
428
|
+
this.filter = this.control.value;
|
|
429
|
+
this.selectedIndex = -1;
|
|
430
|
+
this.filterOptions();
|
|
431
|
+
break;
|
|
432
|
+
}
|
|
607
433
|
}
|
|
608
434
|
}
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
if (this.
|
|
619
|
-
this.
|
|
620
|
-
|
|
621
|
-
this.
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
this.generatedHeader.rowType =
|
|
625
|
-
this.generateHeader === GenerateHeaderOptions$1.sticky
|
|
626
|
-
? DataGridRowTypes$1.stickyHeader
|
|
627
|
-
: DataGridRowTypes$1.header;
|
|
628
|
-
if (this.firstChild !== null || this.rowsPlaceholder !== null) {
|
|
629
|
-
this.insertBefore(generatedHeaderElement, this.firstChild !== null ? this.firstChild : this.rowsPlaceholder);
|
|
435
|
+
/**
|
|
436
|
+
* Ensure that the selectedIndex is within the current allowable filtered range.
|
|
437
|
+
*
|
|
438
|
+
* @param prev - the previous selected index value
|
|
439
|
+
* @param next - the current selected index value
|
|
440
|
+
*
|
|
441
|
+
* @internal
|
|
442
|
+
*/
|
|
443
|
+
selectedIndexChanged(prev, next) {
|
|
444
|
+
if (this.$fastController.isConnected) {
|
|
445
|
+
next = limit(-1, this.options.length - 1, next);
|
|
446
|
+
// we only want to call the super method when the selectedIndex is in range
|
|
447
|
+
if (next !== this.selectedIndex) {
|
|
448
|
+
this.selectedIndex = next;
|
|
449
|
+
return;
|
|
630
450
|
}
|
|
631
|
-
|
|
451
|
+
super.selectedIndexChanged(prev, next);
|
|
632
452
|
}
|
|
633
453
|
}
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
});
|
|
645
|
-
};
|
|
646
|
-
__decorate([
|
|
647
|
-
attr({ attribute: "no-tabbing", mode: "boolean" })
|
|
648
|
-
], DataGrid$1.prototype, "noTabbing", void 0);
|
|
649
|
-
__decorate([
|
|
650
|
-
attr({ attribute: "generate-header" })
|
|
651
|
-
], DataGrid$1.prototype, "generateHeader", void 0);
|
|
652
|
-
__decorate([
|
|
653
|
-
attr({ attribute: "grid-template-columns" })
|
|
654
|
-
], DataGrid$1.prototype, "gridTemplateColumns", void 0);
|
|
655
|
-
__decorate([
|
|
656
|
-
observable
|
|
657
|
-
], DataGrid$1.prototype, "rowsData", void 0);
|
|
658
|
-
__decorate([
|
|
659
|
-
observable
|
|
660
|
-
], DataGrid$1.prototype, "columnDefinitions", void 0);
|
|
661
|
-
__decorate([
|
|
662
|
-
observable
|
|
663
|
-
], DataGrid$1.prototype, "rowItemTemplate", void 0);
|
|
664
|
-
__decorate([
|
|
665
|
-
observable
|
|
666
|
-
], DataGrid$1.prototype, "cellItemTemplate", void 0);
|
|
667
|
-
__decorate([
|
|
668
|
-
observable
|
|
669
|
-
], DataGrid$1.prototype, "headerCellItemTemplate", void 0);
|
|
670
|
-
__decorate([
|
|
671
|
-
observable
|
|
672
|
-
], DataGrid$1.prototype, "focusRowIndex", void 0);
|
|
673
|
-
__decorate([
|
|
674
|
-
observable
|
|
675
|
-
], DataGrid$1.prototype, "focusColumnIndex", void 0);
|
|
676
|
-
__decorate([
|
|
677
|
-
observable
|
|
678
|
-
], DataGrid$1.prototype, "defaultRowItemTemplate", void 0);
|
|
679
|
-
__decorate([
|
|
680
|
-
observable
|
|
681
|
-
], DataGrid$1.prototype, "rowElementTag", void 0);
|
|
682
|
-
__decorate([
|
|
683
|
-
observable
|
|
684
|
-
], DataGrid$1.prototype, "rowElements", void 0);
|
|
685
|
-
|
|
686
|
-
const defaultCellContentsTemplate = html `
|
|
687
|
-
<template>
|
|
688
|
-
${x => x.rowData === null ||
|
|
689
|
-
x.columnDefinition === null ||
|
|
690
|
-
x.columnDefinition.columnDataKey === null
|
|
691
|
-
? null
|
|
692
|
-
: x.rowData[x.columnDefinition.columnDataKey]}
|
|
693
|
-
</template>
|
|
694
|
-
`;
|
|
695
|
-
const defaultHeaderCellContentsTemplate = html `
|
|
696
|
-
<template>
|
|
697
|
-
${x => x.columnDefinition === null
|
|
698
|
-
? null
|
|
699
|
-
: x.columnDefinition.title === undefined
|
|
700
|
-
? x.columnDefinition.columnDataKey
|
|
701
|
-
: x.columnDefinition.title}
|
|
702
|
-
</template>
|
|
703
|
-
`;
|
|
704
|
-
/**
|
|
705
|
-
* A Data Grid Cell Custom HTML Element.
|
|
706
|
-
*
|
|
707
|
-
* @fires cell-focused - Fires a custom 'cell-focused' event when focus is on the cell or its contents
|
|
708
|
-
* @slot - The default slot for cell contents. The "cell contents template" renders here.
|
|
709
|
-
* @public
|
|
710
|
-
*/
|
|
711
|
-
let DataGridCell$1 = class DataGridCell extends FoundationElement {
|
|
712
|
-
constructor() {
|
|
713
|
-
super(...arguments);
|
|
714
|
-
/**
|
|
715
|
-
* The type of cell
|
|
716
|
-
*
|
|
717
|
-
* @public
|
|
718
|
-
* @remarks
|
|
719
|
-
* HTML Attribute: cell-type
|
|
720
|
-
*/
|
|
721
|
-
this.cellType = DataGridCellTypes.default;
|
|
722
|
-
/**
|
|
723
|
-
* The base data for the parent row
|
|
724
|
-
*
|
|
725
|
-
* @public
|
|
726
|
-
*/
|
|
727
|
-
this.rowData = null;
|
|
728
|
-
/**
|
|
729
|
-
* The base data for the column
|
|
730
|
-
*
|
|
731
|
-
* @public
|
|
732
|
-
*/
|
|
733
|
-
this.columnDefinition = null;
|
|
734
|
-
this.isActiveCell = false;
|
|
735
|
-
this.customCellView = null;
|
|
736
|
-
this.updateCellStyle = () => {
|
|
737
|
-
this.style.gridColumn = this.gridColumn;
|
|
738
|
-
};
|
|
739
|
-
}
|
|
740
|
-
cellTypeChanged() {
|
|
741
|
-
if (this.$fastController.isConnected) {
|
|
742
|
-
this.updateCellView();
|
|
454
|
+
/**
|
|
455
|
+
* Move focus to the previous selectable option.
|
|
456
|
+
*
|
|
457
|
+
* @internal
|
|
458
|
+
* @remarks
|
|
459
|
+
* Overrides `Listbox.selectPreviousOption`
|
|
460
|
+
*/
|
|
461
|
+
selectPreviousOption() {
|
|
462
|
+
if (!this.disabled && this.selectedIndex >= 0) {
|
|
463
|
+
this.selectedIndex = this.selectedIndex - 1;
|
|
743
464
|
}
|
|
744
465
|
}
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
466
|
+
/**
|
|
467
|
+
* Set the default selected options at initialization or reset.
|
|
468
|
+
*
|
|
469
|
+
* @internal
|
|
470
|
+
* @remarks
|
|
471
|
+
* Overrides `Listbox.setDefaultSelectedOption`
|
|
472
|
+
*/
|
|
473
|
+
setDefaultSelectedOption() {
|
|
474
|
+
if (this.$fastController.isConnected && this.options) {
|
|
475
|
+
const selectedIndex = this.options.findIndex(el => el.getAttribute("selected") !== null || el.selected);
|
|
476
|
+
this.selectedIndex = selectedIndex;
|
|
477
|
+
if (!this.dirtyValue && this.firstSelectedOption) {
|
|
478
|
+
this.value = this.firstSelectedOption.text;
|
|
479
|
+
}
|
|
480
|
+
this.setSelectedOptions();
|
|
748
481
|
}
|
|
749
482
|
}
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
483
|
+
/**
|
|
484
|
+
* Focus and set the content of the control based on the first selected option.
|
|
485
|
+
*
|
|
486
|
+
* @internal
|
|
487
|
+
*/
|
|
488
|
+
setInputToSelection() {
|
|
489
|
+
if (this.firstSelectedOption) {
|
|
490
|
+
this.control.value = this.firstSelectedOption.text;
|
|
491
|
+
this.control.focus();
|
|
753
492
|
}
|
|
754
493
|
}
|
|
755
494
|
/**
|
|
495
|
+
* Focus, set and select the content of the control based on the first selected option.
|
|
496
|
+
*
|
|
756
497
|
* @internal
|
|
757
498
|
*/
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
this.addEventListener(eventKeyDown, this.handleKeydown);
|
|
764
|
-
this.style.gridColumn = `${((_a = this.columnDefinition) === null || _a === void 0 ? void 0 : _a.gridColumn) === undefined
|
|
765
|
-
? 0
|
|
766
|
-
: this.columnDefinition.gridColumn}`;
|
|
767
|
-
this.updateCellView();
|
|
768
|
-
this.updateCellStyle();
|
|
499
|
+
setInlineSelection() {
|
|
500
|
+
if (this.firstSelectedOption) {
|
|
501
|
+
this.setInputToSelection();
|
|
502
|
+
this.control.setSelectionRange(this.filter.length, this.control.value.length, "backward");
|
|
503
|
+
}
|
|
769
504
|
}
|
|
770
505
|
/**
|
|
506
|
+
* Determines if a value update should involve emitting a change event, then updates the value.
|
|
507
|
+
*
|
|
771
508
|
* @internal
|
|
772
509
|
*/
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
this.
|
|
776
|
-
this.
|
|
777
|
-
this.removeEventListener(eventKeyDown, this.handleKeydown);
|
|
778
|
-
this.disconnectCellView();
|
|
510
|
+
syncValue() {
|
|
511
|
+
var _a;
|
|
512
|
+
const newValue = this.selectedIndex > -1 ? (_a = this.firstSelectedOption) === null || _a === void 0 ? void 0 : _a.text : this.control.value;
|
|
513
|
+
this.updateValue(this.value !== newValue);
|
|
779
514
|
}
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
this.columnDefinition.cellInternalFocusQueue !== true &&
|
|
801
|
-
typeof this.columnDefinition.cellFocusTargetCallback === "function") {
|
|
802
|
-
// move focus to the focus target
|
|
803
|
-
const focusTarget = this.columnDefinition.cellFocusTargetCallback(this);
|
|
804
|
-
if (focusTarget !== null) {
|
|
805
|
-
focusTarget.focus();
|
|
806
|
-
}
|
|
807
|
-
}
|
|
808
|
-
break;
|
|
809
|
-
}
|
|
810
|
-
this.$emit("cell-focused", this);
|
|
515
|
+
/**
|
|
516
|
+
* Calculate and apply listbox positioning based on available viewport space.
|
|
517
|
+
*
|
|
518
|
+
* @param force - direction to force the listbox to display
|
|
519
|
+
* @public
|
|
520
|
+
*/
|
|
521
|
+
setPositioning() {
|
|
522
|
+
const currentBox = this.getBoundingClientRect();
|
|
523
|
+
const viewportHeight = window.innerHeight;
|
|
524
|
+
const availableBottom = viewportHeight - currentBox.bottom;
|
|
525
|
+
this.position = this.forcedPosition
|
|
526
|
+
? this.positionAttribute
|
|
527
|
+
: currentBox.top > availableBottom
|
|
528
|
+
? SelectPosition.above
|
|
529
|
+
: SelectPosition.below;
|
|
530
|
+
this.positionAttribute = this.forcedPosition
|
|
531
|
+
? this.positionAttribute
|
|
532
|
+
: this.position;
|
|
533
|
+
this.maxHeight =
|
|
534
|
+
this.position === SelectPosition.above ? ~~currentBox.top : ~~availableBottom;
|
|
811
535
|
}
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
536
|
+
/**
|
|
537
|
+
* Ensure that the entire list of options is used when setting the selected property.
|
|
538
|
+
*
|
|
539
|
+
* @param prev - the previous list of selected options
|
|
540
|
+
* @param next - the current list of selected options
|
|
541
|
+
*
|
|
542
|
+
* @internal
|
|
543
|
+
* @remarks
|
|
544
|
+
* Overrides: `Listbox.selectedOptionsChanged`
|
|
545
|
+
*/
|
|
546
|
+
selectedOptionsChanged(prev, next) {
|
|
547
|
+
if (this.$fastController.isConnected) {
|
|
548
|
+
this._options.forEach(o => {
|
|
549
|
+
o.selected = next.includes(o);
|
|
550
|
+
});
|
|
815
551
|
}
|
|
816
552
|
}
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
case keyFunction2:
|
|
829
|
-
if (this.contains(document.activeElement) &&
|
|
830
|
-
document.activeElement !== this) {
|
|
831
|
-
return;
|
|
832
|
-
}
|
|
833
|
-
switch (this.cellType) {
|
|
834
|
-
case DataGridCellTypes.columnHeader:
|
|
835
|
-
if (this.columnDefinition.headerCellFocusTargetCallback !==
|
|
836
|
-
undefined) {
|
|
837
|
-
const focusTarget = this.columnDefinition.headerCellFocusTargetCallback(this);
|
|
838
|
-
if (focusTarget !== null) {
|
|
839
|
-
focusTarget.focus();
|
|
840
|
-
}
|
|
841
|
-
e.preventDefault();
|
|
842
|
-
}
|
|
843
|
-
break;
|
|
844
|
-
default:
|
|
845
|
-
if (this.columnDefinition.cellFocusTargetCallback !== undefined) {
|
|
846
|
-
const focusTarget = this.columnDefinition.cellFocusTargetCallback(this);
|
|
847
|
-
if (focusTarget !== null) {
|
|
848
|
-
focusTarget.focus();
|
|
849
|
-
}
|
|
850
|
-
e.preventDefault();
|
|
851
|
-
}
|
|
852
|
-
break;
|
|
853
|
-
}
|
|
854
|
-
break;
|
|
855
|
-
case keyEscape:
|
|
856
|
-
if (this.contains(document.activeElement) &&
|
|
857
|
-
document.activeElement !== this) {
|
|
858
|
-
this.focus();
|
|
859
|
-
e.preventDefault();
|
|
860
|
-
}
|
|
861
|
-
break;
|
|
862
|
-
}
|
|
553
|
+
/**
|
|
554
|
+
* Synchronize the form-associated proxy and update the value property of the element.
|
|
555
|
+
*
|
|
556
|
+
* @param prev - the previous collection of slotted option elements
|
|
557
|
+
* @param next - the next collection of slotted option elements
|
|
558
|
+
*
|
|
559
|
+
* @internal
|
|
560
|
+
*/
|
|
561
|
+
slottedOptionsChanged(prev, next) {
|
|
562
|
+
super.slottedOptionsChanged(prev, next);
|
|
563
|
+
this.updateValue();
|
|
863
564
|
}
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
565
|
+
/**
|
|
566
|
+
* Sets the value and to match the first selected option.
|
|
567
|
+
*
|
|
568
|
+
* @param shouldEmit - if true, the change event will be emitted
|
|
569
|
+
*
|
|
570
|
+
* @internal
|
|
571
|
+
*/
|
|
572
|
+
updateValue(shouldEmit) {
|
|
573
|
+
var _a;
|
|
574
|
+
if (this.$fastController.isConnected) {
|
|
575
|
+
this.value = ((_a = this.firstSelectedOption) === null || _a === void 0 ? void 0 : _a.text) || this.control.value;
|
|
576
|
+
this.control.value = this.value;
|
|
868
577
|
}
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
if (this.columnDefinition.headerCellTemplate !== undefined) {
|
|
872
|
-
this.customCellView = this.columnDefinition.headerCellTemplate.render(this, this);
|
|
873
|
-
}
|
|
874
|
-
else {
|
|
875
|
-
this.customCellView = defaultHeaderCellContentsTemplate.render(this, this);
|
|
876
|
-
}
|
|
877
|
-
break;
|
|
878
|
-
case undefined:
|
|
879
|
-
case DataGridCellTypes.rowHeader:
|
|
880
|
-
case DataGridCellTypes.default:
|
|
881
|
-
if (this.columnDefinition.cellTemplate !== undefined) {
|
|
882
|
-
this.customCellView = this.columnDefinition.cellTemplate.render(this, this);
|
|
883
|
-
}
|
|
884
|
-
else {
|
|
885
|
-
this.customCellView = defaultCellContentsTemplate.render(this, this);
|
|
886
|
-
}
|
|
887
|
-
break;
|
|
578
|
+
if (shouldEmit) {
|
|
579
|
+
this.$emit("change");
|
|
888
580
|
}
|
|
889
581
|
}
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
582
|
+
/**
|
|
583
|
+
* @internal
|
|
584
|
+
*/
|
|
585
|
+
clearSelectionRange() {
|
|
586
|
+
const controlValueLength = this.control.value.length;
|
|
587
|
+
this.control.setSelectionRange(controlValueLength, controlValueLength);
|
|
895
588
|
}
|
|
896
589
|
};
|
|
897
590
|
__decorate([
|
|
898
|
-
attr({ attribute: "
|
|
899
|
-
],
|
|
900
|
-
__decorate([
|
|
901
|
-
attr({ attribute: "grid-column" })
|
|
902
|
-
], DataGridCell$1.prototype, "gridColumn", void 0);
|
|
591
|
+
attr({ attribute: "autocomplete", mode: "fromView" })
|
|
592
|
+
], Combobox$1.prototype, "autocomplete", void 0);
|
|
903
593
|
__decorate([
|
|
904
594
|
observable
|
|
905
|
-
],
|
|
595
|
+
], Combobox$1.prototype, "maxHeight", void 0);
|
|
596
|
+
__decorate([
|
|
597
|
+
attr({ attribute: "open", mode: "boolean" })
|
|
598
|
+
], Combobox$1.prototype, "open", void 0);
|
|
599
|
+
__decorate([
|
|
600
|
+
attr
|
|
601
|
+
], Combobox$1.prototype, "placeholder", void 0);
|
|
602
|
+
__decorate([
|
|
603
|
+
attr({ attribute: "position" })
|
|
604
|
+
], Combobox$1.prototype, "positionAttribute", void 0);
|
|
906
605
|
__decorate([
|
|
907
606
|
observable
|
|
908
|
-
],
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
var __defProp$2 = Object.defineProperty;
|
|
917
|
-
var __getOwnPropDesc$2 = Object.getOwnPropertyDescriptor;
|
|
918
|
-
var __decorateClass$2 = (decorators, target, key, kind) => {
|
|
919
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$2(target, key) : target;
|
|
920
|
-
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
921
|
-
if (decorator = decorators[i])
|
|
922
|
-
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
923
|
-
if (kind && result)
|
|
924
|
-
__defProp$2(target, key, result);
|
|
925
|
-
return result;
|
|
926
|
-
};
|
|
927
|
-
const DataGridSelectionMode = {
|
|
928
|
-
none: "none",
|
|
929
|
-
singleRow: "single-row",
|
|
930
|
-
multiRow: "multi-row",
|
|
931
|
-
singleCell: "single-cell",
|
|
932
|
-
multiCell: "multi-cell"
|
|
933
|
-
};
|
|
934
|
-
class DataGrid extends DataGrid$1 {
|
|
935
|
-
constructor() {
|
|
936
|
-
super();
|
|
937
|
-
this.#handleKeypress = (e) => {
|
|
938
|
-
if (e.key === "Enter" || e.key === " ") {
|
|
939
|
-
this.#handleClick(e);
|
|
940
|
-
}
|
|
941
|
-
};
|
|
942
|
-
this.#handleClick = ({ target, ctrlKey, shiftKey, metaKey }) => {
|
|
943
|
-
if (target.getAttribute("role") !== "gridcell")
|
|
944
|
-
return;
|
|
945
|
-
if (this.selectionMode === DataGridSelectionMode.singleCell || this.selectionMode === DataGridSelectionMode.multiCell) {
|
|
946
|
-
this.#handleCellSelection({ target, ctrlKey, shiftKey, metaKey });
|
|
947
|
-
return;
|
|
948
|
-
}
|
|
949
|
-
if (this.selectionMode === DataGridSelectionMode.singleRow || this.selectionMode === DataGridSelectionMode.multiRow) {
|
|
950
|
-
this.#handleRowSelection({ target, ctrlKey, shiftKey, metaKey });
|
|
951
|
-
}
|
|
952
|
-
};
|
|
953
|
-
this.#handleCellSelection = ({ target, ctrlKey, shiftKey, metaKey }) => {
|
|
954
|
-
const cell = target;
|
|
955
|
-
if (this.selectionMode === DataGridSelectionMode.multiCell && (ctrlKey || shiftKey || metaKey)) {
|
|
956
|
-
this.#setSelectedState(cell, !this.#selectedCells.includes(cell));
|
|
957
|
-
} else {
|
|
958
|
-
const cacheTargetSelection = cell.getAttribute("aria-selected") === "true";
|
|
959
|
-
this.#resetSelection();
|
|
960
|
-
this.#setSelectedState(cell, !cacheTargetSelection);
|
|
961
|
-
}
|
|
962
|
-
};
|
|
963
|
-
this.#handleRowSelection = ({ target, ctrlKey, shiftKey, metaKey }) => {
|
|
964
|
-
const row = target.parentNode;
|
|
965
|
-
if (this.selectionMode === DataGridSelectionMode.multiRow && (ctrlKey || shiftKey || metaKey)) {
|
|
966
|
-
this.#setSelectedState(row, !this.#selectedRows.includes(row));
|
|
967
|
-
} else {
|
|
968
|
-
const cacheTargetSelection = row.getAttribute("aria-selected") === "true";
|
|
969
|
-
this.#resetSelection();
|
|
970
|
-
this.#setSelectedState(row, !cacheTargetSelection);
|
|
971
|
-
}
|
|
972
|
-
};
|
|
973
|
-
this.#setSelectedState = (cell, selectedState) => {
|
|
974
|
-
cell.setAttribute("aria-selected", selectedState.toString());
|
|
975
|
-
};
|
|
976
|
-
this.#resetSelection = () => {
|
|
977
|
-
if (this.selectionMode === DataGridSelectionMode.singleCell || this.selectionMode === DataGridSelectionMode.multiCell) {
|
|
978
|
-
Array.from(this.querySelectorAll('[role="gridcell"]')).forEach((cell) => this.#setSelectedState(cell, false));
|
|
979
|
-
Array.from(this.querySelectorAll('[role="row"]')).forEach((row) => row.removeAttribute("aria-selected"));
|
|
980
|
-
}
|
|
981
|
-
if (this.selectionMode === DataGridSelectionMode.none) {
|
|
982
|
-
Array.from(this.querySelectorAll('[role="gridcell"]')).forEach((cell) => cell.removeAttribute("aria-selected"));
|
|
983
|
-
Array.from(this.querySelectorAll('[role="row"]')).forEach((row) => row.removeAttribute("aria-selected"));
|
|
984
|
-
}
|
|
985
|
-
if (this.selectionMode === DataGridSelectionMode.singleRow || this.selectionMode === DataGridSelectionMode.multiRow) {
|
|
986
|
-
Array.from(this.querySelectorAll('[role="gridcell"]')).forEach((cell) => cell.removeAttribute("aria-selected"));
|
|
987
|
-
Array.from(this.querySelectorAll('[role="row"]')).forEach((row) => row.setAttribute("aria-selected", "false"));
|
|
988
|
-
}
|
|
989
|
-
};
|
|
990
|
-
this.#initSelections = () => {
|
|
991
|
-
if (this.selectionMode === DataGridSelectionMode.singleCell || this.selectionMode === DataGridSelectionMode.multiCell) {
|
|
992
|
-
Array.from(this.querySelectorAll('[role="gridcell"]')).forEach((cell) => !cell.hasAttribute("aria-selected") && this.#setSelectedState(cell, false));
|
|
993
|
-
Array.from(this.querySelectorAll('[role="row"]')).forEach((row) => row.removeAttribute("aria-selected"));
|
|
994
|
-
}
|
|
995
|
-
if (this.selectionMode === DataGridSelectionMode.none) {
|
|
996
|
-
Array.from(this.querySelectorAll('[role="gridcell"]')).forEach((cell) => cell.removeAttribute("aria-selected"));
|
|
997
|
-
Array.from(this.querySelectorAll('[role="row"]')).forEach((row) => row.removeAttribute("aria-selected"));
|
|
998
|
-
}
|
|
999
|
-
if (this.selectionMode === DataGridSelectionMode.singleRow || this.selectionMode === DataGridSelectionMode.multiRow) {
|
|
1000
|
-
Array.from(this.querySelectorAll('[role="gridcell"]')).forEach((cell) => cell.removeAttribute("aria-selected"));
|
|
1001
|
-
Array.from(this.querySelectorAll('[role="row"]')).forEach((row) => !row.hasAttribute("aria-selected") && row.setAttribute("aria-selected", "false"));
|
|
1002
|
-
}
|
|
1003
|
-
};
|
|
1004
|
-
this.addEventListener("click", this.#handleClick);
|
|
1005
|
-
this.addEventListener("keydown", this.#handleKeypress);
|
|
1006
|
-
}
|
|
1007
|
-
get #selectedRows() {
|
|
1008
|
-
return this.rowElements.filter((row) => row.getAttribute("aria-selected") === "true");
|
|
1009
|
-
}
|
|
1010
|
-
get #selectedCells() {
|
|
1011
|
-
return this.rowElements.reduce((acc, row) => {
|
|
1012
|
-
const rowChildren = Array.from(row.children);
|
|
1013
|
-
const selectedCells = rowChildren.filter((cell) => cell.getAttribute("aria-selected") === "true");
|
|
1014
|
-
return acc.concat(selectedCells);
|
|
1015
|
-
}, []);
|
|
1016
|
-
}
|
|
1017
|
-
selectionModeChanged(oldValue) {
|
|
1018
|
-
if (oldValue === void 0) {
|
|
1019
|
-
DOM.queueUpdate(this.#initSelections);
|
|
1020
|
-
return;
|
|
1021
|
-
}
|
|
1022
|
-
this.#resetSelection();
|
|
1023
|
-
}
|
|
1024
|
-
#handleKeypress;
|
|
1025
|
-
#handleClick;
|
|
1026
|
-
#handleCellSelection;
|
|
1027
|
-
#handleRowSelection;
|
|
1028
|
-
#setSelectedState;
|
|
1029
|
-
#resetSelection;
|
|
1030
|
-
#initSelections;
|
|
1031
|
-
static generateColumns(rowData) {
|
|
1032
|
-
return Object.keys(rowData).map((property, index) => {
|
|
1033
|
-
return {
|
|
1034
|
-
columnDataKey: property,
|
|
1035
|
-
gridColumn: `${index}`
|
|
1036
|
-
};
|
|
1037
|
-
});
|
|
1038
|
-
}
|
|
1039
|
-
}
|
|
1040
|
-
__decorateClass$2([
|
|
1041
|
-
attr({ attribute: "selection-mode" })
|
|
1042
|
-
], DataGrid.prototype, "selectionMode", 2);
|
|
1043
|
-
|
|
1044
|
-
var __defProp$1 = Object.defineProperty;
|
|
1045
|
-
var __getOwnPropDesc$1 = Object.getOwnPropertyDescriptor;
|
|
1046
|
-
var __decorateClass$1 = (decorators, target, key, kind) => {
|
|
1047
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$1(target, key) : target;
|
|
1048
|
-
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
1049
|
-
if (decorator = decorators[i])
|
|
1050
|
-
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
1051
|
-
if (kind && result)
|
|
1052
|
-
__defProp$1(target, key, result);
|
|
1053
|
-
return result;
|
|
1054
|
-
};
|
|
1055
|
-
class DataGridRow extends DataGridRow$1 {
|
|
1056
|
-
constructor() {
|
|
1057
|
-
super(...arguments);
|
|
1058
|
-
this.ariaSelected = null;
|
|
1059
|
-
}
|
|
607
|
+
], Combobox$1.prototype, "position", void 0);
|
|
608
|
+
/**
|
|
609
|
+
* Includes ARIA states and properties relating to the ARIA combobox role.
|
|
610
|
+
*
|
|
611
|
+
* @public
|
|
612
|
+
*/
|
|
613
|
+
class DelegatesARIACombobox {
|
|
1060
614
|
}
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
],
|
|
615
|
+
__decorate([
|
|
616
|
+
observable
|
|
617
|
+
], DelegatesARIACombobox.prototype, "ariaAutoComplete", void 0);
|
|
618
|
+
__decorate([
|
|
619
|
+
observable
|
|
620
|
+
], DelegatesARIACombobox.prototype, "ariaControls", void 0);
|
|
621
|
+
applyMixins(DelegatesARIACombobox, DelegatesARIAListbox);
|
|
622
|
+
applyMixins(Combobox$1, StartEnd, DelegatesARIACombobox);
|
|
1064
623
|
|
|
1065
|
-
const
|
|
1066
|
-
none: "none",
|
|
1067
|
-
ascending: "ascending",
|
|
1068
|
-
descending: "descending",
|
|
1069
|
-
other: "other"
|
|
1070
|
-
};
|
|
1071
|
-
const GenerateHeaderOptions = {
|
|
1072
|
-
none: "none",
|
|
1073
|
-
default: "default",
|
|
1074
|
-
sticky: "sticky"
|
|
1075
|
-
};
|
|
1076
|
-
const DataGridRowTypes = {
|
|
1077
|
-
default: "default",
|
|
1078
|
-
header: "header",
|
|
1079
|
-
stickyHeader: "sticky-header"
|
|
1080
|
-
};
|
|
1081
|
-
const DataGridCellRole = {
|
|
1082
|
-
columnheader: "columnheader",
|
|
1083
|
-
rowheader: "rowheader",
|
|
1084
|
-
default: "gridcell"
|
|
1085
|
-
};
|
|
1086
|
-
|
|
1087
|
-
function createRowItemTemplate(context) {
|
|
1088
|
-
const rowTag = context.tagFor(DataGridRow);
|
|
1089
|
-
return html`
|
|
1090
|
-
<${rowTag}
|
|
1091
|
-
:rowData="${(x) => x}"
|
|
1092
|
-
:cellItemTemplate="${(_, c) => c.parent.cellItemTemplate}"
|
|
1093
|
-
:headerCellItemTemplate="${(_, c) => c.parent.headerCellItemTemplate}"
|
|
1094
|
-
></${rowTag}>
|
|
1095
|
-
`;
|
|
1096
|
-
}
|
|
1097
|
-
function getMultiSelectAriaState(x) {
|
|
1098
|
-
return x.selectionMode === void 0 || x.selectionMode === DataGridSelectionMode.none ? null : x.selectionMode.includes("multi") ? "true" : "false";
|
|
1099
|
-
}
|
|
1100
|
-
function setHeaderRow(x) {
|
|
1101
|
-
if (x.columnDefinitions === null) {
|
|
1102
|
-
const headerRow = x.querySelector('[cell-type="columnheader"]')?.parentElement;
|
|
1103
|
-
if (headerRow) {
|
|
1104
|
-
const rowType = x.generateHeader === GenerateHeaderOptions.sticky ? DataGridRowTypes.stickyHeader : x.generateHeader === GenerateHeaderOptions.default ? DataGridRowTypes.header : "hidden-header";
|
|
1105
|
-
headerRow.setAttribute("row-type", rowType);
|
|
1106
|
-
}
|
|
1107
|
-
}
|
|
1108
|
-
}
|
|
1109
|
-
function handleColumnSort(_, { event }) {
|
|
1110
|
-
event.stopPropagation();
|
|
1111
|
-
}
|
|
1112
|
-
const DataGridTemplate = (context) => {
|
|
1113
|
-
const rowItemTemplate = createRowItemTemplate(context);
|
|
1114
|
-
const rowTag = context.tagFor(DataGridRow);
|
|
1115
|
-
return html`
|
|
1116
|
-
<template
|
|
1117
|
-
aria-multiselectable="${getMultiSelectAriaState}"
|
|
1118
|
-
role="grid"
|
|
1119
|
-
tabindex="0"
|
|
1120
|
-
@sort="${handleColumnSort}"
|
|
1121
|
-
:rowElementTag="${() => rowTag}"
|
|
1122
|
-
:defaultRowItemTemplate="${rowItemTemplate}"
|
|
1123
|
-
${children({
|
|
1124
|
-
property: "rowElements",
|
|
1125
|
-
filter: elements("[role=row]")
|
|
1126
|
-
})}
|
|
1127
|
-
>
|
|
1128
|
-
<div class="base">
|
|
1129
|
-
${setHeaderRow}
|
|
1130
|
-
<slot></slot>
|
|
1131
|
-
</div>
|
|
1132
|
-
</template>
|
|
1133
|
-
`;
|
|
1134
|
-
};
|
|
624
|
+
const styles = "/**\n * Do not edit directly\n * Generated on Wed, 22 Nov 2023 16:09:43 GMT\n */\n:host {\n position: relative;\n}\n\n.control {\n display: flex;\n padding-inline-end: 44px !important;\n}\n\n.icon {\n inset-inline-end: 16px;\n inset-inline-start: unset;\n}\n:not(.disabled) .icon {\n cursor: pointer;\n}\n.disabled .icon {\n cursor: not-allowed;\n}\n\n.listbox {\n padding: 4px;\n background-color: var(--_appearance-color-fill);\n border-radius: 6px;\n box-shadow: inset 0 0 0 1px var(--_appearance-color-outline);\n contain: paint;\n}\n.listbox {\n /* @cssprop [--vvd-combobox-accent-backdrop=var(--vvd-color-canvas)] */\n --_connotation-color-backdrop: var(--vvd-combobox-accent-backdrop, var(--vvd-color-canvas));\n /* @cssprop [--vvd-combobox-accent-intermediate=var(--vvd-color-neutral-500)] */\n --_connotation-color-intermediate: var(--vvd-combobox-accent-intermediate, var(--vvd-color-neutral-500));\n /* @cssprop [--vvd-combobox-accent-primary=var(--vvd-color-canvas-text)] */\n --_connotation-color-primary: var(--vvd-combobox-accent-primary, var(--vvd-color-canvas-text));\n /* @cssprop [--vvd-combobox-accent-soft=var(--vvd-color-neutral-100)] */\n --_connotation-color-soft: var(--vvd-combobox-accent-soft, var(--vvd-color-neutral-100));\n}\n.listbox {\n --_appearance-color-text: var(--vvd-color-canvas-text);\n --_appearance-color-fill: var(--_connotation-color-backdrop);\n --_appearance-color-outline: var(--_connotation-color-intermediate);\n}\n.listbox.appearance-ghost {\n --_appearance-color-text: var(--_connotation-color-primary);\n --_appearance-color-fill: transparent;\n --_appearance-color-outline: transparent;\n}\n.listbox:where(:disabled, .disabled) {\n --_appearance-color-text: var(--vvd-color-neutral-300);\n --_appearance-color-fill: var(--vvd-color-neutral-100);\n --_appearance-color-outline: var(--vvd-color-neutral-300);\n}\n.listbox:where(:disabled, .disabled).appearance-ghost {\n --_appearance-color-text: var(--vvd-color-neutral-300);\n --_appearance-color-fill: transparent;\n --_appearance-color-outline: transparent;\n}\n\n::part(popup-base) {\n inline-size: 100%;\n}";
|
|
1135
625
|
|
|
1136
626
|
var __defProp = Object.defineProperty;
|
|
1137
627
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -1144,146 +634,109 @@ var __decorateClass = (decorators, target, key, kind) => {
|
|
|
1144
634
|
__defProp(target, key, result);
|
|
1145
635
|
return result;
|
|
1146
636
|
};
|
|
1147
|
-
class
|
|
1148
|
-
constructor() {
|
|
1149
|
-
super();
|
|
1150
|
-
this.ariaSelected = null;
|
|
1151
|
-
this.ariaSort = null;
|
|
1152
|
-
this.updateCellStyle = () => {
|
|
1153
|
-
if (this.gridColumn && !this.gridColumn.includes("undefined")) {
|
|
1154
|
-
this.style.gridColumn = this.gridColumn;
|
|
1155
|
-
} else {
|
|
1156
|
-
this.style.removeProperty("grid-column");
|
|
1157
|
-
}
|
|
1158
|
-
};
|
|
1159
|
-
}
|
|
1160
|
-
ariaSelectedChanged(_, selectedState) {
|
|
1161
|
-
this.shadowRoot.querySelector(".base")?.classList.toggle("selected", selectedState === "true");
|
|
1162
|
-
}
|
|
637
|
+
let Combobox = class extends Combobox$1 {
|
|
1163
638
|
connectedCallback() {
|
|
1164
639
|
super.connectedCallback();
|
|
1165
|
-
this.
|
|
1166
|
-
}
|
|
1167
|
-
handleFocusin(e) {
|
|
1168
|
-
super.handleFocusin(e);
|
|
1169
|
-
this.shadowRoot.querySelector(".base").classList.add("active");
|
|
640
|
+
this._popup.anchor = this._anchor;
|
|
1170
641
|
}
|
|
1171
|
-
|
|
1172
|
-
super.handleFocusout(e);
|
|
1173
|
-
this.shadowRoot.querySelector(".base").classList.remove("active");
|
|
1174
|
-
}
|
|
1175
|
-
}
|
|
1176
|
-
__decorateClass([
|
|
1177
|
-
attr({ attribute: "aria-selected", mode: "fromView" })
|
|
1178
|
-
], DataGridCell.prototype, "ariaSelected", 2);
|
|
642
|
+
};
|
|
1179
643
|
__decorateClass([
|
|
1180
|
-
attr
|
|
1181
|
-
],
|
|
644
|
+
attr
|
|
645
|
+
], Combobox.prototype, "placement", 2);
|
|
646
|
+
Combobox = __decorateClass([
|
|
647
|
+
formElements
|
|
648
|
+
], Combobox);
|
|
649
|
+
applyMixins(Combobox, AffixIcon);
|
|
1182
650
|
|
|
1183
|
-
function
|
|
1184
|
-
const cellTag = context.tagFor(DataGridCell);
|
|
651
|
+
function renderLabel() {
|
|
1185
652
|
return html`
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
:rowData="${(_, c) => c.parent.rowData}"
|
|
1190
|
-
:columnDefinition="${(x) => x}"
|
|
1191
|
-
selected="${(_, c) => c.parent.ariaSelected === "true" ? true : null}"
|
|
1192
|
-
></${cellTag}>
|
|
1193
|
-
`;
|
|
653
|
+
<label for="control" class="label">
|
|
654
|
+
${(x) => x.label}
|
|
655
|
+
</label>`;
|
|
1194
656
|
}
|
|
1195
|
-
|
|
1196
|
-
|
|
657
|
+
const getStateClasses = ({
|
|
658
|
+
disabled,
|
|
659
|
+
placeholder,
|
|
660
|
+
label
|
|
661
|
+
}) => classNames(
|
|
662
|
+
"base",
|
|
663
|
+
["disabled", disabled],
|
|
664
|
+
["placeholder", Boolean(placeholder)],
|
|
665
|
+
["no-label", !label]
|
|
666
|
+
);
|
|
667
|
+
function renderInput(context) {
|
|
668
|
+
const affixIconTemplate = affixIconTemplateFactory(context);
|
|
669
|
+
const focusTemplate = focusTemplateFactory(context);
|
|
1197
670
|
return html`
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
671
|
+
<div class="${getStateClasses}" ${ref("_anchor")}>
|
|
672
|
+
${when((x) => x.label, renderLabel())}
|
|
673
|
+
<div class="fieldset">
|
|
674
|
+
<input
|
|
675
|
+
id="control"
|
|
676
|
+
class="control"
|
|
677
|
+
aria-activedescendant="${(x) => x.open ? x.ariaActiveDescendant : null}"
|
|
678
|
+
aria-autocomplete="${(x) => x.ariaAutoComplete}"
|
|
679
|
+
aria-controls="${(x) => x.ariaControls}"
|
|
680
|
+
aria-disabled="${(x) => x.ariaDisabled}"
|
|
681
|
+
aria-expanded="${(x) => x.ariaExpanded}"
|
|
682
|
+
aria-haspopup="listbox"
|
|
683
|
+
placeholder="${(x) => x.placeholder}"
|
|
684
|
+
role="combobox"
|
|
685
|
+
type="text"
|
|
686
|
+
?disabled="${(x) => x.disabled}"
|
|
687
|
+
:value="${(x) => x.value}"
|
|
688
|
+
@input="${(x, c) => x.inputHandler(c.event)}"
|
|
689
|
+
@keyup="${(x, c) => x.keyupHandler(c.event)}"
|
|
690
|
+
${ref("control")}
|
|
691
|
+
/>
|
|
692
|
+
${() => affixIconTemplate("chevron-down-line")}
|
|
693
|
+
${() => focusTemplate}
|
|
694
|
+
</div>
|
|
695
|
+
</div>`;
|
|
1204
696
|
}
|
|
1205
|
-
const
|
|
1206
|
-
const
|
|
1207
|
-
const headerCellItemTemplate = createHeaderCellItemTemplate(context);
|
|
697
|
+
const comboboxTemplate = (context) => {
|
|
698
|
+
const popupTag = context.tagFor(Popup);
|
|
1208
699
|
return html`
|
|
1209
700
|
<template
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
${
|
|
1215
|
-
|
|
1216
|
-
filter: elements('[role="cell"],[role="gridcell"],[role="columnheader"],[role="rowheader"]')
|
|
1217
|
-
})}
|
|
701
|
+
aria-disabled="${(x) => x.ariaDisabled}"
|
|
702
|
+
autocomplete="${(x) => x.autocomplete}"
|
|
703
|
+
tabindex="${(x) => !x.disabled ? "0" : null}"
|
|
704
|
+
@click="${(x, c) => x.clickHandler(c.event)}"
|
|
705
|
+
@focusout="${(x, c) => x.focusoutHandler(c.event)}"
|
|
706
|
+
@keydown="${(x, c) => x.keydownHandler(c.event)}"
|
|
1218
707
|
>
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
708
|
+
${() => renderInput(context)}
|
|
709
|
+
<${popupTag} class="popup"
|
|
710
|
+
?open="${(x) => x.open}"
|
|
711
|
+
placement="${(x) => x.placement}"
|
|
712
|
+
strategy="absolute"
|
|
713
|
+
${ref("_popup")}>
|
|
714
|
+
<div id="${(x) => x.listboxId}"
|
|
715
|
+
class="listbox"
|
|
716
|
+
role="listbox"
|
|
717
|
+
?disabled="${(x) => x.disabled}"
|
|
718
|
+
${ref("listbox")}>
|
|
719
|
+
<slot ${slotted({
|
|
720
|
+
filter: Listbox$1.slottedOptionFilter,
|
|
721
|
+
flatten: true,
|
|
722
|
+
property: "slottedOptions"
|
|
723
|
+
})}>
|
|
724
|
+
</slot>
|
|
725
|
+
</div>
|
|
726
|
+
</${popupTag}>
|
|
1224
727
|
</template>
|
|
1225
|
-
|
|
728
|
+
`;
|
|
1226
729
|
};
|
|
1227
730
|
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
731
|
+
const combobox = Combobox.compose({
|
|
732
|
+
baseName: "combobox",
|
|
733
|
+
template: comboboxTemplate,
|
|
734
|
+
styles: [styles$1, styles],
|
|
735
|
+
shadowOptions: {
|
|
736
|
+
delegatesFocus: true
|
|
1231
737
|
}
|
|
1232
|
-
return x.cellType === "columnheader" && x.ariaSort !== null && x.ariaSort !== DataGridCellSortStates.other;
|
|
1233
|
-
}
|
|
1234
|
-
function getSortIcon(x) {
|
|
1235
|
-
return x.ariaSort === DataGridCellSortStates.ascending ? "sort-asc-solid" : x.ariaSort === DataGridCellSortStates.descending ? "sort-desc-solid" : "sort-solid";
|
|
1236
|
-
}
|
|
1237
|
-
function renderSortIcons(c) {
|
|
1238
|
-
const iconTag = c.tagFor(Icon);
|
|
1239
|
-
return html`
|
|
1240
|
-
${when(shouldShowSortIcons, html`
|
|
1241
|
-
<${iconTag} class="header-icon" name="${getSortIcon}"></${iconTag}>
|
|
1242
|
-
`)}
|
|
1243
|
-
`;
|
|
1244
|
-
}
|
|
1245
|
-
function handleClick(x) {
|
|
1246
|
-
if (x.cellType === "columnheader" && x.ariaSort !== null) {
|
|
1247
|
-
x.$emit(
|
|
1248
|
-
"sort",
|
|
1249
|
-
{ columnDataKey: x.columnDefinition && x.columnDefinition.columnDataKey ? x.columnDefinition.columnDataKey : x.textContent.trim(), sortDirection: x.ariaSort }
|
|
1250
|
-
);
|
|
1251
|
-
}
|
|
1252
|
-
}
|
|
1253
|
-
function DataGridCellTemplate(context) {
|
|
1254
|
-
const focusTemplate = focusTemplateFactory(context);
|
|
1255
|
-
return html`
|
|
1256
|
-
<template
|
|
1257
|
-
tabindex="-1"
|
|
1258
|
-
role="${(x) => DataGridCellRole[x.cellType] ?? DataGridCellRole.default}"
|
|
1259
|
-
@click="${handleClick}"
|
|
1260
|
-
>
|
|
1261
|
-
<div class="base">
|
|
1262
|
-
<slot></slot>
|
|
1263
|
-
${() => focusTemplate}
|
|
1264
|
-
${(_) => renderSortIcons(context)}
|
|
1265
|
-
</div>
|
|
1266
|
-
|
|
1267
|
-
</template>
|
|
1268
|
-
`;
|
|
1269
|
-
}
|
|
1270
|
-
|
|
1271
|
-
const dataGrid = DataGrid.compose({
|
|
1272
|
-
baseName: "data-grid",
|
|
1273
|
-
template: DataGridTemplate,
|
|
1274
|
-
styles: dataGridStyles
|
|
1275
|
-
})();
|
|
1276
|
-
const dataGridRow = DataGridRow.compose({
|
|
1277
|
-
baseName: "data-grid-row",
|
|
1278
|
-
template: DataGridRowTemplate,
|
|
1279
|
-
styles: dataGridRowStyles
|
|
1280
|
-
})();
|
|
1281
|
-
const dataGridCell = DataGridCell.compose({
|
|
1282
|
-
baseName: "data-grid-cell",
|
|
1283
|
-
template: DataGridCellTemplate,
|
|
1284
|
-
styles: dataGridCellStyles
|
|
1285
738
|
})();
|
|
1286
|
-
const
|
|
1287
|
-
const
|
|
739
|
+
const comboboxRegistries = [combobox, ...iconRegistries, ...popupRegistries, ...focusRegistries, ...listboxOptionRegistries];
|
|
740
|
+
const registerCombobox = registerFactory(comboboxRegistries);
|
|
1288
741
|
|
|
1289
|
-
export {
|
|
742
|
+
export { comboboxRegistries as a, combobox as c, registerCombobox as r };
|