@angular/cdk 6.4.2 → 6.4.7
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/_text-field.scss +4 -3
- package/a11y/typings/focus-monitor/focus-monitor.d.ts +1 -1
- package/a11y/typings/focus-trap/focus-trap.d.ts +1 -1
- package/a11y/typings/index.metadata.json +1 -1
- package/a11y/typings/live-announcer/live-announcer.d.ts +1 -1
- package/accordion/typings/accordion.d.ts +6 -1
- package/accordion/typings/index.metadata.json +1 -1
- package/bundles/cdk-a11y.umd.js +17 -9
- package/bundles/cdk-a11y.umd.js.map +1 -1
- package/bundles/cdk-a11y.umd.min.js +1 -1
- package/bundles/cdk-a11y.umd.min.js.map +1 -1
- package/bundles/cdk-accordion.umd.js +28 -4
- package/bundles/cdk-accordion.umd.js.map +1 -1
- package/bundles/cdk-accordion.umd.min.js +1 -1
- package/bundles/cdk-accordion.umd.min.js.map +1 -1
- package/bundles/cdk-bidi.umd.js +5 -4
- package/bundles/cdk-bidi.umd.js.map +1 -1
- package/bundles/cdk-bidi.umd.min.js +1 -1
- package/bundles/cdk-bidi.umd.min.js.map +1 -1
- package/bundles/cdk-collections.umd.js +9 -3
- package/bundles/cdk-collections.umd.js.map +1 -1
- package/bundles/cdk-collections.umd.min.js +1 -1
- package/bundles/cdk-collections.umd.min.js.map +1 -1
- package/bundles/cdk-layout.umd.js +9 -3
- package/bundles/cdk-layout.umd.js.map +1 -1
- package/bundles/cdk-layout.umd.min.js +1 -1
- package/bundles/cdk-layout.umd.min.js.map +1 -1
- package/bundles/cdk-observers.umd.js +5 -10
- package/bundles/cdk-observers.umd.js.map +1 -1
- package/bundles/cdk-observers.umd.min.js +1 -1
- package/bundles/cdk-observers.umd.min.js.map +1 -1
- package/bundles/cdk-overlay.umd.js +23 -1
- package/bundles/cdk-overlay.umd.js.map +1 -1
- package/bundles/cdk-overlay.umd.min.js +2 -2
- package/bundles/cdk-overlay.umd.min.js.map +1 -1
- package/bundles/cdk-scrolling.umd.js +1 -1
- package/bundles/cdk-scrolling.umd.js.map +1 -1
- package/bundles/cdk-scrolling.umd.min.js.map +1 -1
- package/bundles/cdk-stepper.umd.js +36 -6
- package/bundles/cdk-stepper.umd.js.map +1 -1
- package/bundles/cdk-stepper.umd.min.js +1 -1
- package/bundles/cdk-stepper.umd.min.js.map +1 -1
- package/bundles/cdk-table.umd.js +34 -9
- package/bundles/cdk-table.umd.js.map +1 -1
- package/bundles/cdk-table.umd.min.js +1 -1
- package/bundles/cdk-table.umd.min.js.map +1 -1
- package/bundles/cdk-text-field.umd.js +12 -23
- package/bundles/cdk-text-field.umd.js.map +1 -1
- package/bundles/cdk-text-field.umd.min.js +1 -1
- package/bundles/cdk-text-field.umd.min.js.map +1 -1
- package/bundles/cdk-tree.umd.js.map +1 -1
- package/bundles/cdk-tree.umd.min.js.map +1 -1
- package/bundles/cdk.umd.js +1 -1
- package/bundles/cdk.umd.js.map +1 -1
- package/bundles/cdk.umd.min.js +1 -1
- package/bundles/cdk.umd.min.js.map +1 -1
- package/collections/typings/index.metadata.json +1 -1
- package/collections/typings/selection.d.ts +6 -0
- package/esm2015/a11y.js +19 -7
- package/esm2015/a11y.js.map +1 -1
- package/esm2015/accordion.js +18 -1
- package/esm2015/accordion.js.map +1 -1
- package/esm2015/bidi.js +5 -4
- package/esm2015/bidi.js.map +1 -1
- package/esm2015/cdk.js +1 -1
- package/esm2015/cdk.js.map +1 -1
- package/esm2015/collections.js +9 -3
- package/esm2015/collections.js.map +1 -1
- package/esm2015/layout.js +10 -4
- package/esm2015/layout.js.map +1 -1
- package/esm2015/observers.js +4 -4
- package/esm2015/observers.js.map +1 -1
- package/esm2015/overlay.js +24 -3
- package/esm2015/overlay.js.map +1 -1
- package/esm2015/scrolling.js +1 -1
- package/esm2015/scrolling.js.map +1 -1
- package/esm2015/stepper.js +32 -4
- package/esm2015/stepper.js.map +1 -1
- package/esm2015/table.js +35 -8
- package/esm2015/table.js.map +1 -1
- package/esm2015/text-field.js +9 -9
- package/esm2015/text-field.js.map +1 -1
- package/esm2015/tree.js.map +1 -1
- package/esm5/a11y.es5.js +17 -9
- package/esm5/a11y.es5.js.map +1 -1
- package/esm5/accordion.es5.js +25 -1
- package/esm5/accordion.es5.js.map +1 -1
- package/esm5/bidi.es5.js +5 -4
- package/esm5/bidi.es5.js.map +1 -1
- package/esm5/cdk.es5.js +1 -1
- package/esm5/cdk.es5.js.map +1 -1
- package/esm5/collections.es5.js +9 -3
- package/esm5/collections.es5.js.map +1 -1
- package/esm5/layout.es5.js +9 -3
- package/esm5/layout.es5.js.map +1 -1
- package/esm5/observers.es5.js +5 -10
- package/esm5/observers.es5.js.map +1 -1
- package/esm5/overlay.es5.js +25 -3
- package/esm5/overlay.es5.js.map +1 -1
- package/esm5/scrolling.es5.js +1 -1
- package/esm5/scrolling.es5.js.map +1 -1
- package/esm5/stepper.es5.js +34 -4
- package/esm5/stepper.es5.js.map +1 -1
- package/esm5/table.es5.js +33 -7
- package/esm5/table.es5.js.map +1 -1
- package/esm5/text-field.es5.js +12 -23
- package/esm5/text-field.es5.js.map +1 -1
- package/esm5/tree.es5.js.map +1 -1
- package/layout/typings/breakpoints-observer.d.ts +7 -0
- package/layout/typings/index.metadata.json +1 -1
- package/observers/typings/index.metadata.json +1 -1
- package/observers/typings/observe-content.d.ts +6 -1
- package/overlay/typings/index.metadata.json +1 -1
- package/overlay/typings/overlay-ref.d.ts +5 -0
- package/overlay/typings/position/connected-position-strategy.d.ts +1 -1
- package/package.json +6 -3
- package/stepper/typings/index.metadata.json +1 -1
- package/stepper/typings/stepper.d.ts +10 -2
- package/table/typings/index.metadata.json +1 -1
- package/table/typings/sticky-styler.d.ts +3 -1
- package/table/typings/table.d.ts +10 -1
- package/text-field/typings/autofill.d.ts +13 -2
- package/text-field/typings/autosize.d.ts +1 -1
- package/text-field/typings/index.metadata.json +1 -1
- package/text-field-prebuilt.css +1 -1
- package/tree/typings/index.metadata.json +1 -1
- package/tree/typings/nested-node.d.ts +2 -2
- package/tree/typings/padding.d.ts +1 -1
- package/tree/typings/tree.d.ts +2 -2
- package/typings/a11y/focus-monitor/focus-monitor.d.ts +1 -1
- package/typings/a11y/focus-trap/focus-trap.d.ts +1 -1
- package/typings/a11y/index.metadata.json +1 -1
- package/typings/a11y/live-announcer/live-announcer.d.ts +1 -1
- package/typings/accordion/accordion.d.ts +6 -1
- package/typings/accordion/index.metadata.json +1 -1
- package/typings/collections/index.metadata.json +1 -1
- package/typings/collections/selection.d.ts +6 -0
- package/typings/esm5/a11y/focus-monitor/focus-monitor.d.ts +1 -1
- package/typings/esm5/a11y/focus-trap/focus-trap.d.ts +1 -1
- package/typings/esm5/a11y/index.metadata.json +1 -1
- package/typings/esm5/a11y/live-announcer/live-announcer.d.ts +1 -1
- package/typings/esm5/accordion/accordion.d.ts +6 -1
- package/typings/esm5/accordion/index.metadata.json +1 -1
- package/typings/esm5/collections/index.metadata.json +1 -1
- package/typings/esm5/collections/selection.d.ts +6 -0
- package/typings/esm5/index.metadata.json +1 -1
- package/typings/esm5/layout/breakpoints-observer.d.ts +7 -0
- package/typings/esm5/layout/index.metadata.json +1 -1
- package/typings/esm5/observers/index.metadata.json +1 -1
- package/typings/esm5/observers/observe-content.d.ts +6 -1
- package/typings/esm5/overlay/index.metadata.json +1 -1
- package/typings/esm5/overlay/overlay-ref.d.ts +5 -0
- package/typings/esm5/overlay/position/connected-position-strategy.d.ts +1 -1
- package/typings/esm5/stepper/index.metadata.json +1 -1
- package/typings/esm5/stepper/stepper.d.ts +10 -2
- package/typings/esm5/table/index.metadata.json +1 -1
- package/typings/esm5/table/sticky-styler.d.ts +3 -1
- package/typings/esm5/table/table.d.ts +10 -1
- package/typings/esm5/text-field/autofill.d.ts +13 -2
- package/typings/esm5/text-field/autosize.d.ts +1 -1
- package/typings/esm5/text-field/index.metadata.json +1 -1
- package/typings/esm5/tree/index.metadata.json +1 -1
- package/typings/esm5/tree/nested-node.d.ts +2 -2
- package/typings/esm5/tree/padding.d.ts +1 -1
- package/typings/esm5/tree/tree.d.ts +2 -2
- package/typings/index.metadata.json +1 -1
- package/typings/layout/breakpoints-observer.d.ts +7 -0
- package/typings/layout/index.metadata.json +1 -1
- package/typings/observers/index.metadata.json +1 -1
- package/typings/observers/observe-content.d.ts +6 -1
- package/typings/overlay/index.metadata.json +1 -1
- package/typings/overlay/overlay-ref.d.ts +5 -0
- package/typings/overlay/position/connected-position-strategy.d.ts +1 -1
- package/typings/stepper/index.metadata.json +1 -1
- package/typings/stepper/stepper.d.ts +10 -2
- package/typings/table/index.metadata.json +1 -1
- package/typings/table/sticky-styler.d.ts +3 -1
- package/typings/table/table.d.ts +10 -1
- package/typings/text-field/autofill.d.ts +13 -2
- package/typings/text-field/autosize.d.ts +1 -1
- package/typings/text-field/index.metadata.json +1 -1
- package/typings/tree/index.metadata.json +1 -1
- package/typings/tree/nested-node.d.ts +2 -2
- package/typings/tree/padding.d.ts +1 -1
- package/typings/tree/tree.d.ts +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cdk-collections.umd.min.js","sources":["../../node_modules/tslib/tslib.es6.js","../../src/cdk/collections/selection.ts","../../src/cdk/collections/data-source.ts","../../src/cdk/collections/array-data-source.ts","../../src/cdk/collections/unique-selection-dispatcher.ts"],"sourcesContent":["/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation. All rights reserved.\r\nLicensed under the Apache License, Version 2.0 (the \"License\"); you may not use\r\nthis file except in compliance with the License. You may obtain a copy of the\r\nLicense at http://www.apache.org/licenses/LICENSE-2.0\r\n\r\nTHIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\nKIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED\r\nWARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,\r\nMERCHANTABLITY OR NON-INFRINGEMENT.\r\n\r\nSee the Apache Version 2.0 License for specific language governing permissions\r\nand limitations under the License.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0)\r\n t[p[i]] = s[p[i]];\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (_) try {\r\n 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) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport function __exportStar(m, exports) {\r\n for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];\r\n}\r\n\r\nexport function __values(o) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator], i = 0;\r\n if (m) return m.call(o);\r\n return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n 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; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n 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);\r\n 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); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];\r\n result.default = mod;\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nimport {Subject} from 'rxjs';\n\n/**\n * Class to be used to power selecting one or more options from a list.\n */\nexport class SelectionModel<T> {\n /** Currently-selected values. */\n private _selection = new Set<T>();\n\n /** Keeps track of the deselected options that haven't been emitted by the change event. */\n private _deselectedToEmit: T[] = [];\n\n /** Keeps track of the selected options that haven't been emitted by the change event. */\n private _selectedToEmit: T[] = [];\n\n /** Cache for the array value of the selected items. */\n private _selected: T[] | null;\n\n /** Selected values. */\n get selected(): T[] {\n if (!this._selected) {\n this._selected = Array.from(this._selection.values());\n }\n\n return this._selected;\n }\n\n /** Event emitted when the value has changed. */\n onChange: Subject<SelectionChange<T>> | null = this._emitChanges ? new Subject() : null;\n\n constructor(\n private _multiple = false,\n initiallySelectedValues?: T[],\n private _emitChanges = true) {\n\n if (initiallySelectedValues && initiallySelectedValues.length) {\n if (_multiple) {\n initiallySelectedValues.forEach(value => this._markSelected(value));\n } else {\n this._markSelected(initiallySelectedValues[0]);\n }\n\n // Clear the array in order to avoid firing the change event for preselected values.\n this._selectedToEmit.length = 0;\n }\n }\n\n /**\n * Selects a value or an array of values.\n */\n select(...values: T[]): void {\n this._verifyValueAssignment(values);\n values.forEach(value => this._markSelected(value));\n this._emitChangeEvent();\n }\n\n /**\n * Deselects a value or an array of values.\n */\n deselect(...values: T[]): void {\n this._verifyValueAssignment(values);\n values.forEach(value => this._unmarkSelected(value));\n this._emitChangeEvent();\n }\n\n /**\n * Toggles a value between selected and deselected.\n */\n toggle(value: T): void {\n this.isSelected(value) ? this.deselect(value) : this.select(value);\n }\n\n /**\n * Clears all of the selected values.\n */\n clear(): void {\n this._unmarkAll();\n this._emitChangeEvent();\n }\n\n /**\n * Determines whether a value is selected.\n */\n isSelected(value: T): boolean {\n return this._selection.has(value);\n }\n\n /**\n * Determines whether the model does not have a value.\n */\n isEmpty(): boolean {\n return this._selection.size === 0;\n }\n\n /**\n * Determines whether the model has a value.\n */\n hasValue(): boolean {\n return !this.isEmpty();\n }\n\n /**\n * Sorts the selected values based on a predicate function.\n */\n sort(predicate?: (a: T, b: T) => number): void {\n if (this._multiple && this.selected) {\n this._selected!.sort(predicate);\n }\n }\n\n /**\n * Gets whether multiple values can be selected.\n */\n isMultipleSelection() {\n return this._multiple;\n }\n\n /** Emits a change event and clears the records of selected and deselected values. */\n private _emitChangeEvent() {\n // Clear the selected values so they can be re-cached.\n this._selected = null;\n\n if (this._selectedToEmit.length || this._deselectedToEmit.length) {\n if (this.onChange) {\n this.onChange.next({\n source: this,\n added: this._selectedToEmit,\n removed: this._deselectedToEmit\n });\n }\n\n this._deselectedToEmit = [];\n this._selectedToEmit = [];\n }\n }\n\n /** Selects a value. */\n private _markSelected(value: T) {\n if (!this.isSelected(value)) {\n if (!this._multiple) {\n this._unmarkAll();\n }\n\n this._selection.add(value);\n\n if (this._emitChanges) {\n this._selectedToEmit.push(value);\n }\n }\n }\n\n /** Deselects a value. */\n private _unmarkSelected(value: T) {\n if (this.isSelected(value)) {\n this._selection.delete(value);\n\n if (this._emitChanges) {\n this._deselectedToEmit.push(value);\n }\n }\n }\n\n /** Clears out the selected values. */\n private _unmarkAll() {\n if (!this.isEmpty()) {\n this._selection.forEach(value => this._unmarkSelected(value));\n }\n }\n\n /**\n * Verifies the value assignment and throws an error if the specified value array is\n * including multiple values while the selection model is not supporting multiple values.\n */\n private _verifyValueAssignment(values: T[]) {\n if (values.length > 1 && !this._multiple) {\n throw getMultipleValuesInSingleSelectionError();\n }\n }\n}\n\n/**\n * Event emitted when the value of a MatSelectionModel has changed.\n * @docs-private\n */\nexport interface SelectionChange<T> {\n /** Model that dispatched the event. */\n source: SelectionModel<T>;\n /** Options that were added to the model. */\n added: T[];\n /** Options that were removed from the model. */\n removed: T[];\n}\n\n/**\n * Returns an error that reports that multiple values are passed into a selection model\n * with a single value.\n */\nexport function getMultipleValuesInSingleSelectionError() {\n return Error('Cannot pass multiple values into SelectionModel with single-value mode.');\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nimport {Observable} from 'rxjs';\nimport {CollectionViewer} from './collection-viewer';\n\nexport abstract class DataSource<T> {\n /**\n * Connects a collection viewer (such as a data-table) to this data source. Note that\n * the stream provided will be accessed during change detection and should not directly change\n * values that are bound in template views.\n * @param collectionViewer The component that exposes a view over the data provided by this\n * data source.\n * @returns Observable that emits a new value when the data changes.\n */\n abstract connect(collectionViewer: CollectionViewer): Observable<T[]>;\n\n /**\n * Disconnects a collection viewer (such as a data-table) from this data source. Can be used\n * to perform any clean-up or tear-down operations when a view is being destroyed.\n *\n * @param collectionViewer The component that exposes a view over the data provided by this\n * data source.\n */\n abstract disconnect(collectionViewer: CollectionViewer): void;\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nimport {Observable, of as observableOf} from 'rxjs';\nimport {DataSource} from './data-source';\n\n\n/** DataSource wrapper for a native array. */\nexport class ArrayDataSource<T> extends DataSource<T> {\n constructor(private _data: T[] | Observable<T[]>) {\n super();\n }\n\n connect(): Observable<T[]> {\n return this._data instanceof Observable ? this._data : observableOf(this._data);\n }\n\n disconnect() {}\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nimport {Injectable, OnDestroy} from '@angular/core';\n\n\n// Users of the Dispatcher never need to see this type, but TypeScript requires it to be exported.\nexport type UniqueSelectionDispatcherListener = (id: string, name: string) => void;\n\n/**\n * Class to coordinate unique selection based on name.\n * Intended to be consumed as an Angular service.\n * This service is needed because native radio change events are only fired on the item currently\n * being selected, and we still need to uncheck the previous selection.\n *\n * This service does not *store* any IDs and names because they may change at any time, so it is\n * less error-prone if they are simply passed through when the events occur.\n */\n@Injectable({providedIn: 'root'})\nexport class UniqueSelectionDispatcher implements OnDestroy {\n private _listeners: UniqueSelectionDispatcherListener[] = [];\n\n /**\n * Notify other items that selection for the given name has been set.\n * @param id ID of the item.\n * @param name Name of the item.\n */\n notify(id: string, name: string) {\n for (let listener of this._listeners) {\n listener(id, name);\n }\n }\n\n /**\n * Listen for future changes to item selection.\n * @return Function used to deregister listener\n */\n listen(listener: UniqueSelectionDispatcherListener): () => void {\n this._listeners.push(listener);\n return () => {\n this._listeners = this._listeners.filter((registered: UniqueSelectionDispatcherListener) => {\n return listener !== registered;\n });\n };\n }\n\n ngOnDestroy() {\n this._listeners = [];\n }\n}\n"],"names":["__extends","d","b","__","this","constructor","extendStatics","prototype","Object","create","getMultipleValuesInSingleSelectionError","Error","setPrototypeOf","__proto__","Array","p","hasOwnProperty","DataSource","ArrayDataSource","_super","_data","_this","call","tslib_1.__extends","connect","Observable","observableOf","disconnect","SelectionModel","_multiple","initiallySelectedValues","_emitChanges","_selection","Set","_deselectedToEmit","_selectedToEmit","onChange","Subject","length","forEach","value","_markSelected","defineProperty","_selected","from","values","select","_i","arguments","_verifyValueAssignment","_emitChangeEvent","deselect","_unmarkSelected","toggle","isSelected","clear","_unmarkAll","has","isEmpty","size","hasValue","sort","predicate","selected","isMultipleSelection","next","source","added","removed","add","push","delete","_listeners","UniqueSelectionDispatcher","notify","id","name","_a","listener","listen","filter","registered","ngOnDestroy","type","Injectable","args","providedIn"],"mappings":";;;;;;;0VAuBA,SAAgBA,GAAUC,EAAGC,GAEzB,QAASC,KAAOC,KAAKC,YAAcJ,EADnCK,EAAcL,EAAGC,GAEjBD,EAAEM,UAAkB,OAANL,EAAaM,OAAOC,OAAOP,IAAMC,EAAGI,UAAYL,EAAEK,UAAW,GAAIJ,ICmLnF,QAAAO,KACE,MAAOC,OAAM,2ED9Lf,GAAIL,GAAgB,SAASL,EAAGC,GAI5B,OAHAI,EAAgBE,OAAOI,iBAChBC,uBAA2BC,QAAS,SAAUb,EAAGC,GAAKD,EAAEY,UAAYX,IACvE,SAAUD,EAAGC,GAAK,IAAK,GAAIa,KAAKb,GAAOA,EAAEc,eAAeD,KAAId,E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KAAK2B,cACP3B,KAAK8B,kBAAkBoC,KAAK9B,KAM1BZ,EAAVrB,UAAAiD,gCACSpD,MAAKsD,WACRtD,KAAK4B,WAAWO,QAAQ,SAAAC,GAAS,MAAAnB,GAAK+B,gBAAgBZ,MAQlDZ,EAAVrB,UAAA0C,uBAAA,SAAiCJ,GAC7B,GAAIA,EAAOP,OAAS,IAAMlC,KAAKyB,UAC7B,KAAMnB,MAvLZkB,+BGyBAxB,KAAAoE,cAzBA,MAgCEC,GAAFlE,UAAAmE,OAAE,SAAOC,EAAYC,GACjB,IAAqB,GAAzB7B,GAAA,EAAyB8B,EAAAzE,KAAKoE,WAALzB,EAAzB8B,EAAAvC,OAAyBS,IAAzB,EACM+B,EADND,EAAA9B,IACe4B,EAAIC,KAQjBH,EAAFlE,UAAAwE,OAAE,SAAOD,GAAP,GAAFzD,GAAAjB,IAEI,OADAA,MAAKoE,WAAWF,KAAKQ,GACd,WACLzD,EAAKmD,WAAanD,EAAKmD,WAAWQ,OAAO,SAACC,GACxC,MAAOH,KAAaG,MAK1BR,EAAFlE,UAAA2E,YAAE,WACE9E,KAAKoE,8BA7BTW,KAACC,EAAAA,WAADC,OAAaC,WAAY,8GAvBzBb"}
|
|
1
|
+
{"version":3,"file":"cdk-collections.umd.min.js","sources":["../../node_modules/tslib/tslib.es6.js","../../src/cdk/collections/selection.ts","../../src/cdk/collections/data-source.ts","../../src/cdk/collections/array-data-source.ts","../../src/cdk/collections/unique-selection-dispatcher.ts"],"sourcesContent":["/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation. All rights reserved.\r\nLicensed under the Apache License, Version 2.0 (the \"License\"); you may not use\r\nthis file except in compliance with the License. You may obtain a copy of the\r\nLicense at http://www.apache.org/licenses/LICENSE-2.0\r\n\r\nTHIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\nKIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED\r\nWARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,\r\nMERCHANTABLITY OR NON-INFRINGEMENT.\r\n\r\nSee the Apache Version 2.0 License for specific language governing permissions\r\nand limitations under the License.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0)\r\n t[p[i]] = s[p[i]];\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (_) try {\r\n 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) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport function __exportStar(m, exports) {\r\n for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];\r\n}\r\n\r\nexport function __values(o) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator], i = 0;\r\n if (m) return m.call(o);\r\n return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n 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; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n 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);\r\n 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); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];\r\n result.default = mod;\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nimport {Subject} from 'rxjs';\n\n/**\n * Class to be used to power selecting one or more options from a list.\n */\nexport class SelectionModel<T> {\n /** Currently-selected values. */\n private _selection = new Set<T>();\n\n /** Keeps track of the deselected options that haven't been emitted by the change event. */\n private _deselectedToEmit: T[] = [];\n\n /** Keeps track of the selected options that haven't been emitted by the change event. */\n private _selectedToEmit: T[] = [];\n\n /** Cache for the array value of the selected items. */\n private _selected: T[] | null;\n\n /** Selected values. */\n get selected(): T[] {\n if (!this._selected) {\n this._selected = Array.from(this._selection.values());\n }\n\n return this._selected;\n }\n\n /** Event emitted when the value has changed. */\n changed: Subject<SelectionChange<T>> | null = this._emitChanges ? new Subject() : null;\n\n /**\n * Event emitted when the value has changed.\n * @deprecated Use `changed` instead.\n * @breaking-change 8.0.0 To be changed to `changed`\n */\n onChange: Subject<SelectionChange<T>> | null = this.changed;\n\n constructor(\n private _multiple = false,\n initiallySelectedValues?: T[],\n private _emitChanges = true) {\n\n if (initiallySelectedValues && initiallySelectedValues.length) {\n if (_multiple) {\n initiallySelectedValues.forEach(value => this._markSelected(value));\n } else {\n this._markSelected(initiallySelectedValues[0]);\n }\n\n // Clear the array in order to avoid firing the change event for preselected values.\n this._selectedToEmit.length = 0;\n }\n }\n\n /**\n * Selects a value or an array of values.\n */\n select(...values: T[]): void {\n this._verifyValueAssignment(values);\n values.forEach(value => this._markSelected(value));\n this._emitChangeEvent();\n }\n\n /**\n * Deselects a value or an array of values.\n */\n deselect(...values: T[]): void {\n this._verifyValueAssignment(values);\n values.forEach(value => this._unmarkSelected(value));\n this._emitChangeEvent();\n }\n\n /**\n * Toggles a value between selected and deselected.\n */\n toggle(value: T): void {\n this.isSelected(value) ? this.deselect(value) : this.select(value);\n }\n\n /**\n * Clears all of the selected values.\n */\n clear(): void {\n this._unmarkAll();\n this._emitChangeEvent();\n }\n\n /**\n * Determines whether a value is selected.\n */\n isSelected(value: T): boolean {\n return this._selection.has(value);\n }\n\n /**\n * Determines whether the model does not have a value.\n */\n isEmpty(): boolean {\n return this._selection.size === 0;\n }\n\n /**\n * Determines whether the model has a value.\n */\n hasValue(): boolean {\n return !this.isEmpty();\n }\n\n /**\n * Sorts the selected values based on a predicate function.\n */\n sort(predicate?: (a: T, b: T) => number): void {\n if (this._multiple && this.selected) {\n this._selected!.sort(predicate);\n }\n }\n\n /**\n * Gets whether multiple values can be selected.\n */\n isMultipleSelection() {\n return this._multiple;\n }\n\n /** Emits a change event and clears the records of selected and deselected values. */\n private _emitChangeEvent() {\n // Clear the selected values so they can be re-cached.\n this._selected = null;\n\n if (this._selectedToEmit.length || this._deselectedToEmit.length) {\n if (this.changed) {\n this.changed.next({\n source: this,\n added: this._selectedToEmit,\n removed: this._deselectedToEmit\n });\n }\n\n this._deselectedToEmit = [];\n this._selectedToEmit = [];\n }\n }\n\n /** Selects a value. */\n private _markSelected(value: T) {\n if (!this.isSelected(value)) {\n if (!this._multiple) {\n this._unmarkAll();\n }\n\n this._selection.add(value);\n\n if (this._emitChanges) {\n this._selectedToEmit.push(value);\n }\n }\n }\n\n /** Deselects a value. */\n private _unmarkSelected(value: T) {\n if (this.isSelected(value)) {\n this._selection.delete(value);\n\n if (this._emitChanges) {\n this._deselectedToEmit.push(value);\n }\n }\n }\n\n /** Clears out the selected values. */\n private _unmarkAll() {\n if (!this.isEmpty()) {\n this._selection.forEach(value => this._unmarkSelected(value));\n }\n }\n\n /**\n * Verifies the value assignment and throws an error if the specified value array is\n * including multiple values while the selection model is not supporting multiple values.\n */\n private _verifyValueAssignment(values: T[]) {\n if (values.length > 1 && !this._multiple) {\n throw getMultipleValuesInSingleSelectionError();\n }\n }\n}\n\n/**\n * Event emitted when the value of a MatSelectionModel has changed.\n * @docs-private\n */\nexport interface SelectionChange<T> {\n /** Model that dispatched the event. */\n source: SelectionModel<T>;\n /** Options that were added to the model. */\n added: T[];\n /** Options that were removed from the model. */\n removed: T[];\n}\n\n/**\n * Returns an error that reports that multiple values are passed into a selection model\n * with a single value.\n */\nexport function getMultipleValuesInSingleSelectionError() {\n return Error('Cannot pass multiple values into SelectionModel with single-value mode.');\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nimport {Observable} from 'rxjs';\nimport {CollectionViewer} from './collection-viewer';\n\nexport abstract class DataSource<T> {\n /**\n * Connects a collection viewer (such as a data-table) to this data source. Note that\n * the stream provided will be accessed during change detection and should not directly change\n * values that are bound in template views.\n * @param collectionViewer The component that exposes a view over the data provided by this\n * data source.\n * @returns Observable that emits a new value when the data changes.\n */\n abstract connect(collectionViewer: CollectionViewer): Observable<T[]>;\n\n /**\n * Disconnects a collection viewer (such as a data-table) from this data source. Can be used\n * to perform any clean-up or tear-down operations when a view is being destroyed.\n *\n * @param collectionViewer The component that exposes a view over the data provided by this\n * data source.\n */\n abstract disconnect(collectionViewer: CollectionViewer): void;\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nimport {Observable, of as observableOf} from 'rxjs';\nimport {DataSource} from './data-source';\n\n\n/** DataSource wrapper for a native array. */\nexport class ArrayDataSource<T> extends DataSource<T> {\n constructor(private _data: T[] | Observable<T[]>) {\n super();\n }\n\n connect(): Observable<T[]> {\n return this._data instanceof Observable ? this._data : observableOf(this._data);\n }\n\n disconnect() {}\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nimport {Injectable, OnDestroy} from '@angular/core';\n\n\n// Users of the Dispatcher never need to see this type, but TypeScript requires it to be exported.\nexport type UniqueSelectionDispatcherListener = (id: string, name: string) => void;\n\n/**\n * Class to coordinate unique selection based on name.\n * Intended to be consumed as an Angular service.\n * This service is needed because native radio change events are only fired on the item currently\n * being selected, and we still need to uncheck the previous selection.\n *\n * This service does not *store* any IDs and names because they may change at any time, so it is\n * less error-prone if they are simply passed through when the events occur.\n */\n@Injectable({providedIn: 'root'})\nexport class UniqueSelectionDispatcher implements OnDestroy {\n private _listeners: UniqueSelectionDispatcherListener[] = [];\n\n /**\n * Notify other items that selection for the given name has been set.\n * @param id ID of the item.\n * @param name Name of the item.\n */\n notify(id: string, name: string) {\n for (let listener of this._listeners) {\n listener(id, name);\n }\n }\n\n /**\n * Listen for future changes to item selection.\n * @return Function used to deregister listener\n */\n listen(listener: UniqueSelectionDispatcherListener): () => void {\n this._listeners.push(listener);\n return () => {\n this._listeners = this._listeners.filter((registered: UniqueSelectionDispatcherListener) => {\n return listener !== registered;\n });\n };\n }\n\n ngOnDestroy() {\n this._listeners = [];\n }\n}\n"],"names":["__extends","d","b","__","this","constructor","extendStatics","prototype","Object","create","getMultipleValuesInSingleSelectionError","Error","setPrototypeOf","__proto__","Array","p","hasOwnProperty","DataSource","ArrayDataSource","_super","_data","_this","call","tslib_1.__extends","connect","Observable","observableOf","disconnect","SelectionModel","_multiple","initiallySelectedValues","_emitChanges","_selection","Set","_deselectedToEmit","_selectedToEmit","changed","Subject","onChange","length","forEach","value","_markSelected","defineProperty","_selected","from","values","select","_i","arguments","_verifyValueAssignment","_emitChangeEvent","deselect","_unmarkSelected","toggle","isSelected","clear","_unmarkAll","has","isEmpty","size","hasValue","sort","predicate","selected","isMultipleSelection","next","source","added","removed","add","push","delete","_listeners","UniqueSelectionDispatcher","notify","id","name","_a","listener","listen","filter","registered","ngOnDestroy","type","Injectable","args","providedIn"],"mappings":";;;;;;;0VAuBA,SAAgBA,GAAUC,EAAGC,GAEzB,QAASC,KAAOC,KAAKC,YAAcJ,EADnCK,EAAcL,EAAGC,GAEjBD,EAAEM,UAAkB,OAANL,EAAaM,OAAOC,OAAOP,IAAMC,EAAGI,UAAYL,EAAEK,UAAW,GAAIJ,I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C,cAAA,SAAwBD,GACfrC,KAAKmD,WAAWd,KACdrC,KAAKyB,WACRzB,KAAKqD,aAGPrD,KAAK4B,WAAWsC,IAAI7B,GAEhBrC,KAAK2B,cACP3B,KAAK+B,gBAAgBoC,KAAK9B,KAMxBb,EAAVrB,UAAA8C,gBAAA,SAA0BZ,GAClBrC,KAAKmD,WAAWd,KAClBrC,KAAK4B,WAAWwC,OAAO/B,GAEnBrC,KAAK2B,cACP3B,KAAK8B,kBAAkBqC,KAAK9B,KAM1Bb,EAAVrB,UAAAkD,gCACSrD,MAAKuD,WACRvD,KAAK4B,WAAWQ,QAAQ,SAAAC,GAAS,MAAApB,GAAKgC,gBAAgBZ,MAQlDb,EAAVrB,UAAA2C,uBAAA,SAAiCJ,GAC7B,GAAIA,EAAOP,OAAS,IAAMnC,KAAKyB,UAC7B,KAAMnB,MA9LZkB,+BGyBAxB,KAAAqE,cAzBA,MAgCEC,GAAFnE,UAAAoE,OAAE,SAAOC,EAAYC,GACjB,IAAqB,GAAzB7B,GAAA,EAAyB8B,EAAA1E,KAAKqE,WAALzB,EAAzB8B,EAAAvC,OAAyBS,IAAzB,EACM+B,EADND,EAAA9B,IACe4B,EAAIC,KAQjBH,EAAFnE,UAAAyE,OAAE,SAAOD,GAAP,GAAF1D,GAAAjB,IAEI,OADAA,MAAKqE,WAAWF,KAAKQ,GACd,WACL1D,EAAKoD,WAAapD,EAAKoD,WAAWQ,OAAO,SAACC,GACxC,MAAOH,KAAaG,MAK1BR,EAAFnE,UAAA4E,YAAE,WACE/E,KAAKqE,8BA7BTW,KAACC,EAAAA,WAADC,OAAaC,WAAY,8GAvBzBb"}
|
|
@@ -202,9 +202,15 @@ var BreakpointObserver = /** @class */ (function () {
|
|
|
202
202
|
var /** @type {?} */ queries = splitQueries(coercion.coerceArray(value));
|
|
203
203
|
var /** @type {?} */ observables = queries.map(function (query) { return _this._registerQuery(query).observable; });
|
|
204
204
|
return rxjs.combineLatest(observables).pipe(operators.map(function (breakpointStates) {
|
|
205
|
-
|
|
206
|
-
matches:
|
|
205
|
+
var /** @type {?} */ response = {
|
|
206
|
+
matches: false,
|
|
207
|
+
breakpoints: {},
|
|
207
208
|
};
|
|
209
|
+
breakpointStates.forEach(function (state) {
|
|
210
|
+
response.matches = response.matches || state.matches;
|
|
211
|
+
response.breakpoints[state.query] = state.matches;
|
|
212
|
+
});
|
|
213
|
+
return response;
|
|
208
214
|
}));
|
|
209
215
|
};
|
|
210
216
|
/**
|
|
@@ -241,7 +247,7 @@ var BreakpointObserver = /** @class */ (function () {
|
|
|
241
247
|
}, function (listener) {
|
|
242
248
|
mql.removeListener(function (e) { return _this.zone.run(function () { return listener(e); }); });
|
|
243
249
|
})
|
|
244
|
-
.pipe(operators.takeUntil(this._destroySubject), operators.startWith(mql), operators.map(function (nextMql) { return ({ matches: nextMql.matches }); }));
|
|
250
|
+
.pipe(operators.takeUntil(this._destroySubject), operators.startWith(mql), operators.map(function (nextMql) { return ({ query: query, matches: nextMql.matches }); }));
|
|
245
251
|
// Add the MediaQueryList to the set of queries.
|
|
246
252
|
var /** @type {?} */ output = { observable: queryObservable, mql: mql };
|
|
247
253
|
this._queries.set(query, output);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cdk-layout.umd.js","sources":["../../src/cdk/layout/breakpoints.ts","../../src/cdk/layout/breakpoints-observer.ts","../../src/cdk/layout/media-matcher.ts","../../src/cdk/layout/layout-module.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n// PascalCase is being used as Breakpoints is used like an enum.\n// tslint:disable-next-line:variable-name\nexport const Breakpoints = {\n XSmall: '(max-width: 599px)',\n Small: '(min-width: 600px) and (max-width: 959px)',\n Medium: '(min-width: 960px) and (max-width: 1279px)',\n Large: '(min-width: 1280px) and (max-width: 1919px)',\n XLarge: '(min-width: 1920px)',\n\n Handset: '(max-width: 599px) and (orientation: portrait), ' +\n '(max-width: 959px) and (orientation: landscape)',\n Tablet: '(min-width: 600px) and (max-width: 839px) and (orientation: portrait), ' +\n '(min-width: 960px) and (max-width: 1279px) and (orientation: landscape)',\n Web: '(min-width: 840px) and (orientation: portrait), ' +\n '(min-width: 1280px) and (orientation: landscape)',\n\n HandsetPortrait: '(max-width: 599px) and (orientation: portrait)',\n TabletPortrait: '(min-width: 600px) and (max-width: 839px) and (orientation: portrait)',\n WebPortrait: '(min-width: 840px) and (orientation: portrait)',\n\n HandsetLandscape: '(max-width: 959px) and (orientation: landscape)',\n TabletLandscape: '(min-width: 960px) and (max-width: 1279px) and (orientation: landscape)',\n WebLandscape: '(min-width: 1280px) and (orientation: landscape)',\n};\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\nimport {Injectable, NgZone, OnDestroy} from '@angular/core';\nimport {MediaMatcher} from './media-matcher';\nimport {combineLatest, fromEventPattern, Observable, Subject} from 'rxjs';\nimport {map, startWith, takeUntil} from 'rxjs/operators';\nimport {coerceArray} from '@angular/cdk/coercion';\n\n\n/** The current state of a layout breakpoint. */\nexport interface BreakpointState {\n /** Whether the breakpoint is currently matching. */\n matches: boolean;\n}\n\ninterface Query {\n observable: Observable<BreakpointState>;\n mql: MediaQueryList;\n}\n\n/** Utility for checking the matching state of @media queries. */\n@Injectable({providedIn: 'root'})\nexport class BreakpointObserver implements OnDestroy {\n /** A map of all media queries currently being listened for. */\n private _queries: Map<string, Query> = new Map();\n /** A subject for all other observables to takeUntil based on. */\n private _destroySubject: Subject<{}> = new Subject();\n\n constructor(private mediaMatcher: MediaMatcher, private zone: NgZone) {}\n\n /** Completes the active subject, signalling to all other observables to complete. */\n ngOnDestroy() {\n this._destroySubject.next();\n this._destroySubject.complete();\n }\n\n /**\n * Whether one or more media queries match the current viewport size.\n * @param value One or more media queries to check.\n * @returns Whether any of the media queries match.\n */\n isMatched(value: string | string[]): boolean {\n const queries = splitQueries(coerceArray(value));\n return queries.some(mediaQuery => this._registerQuery(mediaQuery).mql.matches);\n }\n\n /**\n * Gets an observable of results for the given queries that will emit new results for any changes\n * in matching of the given queries.\n * @param value One or more media queries to check.\n * @returns A stream of matches for the given queries.\n */\n observe(value: string | string[]): Observable<BreakpointState> {\n const queries = splitQueries(coerceArray(value));\n const observables = queries.map(query => this._registerQuery(query).observable);\n\n return combineLatest(observables).pipe(map((breakpointStates: BreakpointState[]) => {\n return {\n matches: breakpointStates.some(state => state && state.matches)\n };\n }));\n }\n\n /** Registers a specific query to be listened for. */\n private _registerQuery(query: string): Query {\n // Only set up a new MediaQueryList if it is not already being listened for.\n if (this._queries.has(query)) {\n return this._queries.get(query)!;\n }\n\n const mql: MediaQueryList = this.mediaMatcher.matchMedia(query);\n // Create callback for match changes and add it is as a listener.\n const queryObservable = fromEventPattern(\n // Listener callback methods are wrapped to be placed back in ngZone. Callbacks must be placed\n // back into the zone because matchMedia is only included in Zone.js by loading the\n // webapis-media-query.js file alongside the zone.js file. Additionally, some browsers do not\n // have MediaQueryList inherit from EventTarget, which causes inconsistencies in how Zone.js\n // patches it.\n (listener: MediaQueryListListener) => {\n mql.addListener((e: MediaQueryList) => this.zone.run(() => listener(e)));\n },\n (listener: MediaQueryListListener) => {\n mql.removeListener((e: MediaQueryList) => this.zone.run(() => listener(e)));\n })\n .pipe(\n takeUntil(this._destroySubject),\n startWith(mql),\n map((nextMql: MediaQueryList) => ({matches: nextMql.matches}))\n );\n\n // Add the MediaQueryList to the set of queries.\n const output = {observable: queryObservable, mql: mql};\n this._queries.set(query, output);\n return output;\n }\n}\n\n/**\n * Split each query string into separate query strings if two queries are provided as comma\n * separated.\n */\nfunction splitQueries(queries: string[]): string[] {\n return queries.map((query: string) => query.split(','))\n .reduce((a1: string[], a2: string[]) => a1.concat(a2))\n .map(query => query.trim());\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\nimport {Injectable} from '@angular/core';\nimport {Platform} from '@angular/cdk/platform';\n\n/** Global registry for all dynamically-created, injected media queries. */\nconst mediaQueriesForWebkitCompatibility: Set<string> = new Set<string>();\n\n/** Style tag that holds all of the dynamically-created media queries. */\nlet mediaQueryStyleNode: HTMLStyleElement | undefined;\n\n/** A utility for calling matchMedia queries. */\n@Injectable({providedIn: 'root'})\nexport class MediaMatcher {\n /** The internal matchMedia method to return back a MediaQueryList like object. */\n private _matchMedia: (query: string) => MediaQueryList;\n\n constructor(private platform: Platform) {\n this._matchMedia = this.platform.isBrowser && window.matchMedia ?\n // matchMedia is bound to the window scope intentionally as it is an illegal invocation to\n // call it from a different scope.\n window.matchMedia.bind(window) :\n noopMatchMedia;\n }\n\n /**\n * Evaluates the given media query and returns the native MediaQueryList from which results\n * can be retrieved.\n * Confirms the layout engine will trigger for the selector query provided and returns the\n * MediaQueryList for the query provided.\n */\n matchMedia(query: string): MediaQueryList {\n if (this.platform.WEBKIT) {\n createEmptyStyleRule(query);\n }\n return this._matchMedia(query);\n }\n}\n\n/**\n * For Webkit engines that only trigger the MediaQueryListListener when\n * there is at least one CSS selector for the respective media query.\n */\nfunction createEmptyStyleRule(query: string) {\n if (mediaQueriesForWebkitCompatibility.has(query)) {\n return;\n }\n\n try {\n if (!mediaQueryStyleNode) {\n mediaQueryStyleNode = document.createElement('style');\n mediaQueryStyleNode.setAttribute('type', 'text/css');\n document.head.appendChild(mediaQueryStyleNode);\n }\n\n if (mediaQueryStyleNode.sheet) {\n (mediaQueryStyleNode.sheet as CSSStyleSheet)\n .insertRule(`@media ${query} {.fx-query-test{ }}`, 0);\n mediaQueriesForWebkitCompatibility.add(query);\n }\n } catch (e) {\n console.error(e);\n }\n}\n\n/** No-op matchMedia replacement for non-browser platforms. */\nfunction noopMatchMedia(query: string): MediaQueryList {\n return {\n matches: query === 'all' || query === '',\n media: query,\n addListener: () => {},\n removeListener: () => {}\n };\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\nimport {NgModule} from '@angular/core';\n\n\n@NgModule()\nexport class LayoutModule {}\n"],"names":["NgZone","Injectable","takeUntil","startWith","map","fromEventPattern","combineLatest","coerceArray","Subject","Platform","platform","NgModule"],"mappings":";;;;;;;;;;;;;;;;;AGOA,AAAA,IAAA,YAAA,kBAAA,YAAA;;;;QAGA,EAAA,IAAA,EAACW,aAAQ,EAAT;;IAVA,OAAA,YAAA,CAAA;;;;;;;;;;ADWA,qBAAM,kCAAkC,GAAgB,IAAI,GAAG,EAAU,CAAC;;;;AAG1E,qBAAI,mBAAiD,CAAC;;;;;IAQpD,SAAF,YAAA,CAAsBD,WAAkB,EAAxC;QAAsB,IAAtB,CAAA,QAA8B,GAARA,WAAQ,CAAU;QACpC,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,QAAQ,CAAC,SAAS,IAAI,MAAM,CAAC,UAAU;;;YAG7D,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC;YAC9B,cAAc,CAAC;KAClB;;;;;;;;;;;;;;;IAQD,YAAF,CAAA,SAAA,CAAA,UAAY;;;;;;;;IAAV,UAAW,KAAa,EAA1B;QACI,IAAI,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE;YACxB,oBAAoB,CAAC,KAAK,CAAC,CAAC;SAC7B;QACD,OAAO,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;KAChC,CAAH;;QAxBA,EAAA,IAAA,EAACT,eAAU,EAAX,IAAA,EAAA,CAAY,EAAC,UAAU,EAAE,MAAM,EAAC,EAAhC,EAAA;;;;QATA,EAAA,IAAA,EAAQQ,iBAAQ,GAAhB;;;IARA,OAAA,YAAA,CAAA;;;;;;;;AAgDA,SAAA,oBAAA,CAA8B,KAAa,EAA3C;IACE,IAAI,kCAAkC,CAAC,GAAG,CAAC,KAAK,CAAC,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,OAAO,CAAC,GAAG,CAAC,UAAC,KAAa,EAAnC,EAAwC,OAAA,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAxD,EAAwD,CAAC;SACxC,MAAM,CAAC,UAAC,EAAY,EAAE,EAAY,EAAnD,EAAwD,OAAA,EAAE,CAAC,MAAM,CAAC,EAAE,CAAC,CAArE,EAAqE,CAAC;SACrD,GAAG,CAAC,UAAA,KAAK,EAA1B,EAA8B,OAAA,KAAK,CAAC,IAAI,EAAE,CAA1C,EAA0C,CAAC,CAAC;CAC3C;;;;;;;ADrGD,AAAA,IAAA,iBAAa,WAAW,GAAG;IACzB,MAAM,EAAE,oBAAoB;IAC5B,KAAK,EAAE,2CAA2C;IAClD,MAAM,EAAE,4CAA4C;IACpD,KAAK,EAAE,6CAA6C;IACpD,MAAM,EAAE,qBAAqB;IAE7B,OAAO,EAAE,kDAAkD;QAClD,iDAAiD;IAC1D,MAAM,EAAE,yEAAyE;QACzE,yEAAyE;IACjF,GAAG,EAAE,kDAAkD;QAClD,kDAAkD;IAEvD,eAAe,EAAE,gDAAgD;IACjE,cAAc,EAAE,uEAAuE;IACvF,WAAW,EAAE,gDAAgD;IAE7D,gBAAgB,EAAE,iDAAiD;IACnE,eAAe,EAAE,yEAAyE;IAC1F,YAAY,EAAE,kDAAkD;CACjE;;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"cdk-layout.umd.js","sources":["../../src/cdk/layout/breakpoints.ts","../../src/cdk/layout/breakpoints-observer.ts","../../src/cdk/layout/media-matcher.ts","../../src/cdk/layout/layout-module.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n// PascalCase is being used as Breakpoints is used like an enum.\n// tslint:disable-next-line:variable-name\nexport const Breakpoints = {\n XSmall: '(max-width: 599px)',\n Small: '(min-width: 600px) and (max-width: 959px)',\n Medium: '(min-width: 960px) and (max-width: 1279px)',\n Large: '(min-width: 1280px) and (max-width: 1919px)',\n XLarge: '(min-width: 1920px)',\n\n Handset: '(max-width: 599px) and (orientation: portrait), ' +\n '(max-width: 959px) and (orientation: landscape)',\n Tablet: '(min-width: 600px) and (max-width: 839px) and (orientation: portrait), ' +\n '(min-width: 960px) and (max-width: 1279px) and (orientation: landscape)',\n Web: '(min-width: 840px) and (orientation: portrait), ' +\n '(min-width: 1280px) and (orientation: landscape)',\n\n HandsetPortrait: '(max-width: 599px) and (orientation: portrait)',\n TabletPortrait: '(min-width: 600px) and (max-width: 839px) and (orientation: portrait)',\n WebPortrait: '(min-width: 840px) and (orientation: portrait)',\n\n HandsetLandscape: '(max-width: 959px) and (orientation: landscape)',\n TabletLandscape: '(min-width: 960px) and (max-width: 1279px) and (orientation: landscape)',\n WebLandscape: '(min-width: 1280px) and (orientation: landscape)',\n};\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\nimport {Injectable, NgZone, OnDestroy} from '@angular/core';\nimport {MediaMatcher} from './media-matcher';\nimport {combineLatest, fromEventPattern, Observable, Subject} from 'rxjs';\nimport {map, startWith, takeUntil} from 'rxjs/operators';\nimport {coerceArray} from '@angular/cdk/coercion';\n\n\n/** The current state of a layout breakpoint. */\nexport interface BreakpointState {\n /** Whether the breakpoint is currently matching. */\n matches: boolean;\n /**\n * A key boolean pair for each query provided to the observe method,\n * with its current matched state.\n */\n breakpoints: {\n [key: string]: boolean;\n };\n}\n\n/** The current state of a layout breakpoint. */\ninterface InternalBreakpointState {\n /** Whether the breakpoint is currently matching. */\n matches: boolean;\n /** The media query being to be matched */\n query: string;\n}\n\ninterface Query {\n observable: Observable<InternalBreakpointState>;\n mql: MediaQueryList;\n}\n\n/** Utility for checking the matching state of @media queries. */\n@Injectable({providedIn: 'root'})\nexport class BreakpointObserver implements OnDestroy {\n /** A map of all media queries currently being listened for. */\n private _queries = new Map<string, Query>();\n /** A subject for all other observables to takeUntil based on. */\n private _destroySubject = new Subject<void>();\n\n constructor(private mediaMatcher: MediaMatcher, private zone: NgZone) {}\n\n /** Completes the active subject, signalling to all other observables to complete. */\n ngOnDestroy() {\n this._destroySubject.next();\n this._destroySubject.complete();\n }\n\n /**\n * Whether one or more media queries match the current viewport size.\n * @param value One or more media queries to check.\n * @returns Whether any of the media queries match.\n */\n isMatched(value: string | string[]): boolean {\n const queries = splitQueries(coerceArray(value));\n return queries.some(mediaQuery => this._registerQuery(mediaQuery).mql.matches);\n }\n\n /**\n * Gets an observable of results for the given queries that will emit new results for any changes\n * in matching of the given queries.\n * @param value One or more media queries to check.\n * @returns A stream of matches for the given queries.\n */\n observe(value: string | string[]): Observable<BreakpointState> {\n const queries = splitQueries(coerceArray(value));\n const observables = queries.map(query => this._registerQuery(query).observable);\n\n return combineLatest(observables).pipe(map((breakpointStates: InternalBreakpointState[]) => {\n const response: BreakpointState = {\n matches: false,\n breakpoints: {},\n };\n breakpointStates.forEach((state: InternalBreakpointState) => {\n response.matches = response.matches || state.matches;\n response.breakpoints[state.query] = state.matches;\n });\n return response;\n }));\n }\n\n /** Registers a specific query to be listened for. */\n private _registerQuery(query: string): Query {\n // Only set up a new MediaQueryList if it is not already being listened for.\n if (this._queries.has(query)) {\n return this._queries.get(query)!;\n }\n\n const mql: MediaQueryList = this.mediaMatcher.matchMedia(query);\n // Create callback for match changes and add it is as a listener.\n const queryObservable = fromEventPattern(\n // Listener callback methods are wrapped to be placed back in ngZone. Callbacks must be placed\n // back into the zone because matchMedia is only included in Zone.js by loading the\n // webapis-media-query.js file alongside the zone.js file. Additionally, some browsers do not\n // have MediaQueryList inherit from EventTarget, which causes inconsistencies in how Zone.js\n // patches it.\n (listener: MediaQueryListListener) => {\n mql.addListener((e: MediaQueryList) => this.zone.run(() => listener(e)));\n },\n (listener: MediaQueryListListener) => {\n mql.removeListener((e: MediaQueryList) => this.zone.run(() => listener(e)));\n })\n .pipe(\n takeUntil(this._destroySubject),\n startWith(mql),\n map((nextMql: MediaQueryList) => ({query, matches: nextMql.matches}))\n );\n\n // Add the MediaQueryList to the set of queries.\n const output = {observable: queryObservable, mql};\n this._queries.set(query, output);\n return output;\n }\n}\n\n/**\n * Split each query string into separate query strings if two queries are provided as comma\n * separated.\n */\nfunction splitQueries(queries: string[]): string[] {\n return queries.map((query: string) => query.split(','))\n .reduce((a1: string[], a2: string[]) => a1.concat(a2))\n .map(query => query.trim());\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\nimport {Injectable} from '@angular/core';\nimport {Platform} from '@angular/cdk/platform';\n\n/** Global registry for all dynamically-created, injected media queries. */\nconst mediaQueriesForWebkitCompatibility: Set<string> = new Set<string>();\n\n/** Style tag that holds all of the dynamically-created media queries. */\nlet mediaQueryStyleNode: HTMLStyleElement | undefined;\n\n/** A utility for calling matchMedia queries. */\n@Injectable({providedIn: 'root'})\nexport class MediaMatcher {\n /** The internal matchMedia method to return back a MediaQueryList like object. */\n private _matchMedia: (query: string) => MediaQueryList;\n\n constructor(private platform: Platform) {\n this._matchMedia = this.platform.isBrowser && window.matchMedia ?\n // matchMedia is bound to the window scope intentionally as it is an illegal invocation to\n // call it from a different scope.\n window.matchMedia.bind(window) :\n noopMatchMedia;\n }\n\n /**\n * Evaluates the given media query and returns the native MediaQueryList from which results\n * can be retrieved.\n * Confirms the layout engine will trigger for the selector query provided and returns the\n * MediaQueryList for the query provided.\n */\n matchMedia(query: string): MediaQueryList {\n if (this.platform.WEBKIT) {\n createEmptyStyleRule(query);\n }\n return this._matchMedia(query);\n }\n}\n\n/**\n * For Webkit engines that only trigger the MediaQueryListListener when\n * there is at least one CSS selector for the respective media query.\n */\nfunction createEmptyStyleRule(query: string) {\n if (mediaQueriesForWebkitCompatibility.has(query)) {\n return;\n }\n\n try {\n if (!mediaQueryStyleNode) {\n mediaQueryStyleNode = document.createElement('style');\n mediaQueryStyleNode.setAttribute('type', 'text/css');\n document.head.appendChild(mediaQueryStyleNode);\n }\n\n if (mediaQueryStyleNode.sheet) {\n (mediaQueryStyleNode.sheet as CSSStyleSheet)\n .insertRule(`@media ${query} {.fx-query-test{ }}`, 0);\n mediaQueriesForWebkitCompatibility.add(query);\n }\n } catch (e) {\n console.error(e);\n }\n}\n\n/** No-op matchMedia replacement for non-browser platforms. */\nfunction noopMatchMedia(query: string): MediaQueryList {\n return {\n matches: query === 'all' || query === '',\n media: query,\n addListener: () => {},\n removeListener: () => {}\n };\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\nimport {NgModule} from '@angular/core';\n\n\n@NgModule()\nexport class LayoutModule {}\n"],"names":["NgZone","Injectable","takeUntil","startWith","map","fromEventPattern","combineLatest","coerceArray","Subject","Platform","platform","NgModule"],"mappings":";;;;;;;;;;;;;;;;;AGOA,AAAA,IAAA,YAAA,kBAAA,YAAA;;;;QAGA,EAAA,IAAA,EAACW,aAAQ,EAAT;;IAVA,OAAA,YAAA,CAAA;;;;;;;;;;ADWA,qBAAM,kCAAkC,GAAgB,IAAI,GAAG,EAAU,CAAC;;;;AAG1E,qBAAI,mBAAiD,CAAC;;;;;IAQpD,SAAF,YAAA,CAAsBD,WAAkB,EAAxC;QAAsB,IAAtB,CAAA,QAA8B,GAARA,WAAQ,CAAU;QACpC,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,QAAQ,CAAC,SAAS,IAAI,MAAM,CAAC,UAAU;;;YAG7D,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC;YAC9B,cAAc,CAAC;KAClB;;;;;;;;;;;;;;;IAQD,YAAF,CAAA,SAAA,CAAA,UAAY;;;;;;;;IAAV,UAAW,KAAa,EAA1B;QACI,IAAI,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE;YACxB,oBAAoB,CAAC,KAAK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IAEvD,eAAe,EAAE,gDAAgD;IACjE,cAAc,EAAE,uEAAuE;IACvF,WAAW,EAAE,gDAAgD;IAE7D,gBAAgB,EAAE,iDAAiD;IACnE,eAAe,EAAE,yEAAyE;IAC1F,YAAY,EAAE,kDAAkD;CACjE;;;;;;;;;;;;;;;"}
|
|
@@ -5,5 +5,5 @@
|
|
|
5
5
|
* Use of this source code is governed by an MIT-style license that can be
|
|
6
6
|
* found in the LICENSE file at https://angular.io/license
|
|
7
7
|
*/
|
|
8
|
-
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@angular/core"),require("@angular/cdk/platform"),require("rxjs"),require("rxjs/operators"),require("@angular/cdk/coercion")):"function"==typeof define&&define.amd?define("@angular/cdk/layout",["exports","@angular/core","@angular/cdk/platform","rxjs","rxjs/operators","@angular/cdk/coercion"],e):e((t.ng=t.ng||{},t.ng.cdk=t.ng.cdk||{},t.ng.cdk.layout={}),t.ng.core,t.ng.cdk.platform,t.rxjs,t.rxjs.operators,t.ng.cdk.coercion)}(this,function(t,e,n,r,i,a){"use strict";function o(t){if(!p.has(t))try{u||(u=document.createElement("style"),u.setAttribute("type","text/css"),document.head.appendChild(u)),u.sheet&&(u.sheet.insertRule("@media "+t+" {.fx-query-test{ }}",0),p.add(t))}catch(t){console.error(t)}}function
|
|
8
|
+
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@angular/core"),require("@angular/cdk/platform"),require("rxjs"),require("rxjs/operators"),require("@angular/cdk/coercion")):"function"==typeof define&&define.amd?define("@angular/cdk/layout",["exports","@angular/core","@angular/cdk/platform","rxjs","rxjs/operators","@angular/cdk/coercion"],e):e((t.ng=t.ng||{},t.ng.cdk=t.ng.cdk||{},t.ng.cdk.layout={}),t.ng.core,t.ng.cdk.platform,t.rxjs,t.rxjs.operators,t.ng.cdk.coercion)}(this,function(t,e,n,r,i,a){"use strict";function o(t){if(!p.has(t))try{u||(u=document.createElement("style"),u.setAttribute("type","text/css"),document.head.appendChild(u)),u.sheet&&(u.sheet.insertRule("@media "+t+" {.fx-query-test{ }}",0),p.add(t))}catch(t){console.error(t)}}function c(t){return{matches:"all"===t||""===t,media:t,addListener:function(){},removeListener:function(){}}}function d(t){return t.map(function(t){return t.split(",")}).reduce(function(t,e){return t.concat(e)}).map(function(t){return t.trim()})}var u,s=function(){function t(){}return t.decorators=[{type:e.NgModule}],t}(),p=new Set,m=function(){function t(t){this.platform=t,this._matchMedia=this.platform.isBrowser&&window.matchMedia?window.matchMedia.bind(window):c}return t.prototype.matchMedia=function(t){return this.platform.WEBKIT&&o(t),this._matchMedia(t)},t.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],t.ctorParameters=function(){return[{type:n.Platform}]},t.ngInjectableDef=e.defineInjectable({factory:function(){return new t(e.inject(n.Platform))},token:t,providedIn:"root"}),t}(),h=function(){function t(t,e){this.mediaMatcher=t,this.zone=e,this._queries=new Map,this._destroySubject=new r.Subject}return t.prototype.ngOnDestroy=function(){this._destroySubject.next(),this._destroySubject.complete()},t.prototype.isMatched=function(t){var e=this;return d(a.coerceArray(t)).some(function(t){return e._registerQuery(t).mql.matches})},t.prototype.observe=function(t){var e=this,n=d(a.coerceArray(t)),o=n.map(function(t){return e._registerQuery(t).observable});return r.combineLatest(o).pipe(i.map(function(t){var e={matches:!1,breakpoints:{}};return t.forEach(function(t){e.matches=e.matches||t.matches,e.breakpoints[t.query]=t.matches}),e}))},t.prototype._registerQuery=function(t){var e=this;if(this._queries.has(t))return this._queries.get(t);var n=this.mediaMatcher.matchMedia(t),a=r.fromEventPattern(function(t){n.addListener(function(n){return e.zone.run(function(){return t(n)})})},function(t){n.removeListener(function(n){return e.zone.run(function(){return t(n)})})}).pipe(i.takeUntil(this._destroySubject),i.startWith(n),i.map(function(e){return{query:t,matches:e.matches}})),o={observable:a,mql:n};return this._queries.set(t,o),o},t.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],t.ctorParameters=function(){return[{type:m},{type:e.NgZone}]},t.ngInjectableDef=e.defineInjectable({factory:function(){return new t(e.inject(m),e.inject(e.NgZone))},token:t,providedIn:"root"}),t}(),f={XSmall:"(max-width: 599px)",Small:"(min-width: 600px) and (max-width: 959px)",Medium:"(min-width: 960px) and (max-width: 1279px)",Large:"(min-width: 1280px) and (max-width: 1919px)",XLarge:"(min-width: 1920px)",Handset:"(max-width: 599px) and (orientation: portrait), (max-width: 959px) and (orientation: landscape)",Tablet:"(min-width: 600px) and (max-width: 839px) and (orientation: portrait), (min-width: 960px) and (max-width: 1279px) and (orientation: landscape)",Web:"(min-width: 840px) and (orientation: portrait), (min-width: 1280px) and (orientation: landscape)",HandsetPortrait:"(max-width: 599px) and (orientation: portrait)",TabletPortrait:"(min-width: 600px) and (max-width: 839px) and (orientation: portrait)",WebPortrait:"(min-width: 840px) and (orientation: portrait)",HandsetLandscape:"(max-width: 959px) and (orientation: landscape)",TabletLandscape:"(min-width: 960px) and (max-width: 1279px) and (orientation: landscape)",WebLandscape:"(min-width: 1280px) and (orientation: landscape)"};t.LayoutModule=s,t.BreakpointObserver=h,t.Breakpoints=f,t.MediaMatcher=m,Object.defineProperty(t,"__esModule",{value:!0})});
|
|
9
9
|
//# sourceMappingURL=cdk-layout.umd.min.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cdk-layout.umd.min.js","sources":["../../src/cdk/layout/media-matcher.ts","../../src/cdk/layout/breakpoints-observer.ts","../../src/cdk/layout/layout-module.ts","../../src/cdk/layout/breakpoints.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\nimport {Injectable} from '@angular/core';\nimport {Platform} from '@angular/cdk/platform';\n\n/** Global registry for all dynamically-created, injected media queries. */\nconst mediaQueriesForWebkitCompatibility: Set<string> = new Set<string>();\n\n/** Style tag that holds all of the dynamically-created media queries. */\nlet mediaQueryStyleNode: HTMLStyleElement | undefined;\n\n/** A utility for calling matchMedia queries. */\n@Injectable({providedIn: 'root'})\nexport class MediaMatcher {\n /** The internal matchMedia method to return back a MediaQueryList like object. */\n private _matchMedia: (query: string) => MediaQueryList;\n\n constructor(private platform: Platform) {\n this._matchMedia = this.platform.isBrowser && window.matchMedia ?\n // matchMedia is bound to the window scope intentionally as it is an illegal invocation to\n // call it from a different scope.\n window.matchMedia.bind(window) :\n noopMatchMedia;\n }\n\n /**\n * Evaluates the given media query and returns the native MediaQueryList from which results\n * can be retrieved.\n * Confirms the layout engine will trigger for the selector query provided and returns the\n * MediaQueryList for the query provided.\n */\n matchMedia(query: string): MediaQueryList {\n if (this.platform.WEBKIT) {\n createEmptyStyleRule(query);\n }\n return this._matchMedia(query);\n }\n}\n\n/**\n * For Webkit engines that only trigger the MediaQueryListListener when\n * there is at least one CSS selector for the respective media query.\n */\nfunction createEmptyStyleRule(query: string) {\n if (mediaQueriesForWebkitCompatibility.has(query)) {\n return;\n }\n\n try {\n if (!mediaQueryStyleNode) {\n mediaQueryStyleNode = document.createElement('style');\n mediaQueryStyleNode.setAttribute('type', 'text/css');\n document.head.appendChild(mediaQueryStyleNode);\n }\n\n if (mediaQueryStyleNode.sheet) {\n (mediaQueryStyleNode.sheet as CSSStyleSheet)\n .insertRule(`@media ${query} {.fx-query-test{ }}`, 0);\n mediaQueriesForWebkitCompatibility.add(query);\n }\n } catch (e) {\n console.error(e);\n }\n}\n\n/** No-op matchMedia replacement for non-browser platforms. */\nfunction noopMatchMedia(query: string): MediaQueryList {\n return {\n matches: query === 'all' || query === '',\n media: query,\n addListener: () => {},\n removeListener: () => {}\n };\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\nimport {Injectable, NgZone, OnDestroy} from '@angular/core';\nimport {MediaMatcher} from './media-matcher';\nimport {combineLatest, fromEventPattern, Observable, Subject} from 'rxjs';\nimport {map, startWith, takeUntil} from 'rxjs/operators';\nimport {coerceArray} from '@angular/cdk/coercion';\n\n\n/** The current state of a layout breakpoint. */\nexport interface BreakpointState {\n /** Whether the breakpoint is currently matching. */\n matches: boolean;\n}\n\ninterface Query {\n observable: Observable<BreakpointState>;\n mql: MediaQueryList;\n}\n\n/** Utility for checking the matching state of @media queries. */\n@Injectable({providedIn: 'root'})\nexport class BreakpointObserver implements OnDestroy {\n /** A map of all media queries currently being listened for. */\n private _queries: Map<string, Query> = new Map();\n /** A subject for all other observables to takeUntil based on. */\n private _destroySubject: Subject<{}> = new Subject();\n\n constructor(private mediaMatcher: MediaMatcher, private zone: NgZone) {}\n\n /** Completes the active subject, signalling to all other observables to complete. */\n ngOnDestroy() {\n this._destroySubject.next();\n this._destroySubject.complete();\n }\n\n /**\n * Whether one or more media queries match the current viewport size.\n * @param value One or more media queries to check.\n * @returns Whether any of the media queries match.\n */\n isMatched(value: string | string[]): boolean {\n const queries = splitQueries(coerceArray(value));\n return queries.some(mediaQuery => this._registerQuery(mediaQuery).mql.matches);\n }\n\n /**\n * Gets an observable of results for the given queries that will emit new results for any changes\n * in matching of the given queries.\n * @param value One or more media queries to check.\n * @returns A stream of matches for the given queries.\n */\n observe(value: string | string[]): Observable<BreakpointState> {\n const queries = splitQueries(coerceArray(value));\n const observables = queries.map(query => this._registerQuery(query).observable);\n\n return combineLatest(observables).pipe(map((breakpointStates: BreakpointState[]) => {\n return {\n matches: breakpointStates.some(state => state && state.matches)\n };\n }));\n }\n\n /** Registers a specific query to be listened for. */\n private _registerQuery(query: string): Query {\n // Only set up a new MediaQueryList if it is not already being listened for.\n if (this._queries.has(query)) {\n return this._queries.get(query)!;\n }\n\n const mql: MediaQueryList = this.mediaMatcher.matchMedia(query);\n // Create callback for match changes and add it is as a listener.\n const queryObservable = fromEventPattern(\n // Listener callback methods are wrapped to be placed back in ngZone. Callbacks must be placed\n // back into the zone because matchMedia is only included in Zone.js by loading the\n // webapis-media-query.js file alongside the zone.js file. Additionally, some browsers do not\n // have MediaQueryList inherit from EventTarget, which causes inconsistencies in how Zone.js\n // patches it.\n (listener: MediaQueryListListener) => {\n mql.addListener((e: MediaQueryList) => this.zone.run(() => listener(e)));\n },\n (listener: MediaQueryListListener) => {\n mql.removeListener((e: MediaQueryList) => this.zone.run(() => listener(e)));\n })\n .pipe(\n takeUntil(this._destroySubject),\n startWith(mql),\n map((nextMql: MediaQueryList) => ({matches: nextMql.matches}))\n );\n\n // Add the MediaQueryList to the set of queries.\n const output = {observable: queryObservable, mql: mql};\n this._queries.set(query, output);\n return output;\n }\n}\n\n/**\n * Split each query string into separate query strings if two queries are provided as comma\n * separated.\n */\nfunction splitQueries(queries: string[]): string[] {\n return queries.map((query: string) => query.split(','))\n .reduce((a1: string[], a2: string[]) => a1.concat(a2))\n .map(query => query.trim());\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\nimport {NgModule} from '@angular/core';\n\n\n@NgModule()\nexport class LayoutModule {}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n// PascalCase is being used as Breakpoints is used like an enum.\n// tslint:disable-next-line:variable-name\nexport const Breakpoints = {\n XSmall: '(max-width: 599px)',\n Small: '(min-width: 600px) and (max-width: 959px)',\n Medium: '(min-width: 960px) and (max-width: 1279px)',\n Large: '(min-width: 1280px) and (max-width: 1919px)',\n XLarge: '(min-width: 1920px)',\n\n Handset: '(max-width: 599px) and (orientation: portrait), ' +\n '(max-width: 959px) and (orientation: landscape)',\n Tablet: '(min-width: 600px) and (max-width: 839px) and (orientation: portrait), ' +\n '(min-width: 960px) and (max-width: 1279px) and (orientation: landscape)',\n Web: '(min-width: 840px) and (orientation: portrait), ' +\n '(min-width: 1280px) and (orientation: landscape)',\n\n HandsetPortrait: '(max-width: 599px) and (orientation: portrait)',\n TabletPortrait: '(min-width: 600px) and (max-width: 839px) and (orientation: portrait)',\n WebPortrait: '(min-width: 840px) and (orientation: portrait)',\n\n HandsetLandscape: '(max-width: 959px) and (orientation: landscape)',\n TabletLandscape: '(min-width: 960px) and (max-width: 1279px) and (orientation: landscape)',\n WebLandscape: '(min-width: 1280px) and (orientation: landscape)',\n};\n"],"names":["createEmptyStyleRule","query","mediaQueriesForWebkitCompatibility","has","mediaQueryStyleNode","document","createElement","setAttribute","head","appendChild","sheet","insertRule","add","e","console","error","noopMatchMedia","matches","media","addListener","removeListener","splitQueries","queries","map","split","reduce","a1","a2","concat","trim","LayoutModule","type","NgModule","Set","MediaMatcher","platform","this","_matchMedia","isBrowser","window","matchMedia","bind","prototype","WEBKIT","Injectable","args","providedIn","Platform","BreakpointObserver","mediaMatcher","zone","_queries","Map","_destroySubject","Subject","ngOnDestroy","next","complete","isMatched","value","_this","coerceArray","some","mediaQuery","_registerQuery","mql","observe","observables","observable","combineLatest","pipe","breakpointStates","state","get","queryObservable","fromEventPattern","listener","run","takeUntil","startWith","nextMql","output","set","NgZone","Breakpoints","XSmall","Small","Medium","Large","XLarge","Handset","Tablet","Web","HandsetPortrait","TabletPortrait","WebPortrait","HandsetLandscape","TabletLandscape","WebLandscape"],"mappings":";;;;;;;wiBAgDA,SAAAA,GAA8BC,GAC5B,IAAIC,EAAmCC,IAAIF,GAI3C,IACOG,IACHA,EAAsBC,SAASC,cAAc,SAC7CF,EAAoBG,aAAa,OAAQ,YACzCF,SAASG,KAAKC,YAAYL,IAGxBA,EAAoBM,QACrBN,EAA0C,MACtCO,WAAW,UAAUV,EAAhC,uBAA6D,GACvDC,EAAmCU,IAAIX,IAEzC,MAAOY,GACPC,QAAQC,MAAMF,IAKlB,QAAAG,GAAwBf,GACtB,OACEgB,QAAmB,QAAVhB,GAA6B,KAAVA,EAC5BiB,MAAOjB,EACPkB,YAAa,aACbC,eAAgB,cC8BpB,QAAAC,GAAsBC,GACpB,MAAOA,GAAQC,IAAI,SAACtB,GAAkB,MAAAA,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IAASA,EAAMvD,eAMrD+B,EAAVN,UAAAsB,eAAA,SAAyB/D,aAErB,IAAImC,KAAKe,SAAShD,IAAIF,GACpB,MAAOmC,MAAKe,SAASsB,IAAIxE,EAG3B,IAAMgE,GAAsB7B,KAAKa,aAAaT,WAAWvC,GAEnDyE,EAAkBC,EAAAA,iBAMtB,SAACC,GACCX,EAAI9C,YAAY,SAACN,GAAsB,MAAA+C,GAAKV,KAAK2B,IAAI,WAAM,MAAAD,GAAS/D,QAEtE,SAAC+D,GACCX,EAAI7C,eAAe,SAACP,GAAsB,MAAA+C,GAAKV,KAAK2B,IAAI,WAAM,MAAAD,GAAS/D,SAExEyD,KACCQ,EAAAA,UAAU1C,KAAKiB,iBACf0B,EAAAA,UAAUd,GACV1C,EAAAA,IAAI,SAACyD,GAA4B,OAAE/D,QAAS+D,EAAQ/D,YAIlDgE,GAAUb,WAAYM,EAAiBT,IAAKA,EAElD,OADA7B,MAAKe,SAAS+B,IAAIjF,EAAOgF,GAClBA,kBAxEXlD,KAACa,EAAAA,WAADC,OAAaC,WAAY,+CAlBzBf,KAAQG,IADRH,KAAoBoD,EAAAA,6IAPpBnC,KESaoC,GACXC,OAAQ,qBACRC,MAAO,4CACPC,OAAQ,6CACRC,MAAO,8CACPC,OAAQ,sBAERC,QAAS,kGAETC,OAAQ,iJAERC,IAAK,mGAGLC,gBAAiB,iDACjBC,eAAgB,wEAChBC,YAAa,iDAEbC,iBAAkB,kDAClBC,gBAAiB,0EACjBC,aAAc"}
|
|
1
|
+
{"version":3,"file":"cdk-layout.umd.min.js","sources":["../../src/cdk/layout/media-matcher.ts","../../src/cdk/layout/breakpoints-observer.ts","../../src/cdk/layout/layout-module.ts","../../src/cdk/layout/breakpoints.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\nimport {Injectable} from '@angular/core';\nimport {Platform} from '@angular/cdk/platform';\n\n/** Global registry for all dynamically-created, injected media queries. */\nconst mediaQueriesForWebkitCompatibility: Set<string> = new Set<string>();\n\n/** Style tag that holds all of the dynamically-created media queries. */\nlet mediaQueryStyleNode: HTMLStyleElement | undefined;\n\n/** A utility for calling matchMedia queries. */\n@Injectable({providedIn: 'root'})\nexport class MediaMatcher {\n /** The internal matchMedia method to return back a MediaQueryList like object. */\n private _matchMedia: (query: string) => MediaQueryList;\n\n constructor(private platform: Platform) {\n this._matchMedia = this.platform.isBrowser && window.matchMedia ?\n // matchMedia is bound to the window scope intentionally as it is an illegal invocation to\n // call it from a different scope.\n window.matchMedia.bind(window) :\n noopMatchMedia;\n }\n\n /**\n * Evaluates the given media query and returns the native MediaQueryList from which results\n * can be retrieved.\n * Confirms the layout engine will trigger for the selector query provided and returns the\n * MediaQueryList for the query provided.\n */\n matchMedia(query: string): MediaQueryList {\n if (this.platform.WEBKIT) {\n createEmptyStyleRule(query);\n }\n return this._matchMedia(query);\n }\n}\n\n/**\n * For Webkit engines that only trigger the MediaQueryListListener when\n * there is at least one CSS selector for the respective media query.\n */\nfunction createEmptyStyleRule(query: string) {\n if (mediaQueriesForWebkitCompatibility.has(query)) {\n return;\n }\n\n try {\n if (!mediaQueryStyleNode) {\n mediaQueryStyleNode = document.createElement('style');\n mediaQueryStyleNode.setAttribute('type', 'text/css');\n document.head.appendChild(mediaQueryStyleNode);\n }\n\n if (mediaQueryStyleNode.sheet) {\n (mediaQueryStyleNode.sheet as CSSStyleSheet)\n .insertRule(`@media ${query} {.fx-query-test{ }}`, 0);\n mediaQueriesForWebkitCompatibility.add(query);\n }\n } catch (e) {\n console.error(e);\n }\n}\n\n/** No-op matchMedia replacement for non-browser platforms. */\nfunction noopMatchMedia(query: string): MediaQueryList {\n return {\n matches: query === 'all' || query === '',\n media: query,\n addListener: () => {},\n removeListener: () => {}\n };\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\nimport {Injectable, NgZone, OnDestroy} from '@angular/core';\nimport {MediaMatcher} from './media-matcher';\nimport {combineLatest, fromEventPattern, Observable, Subject} from 'rxjs';\nimport {map, startWith, takeUntil} from 'rxjs/operators';\nimport {coerceArray} from '@angular/cdk/coercion';\n\n\n/** The current state of a layout breakpoint. */\nexport interface BreakpointState {\n /** Whether the breakpoint is currently matching. */\n matches: boolean;\n /**\n * A key boolean pair for each query provided to the observe method,\n * with its current matched state.\n */\n breakpoints: {\n [key: string]: boolean;\n };\n}\n\n/** The current state of a layout breakpoint. */\ninterface InternalBreakpointState {\n /** Whether the breakpoint is currently matching. */\n matches: boolean;\n /** The media query being to be matched */\n query: string;\n}\n\ninterface Query {\n observable: Observable<InternalBreakpointState>;\n mql: MediaQueryList;\n}\n\n/** Utility for checking the matching state of @media queries. */\n@Injectable({providedIn: 'root'})\nexport class BreakpointObserver implements OnDestroy {\n /** A map of all media queries currently being listened for. */\n private _queries = new Map<string, Query>();\n /** A subject for all other observables to takeUntil based on. */\n private _destroySubject = new Subject<void>();\n\n constructor(private mediaMatcher: MediaMatcher, private zone: NgZone) {}\n\n /** Completes the active subject, signalling to all other observables to complete. */\n ngOnDestroy() {\n this._destroySubject.next();\n this._destroySubject.complete();\n }\n\n /**\n * Whether one or more media queries match the current viewport size.\n * @param value One or more media queries to check.\n * @returns Whether any of the media queries match.\n */\n isMatched(value: string | string[]): boolean {\n const queries = splitQueries(coerceArray(value));\n return queries.some(mediaQuery => this._registerQuery(mediaQuery).mql.matches);\n }\n\n /**\n * Gets an observable of results for the given queries that will emit new results for any changes\n * in matching of the given queries.\n * @param value One or more media queries to check.\n * @returns A stream of matches for the given queries.\n */\n observe(value: string | string[]): Observable<BreakpointState> {\n const queries = splitQueries(coerceArray(value));\n const observables = queries.map(query => this._registerQuery(query).observable);\n\n return combineLatest(observables).pipe(map((breakpointStates: InternalBreakpointState[]) => {\n const response: BreakpointState = {\n matches: false,\n breakpoints: {},\n };\n breakpointStates.forEach((state: InternalBreakpointState) => {\n response.matches = response.matches || state.matches;\n response.breakpoints[state.query] = state.matches;\n });\n return response;\n }));\n }\n\n /** Registers a specific query to be listened for. */\n private _registerQuery(query: string): Query {\n // Only set up a new MediaQueryList if it is not already being listened for.\n if (this._queries.has(query)) {\n return this._queries.get(query)!;\n }\n\n const mql: MediaQueryList = this.mediaMatcher.matchMedia(query);\n // Create callback for match changes and add it is as a listener.\n const queryObservable = fromEventPattern(\n // Listener callback methods are wrapped to be placed back in ngZone. Callbacks must be placed\n // back into the zone because matchMedia is only included in Zone.js by loading the\n // webapis-media-query.js file alongside the zone.js file. Additionally, some browsers do not\n // have MediaQueryList inherit from EventTarget, which causes inconsistencies in how Zone.js\n // patches it.\n (listener: MediaQueryListListener) => {\n mql.addListener((e: MediaQueryList) => this.zone.run(() => listener(e)));\n },\n (listener: MediaQueryListListener) => {\n mql.removeListener((e: MediaQueryList) => this.zone.run(() => listener(e)));\n })\n .pipe(\n takeUntil(this._destroySubject),\n startWith(mql),\n map((nextMql: MediaQueryList) => ({query, matches: nextMql.matches}))\n );\n\n // Add the MediaQueryList to the set of queries.\n const output = {observable: queryObservable, mql};\n this._queries.set(query, output);\n return output;\n }\n}\n\n/**\n * Split each query string into separate query strings if two queries are provided as comma\n * separated.\n */\nfunction splitQueries(queries: string[]): string[] {\n return queries.map((query: string) => query.split(','))\n .reduce((a1: string[], a2: string[]) => a1.concat(a2))\n .map(query => query.trim());\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\nimport {NgModule} from '@angular/core';\n\n\n@NgModule()\nexport class LayoutModule {}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n// PascalCase is being used as Breakpoints is used like an enum.\n// tslint:disable-next-line:variable-name\nexport const Breakpoints = {\n XSmall: '(max-width: 599px)',\n Small: '(min-width: 600px) and (max-width: 959px)',\n Medium: '(min-width: 960px) and (max-width: 1279px)',\n Large: '(min-width: 1280px) and (max-width: 1919px)',\n XLarge: '(min-width: 1920px)',\n\n Handset: '(max-width: 599px) and (orientation: portrait), ' +\n '(max-width: 959px) and (orientation: landscape)',\n Tablet: '(min-width: 600px) and (max-width: 839px) and (orientation: portrait), ' +\n '(min-width: 960px) and (max-width: 1279px) and (orientation: landscape)',\n Web: '(min-width: 840px) and (orientation: portrait), ' +\n '(min-width: 1280px) and (orientation: landscape)',\n\n HandsetPortrait: '(max-width: 599px) and (orientation: portrait)',\n TabletPortrait: '(min-width: 600px) and (max-width: 839px) and (orientation: portrait)',\n WebPortrait: '(min-width: 840px) and (orientation: portrait)',\n\n HandsetLandscape: '(max-width: 959px) and (orientation: landscape)',\n TabletLandscape: '(min-width: 960px) and (max-width: 1279px) and (orientation: landscape)',\n WebLandscape: '(min-width: 1280px) and (orientation: landscape)',\n};\n"],"names":["createEmptyStyleRule","query","mediaQueriesForWebkitCompatibility","has","mediaQueryStyleNode","document","createElement","setAttribute","head","appendChild","sheet","insertRule","add","e","console","error","noopMatchMedia","matches","media","addListener","removeListener","splitQueries","queries","map","split","reduce","a1","a2","concat","trim","LayoutModule","type","NgModule","Set","MediaMatcher","platform","this","_matchMedia","isBrowser","window","matchMedia","bind","prototype","WEBKIT","Injectable","args","providedIn","Platform","BreakpointObserver","mediaMatcher","zone","_queries","Map","_destroySubject","Subject","ngOnDestroy","next","complete","isMatched","value","_this","coerceArray","some","mediaQuery","_registerQuery","mql","observe","observables","observable","combineLatest","pipe","breakpointStates","response","breakpoints","forEach","state","get","queryObservable","fromEventPattern","listener","run","takeUntil","startWith","nextMql","output","set","NgZone","Breakpoints","XSmall","Small","Medium","Large","XLarge","Handset","Tablet","Web","HandsetPortrait","TabletPortrait","WebPortrait","HandsetLandscape","TabletLandscape","WebLandscape"],"mappings":";;;;;;;wiBAgDA,SAAAA,GAA8BC,GAC5B,IAAIC,E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AAAA,6IAPpBtC,KESauC,GACXC,OAAQ,qBACRC,MAAO,4CACPC,OAAQ,6CACRC,MAAO,8CACPC,OAAQ,sBAERC,QAAS,kGAETC,OAAQ,iJAERC,IAAK,mGAGLC,gBAAiB,iDACjBC,eAAgB,wEAChBC,YAAa,iDAEbC,iBAAkB,kDAClBC,gBAAiB,0EACjBC,aAAc"}
|
|
@@ -61,21 +61,16 @@ var ContentObserver = /** @class */ (function () {
|
|
|
61
61
|
this._observedElements.forEach(function (_, element) { return _this._cleanupObserver(element); });
|
|
62
62
|
};
|
|
63
63
|
/**
|
|
64
|
-
*
|
|
65
|
-
* @param element The element to observe for content changes.
|
|
66
|
-
*/
|
|
67
|
-
/**
|
|
68
|
-
* Observe content changes on an element.
|
|
69
|
-
* @param {?} element The element to observe for content changes.
|
|
64
|
+
* @param {?} elementOrRef
|
|
70
65
|
* @return {?}
|
|
71
66
|
*/
|
|
72
67
|
ContentObserver.prototype.observe = /**
|
|
73
|
-
*
|
|
74
|
-
* @param {?} element The element to observe for content changes.
|
|
68
|
+
* @param {?} elementOrRef
|
|
75
69
|
* @return {?}
|
|
76
70
|
*/
|
|
77
|
-
function (
|
|
71
|
+
function (elementOrRef) {
|
|
78
72
|
var _this = this;
|
|
73
|
+
var /** @type {?} */ element = elementOrRef instanceof core.ElementRef ? elementOrRef.nativeElement : elementOrRef;
|
|
79
74
|
return rxjs.Observable.create(function (observer) {
|
|
80
75
|
var /** @type {?} */ stream = _this._observeElement(element);
|
|
81
76
|
var /** @type {?} */ subscription = stream.subscribe(observer);
|
|
@@ -250,7 +245,7 @@ var CdkObserveContent = /** @class */ (function () {
|
|
|
250
245
|
function () {
|
|
251
246
|
var _this = this;
|
|
252
247
|
this._unsubscribe();
|
|
253
|
-
var /** @type {?} */ stream = this._contentObserver.observe(this._elementRef
|
|
248
|
+
var /** @type {?} */ stream = this._contentObserver.observe(this._elementRef);
|
|
254
249
|
// TODO(mmalerba): We shouldn't be emitting on this @Output() outside the zone.
|
|
255
250
|
// Consider brining it back inside the zone next time we're making breaking changes.
|
|
256
251
|
// Bringing it back inside can cause things like infinite change detection loops and changed
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cdk-observers.umd.js","sources":["../../src/cdk/observers/observe-content.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nimport {coerceBooleanProperty, coerceNumberProperty} from '@angular/cdk/coercion';\nimport {\n AfterContentInit,\n Directive,\n ElementRef,\n EventEmitter,\n Injectable,\n Input,\n NgModule,\n NgZone,\n OnDestroy,\n Output,\n} from '@angular/core';\nimport {Observable, Subject, Subscription} from 'rxjs';\nimport {debounceTime} from 'rxjs/operators';\n\n/**\n * Factory that creates a new MutationObserver and allows us to stub it out in unit tests.\n * @docs-private\n */\n@Injectable({providedIn: 'root'})\nexport class MutationObserverFactory {\n create(callback: MutationCallback): MutationObserver | null {\n return typeof MutationObserver === 'undefined' ? null : new MutationObserver(callback);\n }\n}\n\n\n/** An injectable service that allows watching elements for changes to their content. */\n@Injectable({providedIn: 'root'})\nexport class ContentObserver implements OnDestroy {\n /** Keeps track of the existing MutationObservers so they can be reused. */\n private _observedElements = new Map<Element, {\n observer: MutationObserver | null,\n stream: Subject<MutationRecord[]>,\n count: number\n }>();\n\n constructor(private _mutationObserverFactory: MutationObserverFactory) {}\n\n ngOnDestroy() {\n this._observedElements.forEach((_, element) => this._cleanupObserver(element));\n }\n\n /**\n * Observe content changes on an element.\n * @param element The element to observe for content changes.\n */\n observe(element: Element): Observable<MutationRecord[]> {\n return Observable.create(observer => {\n const stream = this._observeElement(element);\n const subscription = stream.subscribe(observer);\n\n return () => {\n subscription.unsubscribe();\n this._unobserveElement(element);\n };\n });\n }\n\n /**\n * Observes the given element by using the existing MutationObserver if available, or creating a\n * new one if not.\n */\n private _observeElement(element: Element): Subject<MutationRecord[]> {\n if (!this._observedElements.has(element)) {\n const stream = new Subject<MutationRecord[]>();\n const observer = this._mutationObserverFactory.create(mutations => stream.next(mutations));\n if (observer) {\n observer.observe(element, {\n characterData: true,\n childList: true,\n subtree: true\n });\n }\n this._observedElements.set(element, {observer, stream, count: 1});\n } else {\n this._observedElements.get(element)!.count++;\n }\n return this._observedElements.get(element)!.stream;\n }\n\n /**\n * Un-observes the given element and cleans up the underlying MutationObserver if nobody else is\n * observing this element.\n */\n private _unobserveElement(element: Element) {\n if (this._observedElements.has(element)) {\n this._observedElements.get(element)!.count--;\n if (!this._observedElements.get(element)!.count) {\n this._cleanupObserver(element);\n }\n }\n }\n\n /** Clean up the underlying MutationObserver for the specified element. */\n private _cleanupObserver(element: Element) {\n if (this._observedElements.has(element)) {\n const {observer, stream} = this._observedElements.get(element)!;\n if (observer) {\n observer.disconnect();\n }\n stream.complete();\n this._observedElements.delete(element);\n }\n }\n}\n\n\n/**\n * Directive that triggers a callback whenever the content of\n * its associated element has changed.\n */\n@Directive({\n selector: '[cdkObserveContent]',\n exportAs: 'cdkObserveContent',\n})\nexport class CdkObserveContent implements AfterContentInit, OnDestroy {\n /** Event emitted for each change in the element's content. */\n @Output('cdkObserveContent') event = new EventEmitter<MutationRecord[]>();\n\n /**\n * Whether observing content is disabled. This option can be used\n * to disconnect the underlying MutationObserver until it is needed.\n */\n @Input('cdkObserveContentDisabled')\n get disabled() { return this._disabled; }\n set disabled(value: any) {\n this._disabled = coerceBooleanProperty(value);\n if (this._disabled) {\n this._unsubscribe();\n } else {\n this._subscribe();\n }\n }\n private _disabled = false;\n\n /** Debounce interval for emitting the changes. */\n @Input()\n get debounce(): number { return this._debounce; }\n set debounce(value: number) {\n this._debounce = coerceNumberProperty(value);\n this._subscribe();\n }\n private _debounce: number;\n\n private _currentSubscription: Subscription | null = null;\n\n constructor(private _contentObserver: ContentObserver, private _elementRef: ElementRef,\n private _ngZone: NgZone) {}\n\n ngAfterContentInit() {\n if (!this._currentSubscription && !this.disabled) {\n this._subscribe();\n }\n }\n\n ngOnDestroy() {\n this._unsubscribe();\n }\n\n private _subscribe() {\n this._unsubscribe();\n const stream = this._contentObserver.observe(this._elementRef.nativeElement);\n\n // TODO(mmalerba): We shouldn't be emitting on this @Output() outside the zone.\n // Consider brining it back inside the zone next time we're making breaking changes.\n // Bringing it back inside can cause things like infinite change detection loops and changed\n // after checked errors if people's code isn't handling it properly.\n this._ngZone.runOutsideAngular(() => {\n this._currentSubscription =\n (this.debounce ? stream.pipe(debounceTime(this.debounce)) : stream).subscribe(this.event);\n });\n }\n\n private _unsubscribe() {\n if (this._currentSubscription) {\n this._currentSubscription.unsubscribe();\n }\n }\n}\n\n\n@NgModule({\n exports: [CdkObserveContent],\n declarations: [CdkObserveContent],\n providers: [MutationObserverFactory]\n})\nexport class ObserversModule {}\n"],"names":["NgModule","Input","Output","NgZone","ElementRef","Directive","debounceTime","coerceNumberProperty","coerceBooleanProperty","EventEmitter","Injectable","Subject","Observable"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;IA8BE,uBAAF,CAAA,SAAA,CAAA,MAAQ;;;;IAAN,UAAO,QAA0B,EAAnC;QACI,OAAO,OAAO,gBAAgB,KAAK,WAAW,GAAG,IAAI,GAAG,IAAI,gBAAgB,CAAC,QAAQ,CAAC,CAAC;KACxF,CAAH;;QAJA,EAAA,IAAA,EAACU,eAAU,EAAX,IAAA,EAAA,CAAY,EAAC,UAAU,EAAE,MAAM,EAAC,EAAhC,EAAA;;;IA5BA,OAAA,uBAAA,CAAA;;;;;;IA8CE,SAAF,eAAA,CAAsB,wBAAiD,EAAvE;QAAsB,IAAtB,CAAA,wBAA8C,GAAxB,wBAAwB,CAAyB;;;;QANvE,IAAA,CAAA,iBAAA,GAA8B,IAAI,GAAG,EAI/B,CAJN;KAM2E;;;;IAEzE,eAAF,CAAA,SAAA,CAAA,WAAa;;;IAAX,YAAF;QAAE,IAAF,KAAA,GAAA,IAAA,CAEG;QADC,IAAI,CAAC,iBAAiB,CAAC,OAAO,CAAC,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JA,OAAA,iBAAA,CAAA;;AA6HA,AAAA,IAAA,eAAA,kBAAA,YAAA;;;;QAkEA,EAAA,IAAA,EAACD,aAAQ,EAAT,IAAA,EAAA,CAAU;oBACR,OAAO,EAAE,CAAC,iBAAiB,CAAC;oBAC5B,YAAY,EAAE,CAAC,iBAAiB,CAAC;oBACjC,SAAS,EAAE,CAAC,uBAAuB,CAAC;iBACrC,EAAD,EAAA;;IAnMA,OAAA,eAAA,CAAA;;;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"cdk-observers.umd.js","sources":["../../src/cdk/observers/observe-content.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nimport {coerceBooleanProperty, coerceNumberProperty} from '@angular/cdk/coercion';\nimport {\n AfterContentInit,\n Directive,\n ElementRef,\n EventEmitter,\n Injectable,\n Input,\n NgModule,\n NgZone,\n OnDestroy,\n Output,\n} from '@angular/core';\nimport {Observable, Subject, Subscription} from 'rxjs';\nimport {debounceTime} from 'rxjs/operators';\n\n/**\n * Factory that creates a new MutationObserver and allows us to stub it out in unit tests.\n * @docs-private\n */\n@Injectable({providedIn: 'root'})\nexport class MutationObserverFactory {\n create(callback: MutationCallback): MutationObserver | null {\n return typeof MutationObserver === 'undefined' ? null : new MutationObserver(callback);\n }\n}\n\n\n/** An injectable service that allows watching elements for changes to their content. */\n@Injectable({providedIn: 'root'})\nexport class ContentObserver implements OnDestroy {\n /** Keeps track of the existing MutationObservers so they can be reused. */\n private _observedElements = new Map<Element, {\n observer: MutationObserver | null,\n stream: Subject<MutationRecord[]>,\n count: number\n }>();\n\n constructor(private _mutationObserverFactory: MutationObserverFactory) {}\n\n ngOnDestroy() {\n this._observedElements.forEach((_, element) => this._cleanupObserver(element));\n }\n\n /**\n * Observe content changes on an element.\n * @param element The element to observe for content changes.\n */\n observe(element: Element): Observable<MutationRecord[]>;\n\n /**\n * Observe content changes on an element.\n * @param element The element to observe for content changes.\n */\n observe(element: ElementRef<Element>): Observable<MutationRecord[]>;\n\n observe(elementOrRef: Element | ElementRef<Element>): Observable<MutationRecord[]> {\n const element = elementOrRef instanceof ElementRef ? elementOrRef.nativeElement : elementOrRef;\n\n return Observable.create(observer => {\n const stream = this._observeElement(element);\n const subscription = stream.subscribe(observer);\n\n return () => {\n subscription.unsubscribe();\n this._unobserveElement(element);\n };\n });\n }\n\n /**\n * Observes the given element by using the existing MutationObserver if available, or creating a\n * new one if not.\n */\n private _observeElement(element: Element): Subject<MutationRecord[]> {\n if (!this._observedElements.has(element)) {\n const stream = new Subject<MutationRecord[]>();\n const observer = this._mutationObserverFactory.create(mutations => stream.next(mutations));\n if (observer) {\n observer.observe(element, {\n characterData: true,\n childList: true,\n subtree: true\n });\n }\n this._observedElements.set(element, {observer, stream, count: 1});\n } else {\n this._observedElements.get(element)!.count++;\n }\n return this._observedElements.get(element)!.stream;\n }\n\n /**\n * Un-observes the given element and cleans up the underlying MutationObserver if nobody else is\n * observing this element.\n */\n private _unobserveElement(element: Element) {\n if (this._observedElements.has(element)) {\n this._observedElements.get(element)!.count--;\n if (!this._observedElements.get(element)!.count) {\n this._cleanupObserver(element);\n }\n }\n }\n\n /** Clean up the underlying MutationObserver for the specified element. */\n private _cleanupObserver(element: Element) {\n if (this._observedElements.has(element)) {\n const {observer, stream} = this._observedElements.get(element)!;\n if (observer) {\n observer.disconnect();\n }\n stream.complete();\n this._observedElements.delete(element);\n }\n }\n}\n\n\n/**\n * Directive that triggers a callback whenever the content of\n * its associated element has changed.\n */\n@Directive({\n selector: '[cdkObserveContent]',\n exportAs: 'cdkObserveContent',\n})\nexport class CdkObserveContent implements AfterContentInit, OnDestroy {\n /** Event emitted for each change in the element's content. */\n @Output('cdkObserveContent') event = new EventEmitter<MutationRecord[]>();\n\n /**\n * Whether observing content is disabled. This option can be used\n * to disconnect the underlying MutationObserver until it is needed.\n */\n @Input('cdkObserveContentDisabled')\n get disabled() { return this._disabled; }\n set disabled(value: any) {\n this._disabled = coerceBooleanProperty(value);\n if (this._disabled) {\n this._unsubscribe();\n } else {\n this._subscribe();\n }\n }\n private _disabled = false;\n\n /** Debounce interval for emitting the changes. */\n @Input()\n get debounce(): number { return this._debounce; }\n set debounce(value: number) {\n this._debounce = coerceNumberProperty(value);\n this._subscribe();\n }\n private _debounce: number;\n\n private _currentSubscription: Subscription | null = null;\n\n constructor(private _contentObserver: ContentObserver,\n private _elementRef: ElementRef<HTMLElement>,\n private _ngZone: NgZone) {}\n\n ngAfterContentInit() {\n if (!this._currentSubscription && !this.disabled) {\n this._subscribe();\n }\n }\n\n ngOnDestroy() {\n this._unsubscribe();\n }\n\n private _subscribe() {\n this._unsubscribe();\n const stream = this._contentObserver.observe(this._elementRef);\n\n // TODO(mmalerba): We shouldn't be emitting on this @Output() outside the zone.\n // Consider brining it back inside the zone next time we're making breaking changes.\n // Bringing it back inside can cause things like infinite change detection loops and changed\n // after checked errors if people's code isn't handling it properly.\n this._ngZone.runOutsideAngular(() => {\n this._currentSubscription =\n (this.debounce ? stream.pipe(debounceTime(this.debounce)) : stream).subscribe(this.event);\n });\n }\n\n private _unsubscribe() {\n if (this._currentSubscription) {\n this._currentSubscription.unsubscribe();\n }\n }\n}\n\n\n@NgModule({\n exports: [CdkObserveContent],\n declarations: [CdkObserveContent],\n providers: [MutationObserverFactory]\n})\nexport class ObserversModule {}\n"],"names":["NgModule","Input","Output","NgZone","ElementRef","Directive","debounceTime","coerceNumberProperty","coerceBooleanProperty","EventEmitter","Injectable","Subject","Observable"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;IA8BE,uBAAF,CAAA,SAAA,CAAA,MAAQ;;;;IAAN,UAAO,QAA0B,EAAnC;QACI,OAAO,OAAO,gBAAgB,KAAK,WAAW,GAAG,IAAI,GAAG,IAAI,gBAAgB,CAAC,QAAQ,CAAC,CAAC;KACxF,CAAH;;QAJA,EAAA,IAAA,EAACU,eAAU,EA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W;oBACT,QAAQ,EAAE,qBAAqB;oBAC/B,QAAQ,EAAE,mBAAmB;iBAC9B,EAAD,EAAA;;;;QAhGA,EAAA,IAAA,EAAa,eAAe,GAA5B;QA1BA,EAAA,IAAA,EAAED,eAAU,GAAZ;QAKA,EAAA,IAAA,EAAED,WAAM,GAAR;;;QAwHA,OAAA,EAAA,CAAA,EAAA,IAAA,EAAGD,WAAM,EAAT,IAAA,EAAA,CAAU,mBAAmB,EAA7B,EAAA,EAAA;QAMA,UAAA,EAAA,CAAA,EAAA,IAAA,EAAGD,UAAK,EAAR,IAAA,EAAA,CAAS,2BAA2B,EAApC,EAAA,EAAA;QAaA,UAAA,EAAA,CAAA,EAAA,IAAA,EAAGA,UAAK,EAAR,EAAA;;IA5JA,OAAA,iBAAA,CAAA;;AAuIA,AAAA,IAAA,eAAA,kBAAA,YAAA;;;;QAmEA,EAAA,IAAA,EAACD,aAAQ,EAAT,IAAA,EAAA,CAAU;oBACR,OAAO,EAAE,CAAC,iBAAiB,CAAC;oBAC5B,YAAY,EAAE,CAAC,iBAAiB,CAAC;oBACjC,SAAS,EAAE,CAAC,uBAAuB,CAAC;iBACrC,EAAD,EAAA;;IA9MA,OAAA,eAAA,CAAA;;;;;;;;;;;;;;;;"}
|
|
@@ -5,5 +5,5 @@
|
|
|
5
5
|
* Use of this source code is governed by an MIT-style license that can be
|
|
6
6
|
* found in the LICENSE file at https://angular.io/license
|
|
7
7
|
*/
|
|
8
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/cdk/coercion"),require("@angular/core"),require("rxjs"),require("rxjs/operators")):"function"==typeof define&&define.amd?define("@angular/cdk/observers",["exports","@angular/cdk/coercion","@angular/core","rxjs","rxjs/operators"],t):t((e.ng=e.ng||{},e.ng.cdk=e.ng.cdk||{},e.ng.cdk.observers={}),e.ng.cdk.coercion,e.ng.core,e.rxjs,e.rxjs.operators)}(this,function(e,t,r,n,o){"use strict";var s=function(){function e(){}return e.prototype.create=function(e){return"undefined"==typeof MutationObserver?null:new MutationObserver(e)},e.decorators=[{type:r.Injectable,args:[{providedIn:"root"}]}],e.ngInjectableDef=r.defineInjectable({factory:function(){return new e},token:e,providedIn:"root"}),e}(),i=function(){function e(e){this._mutationObserverFactory=e,this._observedElements=new Map}return e.prototype.ngOnDestroy=function(){var e=this;this._observedElements.forEach(function(t,r){return e._cleanupObserver(r)})},e.prototype.observe=function(e){var t=this;return n.Observable.create(function(
|
|
8
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/cdk/coercion"),require("@angular/core"),require("rxjs"),require("rxjs/operators")):"function"==typeof define&&define.amd?define("@angular/cdk/observers",["exports","@angular/cdk/coercion","@angular/core","rxjs","rxjs/operators"],t):t((e.ng=e.ng||{},e.ng.cdk=e.ng.cdk||{},e.ng.cdk.observers={}),e.ng.cdk.coercion,e.ng.core,e.rxjs,e.rxjs.operators)}(this,function(e,t,r,n,o){"use strict";var s=function(){function e(){}return e.prototype.create=function(e){return"undefined"==typeof MutationObserver?null:new MutationObserver(e)},e.decorators=[{type:r.Injectable,args:[{providedIn:"root"}]}],e.ngInjectableDef=r.defineInjectable({factory:function(){return new e},token:e,providedIn:"root"}),e}(),i=function(){function e(e){this._mutationObserverFactory=e,this._observedElements=new Map}return e.prototype.ngOnDestroy=function(){var e=this;this._observedElements.forEach(function(t,r){return e._cleanupObserver(r)})},e.prototype.observe=function(e){var t=this,o=e instanceof r.ElementRef?e.nativeElement:e;return n.Observable.create(function(e){var r=t._observeElement(o),n=r.subscribe(e);return function(){n.unsubscribe(),t._unobserveElement(o)}})},e.prototype._observeElement=function(e){if(this._observedElements.has(e))this._observedElements.get(e).count++;else{var t=new n.Subject,r=this._mutationObserverFactory.create(function(e){return t.next(e)});r&&r.observe(e,{characterData:!0,childList:!0,subtree:!0}),this._observedElements.set(e,{observer:r,stream:t,count:1})}return this._observedElements.get(e).stream},e.prototype._unobserveElement=function(e){this._observedElements.has(e)&&(--this._observedElements.get(e).count||this._cleanupObserver(e))},e.prototype._cleanupObserver=function(e){if(this._observedElements.has(e)){var t=this._observedElements.get(e),r=t.observer,n=t.stream;r&&r.disconnect(),n.complete(),this._observedElements.delete(e)}},e.decorators=[{type:r.Injectable,args:[{providedIn:"root"}]}],e.ctorParameters=function(){return[{type:s}]},e.ngInjectableDef=r.defineInjectable({factory:function(){return new e(r.inject(s))},token:e,providedIn:"root"}),e}(),c=function(){function e(e,t,n){this._contentObserver=e,this._elementRef=t,this._ngZone=n,this.event=new r.EventEmitter,this._disabled=!1,this._currentSubscription=null}return Object.defineProperty(e.prototype,"disabled",{get:function(){return this._disabled},set:function(e){this._disabled=t.coerceBooleanProperty(e),this._disabled?this._unsubscribe():this._subscribe()},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"debounce",{get:function(){return this._debounce},set:function(e){this._debounce=t.coerceNumberProperty(e),this._subscribe()},enumerable:!0,configurable:!0}),e.prototype.ngAfterContentInit=function(){this._currentSubscription||this.disabled||this._subscribe()},e.prototype.ngOnDestroy=function(){this._unsubscribe()},e.prototype._subscribe=function(){var e=this;this._unsubscribe();var t=this._contentObserver.observe(this._elementRef);this._ngZone.runOutsideAngular(function(){e._currentSubscription=(e.debounce?t.pipe(o.debounceTime(e.debounce)):t).subscribe(e.event)})},e.prototype._unsubscribe=function(){this._currentSubscription&&this._currentSubscription.unsubscribe()},e.decorators=[{type:r.Directive,args:[{selector:"[cdkObserveContent]",exportAs:"cdkObserveContent"}]}],e.ctorParameters=function(){return[{type:i},{type:r.ElementRef},{type:r.NgZone}]},e.propDecorators={event:[{type:r.Output,args:["cdkObserveContent"]}],disabled:[{type:r.Input,args:["cdkObserveContentDisabled"]}],debounce:[{type:r.Input}]},e}(),u=function(){function e(){}return e.decorators=[{type:r.NgModule,args:[{exports:[c],declarations:[c],providers:[s]}]}],e}();e.MutationObserverFactory=s,e.ContentObserver=i,e.CdkObserveContent=c,e.ObserversModule=u,Object.defineProperty(e,"__esModule",{value:!0})});
|
|
9
9
|
//# sourceMappingURL=cdk-observers.umd.min.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cdk-observers.umd.min.js","sources":["../../src/cdk/observers/observe-content.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nimport {coerceBooleanProperty, coerceNumberProperty} from '@angular/cdk/coercion';\nimport {\n AfterContentInit,\n Directive,\n ElementRef,\n EventEmitter,\n Injectable,\n Input,\n NgModule,\n NgZone,\n OnDestroy,\n Output,\n} from '@angular/core';\nimport {Observable, Subject, Subscription} from 'rxjs';\nimport {debounceTime} from 'rxjs/operators';\n\n/**\n * Factory that creates a new MutationObserver and allows us to stub it out in unit tests.\n * @docs-private\n */\n@Injectable({providedIn: 'root'})\nexport class MutationObserverFactory {\n create(callback: MutationCallback): MutationObserver | null {\n return typeof MutationObserver === 'undefined' ? null : new MutationObserver(callback);\n }\n}\n\n\n/** An injectable service that allows watching elements for changes to their content. */\n@Injectable({providedIn: 'root'})\nexport class ContentObserver implements OnDestroy {\n /** Keeps track of the existing MutationObservers so they can be reused. */\n private _observedElements = new Map<Element, {\n observer: MutationObserver | null,\n stream: Subject<MutationRecord[]>,\n count: number\n }>();\n\n constructor(private _mutationObserverFactory: MutationObserverFactory) {}\n\n ngOnDestroy() {\n this._observedElements.forEach((_, element) => this._cleanupObserver(element));\n }\n\n /**\n * Observe content changes on an element.\n * @param element The element to observe for content changes.\n */\n observe(element: Element): Observable<MutationRecord[]> {\n return Observable.create(observer => {\n const stream = this._observeElement(element);\n const subscription = stream.subscribe(observer);\n\n return () => {\n subscription.unsubscribe();\n this._unobserveElement(element);\n };\n });\n }\n\n /**\n * Observes the given element by using the existing MutationObserver if available, or creating a\n * new one if not.\n */\n private _observeElement(element: Element): Subject<MutationRecord[]> {\n if (!this._observedElements.has(element)) {\n const stream = new Subject<MutationRecord[]>();\n const observer = this._mutationObserverFactory.create(mutations => stream.next(mutations));\n if (observer) {\n observer.observe(element, {\n characterData: true,\n childList: true,\n subtree: true\n });\n }\n this._observedElements.set(element, {observer, stream, count: 1});\n } else {\n this._observedElements.get(element)!.count++;\n }\n return this._observedElements.get(element)!.stream;\n }\n\n /**\n * Un-observes the given element and cleans up the underlying MutationObserver if nobody else is\n * observing this element.\n */\n private _unobserveElement(element: Element) {\n if (this._observedElements.has(element)) {\n this._observedElements.get(element)!.count--;\n if (!this._observedElements.get(element)!.count) {\n this._cleanupObserver(element);\n }\n }\n }\n\n /** Clean up the underlying MutationObserver for the specified element. */\n private _cleanupObserver(element: Element) {\n if (this._observedElements.has(element)) {\n const {observer, stream} = this._observedElements.get(element)!;\n if (observer) {\n observer.disconnect();\n }\n stream.complete();\n this._observedElements.delete(element);\n }\n }\n}\n\n\n/**\n * Directive that triggers a callback whenever the content of\n * its associated element has changed.\n */\n@Directive({\n selector: '[cdkObserveContent]',\n exportAs: 'cdkObserveContent',\n})\nexport class CdkObserveContent implements AfterContentInit, OnDestroy {\n /** Event emitted for each change in the element's content. */\n @Output('cdkObserveContent') event = new EventEmitter<MutationRecord[]>();\n\n /**\n * Whether observing content is disabled. This option can be used\n * to disconnect the underlying MutationObserver until it is needed.\n */\n @Input('cdkObserveContentDisabled')\n get disabled() { return this._disabled; }\n set disabled(value: any) {\n this._disabled = coerceBooleanProperty(value);\n if (this._disabled) {\n this._unsubscribe();\n } else {\n this._subscribe();\n }\n }\n private _disabled = false;\n\n /** Debounce interval for emitting the changes. */\n @Input()\n get debounce(): number { return this._debounce; }\n set debounce(value: number) {\n this._debounce = coerceNumberProperty(value);\n this._subscribe();\n }\n private _debounce: number;\n\n private _currentSubscription: Subscription | null = null;\n\n constructor(private _contentObserver: ContentObserver, private _elementRef: ElementRef,\n private _ngZone: NgZone) {}\n\n ngAfterContentInit() {\n if (!this._currentSubscription && !this.disabled) {\n this._subscribe();\n }\n }\n\n ngOnDestroy() {\n this._unsubscribe();\n }\n\n private _subscribe() {\n this._unsubscribe();\n const stream = this._contentObserver.observe(this._elementRef.nativeElement);\n\n // TODO(mmalerba): We shouldn't be emitting on this @Output() outside the zone.\n // Consider brining it back inside the zone next time we're making breaking changes.\n // Bringing it back inside can cause things like infinite change detection loops and changed\n // after checked errors if people's code isn't handling it properly.\n this._ngZone.runOutsideAngular(() => {\n this._currentSubscription =\n (this.debounce ? stream.pipe(debounceTime(this.debounce)) : stream).subscribe(this.event);\n });\n }\n\n private _unsubscribe() {\n if (this._currentSubscription) {\n this._currentSubscription.unsubscribe();\n }\n }\n}\n\n\n@NgModule({\n exports: [CdkObserveContent],\n declarations: [CdkObserveContent],\n providers: [MutationObserverFactory]\n})\nexport class ObserversModule {}\n"],"names":["MutationObserverFactory","prototype","create","callback","MutationObserver","type","Injectable","args","providedIn","ContentObserver","_mutationObserverFactory","this","_observedElements","Map","ngOnDestroy","_this","forEach","_","element","_cleanupObserver","observe","Observable","observer","stream","_observeElement","subscription","subscribe","unsubscribe","_unobserveElement","has","get","count","stream_1","Subject","mutations","next","characterData","childList","subtree","set","_a","disconnect","complete","delete","CdkObserveContent","_contentObserver","_elementRef","_ngZone","event","EventEmitter","_disabled","_currentSubscription","Object","defineProperty","value","coerceBooleanProperty","_unsubscribe","_subscribe","_debounce","coerceNumberProperty","ngAfterContentInit","disabled","nativeElement","runOutsideAngular","debounce","pipe","debounceTime","Directive","selector","exportAs","ElementRef","NgZone","Output","Input","ObserversModule","NgModule","exports","declarations","providers"],"mappings":";;;;;;;igBAAA,MA8BEA,GAAFC,UAAAC,OAAE,SAAOC,GACL,MAAmC,mBAArBC,kBAAmC,KAAO,GAAIA,kBAAiBD,mBAHjFE,KAACC,EAAAA,WAADC,OAAaC,WAAY,8GA5BzBR,kBA8CE,QAAFS,GAAsBC,GAAAC,KAAtBD,yBAAsBA,EANtBC,KAAAC,kBAA8B,GAAIC,KAxClC,MAgDEJ,GAAFR,UAAAa,YAAE,WAAA,GAAFC,GAAAJ,IACIA,MA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EAAAA,SAADpE,OACEqE,SAAUhC,GACViC,cAAejC,GACfkC,WAAY9E,OAlMd0E"}
|
|
1
|
+
{"version":3,"file":"cdk-observers.umd.min.js","sources":["../../src/cdk/observers/observe-content.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nimport {coerceBooleanProperty, coerceNumberProperty} from '@angular/cdk/coercion';\nimport {\n AfterContentInit,\n Directive,\n ElementRef,\n EventEmitter,\n Injectable,\n Input,\n NgModule,\n NgZone,\n OnDestroy,\n Output,\n} from '@angular/core';\nimport {Observable, Subject, Subscription} from 'rxjs';\nimport {debounceTime} from 'rxjs/operators';\n\n/**\n * Factory that creates a new MutationObserver and allows us to stub it out in unit tests.\n * @docs-private\n */\n@Injectable({providedIn: 'root'})\nexport class MutationObserverFactory {\n create(callback: MutationCallback): MutationObserver | null {\n return typeof MutationObserver === 'undefined' ? null : new MutationObserver(callback);\n }\n}\n\n\n/** An injectable service that allows watching elements for changes to their content. */\n@Injectable({providedIn: 'root'})\nexport class ContentObserver implements OnDestroy {\n /** Keeps track of the existing MutationObservers so they can be reused. */\n private _observedElements = new Map<Element, {\n observer: MutationObserver | null,\n stream: Subject<MutationRecord[]>,\n count: number\n }>();\n\n constructor(private _mutationObserverFactory: MutationObserverFactory) {}\n\n ngOnDestroy() {\n this._observedElements.forEach((_, element) => this._cleanupObserver(element));\n }\n\n /**\n * Observe content changes on an element.\n * @param element The element to observe for content changes.\n */\n observe(element: Element): Observable<MutationRecord[]>;\n\n /**\n * Observe content changes on an element.\n * @param element The element to observe for content changes.\n */\n observe(element: ElementRef<Element>): Observable<MutationRecord[]>;\n\n observe(elementOrRef: Element | ElementRef<Element>): Observable<MutationRecord[]> {\n const element = elementOrRef instanceof ElementRef ? elementOrRef.nativeElement : elementOrRef;\n\n return Observable.create(observer => {\n const stream = this._observeElement(element);\n const subscription = stream.subscribe(observer);\n\n return () => {\n subscription.unsubscribe();\n this._unobserveElement(element);\n };\n });\n }\n\n /**\n * Observes the given element by using the existing MutationObserver if available, or creating a\n * new one if not.\n */\n private _observeElement(element: Element): Subject<MutationRecord[]> {\n if (!this._observedElements.has(element)) {\n const stream = new Subject<MutationRecord[]>();\n const observer = this._mutationObserverFactory.create(mutations => stream.next(mutations));\n if (observer) {\n observer.observe(element, {\n characterData: true,\n childList: true,\n subtree: true\n });\n }\n this._observedElements.set(element, {observer, stream, count: 1});\n } else {\n this._observedElements.get(element)!.count++;\n }\n return this._observedElements.get(element)!.stream;\n }\n\n /**\n * Un-observes the given element and cleans up the underlying MutationObserver if nobody else is\n * observing this element.\n */\n private _unobserveElement(element: Element) {\n if (this._observedElements.has(element)) {\n this._observedElements.get(element)!.count--;\n if (!this._observedElements.get(element)!.count) {\n this._cleanupObserver(element);\n }\n }\n }\n\n /** Clean up the underlying MutationObserver for the specified element. */\n private _cleanupObserver(element: Element) {\n if (this._observedElements.has(element)) {\n const {observer, stream} = this._observedElements.get(element)!;\n if (observer) {\n observer.disconnect();\n }\n stream.complete();\n this._observedElements.delete(element);\n }\n }\n}\n\n\n/**\n * Directive that triggers a callback whenever the content of\n * its associated element has changed.\n */\n@Directive({\n selector: '[cdkObserveContent]',\n exportAs: 'cdkObserveContent',\n})\nexport class CdkObserveContent implements AfterContentInit, OnDestroy {\n /** Event emitted for each change in the element's content. */\n @Output('cdkObserveContent') event = new EventEmitter<MutationRecord[]>();\n\n /**\n * Whether observing content is disabled. This option can be used\n * to disconnect the underlying MutationObserver until it is needed.\n */\n @Input('cdkObserveContentDisabled')\n get disabled() { return this._disabled; }\n set disabled(value: any) {\n this._disabled = coerceBooleanProperty(value);\n if (this._disabled) {\n this._unsubscribe();\n } else {\n this._subscribe();\n }\n }\n private _disabled = false;\n\n /** Debounce interval for emitting the changes. */\n @Input()\n get debounce(): number { return this._debounce; }\n set debounce(value: number) {\n this._debounce = coerceNumberProperty(value);\n this._subscribe();\n }\n private _debounce: number;\n\n private _currentSubscription: Subscription | null = null;\n\n constructor(private _contentObserver: ContentObserver,\n private _elementRef: ElementRef<HTMLElement>,\n private _ngZone: NgZone) {}\n\n ngAfterContentInit() {\n if (!this._currentSubscription && !this.disabled) {\n this._subscribe();\n }\n }\n\n ngOnDestroy() {\n this._unsubscribe();\n }\n\n private _subscribe() {\n this._unsubscribe();\n const stream = this._contentObserver.observe(this._elementRef);\n\n // TODO(mmalerba): We shouldn't be emitting on this @Output() outside the zone.\n // Consider brining it back inside the zone next time we're making breaking changes.\n // Bringing it back inside can cause things like infinite change detection loops and changed\n // after checked errors if people's code isn't handling it properly.\n this._ngZone.runOutsideAngular(() => {\n this._currentSubscription =\n (this.debounce ? stream.pipe(debounceTime(this.debounce)) : stream).subscribe(this.event);\n });\n }\n\n private _unsubscribe() {\n if (this._currentSubscription) {\n this._currentSubscription.unsubscribe();\n }\n }\n}\n\n\n@NgModule({\n exports: [CdkObserveContent],\n declarations: [CdkObserveContent],\n providers: [MutationObserverFactory]\n})\nexport class ObserversModule {}\n"],"names":["MutationObserverFactory","prototype","create","callback","MutationObserver","type","Injectable","args","providedIn","ContentObserver","_mutationObserverFactory","this","_observedElements","Map","ngOnDestroy","_this","forEach","_","element","_cleanupObserver","observe","elementOrRef","ElementRef","nativeElement","Observable","observer","stream","_observeElement","subscription","subscribe","unsubscribe","_unobserveElement","has","get","count","stream_1","Subject","mutations","next","characterData","childList","subtree","set","_a","disconnect","complete","delete","CdkObserveContent","_contentObserver","_elementRef","_ngZone","event","EventEmitter","_disabled","_currentSubscription","Object","defineProperty","value","coerceBooleanProperty","_unsubscribe","_subscribe","_debounce","coerceNumberProperty","ngAfterContentInit","disabled","runOutsideAngular","debounce","pipe","debounceTime","Directive","selector","exportAs","NgZone","Output","Input","ObserversModule","NgModule","exports","declarations","providers"],"mappings":";;;;;;;igBAAA,MA8BEA,GAAFC,UAAAC,OAAE,SAAOC,GACL,MAAmC,mBAArBC,kBAAmC,KAAO,GAAIA,kBA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AaI,IA1BbJ,KAAEiB,EAAAA,aAKFjB,KAAEmE,EAAAA,4BAwHFrB,QAAA9C,KAAGoE,EAAAA,OAAHlE,MAAU,uBAMVyD,WAAA3D,KAAGqE,EAAAA,MAAHnE,MAAS,+BAaT2D,WAAA7D,KAAGqE,EAAAA,SA5JH3B,KAuIA4B,EAAA,yBAvIA,sBA0MAtE,KAACuE,EAAAA,SAADrE,OACEsE,SAAU9B,GACV+B,cAAe/B,GACfgC,WAAY/E,OA7Md2E"}
|
|
@@ -995,6 +995,9 @@ OverlayRef = /** @class */ (function () {
|
|
|
995
995
|
this._config.positionStrategy.attach(this);
|
|
996
996
|
}
|
|
997
997
|
// Update the pane element with the given configuration.
|
|
998
|
+
if (!this._host.parentElement && this._previousHostParent) {
|
|
999
|
+
this._previousHostParent.appendChild(this._host);
|
|
1000
|
+
}
|
|
998
1001
|
this._updateStackingOrder();
|
|
999
1002
|
this._updateElementSize();
|
|
1000
1003
|
this._updateElementDirection();
|
|
@@ -1040,6 +1043,7 @@ OverlayRef = /** @class */ (function () {
|
|
|
1040
1043
|
* @return {?} The portal detachment result.
|
|
1041
1044
|
*/
|
|
1042
1045
|
function () {
|
|
1046
|
+
var _this = this;
|
|
1043
1047
|
if (!this.hasAttached()) {
|
|
1044
1048
|
return;
|
|
1045
1049
|
}
|
|
@@ -1062,6 +1066,24 @@ OverlayRef = /** @class */ (function () {
|
|
|
1062
1066
|
this._detachments.next();
|
|
1063
1067
|
// Remove this overlay from keyboard dispatcher tracking.
|
|
1064
1068
|
this._keyboardDispatcher.remove(this);
|
|
1069
|
+
// Keeping the host element in DOM the can cause scroll jank, because it still gets rendered,
|
|
1070
|
+
// even though it's transparent and unclickable. We can't remove the host here immediately,
|
|
1071
|
+
// because the overlay pane's content might still be animating. This stream helps us avoid
|
|
1072
|
+
// interrupting the animation by waiting for the pane to become empty.
|
|
1073
|
+
var /** @type {?} */ subscription = this._ngZone.onStable
|
|
1074
|
+
.asObservable()
|
|
1075
|
+
.pipe(operators.takeUntil(rxjs.merge(this._attachments, this._detachments)))
|
|
1076
|
+
.subscribe(function () {
|
|
1077
|
+
// Needs a couple of checks for the pane and host, because
|
|
1078
|
+
// they may have been removed by the time the zone stabilizes.
|
|
1079
|
+
if (!_this._pane || !_this._host || _this._pane.children.length === 0) {
|
|
1080
|
+
if (_this._host && _this._host.parentElement) {
|
|
1081
|
+
_this._previousHostParent = _this._host.parentElement;
|
|
1082
|
+
_this._previousHostParent.removeChild(_this._host);
|
|
1083
|
+
}
|
|
1084
|
+
subscription.unsubscribe();
|
|
1085
|
+
}
|
|
1086
|
+
});
|
|
1065
1087
|
return detachmentResult;
|
|
1066
1088
|
};
|
|
1067
1089
|
/** Cleans up the overlay from the DOM. */
|
|
@@ -1091,7 +1113,7 @@ OverlayRef = /** @class */ (function () {
|
|
|
1091
1113
|
this._host.parentNode.removeChild(this._host);
|
|
1092
1114
|
this._host = /** @type {?} */ ((null));
|
|
1093
1115
|
}
|
|
1094
|
-
this._pane = /** @type {?} */ ((null));
|
|
1116
|
+
this._previousHostParent = this._pane = /** @type {?} */ ((null));
|
|
1095
1117
|
if (isAttached) {
|
|
1096
1118
|
this._detachments.next();
|
|
1097
1119
|
}
|