1 | (function (global, factory) {
|
2 | typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/cdk/collections'), require('rxjs'), require('rxjs/operators'), require('@angular/core'), require('@angular/cdk/coercion'), require('@angular/cdk/bidi')) :
|
3 | typeof define === 'function' && define.amd ? define('@angular/cdk/tree', ['exports', '@angular/cdk/collections', 'rxjs', 'rxjs/operators', '@angular/core', '@angular/cdk/coercion', '@angular/cdk/bidi'], factory) :
|
4 | (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.ng = global.ng || {}, global.ng.cdk = global.ng.cdk || {}, global.ng.cdk.tree = {}), global.ng.cdk.collections, global.rxjs, global.rxjs.operators, global.ng.core, global.ng.cdk.coercion, global.ng.cdk.bidi));
|
5 | }(this, (function (exports, collections, rxjs, operators, core, coercion, bidi) { 'use strict';
|
6 |
|
7 | |
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 | var extendStatics = function (d, b) {
|
23 | extendStatics = Object.setPrototypeOf ||
|
24 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
25 | function (d, b) { for (var p in b)
|
26 | if (Object.prototype.hasOwnProperty.call(b, p))
|
27 | d[p] = b[p]; };
|
28 | return extendStatics(d, b);
|
29 | };
|
30 | function __extends(d, b) {
|
31 | if (typeof b !== "function" && b !== null)
|
32 | throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
33 | extendStatics(d, b);
|
34 | function __() { this.constructor = d; }
|
35 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
36 | }
|
37 | var __assign = function () {
|
38 | __assign = Object.assign || function __assign(t) {
|
39 | for (var s, i = 1, n = arguments.length; i < n; i++) {
|
40 | s = arguments[i];
|
41 | for (var p in s)
|
42 | if (Object.prototype.hasOwnProperty.call(s, p))
|
43 | t[p] = s[p];
|
44 | }
|
45 | return t;
|
46 | };
|
47 | return __assign.apply(this, arguments);
|
48 | };
|
49 | function __rest(s, e) {
|
50 | var t = {};
|
51 | for (var p in s)
|
52 | if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
53 | t[p] = s[p];
|
54 | if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
55 | for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
56 | if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
57 | t[p[i]] = s[p[i]];
|
58 | }
|
59 | return t;
|
60 | }
|
61 | function __decorate(decorators, target, key, desc) {
|
62 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
63 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
64 | r = Reflect.decorate(decorators, target, key, desc);
|
65 | else
|
66 | for (var i = decorators.length - 1; i >= 0; i--)
|
67 | if (d = decorators[i])
|
68 | r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
69 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
70 | }
|
71 | function __param(paramIndex, decorator) {
|
72 | return function (target, key) { decorator(target, key, paramIndex); };
|
73 | }
|
74 | function __metadata(metadataKey, metadataValue) {
|
75 | if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
76 | return Reflect.metadata(metadataKey, metadataValue);
|
77 | }
|
78 | function __awaiter(thisArg, _arguments, P, generator) {
|
79 | function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
80 | return new (P || (P = Promise))(function (resolve, reject) {
|
81 | function fulfilled(value) { try {
|
82 | step(generator.next(value));
|
83 | }
|
84 | catch (e) {
|
85 | reject(e);
|
86 | } }
|
87 | function rejected(value) { try {
|
88 | step(generator["throw"](value));
|
89 | }
|
90 | catch (e) {
|
91 | reject(e);
|
92 | } }
|
93 | function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
94 | step((generator = generator.apply(thisArg, _arguments || [])).next());
|
95 | });
|
96 | }
|
97 | function __generator(thisArg, body) {
|
98 | var _ = { label: 0, sent: function () { if (t[0] & 1)
|
99 | throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
100 | return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function () { return this; }), g;
|
101 | function verb(n) { return function (v) { return step([n, v]); }; }
|
102 | function step(op) {
|
103 | if (f)
|
104 | throw new TypeError("Generator is already executing.");
|
105 | while (_)
|
106 | try {
|
107 | if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done)
|
108 | return t;
|
109 | if (y = 0, t)
|
110 | op = [op[0] & 2, t.value];
|
111 | switch (op[0]) {
|
112 | case 0:
|
113 | case 1:
|
114 | t = op;
|
115 | break;
|
116 | case 4:
|
117 | _.label++;
|
118 | return { value: op[1], done: false };
|
119 | case 5:
|
120 | _.label++;
|
121 | y = op[1];
|
122 | op = [0];
|
123 | continue;
|
124 | case 7:
|
125 | op = _.ops.pop();
|
126 | _.trys.pop();
|
127 | continue;
|
128 | default:
|
129 | if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
130 | _ = 0;
|
131 | continue;
|
132 | }
|
133 | if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) {
|
134 | _.label = op[1];
|
135 | break;
|
136 | }
|
137 | if (op[0] === 6 && _.label < t[1]) {
|
138 | _.label = t[1];
|
139 | t = op;
|
140 | break;
|
141 | }
|
142 | if (t && _.label < t[2]) {
|
143 | _.label = t[2];
|
144 | _.ops.push(op);
|
145 | break;
|
146 | }
|
147 | if (t[2])
|
148 | _.ops.pop();
|
149 | _.trys.pop();
|
150 | continue;
|
151 | }
|
152 | op = body.call(thisArg, _);
|
153 | }
|
154 | catch (e) {
|
155 | op = [6, e];
|
156 | y = 0;
|
157 | }
|
158 | finally {
|
159 | f = t = 0;
|
160 | }
|
161 | if (op[0] & 5)
|
162 | throw op[1];
|
163 | return { value: op[0] ? op[1] : void 0, done: true };
|
164 | }
|
165 | }
|
166 | var __createBinding = Object.create ? (function (o, m, k, k2) {
|
167 | if (k2 === undefined)
|
168 | k2 = k;
|
169 | Object.defineProperty(o, k2, { enumerable: true, get: function () { return m[k]; } });
|
170 | }) : (function (o, m, k, k2) {
|
171 | if (k2 === undefined)
|
172 | k2 = k;
|
173 | o[k2] = m[k];
|
174 | });
|
175 | function __exportStar(m, o) {
|
176 | for (var p in m)
|
177 | if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p))
|
178 | __createBinding(o, m, p);
|
179 | }
|
180 | function __values(o) {
|
181 | var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
182 | if (m)
|
183 | return m.call(o);
|
184 | if (o && typeof o.length === "number")
|
185 | return {
|
186 | next: function () {
|
187 | if (o && i >= o.length)
|
188 | o = void 0;
|
189 | return { value: o && o[i++], done: !o };
|
190 | }
|
191 | };
|
192 | throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
193 | }
|
194 | function __read(o, n) {
|
195 | var m = typeof Symbol === "function" && o[Symbol.iterator];
|
196 | if (!m)
|
197 | return o;
|
198 | var i = m.call(o), r, ar = [], e;
|
199 | try {
|
200 | while ((n === void 0 || n-- > 0) && !(r = i.next()).done)
|
201 | ar.push(r.value);
|
202 | }
|
203 | catch (error) {
|
204 | e = { error: error };
|
205 | }
|
206 | finally {
|
207 | try {
|
208 | if (r && !r.done && (m = i["return"]))
|
209 | m.call(i);
|
210 | }
|
211 | finally {
|
212 | if (e)
|
213 | throw e.error;
|
214 | }
|
215 | }
|
216 | return ar;
|
217 | }
|
218 |
|
219 | function __spread() {
|
220 | for (var ar = [], i = 0; i < arguments.length; i++)
|
221 | ar = ar.concat(__read(arguments[i]));
|
222 | return ar;
|
223 | }
|
224 |
|
225 | function __spreadArrays() {
|
226 | for (var s = 0, i = 0, il = arguments.length; i < il; i++)
|
227 | s += arguments[i].length;
|
228 | for (var r = Array(s), k = 0, i = 0; i < il; i++)
|
229 | for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
|
230 | r[k] = a[j];
|
231 | return r;
|
232 | }
|
233 | function __spreadArray(to, from, pack) {
|
234 | if (pack || arguments.length === 2)
|
235 | for (var i = 0, l = from.length, ar; i < l; i++) {
|
236 | if (ar || !(i in from)) {
|
237 | if (!ar)
|
238 | ar = Array.prototype.slice.call(from, 0, i);
|
239 | ar[i] = from[i];
|
240 | }
|
241 | }
|
242 | return to.concat(ar || from);
|
243 | }
|
244 | function __await(v) {
|
245 | return this instanceof __await ? (this.v = v, this) : new __await(v);
|
246 | }
|
247 | function __asyncGenerator(thisArg, _arguments, generator) {
|
248 | if (!Symbol.asyncIterator)
|
249 | throw new TypeError("Symbol.asyncIterator is not defined.");
|
250 | var g = generator.apply(thisArg, _arguments || []), i, q = [];
|
251 | return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
|
252 | function verb(n) { if (g[n])
|
253 | i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
|
254 | function resume(n, v) { try {
|
255 | step(g[n](v));
|
256 | }
|
257 | catch (e) {
|
258 | settle(q[0][3], e);
|
259 | } }
|
260 | function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
|
261 | function fulfill(value) { resume("next", value); }
|
262 | function reject(value) { resume("throw", value); }
|
263 | function settle(f, v) { if (f(v), q.shift(), q.length)
|
264 | resume(q[0][0], q[0][1]); }
|
265 | }
|
266 | function __asyncDelegator(o) {
|
267 | var i, p;
|
268 | return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
|
269 | function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; }
|
270 | }
|
271 | function __asyncValues(o) {
|
272 | if (!Symbol.asyncIterator)
|
273 | throw new TypeError("Symbol.asyncIterator is not defined.");
|
274 | var m = o[Symbol.asyncIterator], i;
|
275 | return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
|
276 | function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
|
277 | function settle(resolve, reject, d, v) { Promise.resolve(v).then(function (v) { resolve({ value: v, done: d }); }, reject); }
|
278 | }
|
279 | function __makeTemplateObject(cooked, raw) {
|
280 | if (Object.defineProperty) {
|
281 | Object.defineProperty(cooked, "raw", { value: raw });
|
282 | }
|
283 | else {
|
284 | cooked.raw = raw;
|
285 | }
|
286 | return cooked;
|
287 | }
|
288 | ;
|
289 | var __setModuleDefault = Object.create ? (function (o, v) {
|
290 | Object.defineProperty(o, "default", { enumerable: true, value: v });
|
291 | }) : function (o, v) {
|
292 | o["default"] = v;
|
293 | };
|
294 | function __importStar(mod) {
|
295 | if (mod && mod.__esModule)
|
296 | return mod;
|
297 | var result = {};
|
298 | if (mod != null)
|
299 | for (var k in mod)
|
300 | if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
|
301 | __createBinding(result, mod, k);
|
302 | __setModuleDefault(result, mod);
|
303 | return result;
|
304 | }
|
305 | function __importDefault(mod) {
|
306 | return (mod && mod.__esModule) ? mod : { default: mod };
|
307 | }
|
308 | function __classPrivateFieldGet(receiver, state, kind, f) {
|
309 | if (kind === "a" && !f)
|
310 | throw new TypeError("Private accessor was defined without a getter");
|
311 | if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
312 | throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
313 | return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
314 | }
|
315 | function __classPrivateFieldSet(receiver, state, value, kind, f) {
|
316 | if (kind === "m")
|
317 | throw new TypeError("Private method is not writable");
|
318 | if (kind === "a" && !f)
|
319 | throw new TypeError("Private accessor was defined without a setter");
|
320 | if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
321 | throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
322 | return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
323 | }
|
324 |
|
325 |
|
326 | var BaseTreeControl = (function () {
|
327 | function BaseTreeControl() {
|
328 |
|
329 | this.expansionModel = new collections.SelectionModel(true);
|
330 | }
|
331 |
|
332 | BaseTreeControl.prototype.toggle = function (dataNode) {
|
333 | this.expansionModel.toggle(this._trackByValue(dataNode));
|
334 | };
|
335 |
|
336 | BaseTreeControl.prototype.expand = function (dataNode) {
|
337 | this.expansionModel.select(this._trackByValue(dataNode));
|
338 | };
|
339 |
|
340 | BaseTreeControl.prototype.collapse = function (dataNode) {
|
341 | this.expansionModel.deselect(this._trackByValue(dataNode));
|
342 | };
|
343 |
|
344 | BaseTreeControl.prototype.isExpanded = function (dataNode) {
|
345 | return this.expansionModel.isSelected(this._trackByValue(dataNode));
|
346 | };
|
347 |
|
348 | BaseTreeControl.prototype.toggleDescendants = function (dataNode) {
|
349 | this.expansionModel.isSelected(this._trackByValue(dataNode)) ?
|
350 | this.collapseDescendants(dataNode) :
|
351 | this.expandDescendants(dataNode);
|
352 | };
|
353 |
|
354 | BaseTreeControl.prototype.collapseAll = function () {
|
355 | this.expansionModel.clear();
|
356 | };
|
357 |
|
358 | BaseTreeControl.prototype.expandDescendants = function (dataNode) {
|
359 | var _a;
|
360 | var _this = this;
|
361 | var toBeProcessed = [dataNode];
|
362 | toBeProcessed.push.apply(toBeProcessed, __spreadArray([], __read(this.getDescendants(dataNode))));
|
363 | (_a = this.expansionModel).select.apply(_a, __spreadArray([], __read(toBeProcessed.map(function (value) { return _this._trackByValue(value); }))));
|
364 | };
|
365 |
|
366 | BaseTreeControl.prototype.collapseDescendants = function (dataNode) {
|
367 | var _a;
|
368 | var _this = this;
|
369 | var toBeProcessed = [dataNode];
|
370 | toBeProcessed.push.apply(toBeProcessed, __spreadArray([], __read(this.getDescendants(dataNode))));
|
371 | (_a = this.expansionModel).deselect.apply(_a, __spreadArray([], __read(toBeProcessed.map(function (value) { return _this._trackByValue(value); }))));
|
372 | };
|
373 | BaseTreeControl.prototype._trackByValue = function (value) {
|
374 | return this.trackBy ? this.trackBy(value) : value;
|
375 | };
|
376 | return BaseTreeControl;
|
377 | }());
|
378 |
|
379 |
|
380 | var FlatTreeControl = (function (_super) {
|
381 | __extends(FlatTreeControl, _super);
|
382 |
|
383 | function FlatTreeControl(getLevel, isExpandable, options) {
|
384 | var _this = _super.call(this) || this;
|
385 | _this.getLevel = getLevel;
|
386 | _this.isExpandable = isExpandable;
|
387 | _this.options = options;
|
388 | if (_this.options) {
|
389 | _this.trackBy = _this.options.trackBy;
|
390 | }
|
391 | return _this;
|
392 | }
|
393 | |
394 |
|
395 |
|
396 |
|
397 |
|
398 |
|
399 | FlatTreeControl.prototype.getDescendants = function (dataNode) {
|
400 | var startIndex = this.dataNodes.indexOf(dataNode);
|
401 | var results = [];
|
402 |
|
403 |
|
404 |
|
405 |
|
406 |
|
407 |
|
408 | for (var i = startIndex + 1; i < this.dataNodes.length && this.getLevel(dataNode) < this.getLevel(this.dataNodes[i]); i++) {
|
409 | results.push(this.dataNodes[i]);
|
410 | }
|
411 | return results;
|
412 | };
|
413 | |
414 |
|
415 |
|
416 |
|
417 |
|
418 |
|
419 | FlatTreeControl.prototype.expandAll = function () {
|
420 | var _a;
|
421 | var _this = this;
|
422 | (_a = this.expansionModel).select.apply(_a, __spreadArray([], __read(this.dataNodes.map(function (node) { return _this._trackByValue(node); }))));
|
423 | };
|
424 | return FlatTreeControl;
|
425 | }(BaseTreeControl));
|
426 |
|
427 |
|
428 | var NestedTreeControl = (function (_super) {
|
429 | __extends(NestedTreeControl, _super);
|
430 |
|
431 | function NestedTreeControl(getChildren, options) {
|
432 | var _this = _super.call(this) || this;
|
433 | _this.getChildren = getChildren;
|
434 | _this.options = options;
|
435 | if (_this.options) {
|
436 | _this.trackBy = _this.options.trackBy;
|
437 | }
|
438 | return _this;
|
439 | }
|
440 | |
441 |
|
442 |
|
443 |
|
444 |
|
445 |
|
446 | NestedTreeControl.prototype.expandAll = function () {
|
447 | var _a;
|
448 | var _this = this;
|
449 | this.expansionModel.clear();
|
450 | var allNodes = this.dataNodes.reduce(function (accumulator, dataNode) { return __spreadArray(__spreadArray(__spreadArray([], __read(accumulator)), __read(_this.getDescendants(dataNode))), [dataNode]); }, []);
|
451 | (_a = this.expansionModel).select.apply(_a, __spreadArray([], __read(allNodes.map(function (node) { return _this._trackByValue(node); }))));
|
452 | };
|
453 |
|
454 | NestedTreeControl.prototype.getDescendants = function (dataNode) {
|
455 | var descendants = [];
|
456 | this._getDescendants(descendants, dataNode);
|
457 |
|
458 | return descendants.splice(1);
|
459 | };
|
460 |
|
461 | NestedTreeControl.prototype._getDescendants = function (descendants, dataNode) {
|
462 | var _this = this;
|
463 | descendants.push(dataNode);
|
464 | var childrenNodes = this.getChildren(dataNode);
|
465 | if (Array.isArray(childrenNodes)) {
|
466 | childrenNodes.forEach(function (child) { return _this._getDescendants(descendants, child); });
|
467 | }
|
468 | else if (rxjs.isObservable(childrenNodes)) {
|
469 |
|
470 |
|
471 | childrenNodes.pipe(operators.take(1), operators.filter(Boolean))
|
472 | .subscribe(function (children) {
|
473 | var e_1, _a;
|
474 | try {
|
475 | for (var children_1 = __values(children), children_1_1 = children_1.next(); !children_1_1.done; children_1_1 = children_1.next()) {
|
476 | var child = children_1_1.value;
|
477 | _this._getDescendants(descendants, child);
|
478 | }
|
479 | }
|
480 | catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
481 | finally {
|
482 | try {
|
483 | if (children_1_1 && !children_1_1.done && (_a = children_1.return)) _a.call(children_1);
|
484 | }
|
485 | finally { if (e_1) throw e_1.error; }
|
486 | }
|
487 | });
|
488 | }
|
489 | };
|
490 | return NestedTreeControl;
|
491 | }(BaseTreeControl));
|
492 |
|
493 | |
494 |
|
495 |
|
496 |
|
497 |
|
498 |
|
499 |
|
500 | |
501 |
|
502 |
|
503 |
|
504 |
|
505 | var CDK_TREE_NODE_OUTLET_NODE = new core.InjectionToken('CDK_TREE_NODE_OUTLET_NODE');
|
506 | |
507 |
|
508 |
|
509 |
|
510 | var CdkTreeNodeOutlet = (function () {
|
511 | function CdkTreeNodeOutlet(viewContainer, _node) {
|
512 | this.viewContainer = viewContainer;
|
513 | this._node = _node;
|
514 | }
|
515 | return CdkTreeNodeOutlet;
|
516 | }());
|
517 | CdkTreeNodeOutlet.decorators = [
|
518 | { type: core.Directive, args: [{
|
519 | selector: '[cdkTreeNodeOutlet]'
|
520 | },] }
|
521 | ];
|
522 | CdkTreeNodeOutlet.ctorParameters = function () { return [
|
523 | { type: core.ViewContainerRef },
|
524 | { type: undefined, decorators: [{ type: core.Inject, args: [CDK_TREE_NODE_OUTLET_NODE,] }, { type: core.Optional }] }
|
525 | ]; };
|
526 |
|
527 | |
528 |
|
529 |
|
530 |
|
531 |
|
532 |
|
533 |
|
534 |
|
535 | var CdkTreeNodeOutletContext = (function () {
|
536 | function CdkTreeNodeOutletContext(data) {
|
537 | this.$implicit = data;
|
538 | }
|
539 | return CdkTreeNodeOutletContext;
|
540 | }());
|
541 | |
542 |
|
543 |
|
544 |
|
545 | var CdkTreeNodeDef = (function () {
|
546 |
|
547 | function CdkTreeNodeDef(template) {
|
548 | this.template = template;
|
549 | }
|
550 | return CdkTreeNodeDef;
|
551 | }());
|
552 | CdkTreeNodeDef.decorators = [
|
553 | { type: core.Directive, args: [{
|
554 | selector: '[cdkTreeNodeDef]',
|
555 | inputs: [
|
556 | 'when: cdkTreeNodeDefWhen'
|
557 | ],
|
558 | },] }
|
559 | ];
|
560 | CdkTreeNodeDef.ctorParameters = function () { return [
|
561 | { type: core.TemplateRef }
|
562 | ]; };
|
563 |
|
564 | |
565 |
|
566 |
|
567 |
|
568 |
|
569 |
|
570 |
|
571 | |
572 |
|
573 |
|
574 |
|
575 | function getTreeNoValidDataSourceError() {
|
576 | return Error("A valid data source must be provided.");
|
577 | }
|
578 | |
579 |
|
580 |
|
581 |
|
582 | function getTreeMultipleDefaultNodeDefsError() {
|
583 | return Error("There can only be one default row without a when predicate function.");
|
584 | }
|
585 | |
586 |
|
587 |
|
588 |
|
589 | function getTreeMissingMatchingNodeDefError() {
|
590 | return Error("Could not find a matching node definition for the provided node data.");
|
591 | }
|
592 | |
593 |
|
594 |
|
595 |
|
596 | function getTreeControlMissingError() {
|
597 | return Error("Could not find a tree control for the tree.");
|
598 | }
|
599 | |
600 |
|
601 |
|
602 |
|
603 | function getTreeControlFunctionsMissingError() {
|
604 | return Error("Could not find functions for nested/flat tree in tree control.");
|
605 | }
|
606 |
|
607 | |
608 |
|
609 |
|
610 |
|
611 | var CdkTree = (function () {
|
612 | function CdkTree(_differs, _changeDetectorRef) {
|
613 | this._differs = _differs;
|
614 | this._changeDetectorRef = _changeDetectorRef;
|
615 |
|
616 | this._onDestroy = new rxjs.Subject();
|
617 |
|
618 | this._levels = new Map();
|
619 |
|
620 |
|
621 | |
622 |
|
623 |
|
624 |
|
625 | this.viewChange = new rxjs.BehaviorSubject({ start: 0, end: Number.MAX_VALUE });
|
626 | }
|
627 | Object.defineProperty(CdkTree.prototype, "dataSource", {
|
628 | |
629 |
|
630 |
|
631 |
|
632 |
|
633 | get: function () { return this._dataSource; },
|
634 | set: function (dataSource) {
|
635 | if (this._dataSource !== dataSource) {
|
636 | this._switchDataSource(dataSource);
|
637 | }
|
638 | },
|
639 | enumerable: false,
|
640 | configurable: true
|
641 | });
|
642 | CdkTree.prototype.ngOnInit = function () {
|
643 | this._dataDiffer = this._differs.find([]).create(this.trackBy);
|
644 | if (!this.treeControl && (typeof ngDevMode === 'undefined' || ngDevMode)) {
|
645 | throw getTreeControlMissingError();
|
646 | }
|
647 | };
|
648 | CdkTree.prototype.ngOnDestroy = function () {
|
649 | this._nodeOutlet.viewContainer.clear();
|
650 | this.viewChange.complete();
|
651 | this._onDestroy.next();
|
652 | this._onDestroy.complete();
|
653 | if (this._dataSource && typeof this._dataSource.disconnect === 'function') {
|
654 | this.dataSource.disconnect(this);
|
655 | }
|
656 | if (this._dataSubscription) {
|
657 | this._dataSubscription.unsubscribe();
|
658 | this._dataSubscription = null;
|
659 | }
|
660 | };
|
661 | CdkTree.prototype.ngAfterContentChecked = function () {
|
662 | var defaultNodeDefs = this._nodeDefs.filter(function (def) { return !def.when; });
|
663 | if (defaultNodeDefs.length > 1 && (typeof ngDevMode === 'undefined' || ngDevMode)) {
|
664 | throw getTreeMultipleDefaultNodeDefsError();
|
665 | }
|
666 | this._defaultNodeDef = defaultNodeDefs[0];
|
667 | if (this.dataSource && this._nodeDefs && !this._dataSubscription) {
|
668 | this._observeRenderChanges();
|
669 | }
|
670 | };
|
671 |
|
672 |
|
673 | |
674 |
|
675 |
|
676 |
|
677 |
|
678 | CdkTree.prototype._switchDataSource = function (dataSource) {
|
679 | if (this._dataSource && typeof this._dataSource.disconnect === 'function') {
|
680 | this.dataSource.disconnect(this);
|
681 | }
|
682 | if (this._dataSubscription) {
|
683 | this._dataSubscription.unsubscribe();
|
684 | this._dataSubscription = null;
|
685 | }
|
686 |
|
687 | if (!dataSource) {
|
688 | this._nodeOutlet.viewContainer.clear();
|
689 | }
|
690 | this._dataSource = dataSource;
|
691 | if (this._nodeDefs) {
|
692 | this._observeRenderChanges();
|
693 | }
|
694 | };
|
695 |
|
696 | CdkTree.prototype._observeRenderChanges = function () {
|
697 | var _this = this;
|
698 | var dataStream;
|
699 | if (collections.isDataSource(this._dataSource)) {
|
700 | dataStream = this._dataSource.connect(this);
|
701 | }
|
702 | else if (rxjs.isObservable(this._dataSource)) {
|
703 | dataStream = this._dataSource;
|
704 | }
|
705 | else if (Array.isArray(this._dataSource)) {
|
706 | dataStream = rxjs.of(this._dataSource);
|
707 | }
|
708 | if (dataStream) {
|
709 | this._dataSubscription = dataStream.pipe(operators.takeUntil(this._onDestroy))
|
710 | .subscribe(function (data) { return _this.renderNodeChanges(data); });
|
711 | }
|
712 | else if (typeof ngDevMode === 'undefined' || ngDevMode) {
|
713 | throw getTreeNoValidDataSourceError();
|
714 | }
|
715 | };
|
716 |
|
717 | CdkTree.prototype.renderNodeChanges = function (data, dataDiffer, viewContainer, parentData) {
|
718 | var _this = this;
|
719 | if (dataDiffer === void 0) { dataDiffer = this._dataDiffer; }
|
720 | if (viewContainer === void 0) { viewContainer = this._nodeOutlet.viewContainer; }
|
721 | var changes = dataDiffer.diff(data);
|
722 | if (!changes) {
|
723 | return;
|
724 | }
|
725 | changes.forEachOperation(function (item, adjustedPreviousIndex, currentIndex) {
|
726 | if (item.previousIndex == null) {
|
727 | _this.insertNode(data[currentIndex], currentIndex, viewContainer, parentData);
|
728 | }
|
729 | else if (currentIndex == null) {
|
730 | viewContainer.remove(adjustedPreviousIndex);
|
731 | _this._levels.delete(item.item);
|
732 | }
|
733 | else {
|
734 | var view = viewContainer.get(adjustedPreviousIndex);
|
735 | viewContainer.move(view, currentIndex);
|
736 | }
|
737 | });
|
738 | this._changeDetectorRef.detectChanges();
|
739 | };
|
740 | |
741 |
|
742 |
|
743 |
|
744 |
|
745 |
|
746 | CdkTree.prototype._getNodeDef = function (data, i) {
|
747 | if (this._nodeDefs.length === 1) {
|
748 | return this._nodeDefs.first;
|
749 | }
|
750 | var nodeDef = this._nodeDefs.find(function (def) { return def.when && def.when(i, data); }) || this._defaultNodeDef;
|
751 | if (!nodeDef && (typeof ngDevMode === 'undefined' || ngDevMode)) {
|
752 | throw getTreeMissingMatchingNodeDefError();
|
753 | }
|
754 | return nodeDef;
|
755 | };
|
756 | |
757 |
|
758 |
|
759 |
|
760 | CdkTree.prototype.insertNode = function (nodeData, index, viewContainer, parentData) {
|
761 | var node = this._getNodeDef(nodeData, index);
|
762 |
|
763 | var context = new CdkTreeNodeOutletContext(nodeData);
|
764 |
|
765 |
|
766 | if (this.treeControl.getLevel) {
|
767 | context.level = this.treeControl.getLevel(nodeData);
|
768 | }
|
769 | else if (typeof parentData !== 'undefined' && this._levels.has(parentData)) {
|
770 | context.level = this._levels.get(parentData) + 1;
|
771 | }
|
772 | else {
|
773 | context.level = 0;
|
774 | }
|
775 | this._levels.set(nodeData, context.level);
|
776 |
|
777 | var container = viewContainer ? viewContainer : this._nodeOutlet.viewContainer;
|
778 | container.createEmbeddedView(node.template, context, index);
|
779 |
|
780 |
|
781 |
|
782 | if (CdkTreeNode.mostRecentTreeNode) {
|
783 | CdkTreeNode.mostRecentTreeNode.data = nodeData;
|
784 | }
|
785 | };
|
786 | return CdkTree;
|
787 | }());
|
788 | CdkTree.decorators = [
|
789 | { type: core.Component, args: [{
|
790 | selector: 'cdk-tree',
|
791 | exportAs: 'cdkTree',
|
792 | template: "<ng-container cdkTreeNodeOutlet></ng-container>",
|
793 | host: {
|
794 | 'class': 'cdk-tree',
|
795 | 'role': 'tree',
|
796 | },
|
797 | encapsulation: core.ViewEncapsulation.None,
|
798 |
|
799 |
|
800 |
|
801 |
|
802 | changeDetection: core.ChangeDetectionStrategy.Default
|
803 | },] }
|
804 | ];
|
805 | CdkTree.ctorParameters = function () { return [
|
806 | { type: core.IterableDiffers },
|
807 | { type: core.ChangeDetectorRef }
|
808 | ]; };
|
809 | CdkTree.propDecorators = {
|
810 | dataSource: [{ type: core.Input }],
|
811 | treeControl: [{ type: core.Input }],
|
812 | trackBy: [{ type: core.Input }],
|
813 | _nodeOutlet: [{ type: core.ViewChild, args: [CdkTreeNodeOutlet, { static: true },] }],
|
814 | _nodeDefs: [{ type: core.ContentChildren, args: [CdkTreeNodeDef, {
|
815 |
|
816 |
|
817 | descendants: true
|
818 | },] }]
|
819 | };
|
820 | |
821 |
|
822 |
|
823 | var CdkTreeNode = (function () {
|
824 | function CdkTreeNode(_elementRef, _tree) {
|
825 | this._elementRef = _elementRef;
|
826 | this._tree = _tree;
|
827 |
|
828 | this._destroyed = new rxjs.Subject();
|
829 |
|
830 | this._dataChanges = new rxjs.Subject();
|
831 | CdkTreeNode.mostRecentTreeNode = this;
|
832 |
|
833 |
|
834 |
|
835 |
|
836 | this._elementRef.nativeElement.classList.add('cdk-tree-node');
|
837 | this.role = 'treeitem';
|
838 | }
|
839 | Object.defineProperty(CdkTreeNode.prototype, "role", {
|
840 | |
841 |
|
842 |
|
843 |
|
844 |
|
845 |
|
846 | get: function () { return 'treeitem'; },
|
847 | set: function (_role) {
|
848 |
|
849 | this._elementRef.nativeElement.setAttribute('role', _role);
|
850 | },
|
851 | enumerable: false,
|
852 | configurable: true
|
853 | });
|
854 | Object.defineProperty(CdkTreeNode.prototype, "data", {
|
855 |
|
856 | get: function () { return this._data; },
|
857 | set: function (value) {
|
858 | if (value !== this._data) {
|
859 | this._data = value;
|
860 | this._setRoleFromData();
|
861 | this._dataChanges.next();
|
862 | }
|
863 | },
|
864 | enumerable: false,
|
865 | configurable: true
|
866 | });
|
867 | Object.defineProperty(CdkTreeNode.prototype, "isExpanded", {
|
868 | get: function () {
|
869 | return this._tree.treeControl.isExpanded(this._data);
|
870 | },
|
871 | enumerable: false,
|
872 | configurable: true
|
873 | });
|
874 | CdkTreeNode.prototype._setExpanded = function (_expanded) {
|
875 | this._isAriaExpanded = _expanded;
|
876 | this._elementRef.nativeElement.setAttribute('aria-expanded', "" + _expanded);
|
877 | };
|
878 | Object.defineProperty(CdkTreeNode.prototype, "level", {
|
879 | get: function () {
|
880 |
|
881 |
|
882 |
|
883 | return this._tree.treeControl.getLevel ?
|
884 | this._tree.treeControl.getLevel(this._data) : this._parentNodeAriaLevel;
|
885 | },
|
886 | enumerable: false,
|
887 | configurable: true
|
888 | });
|
889 | CdkTreeNode.prototype.ngOnInit = function () {
|
890 | this._parentNodeAriaLevel = getParentNodeAriaLevel(this._elementRef.nativeElement);
|
891 | this._elementRef.nativeElement.setAttribute('aria-level', "" + (this.level + 1));
|
892 | };
|
893 | CdkTreeNode.prototype.ngDoCheck = function () {
|
894 |
|
895 |
|
896 |
|
897 |
|
898 | if (this.isExpanded != this._isAriaExpanded) {
|
899 | this._setExpanded(this.isExpanded);
|
900 | }
|
901 | };
|
902 | CdkTreeNode.prototype.ngOnDestroy = function () {
|
903 |
|
904 |
|
905 | if (CdkTreeNode.mostRecentTreeNode === this) {
|
906 | CdkTreeNode.mostRecentTreeNode = null;
|
907 | }
|
908 | this._dataChanges.complete();
|
909 | this._destroyed.next();
|
910 | this._destroyed.complete();
|
911 | };
|
912 |
|
913 | CdkTreeNode.prototype.focus = function () {
|
914 | this._elementRef.nativeElement.focus();
|
915 | };
|
916 |
|
917 | CdkTreeNode.prototype._setRoleFromData = function () {
|
918 | if (!this._tree.treeControl.isExpandable && !this._tree.treeControl.getChildren &&
|
919 | (typeof ngDevMode === 'undefined' || ngDevMode)) {
|
920 | throw getTreeControlFunctionsMissingError();
|
921 | }
|
922 | this.role = 'treeitem';
|
923 | };
|
924 | return CdkTreeNode;
|
925 | }());
|
926 | |
927 |
|
928 |
|
929 |
|
930 | CdkTreeNode.mostRecentTreeNode = null;
|
931 | CdkTreeNode.decorators = [
|
932 | { type: core.Directive, args: [{
|
933 | selector: 'cdk-tree-node',
|
934 | exportAs: 'cdkTreeNode',
|
935 | },] }
|
936 | ];
|
937 | CdkTreeNode.ctorParameters = function () { return [
|
938 | { type: core.ElementRef },
|
939 | { type: CdkTree }
|
940 | ]; };
|
941 | CdkTreeNode.propDecorators = {
|
942 | role: [{ type: core.Input }]
|
943 | };
|
944 | function getParentNodeAriaLevel(nodeElement) {
|
945 | var parent = nodeElement.parentElement;
|
946 | while (parent && !isNodeElement(parent)) {
|
947 | parent = parent.parentElement;
|
948 | }
|
949 | if (!parent) {
|
950 | if (typeof ngDevMode === 'undefined' || ngDevMode) {
|
951 | throw Error('Incorrect tree structure containing detached node.');
|
952 | }
|
953 | else {
|
954 | return -1;
|
955 | }
|
956 | }
|
957 | else if (parent.classList.contains('cdk-nested-tree-node')) {
|
958 | return coercion.coerceNumberProperty(parent.getAttribute('aria-level'));
|
959 | }
|
960 | else {
|
961 |
|
962 | return 0;
|
963 | }
|
964 | }
|
965 | function isNodeElement(element) {
|
966 | var classList = element.classList;
|
967 | return !!((classList === null || classList === void 0 ? void 0 : classList.contains('cdk-nested-tree-node')) || (classList === null || classList === void 0 ? void 0 : classList.contains('cdk-tree')));
|
968 | }
|
969 |
|
970 | |
971 |
|
972 |
|
973 |
|
974 |
|
975 |
|
976 | var CdkNestedTreeNode = (function (_super) {
|
977 | __extends(CdkNestedTreeNode, _super);
|
978 | function CdkNestedTreeNode(elementRef, tree, _differs) {
|
979 | var _this = _super.call(this, elementRef, tree) || this;
|
980 | _this._differs = _differs;
|
981 |
|
982 |
|
983 |
|
984 |
|
985 | elementRef.nativeElement.classList.add('cdk-nested-tree-node');
|
986 | return _this;
|
987 | }
|
988 | CdkNestedTreeNode.prototype.ngAfterContentInit = function () {
|
989 | var _this = this;
|
990 | this._dataDiffer = this._differs.find([]).create(this._tree.trackBy);
|
991 | if (!this._tree.treeControl.getChildren && (typeof ngDevMode === 'undefined' || ngDevMode)) {
|
992 | throw getTreeControlFunctionsMissingError();
|
993 | }
|
994 | var childrenNodes = this._tree.treeControl.getChildren(this.data);
|
995 | if (Array.isArray(childrenNodes)) {
|
996 | this.updateChildrenNodes(childrenNodes);
|
997 | }
|
998 | else if (rxjs.isObservable(childrenNodes)) {
|
999 | childrenNodes.pipe(operators.takeUntil(this._destroyed))
|
1000 | .subscribe(function (result) { return _this.updateChildrenNodes(result); });
|
1001 | }
|
1002 | this.nodeOutlet.changes.pipe(operators.takeUntil(this._destroyed))
|
1003 | .subscribe(function () { return _this.updateChildrenNodes(); });
|
1004 | };
|
1005 |
|
1006 |
|
1007 | CdkNestedTreeNode.prototype.ngOnInit = function () {
|
1008 | _super.prototype.ngOnInit.call(this);
|
1009 | };
|
1010 | CdkNestedTreeNode.prototype.ngDoCheck = function () {
|
1011 | _super.prototype.ngDoCheck.call(this);
|
1012 | };
|
1013 | CdkNestedTreeNode.prototype.ngOnDestroy = function () {
|
1014 | this._clear();
|
1015 | _super.prototype.ngOnDestroy.call(this);
|
1016 | };
|
1017 |
|
1018 | CdkNestedTreeNode.prototype.updateChildrenNodes = function (children) {
|
1019 | var outlet = this._getNodeOutlet();
|
1020 | if (children) {
|
1021 | this._children = children;
|
1022 | }
|
1023 | if (outlet && this._children) {
|
1024 | var viewContainer = outlet.viewContainer;
|
1025 | this._tree.renderNodeChanges(this._children, this._dataDiffer, viewContainer, this._data);
|
1026 | }
|
1027 | else {
|
1028 |
|
1029 | this._dataDiffer.diff([]);
|
1030 | }
|
1031 | };
|
1032 |
|
1033 | CdkNestedTreeNode.prototype._clear = function () {
|
1034 | var outlet = this._getNodeOutlet();
|
1035 | if (outlet) {
|
1036 | outlet.viewContainer.clear();
|
1037 | this._dataDiffer.diff([]);
|
1038 | }
|
1039 | };
|
1040 |
|
1041 | CdkNestedTreeNode.prototype._getNodeOutlet = function () {
|
1042 | var _this = this;
|
1043 | var outlets = this.nodeOutlet;
|
1044 |
|
1045 |
|
1046 | return outlets && outlets.find(function (outlet) { return !outlet._node || outlet._node === _this; });
|
1047 | };
|
1048 | return CdkNestedTreeNode;
|
1049 | }(CdkTreeNode));
|
1050 | CdkNestedTreeNode.decorators = [
|
1051 | { type: core.Directive, args: [{
|
1052 | selector: 'cdk-nested-tree-node',
|
1053 | exportAs: 'cdkNestedTreeNode',
|
1054 | inputs: ['role', 'disabled', 'tabIndex'],
|
1055 | providers: [
|
1056 | { provide: CdkTreeNode, useExisting: CdkNestedTreeNode },
|
1057 | { provide: CDK_TREE_NODE_OUTLET_NODE, useExisting: CdkNestedTreeNode }
|
1058 | ]
|
1059 | },] }
|
1060 | ];
|
1061 | CdkNestedTreeNode.ctorParameters = function () { return [
|
1062 | { type: core.ElementRef },
|
1063 | { type: CdkTree },
|
1064 | { type: core.IterableDiffers }
|
1065 | ]; };
|
1066 | CdkNestedTreeNode.propDecorators = {
|
1067 | nodeOutlet: [{ type: core.ContentChildren, args: [CdkTreeNodeOutlet, {
|
1068 |
|
1069 |
|
1070 | descendants: true
|
1071 | },] }]
|
1072 | };
|
1073 |
|
1074 | |
1075 |
|
1076 |
|
1077 |
|
1078 |
|
1079 |
|
1080 |
|
1081 |
|
1082 | var cssUnitPattern = /([A-Za-z%]+)$/;
|
1083 | |
1084 |
|
1085 |
|
1086 |
|
1087 | var CdkTreeNodePadding = (function () {
|
1088 | function CdkTreeNodePadding(_treeNode, _tree, _element, _dir) {
|
1089 | var _this = this;
|
1090 | this._treeNode = _treeNode;
|
1091 | this._tree = _tree;
|
1092 | this._element = _element;
|
1093 | this._dir = _dir;
|
1094 |
|
1095 | this._destroyed = new rxjs.Subject();
|
1096 |
|
1097 | this.indentUnits = 'px';
|
1098 | this._indent = 40;
|
1099 | this._setPadding();
|
1100 | if (_dir) {
|
1101 | _dir.change.pipe(operators.takeUntil(this._destroyed)).subscribe(function () { return _this._setPadding(true); });
|
1102 | }
|
1103 |
|
1104 |
|
1105 |
|
1106 | _treeNode._dataChanges.subscribe(function () { return _this._setPadding(); });
|
1107 | }
|
1108 | Object.defineProperty(CdkTreeNodePadding.prototype, "level", {
|
1109 |
|
1110 | get: function () { return this._level; },
|
1111 | set: function (value) { this._setLevelInput(value); },
|
1112 | enumerable: false,
|
1113 | configurable: true
|
1114 | });
|
1115 | Object.defineProperty(CdkTreeNodePadding.prototype, "indent", {
|
1116 | |
1117 |
|
1118 |
|
1119 |
|
1120 | get: function () { return this._indent; },
|
1121 | set: function (indent) { this._setIndentInput(indent); },
|
1122 | enumerable: false,
|
1123 | configurable: true
|
1124 | });
|
1125 | CdkTreeNodePadding.prototype.ngOnDestroy = function () {
|
1126 | this._destroyed.next();
|
1127 | this._destroyed.complete();
|
1128 | };
|
1129 |
|
1130 | CdkTreeNodePadding.prototype._paddingIndent = function () {
|
1131 | var nodeLevel = (this._treeNode.data && this._tree.treeControl.getLevel)
|
1132 | ? this._tree.treeControl.getLevel(this._treeNode.data)
|
1133 | : null;
|
1134 | var level = this._level == null ? nodeLevel : this._level;
|
1135 | return typeof level === 'number' ? "" + level * this._indent + this.indentUnits : null;
|
1136 | };
|
1137 | CdkTreeNodePadding.prototype._setPadding = function (forceChange) {
|
1138 | if (forceChange === void 0) { forceChange = false; }
|
1139 | var padding = this._paddingIndent();
|
1140 | if (padding !== this._currentPadding || forceChange) {
|
1141 | var element = this._element.nativeElement;
|
1142 | var paddingProp = this._dir && this._dir.value === 'rtl' ? 'paddingRight' : 'paddingLeft';
|
1143 | var resetProp = paddingProp === 'paddingLeft' ? 'paddingRight' : 'paddingLeft';
|
1144 | element.style[paddingProp] = padding || '';
|
1145 | element.style[resetProp] = '';
|
1146 | this._currentPadding = padding;
|
1147 | }
|
1148 | };
|
1149 | |
1150 |
|
1151 |
|
1152 |
|
1153 |
|
1154 |
|
1155 | CdkTreeNodePadding.prototype._setLevelInput = function (value) {
|
1156 |
|
1157 |
|
1158 |
|
1159 | this._level = coercion.coerceNumberProperty(value, null);
|
1160 | this._setPadding();
|
1161 | };
|
1162 | |
1163 |
|
1164 |
|
1165 |
|
1166 |
|
1167 |
|
1168 | CdkTreeNodePadding.prototype._setIndentInput = function (indent) {
|
1169 | var value = indent;
|
1170 | var units = 'px';
|
1171 | if (typeof indent === 'string') {
|
1172 | var parts = indent.split(cssUnitPattern);
|
1173 | value = parts[0];
|
1174 | units = parts[1] || units;
|
1175 | }
|
1176 | this.indentUnits = units;
|
1177 | this._indent = coercion.coerceNumberProperty(value);
|
1178 | this._setPadding();
|
1179 | };
|
1180 | return CdkTreeNodePadding;
|
1181 | }());
|
1182 | CdkTreeNodePadding.decorators = [
|
1183 | { type: core.Directive, args: [{
|
1184 | selector: '[cdkTreeNodePadding]',
|
1185 | },] }
|
1186 | ];
|
1187 | CdkTreeNodePadding.ctorParameters = function () { return [
|
1188 | { type: CdkTreeNode },
|
1189 | { type: CdkTree },
|
1190 | { type: core.ElementRef },
|
1191 | { type: bidi.Directionality, decorators: [{ type: core.Optional }] }
|
1192 | ]; };
|
1193 | CdkTreeNodePadding.propDecorators = {
|
1194 | level: [{ type: core.Input, args: ['cdkTreeNodePadding',] }],
|
1195 | indent: [{ type: core.Input, args: ['cdkTreeNodePaddingIndent',] }]
|
1196 | };
|
1197 |
|
1198 | |
1199 |
|
1200 |
|
1201 |
|
1202 |
|
1203 |
|
1204 |
|
1205 | |
1206 |
|
1207 |
|
1208 | var CdkTreeNodeToggle = (function () {
|
1209 | function CdkTreeNodeToggle(_tree, _treeNode) {
|
1210 | this._tree = _tree;
|
1211 | this._treeNode = _treeNode;
|
1212 | this._recursive = false;
|
1213 | }
|
1214 | Object.defineProperty(CdkTreeNodeToggle.prototype, "recursive", {
|
1215 |
|
1216 | get: function () { return this._recursive; },
|
1217 | set: function (value) { this._recursive = coercion.coerceBooleanProperty(value); },
|
1218 | enumerable: false,
|
1219 | configurable: true
|
1220 | });
|
1221 |
|
1222 |
|
1223 |
|
1224 |
|
1225 |
|
1226 | CdkTreeNodeToggle.prototype._toggle = function (event) {
|
1227 | this.recursive
|
1228 | ? this._tree.treeControl.toggleDescendants(this._treeNode.data)
|
1229 | : this._tree.treeControl.toggle(this._treeNode.data);
|
1230 | event.stopPropagation();
|
1231 | };
|
1232 | return CdkTreeNodeToggle;
|
1233 | }());
|
1234 | CdkTreeNodeToggle.decorators = [
|
1235 | { type: core.Directive, args: [{ selector: '[cdkTreeNodeToggle]' },] }
|
1236 | ];
|
1237 | CdkTreeNodeToggle.ctorParameters = function () { return [
|
1238 | { type: CdkTree },
|
1239 | { type: CdkTreeNode }
|
1240 | ]; };
|
1241 | CdkTreeNodeToggle.propDecorators = {
|
1242 | recursive: [{ type: core.Input, args: ['cdkTreeNodeToggleRecursive',] }],
|
1243 | _toggle: [{ type: core.HostListener, args: ['click', ['$event'],] }]
|
1244 | };
|
1245 |
|
1246 | |
1247 |
|
1248 |
|
1249 |
|
1250 |
|
1251 |
|
1252 |
|
1253 | var EXPORTED_DECLARATIONS = [
|
1254 | CdkNestedTreeNode,
|
1255 | CdkTreeNodeDef,
|
1256 | CdkTreeNodePadding,
|
1257 | CdkTreeNodeToggle,
|
1258 | CdkTree,
|
1259 | CdkTreeNode,
|
1260 | CdkTreeNodeOutlet,
|
1261 | ];
|
1262 | var CdkTreeModule = (function () {
|
1263 | function CdkTreeModule() {
|
1264 | }
|
1265 | return CdkTreeModule;
|
1266 | }());
|
1267 | CdkTreeModule.decorators = [
|
1268 | { type: core.NgModule, args: [{
|
1269 | exports: EXPORTED_DECLARATIONS,
|
1270 | declarations: EXPORTED_DECLARATIONS,
|
1271 | },] }
|
1272 | ];
|
1273 |
|
1274 | |
1275 |
|
1276 |
|
1277 |
|
1278 |
|
1279 |
|
1280 |
|
1281 |
|
1282 | |
1283 |
|
1284 |
|
1285 |
|
1286 | exports.BaseTreeControl = BaseTreeControl;
|
1287 | exports.CDK_TREE_NODE_OUTLET_NODE = CDK_TREE_NODE_OUTLET_NODE;
|
1288 | exports.CdkNestedTreeNode = CdkNestedTreeNode;
|
1289 | exports.CdkTree = CdkTree;
|
1290 | exports.CdkTreeModule = CdkTreeModule;
|
1291 | exports.CdkTreeNode = CdkTreeNode;
|
1292 | exports.CdkTreeNodeDef = CdkTreeNodeDef;
|
1293 | exports.CdkTreeNodeOutlet = CdkTreeNodeOutlet;
|
1294 | exports.CdkTreeNodeOutletContext = CdkTreeNodeOutletContext;
|
1295 | exports.CdkTreeNodePadding = CdkTreeNodePadding;
|
1296 | exports.CdkTreeNodeToggle = CdkTreeNodeToggle;
|
1297 | exports.FlatTreeControl = FlatTreeControl;
|
1298 | exports.NestedTreeControl = NestedTreeControl;
|
1299 | exports.getTreeControlFunctionsMissingError = getTreeControlFunctionsMissingError;
|
1300 | exports.getTreeControlMissingError = getTreeControlMissingError;
|
1301 | exports.getTreeMissingMatchingNodeDefError = getTreeMissingMatchingNodeDefError;
|
1302 | exports.getTreeMultipleDefaultNodeDefsError = getTreeMultipleDefaultNodeDefsError;
|
1303 | exports.getTreeNoValidDataSourceError = getTreeNoValidDataSourceError;
|
1304 |
|
1305 | Object.defineProperty(exports, '__esModule', { value: true });
|
1306 |
|
1307 | })));
|
1308 |
|