@angular/cdk-experimental 21.0.0-next.8 → 21.0.0-rc.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/fesm2022/_polyfill-chunk.mjs +8 -9
- package/fesm2022/_polyfill-chunk.mjs.map +1 -1
- package/fesm2022/cdk-experimental.mjs +1 -2
- package/fesm2022/cdk-experimental.mjs.map +1 -1
- package/fesm2022/column-resize.mjs +1115 -954
- package/fesm2022/column-resize.mjs.map +1 -1
- package/fesm2022/popover-edit.mjs +1125 -1061
- package/fesm2022/popover-edit.mjs.map +1 -1
- package/fesm2022/scrolling.mjs +292 -409
- package/fesm2022/scrolling.mjs.map +1 -1
- package/fesm2022/selection.mjs +698 -535
- package/fesm2022/selection.mjs.map +1 -1
- package/fesm2022/table-scroll-container.mjs +163 -113
- package/fesm2022/table-scroll-container.mjs.map +1 -1
- package/package.json +2 -2
|
@@ -11,1142 +11,1206 @@ import { TemplatePortal } from '@angular/cdk/portal';
|
|
|
11
11
|
import { FocusTrapFactory, InteractivityChecker, FocusTrap } from '@angular/cdk/a11y';
|
|
12
12
|
import { ScrollDispatcher, ViewportRuler } from '@angular/cdk/scrolling';
|
|
13
13
|
|
|
14
|
-
/** Selector for finding table cells. */
|
|
15
14
|
const CELL_SELECTOR = '.cdk-cell, .mat-cell, td';
|
|
16
|
-
/** Selector for finding editable table cells. */
|
|
17
15
|
const EDITABLE_CELL_SELECTOR = '.cdk-popover-edit-cell, .mat-popover-edit-cell';
|
|
18
|
-
/** Selector for finding table rows. */
|
|
19
16
|
const ROW_SELECTOR = '.cdk-row, .mat-row, tr';
|
|
20
|
-
/** Selector for finding the table element. */
|
|
21
17
|
const TABLE_SELECTOR = 'table, cdk-table, mat-table';
|
|
22
|
-
/** CSS class added to the edit lens pane. */
|
|
23
18
|
const EDIT_PANE_CLASS = 'cdk-edit-pane';
|
|
24
|
-
/** Selector for finding the edit lens pane. */
|
|
25
19
|
const EDIT_PANE_SELECTOR = `.${EDIT_PANE_CLASS}, .mat-edit-pane`;
|
|
26
|
-
/** Selector for table rows that should be skipped when moving focus. */
|
|
27
20
|
const SKIP_ROW_FOCUS_SELECTOR = '.cdk-popover-edit-skip-focus, .mat-popover-edit-skip-focus';
|
|
28
21
|
|
|
29
|
-
/** The delay applied to mouse events before hiding or showing hover content. */
|
|
30
22
|
const MOUSE_EVENT_DELAY_MS = 40;
|
|
31
|
-
/** The delay for reacting to focus/blur changes. */
|
|
32
23
|
const FOCUS_DELAY = 0;
|
|
33
|
-
/**
|
|
34
|
-
* The possible states for hover content:
|
|
35
|
-
* OFF - Not rendered.
|
|
36
|
-
* FOCUSABLE - Rendered in the dom and styled for its contents to be focusable but invisible.
|
|
37
|
-
* ON - Rendered and fully visible.
|
|
38
|
-
*/
|
|
39
24
|
var HoverContentState;
|
|
40
25
|
(function (HoverContentState) {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
26
|
+
HoverContentState[HoverContentState["OFF"] = 0] = "OFF";
|
|
27
|
+
HoverContentState[HoverContentState["FOCUSABLE"] = 1] = "FOCUSABLE";
|
|
28
|
+
HoverContentState[HoverContentState["ON"] = 2] = "ON";
|
|
44
29
|
})(HoverContentState || (HoverContentState = {}));
|
|
45
|
-
// Note: this class is generic, rather than referencing EditRef directly, in order to avoid
|
|
46
|
-
// circular imports. If we were to reference it here, importing the registry into the
|
|
47
|
-
// class that is registering itself will introduce a circular import.
|
|
48
|
-
/**
|
|
49
|
-
* Service for sharing delegated events and state for triggering table edits.
|
|
50
|
-
*/
|
|
51
30
|
class EditEventDispatcher {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
this.
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
/** Sets the currently active EditRef. */
|
|
130
|
-
setActiveEditRef(ref) {
|
|
131
|
-
this._editRef = ref;
|
|
132
|
-
}
|
|
133
|
-
/** Unset the currently active EditRef, if the specified editRef is active. */
|
|
134
|
-
unsetActiveEditRef(ref) {
|
|
135
|
-
if (this._editRef !== ref) {
|
|
136
|
-
return;
|
|
137
|
-
}
|
|
138
|
-
this._editRef = null;
|
|
139
|
-
}
|
|
140
|
-
/** Adds the specified table row to be tracked for first/last row comparisons. */
|
|
141
|
-
registerRowWithHoverContent(row) {
|
|
142
|
-
this._rowsWithHoverContent.set(row, (this._rowsWithHoverContent.get(row) || 0) + 1);
|
|
143
|
-
}
|
|
144
|
-
/**
|
|
145
|
-
* Reference decrements and ultimately removes the specified table row from first/last row
|
|
146
|
-
* comparisons.
|
|
147
|
-
*/
|
|
148
|
-
deregisterRowWithHoverContent(row) {
|
|
149
|
-
const refCount = this._rowsWithHoverContent.get(row) || 0;
|
|
150
|
-
if (refCount <= 1) {
|
|
151
|
-
this._rowsWithHoverContent.delete(row);
|
|
31
|
+
_ngZone = inject(NgZone);
|
|
32
|
+
editing = new Subject();
|
|
33
|
+
hovering = new Subject();
|
|
34
|
+
focused = new Subject();
|
|
35
|
+
allRows = new Subject();
|
|
36
|
+
mouseMove = new Subject();
|
|
37
|
+
disabledCells = new WeakMap();
|
|
38
|
+
get editRef() {
|
|
39
|
+
return this._editRef;
|
|
40
|
+
}
|
|
41
|
+
_editRef = null;
|
|
42
|
+
_distinctUntilChanged = distinctUntilChanged();
|
|
43
|
+
_startWithNull = startWith(null);
|
|
44
|
+
_distinctShare = pipe(this._distinctUntilChanged, shareReplay(1));
|
|
45
|
+
_startWithNullDistinct = pipe(this._startWithNull, this._distinctUntilChanged);
|
|
46
|
+
editingAndEnabled = this.editing.pipe(filter(cell => cell == null || !this.disabledCells.has(cell)), shareReplay(1));
|
|
47
|
+
editingOrFocused = combineLatest([this.editingAndEnabled.pipe(map(cell => closest(cell, ROW_SELECTOR)), this._startWithNull), this.focused.pipe(this._startWithNull)]).pipe(map(([editingRow, focusedRow]) => focusedRow || editingRow), this._distinctUntilChanged, auditTime(FOCUS_DELAY), this._distinctUntilChanged, shareReplay(1));
|
|
48
|
+
_rowsWithHoverContent = new WeakMap();
|
|
49
|
+
_currentlyEditing = null;
|
|
50
|
+
_hoveredContentStateDistinct = combineLatest([this._getFirstRowWithHoverContent(), this._getLastRowWithHoverContent(), this.editingOrFocused, this.hovering.pipe(distinctUntilChanged(), audit(row => this.mouseMove.pipe(filter(mouseMoveRow => row === mouseMoveRow), this._startWithNull, debounceTime(MOUSE_EVENT_DELAY_MS))), this._startWithNullDistinct)]).pipe(skip(1), map(computeHoverContentState), distinctUntilChanged(areMapEntriesEqual), this._enterZone(), shareReplay(1));
|
|
51
|
+
_editingAndEnabledDistinct = this.editingAndEnabled.pipe(distinctUntilChanged(), this._enterZone(), shareReplay(1));
|
|
52
|
+
_lastSeenRow = null;
|
|
53
|
+
_lastSeenRowHoverOrFocus = null;
|
|
54
|
+
constructor() {
|
|
55
|
+
this._editingAndEnabledDistinct.subscribe(cell => {
|
|
56
|
+
this._currentlyEditing = cell;
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
editingCell(element) {
|
|
60
|
+
let cell = null;
|
|
61
|
+
return this._editingAndEnabledDistinct.pipe(map(editCell => editCell === (cell || (cell = closest(element, CELL_SELECTOR)))), this._distinctUntilChanged);
|
|
62
|
+
}
|
|
63
|
+
doneEditingCell(element) {
|
|
64
|
+
const cell = closest(element, CELL_SELECTOR);
|
|
65
|
+
if (this._currentlyEditing === cell) {
|
|
66
|
+
this.editing.next(null);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
setActiveEditRef(ref) {
|
|
70
|
+
this._editRef = ref;
|
|
71
|
+
}
|
|
72
|
+
unsetActiveEditRef(ref) {
|
|
73
|
+
if (this._editRef !== ref) {
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
this._editRef = null;
|
|
77
|
+
}
|
|
78
|
+
registerRowWithHoverContent(row) {
|
|
79
|
+
this._rowsWithHoverContent.set(row, (this._rowsWithHoverContent.get(row) || 0) + 1);
|
|
80
|
+
}
|
|
81
|
+
deregisterRowWithHoverContent(row) {
|
|
82
|
+
const refCount = this._rowsWithHoverContent.get(row) || 0;
|
|
83
|
+
if (refCount <= 1) {
|
|
84
|
+
this._rowsWithHoverContent.delete(row);
|
|
85
|
+
} else {
|
|
86
|
+
this._rowsWithHoverContent.set(row, refCount - 1);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
hoverOrFocusOnRow(row) {
|
|
90
|
+
if (row !== this._lastSeenRow) {
|
|
91
|
+
this._lastSeenRow = row;
|
|
92
|
+
this._lastSeenRowHoverOrFocus = this._hoveredContentStateDistinct.pipe(map(state => state.get(row) || HoverContentState.OFF), this._distinctShare);
|
|
93
|
+
}
|
|
94
|
+
return this._lastSeenRowHoverOrFocus;
|
|
95
|
+
}
|
|
96
|
+
_enterZone() {
|
|
97
|
+
return source => new Observable(observer => source.subscribe({
|
|
98
|
+
next: value => this._ngZone.run(() => observer.next(value)),
|
|
99
|
+
error: err => observer.error(err),
|
|
100
|
+
complete: () => observer.complete()
|
|
101
|
+
}));
|
|
102
|
+
}
|
|
103
|
+
_getFirstRowWithHoverContent() {
|
|
104
|
+
return this._mapAllRowsToSingleRow(rows => {
|
|
105
|
+
for (let i = 0, row; row = rows[i]; i++) {
|
|
106
|
+
if (this._rowsWithHoverContent.has(row)) {
|
|
107
|
+
return row;
|
|
152
108
|
}
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
hoverOrFocusOnRow(row) {
|
|
163
|
-
if (row !== this._lastSeenRow) {
|
|
164
|
-
this._lastSeenRow = row;
|
|
165
|
-
this._lastSeenRowHoverOrFocus = this._hoveredContentStateDistinct.pipe(map(state => state.get(row) || HoverContentState.OFF), this._distinctShare);
|
|
109
|
+
}
|
|
110
|
+
return null;
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
_getLastRowWithHoverContent() {
|
|
114
|
+
return this._mapAllRowsToSingleRow(rows => {
|
|
115
|
+
for (let i = rows.length - 1, row; row = rows[i]; i--) {
|
|
116
|
+
if (this._rowsWithHoverContent.has(row)) {
|
|
117
|
+
return row;
|
|
166
118
|
}
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
});
|
|
189
|
-
}
|
|
190
|
-
_getLastRowWithHoverContent() {
|
|
191
|
-
return this._mapAllRowsToSingleRow(rows => {
|
|
192
|
-
for (let i = rows.length - 1, row; (row = rows[i]); i--) {
|
|
193
|
-
if (this._rowsWithHoverContent.has(row)) {
|
|
194
|
-
return row;
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
return null;
|
|
198
|
-
});
|
|
199
|
-
}
|
|
200
|
-
_mapAllRowsToSingleRow(mapper) {
|
|
201
|
-
return this.allRows.pipe(map(mapper), this._startWithNullDistinct);
|
|
202
|
-
}
|
|
203
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.0-next.2", ngImport: i0, type: EditEventDispatcher, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
204
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.2.0-next.2", ngImport: i0, type: EditEventDispatcher });
|
|
119
|
+
}
|
|
120
|
+
return null;
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
_mapAllRowsToSingleRow(mapper) {
|
|
124
|
+
return this.allRows.pipe(map(mapper), this._startWithNullDistinct);
|
|
125
|
+
}
|
|
126
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
127
|
+
minVersion: "12.0.0",
|
|
128
|
+
version: "20.2.0-next.2",
|
|
129
|
+
ngImport: i0,
|
|
130
|
+
type: EditEventDispatcher,
|
|
131
|
+
deps: [],
|
|
132
|
+
target: i0.ɵɵFactoryTarget.Injectable
|
|
133
|
+
});
|
|
134
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({
|
|
135
|
+
minVersion: "12.0.0",
|
|
136
|
+
version: "20.2.0-next.2",
|
|
137
|
+
ngImport: i0,
|
|
138
|
+
type: EditEventDispatcher
|
|
139
|
+
});
|
|
205
140
|
}
|
|
206
|
-
i0.ɵɵngDeclareClassMetadata({
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
141
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
142
|
+
minVersion: "12.0.0",
|
|
143
|
+
version: "20.2.0-next.2",
|
|
144
|
+
ngImport: i0,
|
|
145
|
+
type: EditEventDispatcher,
|
|
146
|
+
decorators: [{
|
|
147
|
+
type: Injectable
|
|
148
|
+
}],
|
|
149
|
+
ctorParameters: () => []
|
|
150
|
+
});
|
|
151
|
+
function computeHoverContentState([firstRow, lastRow, activeRow, hoverRow]) {
|
|
152
|
+
const hoverContentState = new Map();
|
|
153
|
+
for (const focussableRow of [firstRow, lastRow, activeRow && activeRow.previousElementSibling, activeRow && activeRow.nextElementSibling]) {
|
|
154
|
+
if (focussableRow) {
|
|
155
|
+
hoverContentState.set(focussableRow, HoverContentState.FOCUSABLE);
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
for (const onRow of [activeRow, hoverRow]) {
|
|
159
|
+
if (onRow) {
|
|
160
|
+
hoverContentState.set(onRow, HoverContentState.ON);
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
return hoverContentState;
|
|
229
164
|
}
|
|
230
165
|
function areMapEntriesEqual(a, b) {
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
return false;
|
|
238
|
-
}
|
|
166
|
+
if (a.size !== b.size) {
|
|
167
|
+
return false;
|
|
168
|
+
}
|
|
169
|
+
for (const aKey of Array.from(a.keys())) {
|
|
170
|
+
if (b.get(aKey) !== a.get(aKey)) {
|
|
171
|
+
return false;
|
|
239
172
|
}
|
|
240
|
-
|
|
173
|
+
}
|
|
174
|
+
return true;
|
|
241
175
|
}
|
|
242
176
|
|
|
243
|
-
/**
|
|
244
|
-
* Used for communication between the form within the edit lens and the
|
|
245
|
-
* table that launched it. Provided by CdkEditControl within the lens.
|
|
246
|
-
*/
|
|
247
177
|
class EditRef {
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.0-next.2", ngImport: i0, type: EditRef, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
306
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.2.0-next.2", ngImport: i0, type: EditRef });
|
|
178
|
+
_form = inject(ControlContainer, {
|
|
179
|
+
self: true
|
|
180
|
+
});
|
|
181
|
+
_editEventDispatcher = inject(EditEventDispatcher);
|
|
182
|
+
_finalValueSubject = new Subject();
|
|
183
|
+
finalValue = this._finalValueSubject;
|
|
184
|
+
_blurredSubject = new Subject();
|
|
185
|
+
blurred = this._blurredSubject;
|
|
186
|
+
_revertFormValue;
|
|
187
|
+
_injector = inject(Injector);
|
|
188
|
+
constructor() {
|
|
189
|
+
this._editEventDispatcher.setActiveEditRef(this);
|
|
190
|
+
}
|
|
191
|
+
init(previousFormValue) {
|
|
192
|
+
afterNextRender(() => {
|
|
193
|
+
this.updateRevertValue();
|
|
194
|
+
if (previousFormValue) {
|
|
195
|
+
this.reset(previousFormValue);
|
|
196
|
+
}
|
|
197
|
+
}, {
|
|
198
|
+
injector: this._injector
|
|
199
|
+
});
|
|
200
|
+
}
|
|
201
|
+
ngOnDestroy() {
|
|
202
|
+
this._editEventDispatcher.unsetActiveEditRef(this);
|
|
203
|
+
this._finalValueSubject.next(this._form.value);
|
|
204
|
+
this._finalValueSubject.complete();
|
|
205
|
+
}
|
|
206
|
+
isValid() {
|
|
207
|
+
return this._form.valid;
|
|
208
|
+
}
|
|
209
|
+
updateRevertValue() {
|
|
210
|
+
this._revertFormValue = this._form.value;
|
|
211
|
+
}
|
|
212
|
+
close() {
|
|
213
|
+
this._editEventDispatcher.editing.next(null);
|
|
214
|
+
}
|
|
215
|
+
blur() {
|
|
216
|
+
this._blurredSubject.next();
|
|
217
|
+
}
|
|
218
|
+
reset(value) {
|
|
219
|
+
this._form.reset(value || this._revertFormValue);
|
|
220
|
+
}
|
|
221
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
222
|
+
minVersion: "12.0.0",
|
|
223
|
+
version: "20.2.0-next.2",
|
|
224
|
+
ngImport: i0,
|
|
225
|
+
type: EditRef,
|
|
226
|
+
deps: [],
|
|
227
|
+
target: i0.ɵɵFactoryTarget.Injectable
|
|
228
|
+
});
|
|
229
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({
|
|
230
|
+
minVersion: "12.0.0",
|
|
231
|
+
version: "20.2.0-next.2",
|
|
232
|
+
ngImport: i0,
|
|
233
|
+
type: EditRef
|
|
234
|
+
});
|
|
307
235
|
}
|
|
308
|
-
i0.ɵɵngDeclareClassMetadata({
|
|
309
|
-
|
|
310
|
-
|
|
236
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
237
|
+
minVersion: "12.0.0",
|
|
238
|
+
version: "20.2.0-next.2",
|
|
239
|
+
ngImport: i0,
|
|
240
|
+
type: EditRef,
|
|
241
|
+
decorators: [{
|
|
242
|
+
type: Injectable
|
|
243
|
+
}],
|
|
244
|
+
ctorParameters: () => []
|
|
245
|
+
});
|
|
311
246
|
|
|
312
|
-
/**
|
|
313
|
-
* Service responsible for moving cell focus around in response to keyboard events.
|
|
314
|
-
* May be overridden to customize the keyboard behavior of popover edit.
|
|
315
|
-
*/
|
|
316
247
|
class FocusDispatcher {
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
}
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
248
|
+
directionality = inject(Directionality);
|
|
249
|
+
keyObserver;
|
|
250
|
+
constructor() {
|
|
251
|
+
this.keyObserver = {
|
|
252
|
+
next: event => this.handleKeyboardEvent(event)
|
|
253
|
+
};
|
|
254
|
+
}
|
|
255
|
+
moveFocusHorizontally(currentCell, offset) {
|
|
256
|
+
const cells = Array.from(closest(currentCell, TABLE_SELECTOR).querySelectorAll(EDITABLE_CELL_SELECTOR));
|
|
257
|
+
const currentIndex = cells.indexOf(currentCell);
|
|
258
|
+
const newIndex = currentIndex + offset;
|
|
259
|
+
if (cells[newIndex]) {
|
|
260
|
+
cells[newIndex].focus();
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
moveFocusVertically(currentCell, offset) {
|
|
264
|
+
const currentRow = closest(currentCell, ROW_SELECTOR);
|
|
265
|
+
const rows = Array.from(closest(currentRow, TABLE_SELECTOR).querySelectorAll(ROW_SELECTOR));
|
|
266
|
+
const currentRowIndex = rows.indexOf(currentRow);
|
|
267
|
+
const currentIndexWithinRow = Array.from(currentRow.querySelectorAll(EDITABLE_CELL_SELECTOR)).indexOf(currentCell);
|
|
268
|
+
let newRowIndex = currentRowIndex + offset;
|
|
269
|
+
while (rows[newRowIndex]?.matches(SKIP_ROW_FOCUS_SELECTOR)) {
|
|
270
|
+
newRowIndex = newRowIndex + (offset > 0 ? 1 : -1);
|
|
271
|
+
}
|
|
272
|
+
if (rows[newRowIndex]) {
|
|
273
|
+
const rowToFocus = Array.from(rows[newRowIndex].querySelectorAll(EDITABLE_CELL_SELECTOR));
|
|
274
|
+
if (rowToFocus[currentIndexWithinRow]) {
|
|
275
|
+
rowToFocus[currentIndexWithinRow].focus();
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
handleKeyboardEvent(event) {
|
|
280
|
+
const cell = closest(event.target, EDITABLE_CELL_SELECTOR);
|
|
281
|
+
if (!cell) {
|
|
282
|
+
return;
|
|
283
|
+
}
|
|
284
|
+
switch (event.keyCode) {
|
|
285
|
+
case UP_ARROW:
|
|
286
|
+
this.moveFocusVertically(cell, -1);
|
|
287
|
+
break;
|
|
288
|
+
case DOWN_ARROW:
|
|
289
|
+
this.moveFocusVertically(cell, 1);
|
|
290
|
+
break;
|
|
291
|
+
case LEFT_ARROW:
|
|
292
|
+
this.moveFocusHorizontally(cell, this.directionality.value === 'ltr' ? -1 : 1);
|
|
293
|
+
break;
|
|
294
|
+
case RIGHT_ARROW:
|
|
295
|
+
this.moveFocusHorizontally(cell, this.directionality.value === 'ltr' ? 1 : -1);
|
|
296
|
+
break;
|
|
297
|
+
default:
|
|
298
|
+
return;
|
|
299
|
+
}
|
|
300
|
+
event.preventDefault();
|
|
301
|
+
}
|
|
302
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
303
|
+
minVersion: "12.0.0",
|
|
304
|
+
version: "20.2.0-next.2",
|
|
305
|
+
ngImport: i0,
|
|
306
|
+
type: FocusDispatcher,
|
|
307
|
+
deps: [],
|
|
308
|
+
target: i0.ɵɵFactoryTarget.Injectable
|
|
309
|
+
});
|
|
310
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({
|
|
311
|
+
minVersion: "12.0.0",
|
|
312
|
+
version: "20.2.0-next.2",
|
|
313
|
+
ngImport: i0,
|
|
314
|
+
type: FocusDispatcher,
|
|
315
|
+
providedIn: 'root'
|
|
316
|
+
});
|
|
379
317
|
}
|
|
380
|
-
i0.ɵɵngDeclareClassMetadata({
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
318
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
319
|
+
minVersion: "12.0.0",
|
|
320
|
+
version: "20.2.0-next.2",
|
|
321
|
+
ngImport: i0,
|
|
322
|
+
type: FocusDispatcher,
|
|
323
|
+
decorators: [{
|
|
324
|
+
type: Injectable,
|
|
325
|
+
args: [{
|
|
326
|
+
providedIn: 'root'
|
|
327
|
+
}]
|
|
328
|
+
}],
|
|
329
|
+
ctorParameters: () => []
|
|
330
|
+
});
|
|
384
331
|
|
|
385
|
-
/**
|
|
386
|
-
* A convenience class for preserving unsaved form state while an edit lens is closed.
|
|
387
|
-
*
|
|
388
|
-
* Example usage:
|
|
389
|
-
* class MyComponent {
|
|
390
|
-
* readonly nameEditValues = new FormValueContainer<Item, {name: string}>();
|
|
391
|
-
* }
|
|
392
|
-
*
|
|
393
|
-
* <form cdkEditControl [(cdkEditControlPreservedFormValue)]="nameEditValues.for(item).value">
|
|
394
|
-
*/
|
|
395
332
|
class FormValueContainer {
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
}
|
|
333
|
+
_formValues = new WeakMap();
|
|
334
|
+
for(key) {
|
|
335
|
+
const _formValues = this._formValues;
|
|
336
|
+
let entry = _formValues.get(key);
|
|
337
|
+
if (!entry) {
|
|
338
|
+
entry = {};
|
|
339
|
+
_formValues.set(key, entry);
|
|
340
|
+
}
|
|
341
|
+
return entry;
|
|
342
|
+
}
|
|
407
343
|
}
|
|
408
344
|
|
|
409
|
-
/**
|
|
410
|
-
* A directive that attaches to a form within the edit lens.
|
|
411
|
-
* It coordinates the form state with the table-wide edit system and handles
|
|
412
|
-
* closing the edit lens when the form is submitted or the user clicks
|
|
413
|
-
* out.
|
|
414
|
-
*/
|
|
415
345
|
class CdkEditControl {
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
*/
|
|
450
|
-
handleFormSubmit() {
|
|
451
|
-
if (this.ignoreSubmitUnlessValid && !this.editRef.isValid()) {
|
|
452
|
-
return;
|
|
453
|
-
}
|
|
454
|
-
this.editRef.updateRevertValue();
|
|
346
|
+
elementRef = inject(ElementRef);
|
|
347
|
+
editRef = inject(EditRef);
|
|
348
|
+
destroyed = new Subject();
|
|
349
|
+
clickOutBehavior = 'close';
|
|
350
|
+
preservedFormValue;
|
|
351
|
+
preservedFormValueChange = new EventEmitter();
|
|
352
|
+
ignoreSubmitUnlessValid = true;
|
|
353
|
+
ngOnInit() {
|
|
354
|
+
this.editRef.init(this.preservedFormValue);
|
|
355
|
+
this.editRef.finalValue.subscribe(this.preservedFormValueChange);
|
|
356
|
+
this.editRef.blurred.subscribe(() => this._handleBlur());
|
|
357
|
+
}
|
|
358
|
+
ngOnDestroy() {
|
|
359
|
+
this.destroyed.next();
|
|
360
|
+
this.destroyed.complete();
|
|
361
|
+
}
|
|
362
|
+
handleFormSubmit() {
|
|
363
|
+
if (this.ignoreSubmitUnlessValid && !this.editRef.isValid()) {
|
|
364
|
+
return;
|
|
365
|
+
}
|
|
366
|
+
this.editRef.updateRevertValue();
|
|
367
|
+
this.editRef.close();
|
|
368
|
+
}
|
|
369
|
+
close() {
|
|
370
|
+
this.editRef.close();
|
|
371
|
+
}
|
|
372
|
+
handlePossibleClickOut(evt) {
|
|
373
|
+
if (closest(evt.target, EDIT_PANE_SELECTOR)) {
|
|
374
|
+
return;
|
|
375
|
+
}
|
|
376
|
+
switch (this.clickOutBehavior) {
|
|
377
|
+
case 'submit':
|
|
378
|
+
this._triggerFormSubmit();
|
|
455
379
|
this.editRef.close();
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
close() {
|
|
459
|
-
// todo - allow this behavior to be customized as well, such as calling
|
|
460
|
-
// reset before close
|
|
380
|
+
break;
|
|
381
|
+
case 'close':
|
|
461
382
|
this.editRef.close();
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
}
|
|
498
|
-
|
|
499
|
-
|
|
383
|
+
break;
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
_handleKeydown(event) {
|
|
387
|
+
if (event.key === 'Escape' && !hasModifierKey(event)) {
|
|
388
|
+
this.close();
|
|
389
|
+
event.preventDefault();
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
_handleBlur() {
|
|
393
|
+
if (this.clickOutBehavior === 'submit') {
|
|
394
|
+
this._triggerFormSubmit();
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
_triggerFormSubmit() {
|
|
398
|
+
this.elementRef.nativeElement.dispatchEvent(new Event('submit'));
|
|
399
|
+
}
|
|
400
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
401
|
+
minVersion: "12.0.0",
|
|
402
|
+
version: "20.2.0-next.2",
|
|
403
|
+
ngImport: i0,
|
|
404
|
+
type: CdkEditControl,
|
|
405
|
+
deps: [],
|
|
406
|
+
target: i0.ɵɵFactoryTarget.Directive
|
|
407
|
+
});
|
|
408
|
+
static ɵdir = i0.ɵɵngDeclareDirective({
|
|
409
|
+
minVersion: "14.0.0",
|
|
410
|
+
version: "20.2.0-next.2",
|
|
411
|
+
type: CdkEditControl,
|
|
412
|
+
isStandalone: true,
|
|
413
|
+
selector: "form[cdkEditControl]",
|
|
414
|
+
inputs: {
|
|
415
|
+
clickOutBehavior: ["cdkEditControlClickOutBehavior", "clickOutBehavior"],
|
|
416
|
+
preservedFormValue: ["cdkEditControlPreservedFormValue", "preservedFormValue"],
|
|
417
|
+
ignoreSubmitUnlessValid: ["cdkEditControlIgnoreSubmitUnlessValid", "ignoreSubmitUnlessValid"]
|
|
418
|
+
},
|
|
419
|
+
outputs: {
|
|
420
|
+
preservedFormValueChange: "cdkEditControlPreservedFormValueChange"
|
|
421
|
+
},
|
|
422
|
+
host: {
|
|
423
|
+
listeners: {
|
|
424
|
+
"ngSubmit": "handleFormSubmit()",
|
|
425
|
+
"document:click": "handlePossibleClickOut($event)",
|
|
426
|
+
"keydown": "_handleKeydown($event)"
|
|
427
|
+
}
|
|
428
|
+
},
|
|
429
|
+
providers: [EditRef],
|
|
430
|
+
ngImport: i0
|
|
431
|
+
});
|
|
500
432
|
}
|
|
501
|
-
i0.ɵɵngDeclareClassMetadata({
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
433
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
434
|
+
minVersion: "12.0.0",
|
|
435
|
+
version: "20.2.0-next.2",
|
|
436
|
+
ngImport: i0,
|
|
437
|
+
type: CdkEditControl,
|
|
438
|
+
decorators: [{
|
|
439
|
+
type: Directive,
|
|
440
|
+
args: [{
|
|
441
|
+
selector: 'form[cdkEditControl]',
|
|
442
|
+
inputs: [{
|
|
443
|
+
name: 'clickOutBehavior',
|
|
444
|
+
alias: 'cdkEditControlClickOutBehavior'
|
|
445
|
+
}, {
|
|
446
|
+
name: 'preservedFormValue',
|
|
447
|
+
alias: 'cdkEditControlPreservedFormValue'
|
|
448
|
+
}, {
|
|
449
|
+
name: 'ignoreSubmitUnlessValid',
|
|
450
|
+
alias: 'cdkEditControlIgnoreSubmitUnlessValid'
|
|
451
|
+
}],
|
|
452
|
+
outputs: ['preservedFormValueChange: cdkEditControlPreservedFormValueChange'],
|
|
453
|
+
providers: [EditRef],
|
|
454
|
+
host: {
|
|
455
|
+
'(ngSubmit)': 'handleFormSubmit()',
|
|
456
|
+
'(document:click)': 'handlePossibleClickOut($event)',
|
|
457
|
+
'(keydown)': '_handleKeydown($event)'
|
|
458
|
+
}
|
|
459
|
+
}]
|
|
460
|
+
}]
|
|
461
|
+
});
|
|
520
462
|
class CdkEditRevert {
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
463
|
+
editRef = inject(EditRef);
|
|
464
|
+
type = 'button';
|
|
465
|
+
revertEdit() {
|
|
466
|
+
this.editRef.reset();
|
|
467
|
+
}
|
|
468
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
469
|
+
minVersion: "12.0.0",
|
|
470
|
+
version: "20.2.0-next.2",
|
|
471
|
+
ngImport: i0,
|
|
472
|
+
type: CdkEditRevert,
|
|
473
|
+
deps: [],
|
|
474
|
+
target: i0.ɵɵFactoryTarget.Directive
|
|
475
|
+
});
|
|
476
|
+
static ɵdir = i0.ɵɵngDeclareDirective({
|
|
477
|
+
minVersion: "14.0.0",
|
|
478
|
+
version: "20.2.0-next.2",
|
|
479
|
+
type: CdkEditRevert,
|
|
480
|
+
isStandalone: true,
|
|
481
|
+
selector: "button[cdkEditRevert]",
|
|
482
|
+
inputs: {
|
|
483
|
+
type: "type"
|
|
484
|
+
},
|
|
485
|
+
host: {
|
|
486
|
+
attributes: {
|
|
487
|
+
"type": "button"
|
|
488
|
+
},
|
|
489
|
+
listeners: {
|
|
490
|
+
"click": "revertEdit()"
|
|
491
|
+
}
|
|
492
|
+
},
|
|
493
|
+
ngImport: i0
|
|
494
|
+
});
|
|
529
495
|
}
|
|
530
|
-
i0.ɵɵngDeclareClassMetadata({
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
496
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
497
|
+
minVersion: "12.0.0",
|
|
498
|
+
version: "20.2.0-next.2",
|
|
499
|
+
ngImport: i0,
|
|
500
|
+
type: CdkEditRevert,
|
|
501
|
+
decorators: [{
|
|
502
|
+
type: Directive,
|
|
503
|
+
args: [{
|
|
504
|
+
selector: 'button[cdkEditRevert]',
|
|
505
|
+
host: {
|
|
506
|
+
'type': 'button',
|
|
507
|
+
'(click)': 'revertEdit()'
|
|
508
|
+
}
|
|
509
|
+
}]
|
|
510
|
+
}],
|
|
511
|
+
propDecorators: {
|
|
512
|
+
type: [{
|
|
513
|
+
type: Input
|
|
514
|
+
}]
|
|
515
|
+
}
|
|
516
|
+
});
|
|
543
517
|
class CdkEditClose {
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
518
|
+
elementRef = inject(ElementRef);
|
|
519
|
+
editRef = inject(EditRef);
|
|
520
|
+
constructor() {
|
|
521
|
+
const nativeElement = this.elementRef.nativeElement;
|
|
522
|
+
if (nativeElement.nodeName === 'BUTTON' && !nativeElement.getAttribute('type')) {
|
|
523
|
+
nativeElement.setAttribute('type', 'button');
|
|
524
|
+
}
|
|
525
|
+
}
|
|
526
|
+
closeEdit() {
|
|
527
|
+
this.editRef.close();
|
|
528
|
+
}
|
|
529
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
530
|
+
minVersion: "12.0.0",
|
|
531
|
+
version: "20.2.0-next.2",
|
|
532
|
+
ngImport: i0,
|
|
533
|
+
type: CdkEditClose,
|
|
534
|
+
deps: [],
|
|
535
|
+
target: i0.ɵɵFactoryTarget.Directive
|
|
536
|
+
});
|
|
537
|
+
static ɵdir = i0.ɵɵngDeclareDirective({
|
|
538
|
+
minVersion: "14.0.0",
|
|
539
|
+
version: "20.2.0-next.2",
|
|
540
|
+
type: CdkEditClose,
|
|
541
|
+
isStandalone: true,
|
|
542
|
+
selector: "[cdkEditClose]",
|
|
543
|
+
host: {
|
|
544
|
+
listeners: {
|
|
545
|
+
"click": "closeEdit()",
|
|
546
|
+
"keydown.enter": "closeEdit()",
|
|
547
|
+
"keydown.space": "closeEdit()"
|
|
548
|
+
}
|
|
549
|
+
},
|
|
550
|
+
ngImport: i0
|
|
551
|
+
});
|
|
563
552
|
}
|
|
564
|
-
i0.ɵɵngDeclareClassMetadata({
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
553
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
554
|
+
minVersion: "12.0.0",
|
|
555
|
+
version: "20.2.0-next.2",
|
|
556
|
+
ngImport: i0,
|
|
557
|
+
type: CdkEditClose,
|
|
558
|
+
decorators: [{
|
|
559
|
+
type: Directive,
|
|
560
|
+
args: [{
|
|
561
|
+
selector: '[cdkEditClose]',
|
|
562
|
+
host: {
|
|
563
|
+
'(click)': 'closeEdit()',
|
|
564
|
+
'(keydown.enter)': 'closeEdit()',
|
|
565
|
+
'(keydown.space)': 'closeEdit()'
|
|
566
|
+
}
|
|
567
|
+
}]
|
|
568
|
+
}],
|
|
569
|
+
ctorParameters: () => []
|
|
570
|
+
});
|
|
575
571
|
|
|
576
|
-
/**
|
|
577
|
-
* Optimization
|
|
578
|
-
* Collects multiple Injectables into a singleton shared across the table. By reducing the
|
|
579
|
-
* number of services injected into each CdkPopoverEdit, this saves about 0.023ms of cpu time
|
|
580
|
-
* and 56 bytes of memory per instance.
|
|
581
|
-
*/
|
|
582
572
|
class EditServices {
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
573
|
+
directionality = inject(Directionality);
|
|
574
|
+
editEventDispatcher = inject(EditEventDispatcher);
|
|
575
|
+
focusDispatcher = inject(FocusDispatcher);
|
|
576
|
+
focusTrapFactory = inject(FocusTrapFactory);
|
|
577
|
+
ngZone = inject(NgZone);
|
|
578
|
+
scrollDispatcher = inject(ScrollDispatcher);
|
|
579
|
+
viewportRuler = inject(ViewportRuler);
|
|
580
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
581
|
+
minVersion: "12.0.0",
|
|
582
|
+
version: "20.2.0-next.2",
|
|
583
|
+
ngImport: i0,
|
|
584
|
+
type: EditServices,
|
|
585
|
+
deps: [],
|
|
586
|
+
target: i0.ɵɵFactoryTarget.Injectable
|
|
587
|
+
});
|
|
588
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({
|
|
589
|
+
minVersion: "12.0.0",
|
|
590
|
+
version: "20.2.0-next.2",
|
|
591
|
+
ngImport: i0,
|
|
592
|
+
type: EditServices
|
|
593
|
+
});
|
|
592
594
|
}
|
|
593
|
-
i0.ɵɵngDeclareClassMetadata({
|
|
594
|
-
|
|
595
|
-
|
|
595
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
596
|
+
minVersion: "12.0.0",
|
|
597
|
+
version: "20.2.0-next.2",
|
|
598
|
+
ngImport: i0,
|
|
599
|
+
type: EditServices,
|
|
600
|
+
decorators: [{
|
|
601
|
+
type: Injectable
|
|
602
|
+
}]
|
|
603
|
+
});
|
|
596
604
|
|
|
597
|
-
/** Value indicating whether focus left the target area before or after the enclosed elements. */
|
|
598
605
|
var FocusEscapeNotifierDirection;
|
|
599
606
|
(function (FocusEscapeNotifierDirection) {
|
|
600
|
-
|
|
601
|
-
|
|
607
|
+
FocusEscapeNotifierDirection[FocusEscapeNotifierDirection["START"] = 0] = "START";
|
|
608
|
+
FocusEscapeNotifierDirection[FocusEscapeNotifierDirection["END"] = 1] = "END";
|
|
602
609
|
})(FocusEscapeNotifierDirection || (FocusEscapeNotifierDirection = {}));
|
|
603
|
-
/**
|
|
604
|
-
* Like FocusTrap, but rather than trapping focus within a dom region, notifies subscribers when
|
|
605
|
-
* focus leaves the region.
|
|
606
|
-
*/
|
|
607
610
|
class FocusEscapeNotifier extends FocusTrap {
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
return this._escapeSubject;
|
|
625
|
-
}
|
|
611
|
+
_escapeSubject = new Subject();
|
|
612
|
+
constructor(element, checker, ngZone, document) {
|
|
613
|
+
super(element, checker, ngZone, document, true);
|
|
614
|
+
this.startAnchorListener = () => {
|
|
615
|
+
this._escapeSubject.next(FocusEscapeNotifierDirection.START);
|
|
616
|
+
return true;
|
|
617
|
+
};
|
|
618
|
+
this.endAnchorListener = () => {
|
|
619
|
+
this._escapeSubject.next(FocusEscapeNotifierDirection.END);
|
|
620
|
+
return true;
|
|
621
|
+
};
|
|
622
|
+
this.attachAnchors();
|
|
623
|
+
}
|
|
624
|
+
escapes() {
|
|
625
|
+
return this._escapeSubject;
|
|
626
|
+
}
|
|
626
627
|
}
|
|
627
|
-
/** Factory that allows easy instantiation of focus escape notifiers. */
|
|
628
628
|
class FocusEscapeNotifierFactory {
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
629
|
+
_checker = inject(InteractivityChecker);
|
|
630
|
+
_ngZone = inject(NgZone);
|
|
631
|
+
_document = inject(DOCUMENT);
|
|
632
|
+
create(element) {
|
|
633
|
+
return new FocusEscapeNotifier(element, this._checker, this._ngZone, this._document);
|
|
634
|
+
}
|
|
635
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
636
|
+
minVersion: "12.0.0",
|
|
637
|
+
version: "20.2.0-next.2",
|
|
638
|
+
ngImport: i0,
|
|
639
|
+
type: FocusEscapeNotifierFactory,
|
|
640
|
+
deps: [],
|
|
641
|
+
target: i0.ɵɵFactoryTarget.Injectable
|
|
642
|
+
});
|
|
643
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({
|
|
644
|
+
minVersion: "12.0.0",
|
|
645
|
+
version: "20.2.0-next.2",
|
|
646
|
+
ngImport: i0,
|
|
647
|
+
type: FocusEscapeNotifierFactory,
|
|
648
|
+
providedIn: 'root'
|
|
649
|
+
});
|
|
642
650
|
}
|
|
643
|
-
i0.ɵɵngDeclareClassMetadata({
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
651
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
652
|
+
minVersion: "12.0.0",
|
|
653
|
+
version: "20.2.0-next.2",
|
|
654
|
+
ngImport: i0,
|
|
655
|
+
type: FocusEscapeNotifierFactory,
|
|
656
|
+
decorators: [{
|
|
657
|
+
type: Injectable,
|
|
658
|
+
args: [{
|
|
659
|
+
providedIn: 'root'
|
|
660
|
+
}]
|
|
661
|
+
}]
|
|
662
|
+
});
|
|
647
663
|
|
|
648
|
-
/** Used for rate-limiting mousemove events. */
|
|
649
664
|
const MOUSE_MOVE_THROTTLE_TIME_MS = 10;
|
|
650
665
|
function hasRowElement(nl) {
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
}
|
|
656
|
-
if (el.matches(ROW_SELECTOR)) {
|
|
657
|
-
return true;
|
|
658
|
-
}
|
|
666
|
+
for (let i = 0; i < nl.length; i++) {
|
|
667
|
+
const el = nl[i];
|
|
668
|
+
if (!(el instanceof HTMLElement)) {
|
|
669
|
+
continue;
|
|
659
670
|
}
|
|
660
|
-
|
|
671
|
+
if (el.matches(ROW_SELECTOR)) {
|
|
672
|
+
return true;
|
|
673
|
+
}
|
|
674
|
+
}
|
|
675
|
+
return false;
|
|
661
676
|
}
|
|
662
677
|
function isRowMutation(mutation) {
|
|
663
|
-
|
|
678
|
+
return hasRowElement(mutation.addedNodes) || hasRowElement(mutation.removedNodes);
|
|
664
679
|
}
|
|
665
|
-
/**
|
|
666
|
-
* A directive that must be attached to enable editability on a table.
|
|
667
|
-
* It is responsible for setting up delegated event handlers and providing the
|
|
668
|
-
* EditEventDispatcher service for use by the other edit directives.
|
|
669
|
-
*/
|
|
670
680
|
class CdkEditable {
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
withLatestFrom(this.editEventDispatcher.editingOrFocused), filter(([_, activeRow]) => activeRow == null), map(() => element.querySelectorAll(ROW_SELECTOR)), share(), takeUntil(this.destroyed))
|
|
746
|
-
.subscribe(this.editEventDispatcher.allRows);
|
|
747
|
-
this._observableFromEvent(element, 'keydown')
|
|
748
|
-
.pipe(filter(event => event.key === 'Enter'), toClosest(CELL_SELECTOR), takeUntil(this.destroyed))
|
|
749
|
-
.subscribe(this.editEventDispatcher.editing);
|
|
750
|
-
// Keydown must be used here or else key auto-repeat does not work properly on some platforms.
|
|
751
|
-
this._observableFromEvent(element, 'keydown')
|
|
752
|
-
.pipe(takeUntil(this.destroyed))
|
|
753
|
-
.subscribe(this.focusDispatcher.keyObserver);
|
|
754
|
-
});
|
|
755
|
-
}
|
|
756
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.0-next.2", ngImport: i0, type: CdkEditable, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
757
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.2.0-next.2", type: CdkEditable, isStandalone: true, selector: "table[editable], cdk-table[editable], mat-table[editable]", providers: [EditEventDispatcher, EditServices], ngImport: i0 });
|
|
681
|
+
elementRef = inject(ElementRef);
|
|
682
|
+
editEventDispatcher = inject(EditEventDispatcher);
|
|
683
|
+
focusDispatcher = inject(FocusDispatcher);
|
|
684
|
+
ngZone = inject(NgZone);
|
|
685
|
+
_renderer = inject(Renderer2);
|
|
686
|
+
destroyed = new Subject();
|
|
687
|
+
_rowsRendered = new Subject();
|
|
688
|
+
_rowMutationObserver = globalThis.MutationObserver ? new globalThis.MutationObserver(mutations => {
|
|
689
|
+
if (mutations.some(isRowMutation)) {
|
|
690
|
+
this._rowsRendered.next();
|
|
691
|
+
}
|
|
692
|
+
}) : null;
|
|
693
|
+
constructor() {
|
|
694
|
+
afterNextRender(() => {
|
|
695
|
+
this._rowsRendered.next();
|
|
696
|
+
this._rowMutationObserver?.observe(this.elementRef.nativeElement, {
|
|
697
|
+
childList: true,
|
|
698
|
+
subtree: true
|
|
699
|
+
});
|
|
700
|
+
});
|
|
701
|
+
}
|
|
702
|
+
ngAfterViewInit() {
|
|
703
|
+
this._listenForTableEvents();
|
|
704
|
+
}
|
|
705
|
+
ngOnDestroy() {
|
|
706
|
+
this.destroyed.next();
|
|
707
|
+
this.destroyed.complete();
|
|
708
|
+
this._rowMutationObserver?.disconnect();
|
|
709
|
+
}
|
|
710
|
+
_observableFromEvent(element, name, options) {
|
|
711
|
+
return new Observable(subscriber => {
|
|
712
|
+
const handler = event => subscriber.next(event);
|
|
713
|
+
const cleanup = this._renderer.listen(element, name, handler, options);
|
|
714
|
+
return () => {
|
|
715
|
+
cleanup();
|
|
716
|
+
subscriber.complete();
|
|
717
|
+
};
|
|
718
|
+
});
|
|
719
|
+
}
|
|
720
|
+
_listenForTableEvents() {
|
|
721
|
+
const element = this.elementRef.nativeElement;
|
|
722
|
+
const toClosest = selector => map(event => closest(event.target, selector));
|
|
723
|
+
this.ngZone.runOutsideAngular(() => {
|
|
724
|
+
this._observableFromEvent(element, 'mouseover').pipe(toClosest(ROW_SELECTOR), takeUntil(this.destroyed)).subscribe(this.editEventDispatcher.hovering);
|
|
725
|
+
this._observableFromEvent(element, 'mouseleave').pipe(mapTo(null), takeUntil(this.destroyed)).subscribe(this.editEventDispatcher.hovering);
|
|
726
|
+
this._observableFromEvent(element, 'mousemove').pipe(throttleTime(MOUSE_MOVE_THROTTLE_TIME_MS), toClosest(ROW_SELECTOR), takeUntil(this.destroyed)).subscribe(this.editEventDispatcher.mouseMove);
|
|
727
|
+
this._observableFromEvent(element, 'focus', {
|
|
728
|
+
capture: true
|
|
729
|
+
}).pipe(toClosest(ROW_SELECTOR), share(), takeUntil(this.destroyed)).subscribe(this.editEventDispatcher.focused);
|
|
730
|
+
merge(this._observableFromEvent(element, 'blur', {
|
|
731
|
+
capture: true
|
|
732
|
+
}), this._observableFromEvent(element, 'keydown').pipe(filter(event => event.key === 'Escape'))).pipe(mapTo(null), share(), takeUntil(this.destroyed)).subscribe(this.editEventDispatcher.focused);
|
|
733
|
+
this._rowsRendered.pipe(debounceTime(0), withLatestFrom(this.editEventDispatcher.editingOrFocused), filter(([_, activeRow]) => activeRow == null), map(() => element.querySelectorAll(ROW_SELECTOR)), share(), takeUntil(this.destroyed)).subscribe(this.editEventDispatcher.allRows);
|
|
734
|
+
this._observableFromEvent(element, 'keydown').pipe(filter(event => event.key === 'Enter'), toClosest(CELL_SELECTOR), takeUntil(this.destroyed)).subscribe(this.editEventDispatcher.editing);
|
|
735
|
+
this._observableFromEvent(element, 'keydown').pipe(takeUntil(this.destroyed)).subscribe(this.focusDispatcher.keyObserver);
|
|
736
|
+
});
|
|
737
|
+
}
|
|
738
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
739
|
+
minVersion: "12.0.0",
|
|
740
|
+
version: "20.2.0-next.2",
|
|
741
|
+
ngImport: i0,
|
|
742
|
+
type: CdkEditable,
|
|
743
|
+
deps: [],
|
|
744
|
+
target: i0.ɵɵFactoryTarget.Directive
|
|
745
|
+
});
|
|
746
|
+
static ɵdir = i0.ɵɵngDeclareDirective({
|
|
747
|
+
minVersion: "14.0.0",
|
|
748
|
+
version: "20.2.0-next.2",
|
|
749
|
+
type: CdkEditable,
|
|
750
|
+
isStandalone: true,
|
|
751
|
+
selector: "table[editable], cdk-table[editable], mat-table[editable]",
|
|
752
|
+
providers: [EditEventDispatcher, EditServices],
|
|
753
|
+
ngImport: i0
|
|
754
|
+
});
|
|
758
755
|
}
|
|
759
|
-
i0.ɵɵngDeclareClassMetadata({
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
756
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
757
|
+
minVersion: "12.0.0",
|
|
758
|
+
version: "20.2.0-next.2",
|
|
759
|
+
ngImport: i0,
|
|
760
|
+
type: CdkEditable,
|
|
761
|
+
decorators: [{
|
|
762
|
+
type: Directive,
|
|
763
|
+
args: [{
|
|
764
|
+
selector: 'table[editable], cdk-table[editable], mat-table[editable]',
|
|
765
|
+
providers: [EditEventDispatcher, EditServices]
|
|
766
|
+
}]
|
|
767
|
+
}],
|
|
768
|
+
ctorParameters: () => []
|
|
769
|
+
});
|
|
766
770
|
const POPOVER_EDIT_HOST_BINDINGS = {
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
771
|
+
'[attr.tabindex]': 'disabled ? null : 0',
|
|
772
|
+
'class': 'cdk-popover-edit-cell',
|
|
773
|
+
'[attr.aria-haspopup]': '!disabled'
|
|
770
774
|
};
|
|
771
|
-
const POPOVER_EDIT_INPUTS = [
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
775
|
+
const POPOVER_EDIT_INPUTS = [{
|
|
776
|
+
name: 'template',
|
|
777
|
+
alias: 'cdkPopoverEdit'
|
|
778
|
+
}, {
|
|
779
|
+
name: 'context',
|
|
780
|
+
alias: 'cdkPopoverEditContext'
|
|
781
|
+
}, {
|
|
782
|
+
name: 'colspan',
|
|
783
|
+
alias: 'cdkPopoverEditColspan'
|
|
784
|
+
}, {
|
|
785
|
+
name: 'disabled',
|
|
786
|
+
alias: 'cdkPopoverEditDisabled'
|
|
787
|
+
}, {
|
|
788
|
+
name: 'ariaLabel',
|
|
789
|
+
alias: 'cdkPopoverEditAriaLabel'
|
|
790
|
+
}];
|
|
783
791
|
class CdkPopoverEdit {
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
this.focusTrap = this.services.focusTrapFactory.create(this.overlayRef.overlayElement);
|
|
849
|
-
}
|
|
850
|
-
closeEditOverlay() {
|
|
851
|
-
this.services.editEventDispatcher.doneEditingCell(this.elementRef.nativeElement);
|
|
852
|
-
}
|
|
853
|
-
panelClass() {
|
|
854
|
-
return EDIT_PANE_CLASS;
|
|
855
|
-
}
|
|
856
|
-
_startListeningToEditEvents() {
|
|
857
|
-
this.services.editEventDispatcher
|
|
858
|
-
.editingCell(this.elementRef.nativeElement)
|
|
859
|
-
.pipe(takeUntil(this.destroyed))
|
|
860
|
-
.subscribe(open => {
|
|
861
|
-
if (open && this.template) {
|
|
862
|
-
if (!this.overlayRef) {
|
|
863
|
-
this._createEditOverlay();
|
|
864
|
-
}
|
|
865
|
-
this._showEditOverlay();
|
|
866
|
-
}
|
|
867
|
-
else if (this.overlayRef) {
|
|
868
|
-
this._maybeReturnFocusToCell();
|
|
869
|
-
this.overlayRef.detach();
|
|
870
|
-
}
|
|
871
|
-
});
|
|
872
|
-
}
|
|
873
|
-
_createEditOverlay() {
|
|
874
|
-
this.overlayRef = createOverlayRef(this._injector, {
|
|
875
|
-
disposeOnNavigation: true,
|
|
876
|
-
panelClass: this.panelClass(),
|
|
877
|
-
positionStrategy: this._getPositionStrategy(),
|
|
878
|
-
scrollStrategy: createRepositionScrollStrategy(this._injector),
|
|
879
|
-
direction: this.services.directionality,
|
|
880
|
-
});
|
|
881
|
-
this.initFocusTrap();
|
|
882
|
-
this.overlayRef.overlayElement.setAttribute('role', 'dialog');
|
|
883
|
-
if (this.ariaLabel) {
|
|
884
|
-
this.overlayRef.overlayElement.setAttribute('aria-label', this.ariaLabel);
|
|
885
|
-
}
|
|
886
|
-
this.overlayRef.detachments().subscribe(() => this.closeEditOverlay());
|
|
887
|
-
}
|
|
888
|
-
_showEditOverlay() {
|
|
889
|
-
this.overlayRef.attach(new TemplatePortal(this.template, this.viewContainerRef, { $implicit: this.context }));
|
|
890
|
-
// We have to defer trapping focus, because doing so too early can cause the form inside
|
|
891
|
-
// the overlay to be submitted immediately if it was opened on an Enter keydown event.
|
|
892
|
-
this.services.ngZone.runOutsideAngular(() => {
|
|
893
|
-
setTimeout(() => {
|
|
894
|
-
this.focusTrap.focusInitialElement();
|
|
895
|
-
});
|
|
896
|
-
});
|
|
897
|
-
// Update the size of the popup initially and on subsequent changes to
|
|
898
|
-
// scroll position and viewport size.
|
|
899
|
-
merge(this.services.scrollDispatcher.scrolled(), this.services.viewportRuler.change())
|
|
900
|
-
.pipe(startWith(null), takeUntil(merge(this.overlayRef.detachments(), this.destroyed)))
|
|
901
|
-
.subscribe(() => {
|
|
902
|
-
this._updateOverlaySize();
|
|
903
|
-
});
|
|
904
|
-
}
|
|
905
|
-
_getOverlayCells() {
|
|
906
|
-
const cell = closest(this.elementRef.nativeElement, CELL_SELECTOR);
|
|
907
|
-
if (!this._colspan.before && !this._colspan.after) {
|
|
908
|
-
return [cell];
|
|
909
|
-
}
|
|
910
|
-
const row = closest(this.elementRef.nativeElement, ROW_SELECTOR);
|
|
911
|
-
const rowCells = Array.from(row.querySelectorAll(CELL_SELECTOR));
|
|
912
|
-
const ownIndex = rowCells.indexOf(cell);
|
|
913
|
-
return rowCells.slice(ownIndex - (this._colspan.before || 0), ownIndex + (this._colspan.after || 0) + 1);
|
|
914
|
-
}
|
|
915
|
-
_getPositionStrategy() {
|
|
916
|
-
const cells = this._getOverlayCells();
|
|
917
|
-
return createFlexibleConnectedPositionStrategy(this._injector, cells[0])
|
|
918
|
-
.withGrowAfterOpen()
|
|
919
|
-
.withPush()
|
|
920
|
-
.withViewportMargin(16)
|
|
921
|
-
.withPositions([
|
|
922
|
-
{
|
|
923
|
-
originX: 'start',
|
|
924
|
-
originY: 'top',
|
|
925
|
-
overlayX: 'start',
|
|
926
|
-
overlayY: 'top',
|
|
927
|
-
},
|
|
928
|
-
]);
|
|
929
|
-
}
|
|
930
|
-
_updateOverlaySize() {
|
|
931
|
-
this.overlayRef.updateSize(this._sizeConfigForCells(this._getOverlayCells()));
|
|
932
|
-
}
|
|
933
|
-
_maybeReturnFocusToCell() {
|
|
934
|
-
if (closest(document.activeElement, EDIT_PANE_SELECTOR) === this.overlayRef.overlayElement) {
|
|
935
|
-
this.elementRef.nativeElement.focus();
|
|
936
|
-
}
|
|
937
|
-
}
|
|
938
|
-
_sizeConfigForCells(cells) {
|
|
939
|
-
if (cells.length === 0) {
|
|
940
|
-
return {};
|
|
792
|
+
services = inject(EditServices);
|
|
793
|
+
elementRef = inject(ElementRef);
|
|
794
|
+
viewContainerRef = inject(ViewContainerRef);
|
|
795
|
+
_injector = inject(Injector);
|
|
796
|
+
template = null;
|
|
797
|
+
context;
|
|
798
|
+
ariaLabel;
|
|
799
|
+
get colspan() {
|
|
800
|
+
return this._colspan;
|
|
801
|
+
}
|
|
802
|
+
set colspan(value) {
|
|
803
|
+
this._colspan = value;
|
|
804
|
+
if (this.overlayRef) {
|
|
805
|
+
this.overlayRef.updatePositionStrategy(this._getPositionStrategy());
|
|
806
|
+
if (this.overlayRef.hasAttached()) {
|
|
807
|
+
this._updateOverlaySize();
|
|
808
|
+
}
|
|
809
|
+
}
|
|
810
|
+
}
|
|
811
|
+
_colspan = {};
|
|
812
|
+
get disabled() {
|
|
813
|
+
return this._disabled;
|
|
814
|
+
}
|
|
815
|
+
set disabled(value) {
|
|
816
|
+
this._disabled = value;
|
|
817
|
+
if (value) {
|
|
818
|
+
this.services.editEventDispatcher.doneEditingCell(this.elementRef.nativeElement);
|
|
819
|
+
this.services.editEventDispatcher.disabledCells.set(this.elementRef.nativeElement, true);
|
|
820
|
+
} else {
|
|
821
|
+
this.services.editEventDispatcher.disabledCells.delete(this.elementRef.nativeElement);
|
|
822
|
+
}
|
|
823
|
+
}
|
|
824
|
+
_disabled = false;
|
|
825
|
+
focusTrap;
|
|
826
|
+
overlayRef;
|
|
827
|
+
destroyed = new Subject();
|
|
828
|
+
ngAfterViewInit() {
|
|
829
|
+
this._startListeningToEditEvents();
|
|
830
|
+
}
|
|
831
|
+
ngOnDestroy() {
|
|
832
|
+
this.destroyed.next();
|
|
833
|
+
this.destroyed.complete();
|
|
834
|
+
if (this.focusTrap) {
|
|
835
|
+
this.focusTrap.destroy();
|
|
836
|
+
this.focusTrap = undefined;
|
|
837
|
+
}
|
|
838
|
+
if (this.overlayRef) {
|
|
839
|
+
this.overlayRef.dispose();
|
|
840
|
+
}
|
|
841
|
+
}
|
|
842
|
+
initFocusTrap() {
|
|
843
|
+
this.focusTrap = this.services.focusTrapFactory.create(this.overlayRef.overlayElement);
|
|
844
|
+
}
|
|
845
|
+
closeEditOverlay() {
|
|
846
|
+
this.services.editEventDispatcher.doneEditingCell(this.elementRef.nativeElement);
|
|
847
|
+
}
|
|
848
|
+
panelClass() {
|
|
849
|
+
return EDIT_PANE_CLASS;
|
|
850
|
+
}
|
|
851
|
+
_startListeningToEditEvents() {
|
|
852
|
+
this.services.editEventDispatcher.editingCell(this.elementRef.nativeElement).pipe(takeUntil(this.destroyed)).subscribe(open => {
|
|
853
|
+
if (open && this.template) {
|
|
854
|
+
if (!this.overlayRef) {
|
|
855
|
+
this._createEditOverlay();
|
|
941
856
|
}
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
857
|
+
this._showEditOverlay();
|
|
858
|
+
} else if (this.overlayRef) {
|
|
859
|
+
this._maybeReturnFocusToCell();
|
|
860
|
+
this.overlayRef.detach();
|
|
861
|
+
}
|
|
862
|
+
});
|
|
863
|
+
}
|
|
864
|
+
_createEditOverlay() {
|
|
865
|
+
this.overlayRef = createOverlayRef(this._injector, {
|
|
866
|
+
disposeOnNavigation: true,
|
|
867
|
+
panelClass: this.panelClass(),
|
|
868
|
+
positionStrategy: this._getPositionStrategy(),
|
|
869
|
+
scrollStrategy: createRepositionScrollStrategy(this._injector),
|
|
870
|
+
direction: this.services.directionality
|
|
871
|
+
});
|
|
872
|
+
this.initFocusTrap();
|
|
873
|
+
this.overlayRef.overlayElement.setAttribute('role', 'dialog');
|
|
874
|
+
if (this.ariaLabel) {
|
|
875
|
+
this.overlayRef.overlayElement.setAttribute('aria-label', this.ariaLabel);
|
|
876
|
+
}
|
|
877
|
+
this.overlayRef.detachments().subscribe(() => this.closeEditOverlay());
|
|
878
|
+
}
|
|
879
|
+
_showEditOverlay() {
|
|
880
|
+
this.overlayRef.attach(new TemplatePortal(this.template, this.viewContainerRef, {
|
|
881
|
+
$implicit: this.context
|
|
882
|
+
}));
|
|
883
|
+
this.services.ngZone.runOutsideAngular(() => {
|
|
884
|
+
setTimeout(() => {
|
|
885
|
+
this.focusTrap.focusInitialElement();
|
|
886
|
+
});
|
|
887
|
+
});
|
|
888
|
+
merge(this.services.scrollDispatcher.scrolled(), this.services.viewportRuler.change()).pipe(startWith(null), takeUntil(merge(this.overlayRef.detachments(), this.destroyed))).subscribe(() => {
|
|
889
|
+
this._updateOverlaySize();
|
|
890
|
+
});
|
|
891
|
+
}
|
|
892
|
+
_getOverlayCells() {
|
|
893
|
+
const cell = closest(this.elementRef.nativeElement, CELL_SELECTOR);
|
|
894
|
+
if (!this._colspan.before && !this._colspan.after) {
|
|
895
|
+
return [cell];
|
|
896
|
+
}
|
|
897
|
+
const row = closest(this.elementRef.nativeElement, ROW_SELECTOR);
|
|
898
|
+
const rowCells = Array.from(row.querySelectorAll(CELL_SELECTOR));
|
|
899
|
+
const ownIndex = rowCells.indexOf(cell);
|
|
900
|
+
return rowCells.slice(ownIndex - (this._colspan.before || 0), ownIndex + (this._colspan.after || 0) + 1);
|
|
901
|
+
}
|
|
902
|
+
_getPositionStrategy() {
|
|
903
|
+
const cells = this._getOverlayCells();
|
|
904
|
+
return createFlexibleConnectedPositionStrategy(this._injector, cells[0]).withGrowAfterOpen().withPush().withViewportMargin(16).withPositions([{
|
|
905
|
+
originX: 'start',
|
|
906
|
+
originY: 'top',
|
|
907
|
+
overlayX: 'start',
|
|
908
|
+
overlayY: 'top'
|
|
909
|
+
}]);
|
|
910
|
+
}
|
|
911
|
+
_updateOverlaySize() {
|
|
912
|
+
this.overlayRef.updateSize(this._sizeConfigForCells(this._getOverlayCells()));
|
|
913
|
+
}
|
|
914
|
+
_maybeReturnFocusToCell() {
|
|
915
|
+
if (closest(document.activeElement, EDIT_PANE_SELECTOR) === this.overlayRef.overlayElement) {
|
|
916
|
+
this.elementRef.nativeElement.focus();
|
|
917
|
+
}
|
|
918
|
+
}
|
|
919
|
+
_sizeConfigForCells(cells) {
|
|
920
|
+
if (cells.length === 0) {
|
|
921
|
+
return {};
|
|
922
|
+
}
|
|
923
|
+
if (cells.length === 1) {
|
|
924
|
+
return {
|
|
925
|
+
width: cells[0].getBoundingClientRect().width
|
|
926
|
+
};
|
|
927
|
+
}
|
|
928
|
+
let firstCell, lastCell;
|
|
929
|
+
if (this.services.directionality.value === 'ltr') {
|
|
930
|
+
firstCell = cells[0];
|
|
931
|
+
lastCell = cells[cells.length - 1];
|
|
932
|
+
} else {
|
|
933
|
+
lastCell = cells[0];
|
|
934
|
+
firstCell = cells[cells.length - 1];
|
|
935
|
+
}
|
|
936
|
+
return {
|
|
937
|
+
width: lastCell.getBoundingClientRect().right - firstCell.getBoundingClientRect().left
|
|
938
|
+
};
|
|
939
|
+
}
|
|
940
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
941
|
+
minVersion: "12.0.0",
|
|
942
|
+
version: "20.2.0-next.2",
|
|
943
|
+
ngImport: i0,
|
|
944
|
+
type: CdkPopoverEdit,
|
|
945
|
+
deps: [],
|
|
946
|
+
target: i0.ɵɵFactoryTarget.Directive
|
|
947
|
+
});
|
|
948
|
+
static ɵdir = i0.ɵɵngDeclareDirective({
|
|
949
|
+
minVersion: "14.0.0",
|
|
950
|
+
version: "20.2.0-next.2",
|
|
951
|
+
type: CdkPopoverEdit,
|
|
952
|
+
isStandalone: true,
|
|
953
|
+
selector: "[cdkPopoverEdit]:not([cdkPopoverEditTabOut])",
|
|
954
|
+
inputs: {
|
|
955
|
+
template: ["cdkPopoverEdit", "template"],
|
|
956
|
+
context: ["cdkPopoverEditContext", "context"],
|
|
957
|
+
colspan: ["cdkPopoverEditColspan", "colspan"],
|
|
958
|
+
disabled: ["cdkPopoverEditDisabled", "disabled"],
|
|
959
|
+
ariaLabel: ["cdkPopoverEditAriaLabel", "ariaLabel"]
|
|
960
|
+
},
|
|
961
|
+
host: {
|
|
962
|
+
properties: {
|
|
963
|
+
"attr.tabindex": "disabled ? null : 0",
|
|
964
|
+
"attr.aria-haspopup": "!disabled"
|
|
965
|
+
},
|
|
966
|
+
classAttribute: "cdk-popover-edit-cell"
|
|
967
|
+
},
|
|
968
|
+
ngImport: i0
|
|
969
|
+
});
|
|
958
970
|
}
|
|
959
|
-
i0.ɵɵngDeclareClassMetadata({
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
971
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
972
|
+
minVersion: "12.0.0",
|
|
973
|
+
version: "20.2.0-next.2",
|
|
974
|
+
ngImport: i0,
|
|
975
|
+
type: CdkPopoverEdit,
|
|
976
|
+
decorators: [{
|
|
977
|
+
type: Directive,
|
|
978
|
+
args: [{
|
|
979
|
+
selector: '[cdkPopoverEdit]:not([cdkPopoverEditTabOut])',
|
|
980
|
+
host: POPOVER_EDIT_HOST_BINDINGS,
|
|
981
|
+
inputs: POPOVER_EDIT_INPUTS
|
|
982
|
+
}]
|
|
983
|
+
}]
|
|
984
|
+
});
|
|
972
985
|
class CdkPopoverEditTabOut extends CdkPopoverEdit {
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
986
|
+
focusEscapeNotifierFactory = inject(FocusEscapeNotifierFactory);
|
|
987
|
+
focusTrap = undefined;
|
|
988
|
+
initFocusTrap() {
|
|
989
|
+
this.focusTrap = this.focusEscapeNotifierFactory.create(this.overlayRef.overlayElement);
|
|
990
|
+
this.focusTrap.escapes().pipe(takeUntil(this.destroyed)).subscribe(direction => {
|
|
991
|
+
this.services.editEventDispatcher.editRef?.blur();
|
|
992
|
+
this.services.focusDispatcher.moveFocusHorizontally(closest(this.elementRef.nativeElement, CELL_SELECTOR), direction === FocusEscapeNotifierDirection.START ? -1 : 1);
|
|
993
|
+
this.closeEditOverlay();
|
|
994
|
+
});
|
|
995
|
+
}
|
|
996
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
997
|
+
minVersion: "12.0.0",
|
|
998
|
+
version: "20.2.0-next.2",
|
|
999
|
+
ngImport: i0,
|
|
1000
|
+
type: CdkPopoverEditTabOut,
|
|
1001
|
+
deps: null,
|
|
1002
|
+
target: i0.ɵɵFactoryTarget.Directive
|
|
1003
|
+
});
|
|
1004
|
+
static ɵdir = i0.ɵɵngDeclareDirective({
|
|
1005
|
+
minVersion: "14.0.0",
|
|
1006
|
+
version: "20.2.0-next.2",
|
|
1007
|
+
type: CdkPopoverEditTabOut,
|
|
1008
|
+
isStandalone: true,
|
|
1009
|
+
selector: "[cdkPopoverEdit][cdkPopoverEditTabOut]",
|
|
1010
|
+
inputs: {
|
|
1011
|
+
template: ["cdkPopoverEdit", "template"],
|
|
1012
|
+
context: ["cdkPopoverEditContext", "context"],
|
|
1013
|
+
colspan: ["cdkPopoverEditColspan", "colspan"],
|
|
1014
|
+
disabled: ["cdkPopoverEditDisabled", "disabled"],
|
|
1015
|
+
ariaLabel: ["cdkPopoverEditAriaLabel", "ariaLabel"]
|
|
1016
|
+
},
|
|
1017
|
+
host: {
|
|
1018
|
+
properties: {
|
|
1019
|
+
"attr.tabindex": "disabled ? null : 0",
|
|
1020
|
+
"attr.aria-haspopup": "!disabled"
|
|
1021
|
+
},
|
|
1022
|
+
classAttribute: "cdk-popover-edit-cell"
|
|
1023
|
+
},
|
|
1024
|
+
usesInheritance: true,
|
|
1025
|
+
ngImport: i0
|
|
1026
|
+
});
|
|
988
1027
|
}
|
|
989
|
-
i0.ɵɵngDeclareClassMetadata({
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1028
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
1029
|
+
minVersion: "12.0.0",
|
|
1030
|
+
version: "20.2.0-next.2",
|
|
1031
|
+
ngImport: i0,
|
|
1032
|
+
type: CdkPopoverEditTabOut,
|
|
1033
|
+
decorators: [{
|
|
1034
|
+
type: Directive,
|
|
1035
|
+
args: [{
|
|
1036
|
+
selector: '[cdkPopoverEdit][cdkPopoverEditTabOut]',
|
|
1037
|
+
host: POPOVER_EDIT_HOST_BINDINGS,
|
|
1038
|
+
inputs: POPOVER_EDIT_INPUTS
|
|
1039
|
+
}]
|
|
1040
|
+
}]
|
|
1041
|
+
});
|
|
1001
1042
|
class CdkRowHoverContent {
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1043
|
+
services = inject(EditServices);
|
|
1044
|
+
elementRef = inject(ElementRef);
|
|
1045
|
+
templateRef = inject(TemplateRef);
|
|
1046
|
+
viewContainerRef = inject(ViewContainerRef);
|
|
1047
|
+
destroyed = new Subject();
|
|
1048
|
+
viewRef = null;
|
|
1049
|
+
_row;
|
|
1050
|
+
ngAfterViewInit() {
|
|
1051
|
+
this._row = closest(this.elementRef.nativeElement, ROW_SELECTOR);
|
|
1052
|
+
this.services.editEventDispatcher.registerRowWithHoverContent(this._row);
|
|
1053
|
+
this._listenForHoverAndFocusEvents();
|
|
1054
|
+
}
|
|
1055
|
+
ngOnDestroy() {
|
|
1056
|
+
this.destroyed.next();
|
|
1057
|
+
this.destroyed.complete();
|
|
1058
|
+
if (this.viewRef) {
|
|
1059
|
+
this.viewRef.destroy();
|
|
1060
|
+
}
|
|
1061
|
+
if (this._row) {
|
|
1062
|
+
this.services.editEventDispatcher.deregisterRowWithHoverContent(this._row);
|
|
1063
|
+
}
|
|
1064
|
+
}
|
|
1065
|
+
initElement(_) {}
|
|
1066
|
+
makeElementHiddenButFocusable(element) {
|
|
1067
|
+
element.style.opacity = '0';
|
|
1068
|
+
}
|
|
1069
|
+
makeElementVisible(element) {
|
|
1070
|
+
element.style.opacity = '';
|
|
1071
|
+
}
|
|
1072
|
+
_listenForHoverAndFocusEvents() {
|
|
1073
|
+
this.services.editEventDispatcher.hoverOrFocusOnRow(this._row).pipe(takeUntil(this.destroyed)).subscribe(eventState => {
|
|
1074
|
+
if (eventState === HoverContentState.ON || eventState === HoverContentState.FOCUSABLE) {
|
|
1075
|
+
if (!this.viewRef) {
|
|
1076
|
+
this.viewRef = this.viewContainerRef.createEmbeddedView(this.templateRef, {});
|
|
1077
|
+
this.initElement(this.viewRef.rootNodes[0]);
|
|
1078
|
+
this.viewRef.markForCheck();
|
|
1079
|
+
} else if (this.viewContainerRef.indexOf(this.viewRef) === -1) {
|
|
1080
|
+
this.viewContainerRef.insert(this.viewRef);
|
|
1081
|
+
this.viewRef.markForCheck();
|
|
1019
1082
|
}
|
|
1020
|
-
if (
|
|
1021
|
-
|
|
1083
|
+
if (eventState === HoverContentState.ON) {
|
|
1084
|
+
this.makeElementVisible(this.viewRef.rootNodes[0]);
|
|
1085
|
+
} else {
|
|
1086
|
+
this.makeElementHiddenButFocusable(this.viewRef.rootNodes[0]);
|
|
1022
1087
|
}
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
_listenForHoverAndFocusEvents() {
|
|
1045
|
-
this.services.editEventDispatcher
|
|
1046
|
-
.hoverOrFocusOnRow(this._row)
|
|
1047
|
-
.pipe(takeUntil(this.destroyed))
|
|
1048
|
-
.subscribe(eventState => {
|
|
1049
|
-
// When in FOCUSABLE state, add the hover content to the dom but make it transparent so
|
|
1050
|
-
// that it is in the tab order relative to the currently focused row.
|
|
1051
|
-
if (eventState === HoverContentState.ON || eventState === HoverContentState.FOCUSABLE) {
|
|
1052
|
-
if (!this.viewRef) {
|
|
1053
|
-
this.viewRef = this.viewContainerRef.createEmbeddedView(this.templateRef, {});
|
|
1054
|
-
this.initElement(this.viewRef.rootNodes[0]);
|
|
1055
|
-
this.viewRef.markForCheck();
|
|
1056
|
-
}
|
|
1057
|
-
else if (this.viewContainerRef.indexOf(this.viewRef) === -1) {
|
|
1058
|
-
this.viewContainerRef.insert(this.viewRef);
|
|
1059
|
-
this.viewRef.markForCheck();
|
|
1060
|
-
}
|
|
1061
|
-
if (eventState === HoverContentState.ON) {
|
|
1062
|
-
this.makeElementVisible(this.viewRef.rootNodes[0]);
|
|
1063
|
-
}
|
|
1064
|
-
else {
|
|
1065
|
-
this.makeElementHiddenButFocusable(this.viewRef.rootNodes[0]);
|
|
1066
|
-
}
|
|
1067
|
-
}
|
|
1068
|
-
else if (this.viewRef) {
|
|
1069
|
-
this.viewContainerRef.detach(this.viewContainerRef.indexOf(this.viewRef));
|
|
1070
|
-
}
|
|
1071
|
-
});
|
|
1072
|
-
}
|
|
1073
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.0-next.2", ngImport: i0, type: CdkRowHoverContent, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
1074
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.2.0-next.2", type: CdkRowHoverContent, isStandalone: true, selector: "[cdkRowHoverContent]", ngImport: i0 });
|
|
1088
|
+
} else if (this.viewRef) {
|
|
1089
|
+
this.viewContainerRef.detach(this.viewContainerRef.indexOf(this.viewRef));
|
|
1090
|
+
}
|
|
1091
|
+
});
|
|
1092
|
+
}
|
|
1093
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
1094
|
+
minVersion: "12.0.0",
|
|
1095
|
+
version: "20.2.0-next.2",
|
|
1096
|
+
ngImport: i0,
|
|
1097
|
+
type: CdkRowHoverContent,
|
|
1098
|
+
deps: [],
|
|
1099
|
+
target: i0.ɵɵFactoryTarget.Directive
|
|
1100
|
+
});
|
|
1101
|
+
static ɵdir = i0.ɵɵngDeclareDirective({
|
|
1102
|
+
minVersion: "14.0.0",
|
|
1103
|
+
version: "20.2.0-next.2",
|
|
1104
|
+
type: CdkRowHoverContent,
|
|
1105
|
+
isStandalone: true,
|
|
1106
|
+
selector: "[cdkRowHoverContent]",
|
|
1107
|
+
ngImport: i0
|
|
1108
|
+
});
|
|
1075
1109
|
}
|
|
1076
|
-
i0.ɵɵngDeclareClassMetadata({
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1110
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
1111
|
+
minVersion: "12.0.0",
|
|
1112
|
+
version: "20.2.0-next.2",
|
|
1113
|
+
ngImport: i0,
|
|
1114
|
+
type: CdkRowHoverContent,
|
|
1115
|
+
decorators: [{
|
|
1116
|
+
type: Directive,
|
|
1117
|
+
args: [{
|
|
1118
|
+
selector: '[cdkRowHoverContent]'
|
|
1119
|
+
}]
|
|
1120
|
+
}]
|
|
1121
|
+
});
|
|
1086
1122
|
class CdkEditOpen {
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1123
|
+
elementRef = inject(ElementRef);
|
|
1124
|
+
editEventDispatcher = inject(EditEventDispatcher);
|
|
1125
|
+
constructor() {
|
|
1126
|
+
const elementRef = this.elementRef;
|
|
1127
|
+
const nativeElement = elementRef.nativeElement;
|
|
1128
|
+
if (nativeElement.nodeName === 'BUTTON' && !nativeElement.getAttribute('type')) {
|
|
1129
|
+
nativeElement.setAttribute('type', 'button');
|
|
1130
|
+
}
|
|
1131
|
+
}
|
|
1132
|
+
openEdit(evt) {
|
|
1133
|
+
this.editEventDispatcher.editing.next(closest(this.elementRef.nativeElement, CELL_SELECTOR));
|
|
1134
|
+
evt.stopPropagation();
|
|
1135
|
+
}
|
|
1136
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
1137
|
+
minVersion: "12.0.0",
|
|
1138
|
+
version: "20.2.0-next.2",
|
|
1139
|
+
ngImport: i0,
|
|
1140
|
+
type: CdkEditOpen,
|
|
1141
|
+
deps: [],
|
|
1142
|
+
target: i0.ɵɵFactoryTarget.Directive
|
|
1143
|
+
});
|
|
1144
|
+
static ɵdir = i0.ɵɵngDeclareDirective({
|
|
1145
|
+
minVersion: "14.0.0",
|
|
1146
|
+
version: "20.2.0-next.2",
|
|
1147
|
+
type: CdkEditOpen,
|
|
1148
|
+
isStandalone: true,
|
|
1149
|
+
selector: "[cdkEditOpen]",
|
|
1150
|
+
host: {
|
|
1151
|
+
listeners: {
|
|
1152
|
+
"click": "openEdit($event)"
|
|
1153
|
+
}
|
|
1154
|
+
},
|
|
1155
|
+
ngImport: i0
|
|
1156
|
+
});
|
|
1103
1157
|
}
|
|
1104
|
-
i0.ɵɵngDeclareClassMetadata({
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1158
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
1159
|
+
minVersion: "12.0.0",
|
|
1160
|
+
version: "20.2.0-next.2",
|
|
1161
|
+
ngImport: i0,
|
|
1162
|
+
type: CdkEditOpen,
|
|
1163
|
+
decorators: [{
|
|
1164
|
+
type: Directive,
|
|
1165
|
+
args: [{
|
|
1166
|
+
selector: '[cdkEditOpen]',
|
|
1167
|
+
host: {
|
|
1168
|
+
'(click)': 'openEdit($event)'
|
|
1169
|
+
}
|
|
1170
|
+
}]
|
|
1171
|
+
}],
|
|
1172
|
+
ctorParameters: () => []
|
|
1173
|
+
});
|
|
1113
1174
|
|
|
1114
|
-
const EXPORTED_DECLARATIONS = [
|
|
1115
|
-
CdkPopoverEdit,
|
|
1116
|
-
CdkPopoverEditTabOut,
|
|
1117
|
-
CdkRowHoverContent,
|
|
1118
|
-
CdkEditControl,
|
|
1119
|
-
CdkEditRevert,
|
|
1120
|
-
CdkEditClose,
|
|
1121
|
-
CdkEditable,
|
|
1122
|
-
CdkEditOpen,
|
|
1123
|
-
];
|
|
1175
|
+
const EXPORTED_DECLARATIONS = [CdkPopoverEdit, CdkPopoverEditTabOut, CdkRowHoverContent, CdkEditControl, CdkEditRevert, CdkEditClose, CdkEditable, CdkEditOpen];
|
|
1124
1176
|
class CdkPopoverEditModule {
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1177
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
1178
|
+
minVersion: "12.0.0",
|
|
1179
|
+
version: "20.2.0-next.2",
|
|
1180
|
+
ngImport: i0,
|
|
1181
|
+
type: CdkPopoverEditModule,
|
|
1182
|
+
deps: [],
|
|
1183
|
+
target: i0.ɵɵFactoryTarget.NgModule
|
|
1184
|
+
});
|
|
1185
|
+
static ɵmod = i0.ɵɵngDeclareNgModule({
|
|
1186
|
+
minVersion: "14.0.0",
|
|
1187
|
+
version: "20.2.0-next.2",
|
|
1188
|
+
ngImport: i0,
|
|
1189
|
+
type: CdkPopoverEditModule,
|
|
1190
|
+
imports: [OverlayModule, CdkPopoverEdit, CdkPopoverEditTabOut, CdkRowHoverContent, CdkEditControl, CdkEditRevert, CdkEditClose, CdkEditable, CdkEditOpen],
|
|
1191
|
+
exports: [CdkPopoverEdit, CdkPopoverEditTabOut, CdkRowHoverContent, CdkEditControl, CdkEditRevert, CdkEditClose, CdkEditable, CdkEditOpen]
|
|
1192
|
+
});
|
|
1193
|
+
static ɵinj = i0.ɵɵngDeclareInjector({
|
|
1194
|
+
minVersion: "12.0.0",
|
|
1195
|
+
version: "20.2.0-next.2",
|
|
1196
|
+
ngImport: i0,
|
|
1197
|
+
type: CdkPopoverEditModule,
|
|
1198
|
+
imports: [OverlayModule]
|
|
1199
|
+
});
|
|
1142
1200
|
}
|
|
1143
|
-
i0.ɵɵngDeclareClassMetadata({
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1201
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
1202
|
+
minVersion: "12.0.0",
|
|
1203
|
+
version: "20.2.0-next.2",
|
|
1204
|
+
ngImport: i0,
|
|
1205
|
+
type: CdkPopoverEditModule,
|
|
1206
|
+
decorators: [{
|
|
1207
|
+
type: NgModule,
|
|
1208
|
+
args: [{
|
|
1209
|
+
imports: [OverlayModule, ...EXPORTED_DECLARATIONS],
|
|
1210
|
+
exports: EXPORTED_DECLARATIONS
|
|
1211
|
+
}]
|
|
1212
|
+
}]
|
|
1213
|
+
});
|
|
1150
1214
|
|
|
1151
1215
|
export { CdkEditClose, CdkEditControl, CdkEditOpen, CdkEditRevert, CdkEditable, CdkPopoverEdit, CdkPopoverEditModule, CdkPopoverEditTabOut, CdkRowHoverContent, EditEventDispatcher, EditRef, FocusDispatcher, FormValueContainer, HoverContentState, CELL_SELECTOR as _CELL_SELECTOR, closest as _closest };
|
|
1152
1216
|
//# sourceMappingURL=popover-edit.mjs.map
|