[6a3a178] | 1 | (function (global, factory) {
|
---|
| 2 | typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/cdk/table'), require('@angular/cdk/collections'), require('@angular/material/core'), require('@angular/cdk/coercion'), require('rxjs'), require('rxjs/operators')) :
|
---|
| 3 | typeof define === 'function' && define.amd ? define('@angular/material/table', ['exports', '@angular/core', '@angular/cdk/table', '@angular/cdk/collections', '@angular/material/core', '@angular/cdk/coercion', 'rxjs', 'rxjs/operators'], factory) :
|
---|
| 4 | (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.ng = global.ng || {}, global.ng.material = global.ng.material || {}, global.ng.material.table = {}), global.ng.core, global.ng.cdk.table, global.ng.cdk.collections, global.ng.material.core, global.ng.cdk.coercion, global.rxjs, global.rxjs.operators));
|
---|
| 5 | }(this, (function (exports, core, table, collections, core$1, coercion, rxjs, operators) { 'use strict';
|
---|
| 6 |
|
---|
| 7 | /*! *****************************************************************************
|
---|
| 8 | Copyright (c) Microsoft Corporation.
|
---|
| 9 |
|
---|
| 10 | Permission to use, copy, modify, and/or distribute this software for any
|
---|
| 11 | purpose with or without fee is hereby granted.
|
---|
| 12 |
|
---|
| 13 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
---|
| 14 | REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
---|
| 15 | AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
---|
| 16 | INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
---|
| 17 | LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
---|
| 18 | OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
---|
| 19 | PERFORMANCE OF THIS SOFTWARE.
|
---|
| 20 | ***************************************************************************** */
|
---|
| 21 | /* global Reflect, Promise */
|
---|
| 22 | var extendStatics = function (d, b) {
|
---|
| 23 | extendStatics = Object.setPrototypeOf ||
|
---|
| 24 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
---|
| 25 | function (d, b) { for (var p in b)
|
---|
| 26 | if (Object.prototype.hasOwnProperty.call(b, p))
|
---|
| 27 | d[p] = b[p]; };
|
---|
| 28 | return extendStatics(d, b);
|
---|
| 29 | };
|
---|
| 30 | function __extends(d, b) {
|
---|
| 31 | if (typeof b !== "function" && b !== null)
|
---|
| 32 | throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
---|
| 33 | extendStatics(d, b);
|
---|
| 34 | function __() { this.constructor = d; }
|
---|
| 35 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
---|
| 36 | }
|
---|
| 37 | var __assign = function () {
|
---|
| 38 | __assign = Object.assign || function __assign(t) {
|
---|
| 39 | for (var s, i = 1, n = arguments.length; i < n; i++) {
|
---|
| 40 | s = arguments[i];
|
---|
| 41 | for (var p in s)
|
---|
| 42 | if (Object.prototype.hasOwnProperty.call(s, p))
|
---|
| 43 | t[p] = s[p];
|
---|
| 44 | }
|
---|
| 45 | return t;
|
---|
| 46 | };
|
---|
| 47 | return __assign.apply(this, arguments);
|
---|
| 48 | };
|
---|
| 49 | function __rest(s, e) {
|
---|
| 50 | var t = {};
|
---|
| 51 | for (var p in s)
|
---|
| 52 | if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
---|
| 53 | t[p] = s[p];
|
---|
| 54 | if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
---|
| 55 | for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
---|
| 56 | if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
---|
| 57 | t[p[i]] = s[p[i]];
|
---|
| 58 | }
|
---|
| 59 | return t;
|
---|
| 60 | }
|
---|
| 61 | function __decorate(decorators, target, key, desc) {
|
---|
| 62 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
---|
| 63 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
---|
| 64 | r = Reflect.decorate(decorators, target, key, desc);
|
---|
| 65 | else
|
---|
| 66 | for (var i = decorators.length - 1; i >= 0; i--)
|
---|
| 67 | if (d = decorators[i])
|
---|
| 68 | r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
---|
| 69 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
---|
| 70 | }
|
---|
| 71 | function __param(paramIndex, decorator) {
|
---|
| 72 | return function (target, key) { decorator(target, key, paramIndex); };
|
---|
| 73 | }
|
---|
| 74 | function __metadata(metadataKey, metadataValue) {
|
---|
| 75 | if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
---|
| 76 | return Reflect.metadata(metadataKey, metadataValue);
|
---|
| 77 | }
|
---|
| 78 | function __awaiter(thisArg, _arguments, P, generator) {
|
---|
| 79 | function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
---|
| 80 | return new (P || (P = Promise))(function (resolve, reject) {
|
---|
| 81 | function fulfilled(value) { try {
|
---|
| 82 | step(generator.next(value));
|
---|
| 83 | }
|
---|
| 84 | catch (e) {
|
---|
| 85 | reject(e);
|
---|
| 86 | } }
|
---|
| 87 | function rejected(value) { try {
|
---|
| 88 | step(generator["throw"](value));
|
---|
| 89 | }
|
---|
| 90 | catch (e) {
|
---|
| 91 | reject(e);
|
---|
| 92 | } }
|
---|
| 93 | function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
---|
| 94 | step((generator = generator.apply(thisArg, _arguments || [])).next());
|
---|
| 95 | });
|
---|
| 96 | }
|
---|
| 97 | function __generator(thisArg, body) {
|
---|
| 98 | var _ = { label: 0, sent: function () { if (t[0] & 1)
|
---|
| 99 | throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
---|
| 100 | return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function () { return this; }), g;
|
---|
| 101 | function verb(n) { return function (v) { return step([n, v]); }; }
|
---|
| 102 | function step(op) {
|
---|
| 103 | if (f)
|
---|
| 104 | throw new TypeError("Generator is already executing.");
|
---|
| 105 | while (_)
|
---|
| 106 | try {
|
---|
| 107 | if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done)
|
---|
| 108 | return t;
|
---|
| 109 | if (y = 0, t)
|
---|
| 110 | op = [op[0] & 2, t.value];
|
---|
| 111 | switch (op[0]) {
|
---|
| 112 | case 0:
|
---|
| 113 | case 1:
|
---|
| 114 | t = op;
|
---|
| 115 | break;
|
---|
| 116 | case 4:
|
---|
| 117 | _.label++;
|
---|
| 118 | return { value: op[1], done: false };
|
---|
| 119 | case 5:
|
---|
| 120 | _.label++;
|
---|
| 121 | y = op[1];
|
---|
| 122 | op = [0];
|
---|
| 123 | continue;
|
---|
| 124 | case 7:
|
---|
| 125 | op = _.ops.pop();
|
---|
| 126 | _.trys.pop();
|
---|
| 127 | continue;
|
---|
| 128 | default:
|
---|
| 129 | if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
---|
| 130 | _ = 0;
|
---|
| 131 | continue;
|
---|
| 132 | }
|
---|
| 133 | if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) {
|
---|
| 134 | _.label = op[1];
|
---|
| 135 | break;
|
---|
| 136 | }
|
---|
| 137 | if (op[0] === 6 && _.label < t[1]) {
|
---|
| 138 | _.label = t[1];
|
---|
| 139 | t = op;
|
---|
| 140 | break;
|
---|
| 141 | }
|
---|
| 142 | if (t && _.label < t[2]) {
|
---|
| 143 | _.label = t[2];
|
---|
| 144 | _.ops.push(op);
|
---|
| 145 | break;
|
---|
| 146 | }
|
---|
| 147 | if (t[2])
|
---|
| 148 | _.ops.pop();
|
---|
| 149 | _.trys.pop();
|
---|
| 150 | continue;
|
---|
| 151 | }
|
---|
| 152 | op = body.call(thisArg, _);
|
---|
| 153 | }
|
---|
| 154 | catch (e) {
|
---|
| 155 | op = [6, e];
|
---|
| 156 | y = 0;
|
---|
| 157 | }
|
---|
| 158 | finally {
|
---|
| 159 | f = t = 0;
|
---|
| 160 | }
|
---|
| 161 | if (op[0] & 5)
|
---|
| 162 | throw op[1];
|
---|
| 163 | return { value: op[0] ? op[1] : void 0, done: true };
|
---|
| 164 | }
|
---|
| 165 | }
|
---|
| 166 | var __createBinding = Object.create ? (function (o, m, k, k2) {
|
---|
| 167 | if (k2 === undefined)
|
---|
| 168 | k2 = k;
|
---|
| 169 | Object.defineProperty(o, k2, { enumerable: true, get: function () { return m[k]; } });
|
---|
| 170 | }) : (function (o, m, k, k2) {
|
---|
| 171 | if (k2 === undefined)
|
---|
| 172 | k2 = k;
|
---|
| 173 | o[k2] = m[k];
|
---|
| 174 | });
|
---|
| 175 | function __exportStar(m, o) {
|
---|
| 176 | for (var p in m)
|
---|
| 177 | if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p))
|
---|
| 178 | __createBinding(o, m, p);
|
---|
| 179 | }
|
---|
| 180 | function __values(o) {
|
---|
| 181 | var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
---|
| 182 | if (m)
|
---|
| 183 | return m.call(o);
|
---|
| 184 | if (o && typeof o.length === "number")
|
---|
| 185 | return {
|
---|
| 186 | next: function () {
|
---|
| 187 | if (o && i >= o.length)
|
---|
| 188 | o = void 0;
|
---|
| 189 | return { value: o && o[i++], done: !o };
|
---|
| 190 | }
|
---|
| 191 | };
|
---|
| 192 | throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
---|
| 193 | }
|
---|
| 194 | function __read(o, n) {
|
---|
| 195 | var m = typeof Symbol === "function" && o[Symbol.iterator];
|
---|
| 196 | if (!m)
|
---|
| 197 | return o;
|
---|
| 198 | var i = m.call(o), r, ar = [], e;
|
---|
| 199 | try {
|
---|
| 200 | while ((n === void 0 || n-- > 0) && !(r = i.next()).done)
|
---|
| 201 | ar.push(r.value);
|
---|
| 202 | }
|
---|
| 203 | catch (error) {
|
---|
| 204 | e = { error: error };
|
---|
| 205 | }
|
---|
| 206 | finally {
|
---|
| 207 | try {
|
---|
| 208 | if (r && !r.done && (m = i["return"]))
|
---|
| 209 | m.call(i);
|
---|
| 210 | }
|
---|
| 211 | finally {
|
---|
| 212 | if (e)
|
---|
| 213 | throw e.error;
|
---|
| 214 | }
|
---|
| 215 | }
|
---|
| 216 | return ar;
|
---|
| 217 | }
|
---|
| 218 | /** @deprecated */
|
---|
| 219 | function __spread() {
|
---|
| 220 | for (var ar = [], i = 0; i < arguments.length; i++)
|
---|
| 221 | ar = ar.concat(__read(arguments[i]));
|
---|
| 222 | return ar;
|
---|
| 223 | }
|
---|
| 224 | /** @deprecated */
|
---|
| 225 | function __spreadArrays() {
|
---|
| 226 | for (var s = 0, i = 0, il = arguments.length; i < il; i++)
|
---|
| 227 | s += arguments[i].length;
|
---|
| 228 | for (var r = Array(s), k = 0, i = 0; i < il; i++)
|
---|
| 229 | for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
|
---|
| 230 | r[k] = a[j];
|
---|
| 231 | return r;
|
---|
| 232 | }
|
---|
| 233 | function __spreadArray(to, from, pack) {
|
---|
| 234 | if (pack || arguments.length === 2)
|
---|
| 235 | for (var i = 0, l = from.length, ar; i < l; i++) {
|
---|
| 236 | if (ar || !(i in from)) {
|
---|
| 237 | if (!ar)
|
---|
| 238 | ar = Array.prototype.slice.call(from, 0, i);
|
---|
| 239 | ar[i] = from[i];
|
---|
| 240 | }
|
---|
| 241 | }
|
---|
| 242 | return to.concat(ar || from);
|
---|
| 243 | }
|
---|
| 244 | function __await(v) {
|
---|
| 245 | return this instanceof __await ? (this.v = v, this) : new __await(v);
|
---|
| 246 | }
|
---|
| 247 | function __asyncGenerator(thisArg, _arguments, generator) {
|
---|
| 248 | if (!Symbol.asyncIterator)
|
---|
| 249 | throw new TypeError("Symbol.asyncIterator is not defined.");
|
---|
| 250 | var g = generator.apply(thisArg, _arguments || []), i, q = [];
|
---|
| 251 | return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
|
---|
| 252 | function verb(n) { if (g[n])
|
---|
| 253 | i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
|
---|
| 254 | function resume(n, v) { try {
|
---|
| 255 | step(g[n](v));
|
---|
| 256 | }
|
---|
| 257 | catch (e) {
|
---|
| 258 | settle(q[0][3], e);
|
---|
| 259 | } }
|
---|
| 260 | function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
|
---|
| 261 | function fulfill(value) { resume("next", value); }
|
---|
| 262 | function reject(value) { resume("throw", value); }
|
---|
| 263 | function settle(f, v) { if (f(v), q.shift(), q.length)
|
---|
| 264 | resume(q[0][0], q[0][1]); }
|
---|
| 265 | }
|
---|
| 266 | function __asyncDelegator(o) {
|
---|
| 267 | var i, p;
|
---|
| 268 | return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
|
---|
| 269 | function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; }
|
---|
| 270 | }
|
---|
| 271 | function __asyncValues(o) {
|
---|
| 272 | if (!Symbol.asyncIterator)
|
---|
| 273 | throw new TypeError("Symbol.asyncIterator is not defined.");
|
---|
| 274 | var m = o[Symbol.asyncIterator], i;
|
---|
| 275 | return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
|
---|
| 276 | function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
|
---|
| 277 | function settle(resolve, reject, d, v) { Promise.resolve(v).then(function (v) { resolve({ value: v, done: d }); }, reject); }
|
---|
| 278 | }
|
---|
| 279 | function __makeTemplateObject(cooked, raw) {
|
---|
| 280 | if (Object.defineProperty) {
|
---|
| 281 | Object.defineProperty(cooked, "raw", { value: raw });
|
---|
| 282 | }
|
---|
| 283 | else {
|
---|
| 284 | cooked.raw = raw;
|
---|
| 285 | }
|
---|
| 286 | return cooked;
|
---|
| 287 | }
|
---|
| 288 | ;
|
---|
| 289 | var __setModuleDefault = Object.create ? (function (o, v) {
|
---|
| 290 | Object.defineProperty(o, "default", { enumerable: true, value: v });
|
---|
| 291 | }) : function (o, v) {
|
---|
| 292 | o["default"] = v;
|
---|
| 293 | };
|
---|
| 294 | function __importStar(mod) {
|
---|
| 295 | if (mod && mod.__esModule)
|
---|
| 296 | return mod;
|
---|
| 297 | var result = {};
|
---|
| 298 | if (mod != null)
|
---|
| 299 | for (var k in mod)
|
---|
| 300 | if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
|
---|
| 301 | __createBinding(result, mod, k);
|
---|
| 302 | __setModuleDefault(result, mod);
|
---|
| 303 | return result;
|
---|
| 304 | }
|
---|
| 305 | function __importDefault(mod) {
|
---|
| 306 | return (mod && mod.__esModule) ? mod : { default: mod };
|
---|
| 307 | }
|
---|
| 308 | function __classPrivateFieldGet(receiver, state, kind, f) {
|
---|
| 309 | if (kind === "a" && !f)
|
---|
| 310 | throw new TypeError("Private accessor was defined without a getter");
|
---|
| 311 | if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
---|
| 312 | throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
---|
| 313 | return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
---|
| 314 | }
|
---|
| 315 | function __classPrivateFieldSet(receiver, state, value, kind, f) {
|
---|
| 316 | if (kind === "m")
|
---|
| 317 | throw new TypeError("Private method is not writable");
|
---|
| 318 | if (kind === "a" && !f)
|
---|
| 319 | throw new TypeError("Private accessor was defined without a setter");
|
---|
| 320 | if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
---|
| 321 | throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
---|
| 322 | return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
---|
| 323 | }
|
---|
| 324 |
|
---|
| 325 | /**
|
---|
| 326 | * Enables the recycle view repeater strategy, which reduces rendering latency. Not compatible with
|
---|
| 327 | * tables that animate rows.
|
---|
| 328 | */
|
---|
| 329 | var MatRecycleRows = /** @class */ (function () {
|
---|
| 330 | function MatRecycleRows() {
|
---|
| 331 | }
|
---|
| 332 | return MatRecycleRows;
|
---|
| 333 | }());
|
---|
| 334 | MatRecycleRows.decorators = [
|
---|
| 335 | { type: core.Directive, args: [{
|
---|
| 336 | selector: 'mat-table[recycleRows], table[mat-table][recycleRows]',
|
---|
| 337 | providers: [
|
---|
| 338 | { provide: collections._VIEW_REPEATER_STRATEGY, useClass: collections._RecycleViewRepeaterStrategy },
|
---|
| 339 | ],
|
---|
| 340 | },] }
|
---|
| 341 | ];
|
---|
| 342 | /**
|
---|
| 343 | * Wrapper for the CdkTable with Material design styles.
|
---|
| 344 | */
|
---|
| 345 | var MatTable = /** @class */ (function (_super) {
|
---|
| 346 | __extends(MatTable, _super);
|
---|
| 347 | function MatTable() {
|
---|
| 348 | var _this = _super.apply(this, __spreadArray([], __read(arguments))) || this;
|
---|
| 349 | /** Overrides the sticky CSS class set by the `CdkTable`. */
|
---|
| 350 | _this.stickyCssClass = 'mat-table-sticky';
|
---|
| 351 | /** Overrides the need to add position: sticky on every sticky cell element in `CdkTable`. */
|
---|
| 352 | _this.needsPositionStickyOnElement = false;
|
---|
| 353 | return _this;
|
---|
| 354 | }
|
---|
| 355 | return MatTable;
|
---|
| 356 | }(table.CdkTable));
|
---|
| 357 | MatTable.decorators = [
|
---|
| 358 | { type: core.Component, args: [{
|
---|
| 359 | selector: 'mat-table, table[mat-table]',
|
---|
| 360 | exportAs: 'matTable',
|
---|
| 361 | template: table.CDK_TABLE_TEMPLATE,
|
---|
| 362 | host: {
|
---|
| 363 | 'class': 'mat-table',
|
---|
| 364 | '[class.mat-table-fixed-layout]': 'fixedLayout',
|
---|
| 365 | },
|
---|
| 366 | providers: [
|
---|
| 367 | // TODO(michaeljamesparsons) Abstract the view repeater strategy to a directive API so this code
|
---|
| 368 | // is only included in the build if used.
|
---|
| 369 | { provide: collections._VIEW_REPEATER_STRATEGY, useClass: collections._DisposeViewRepeaterStrategy },
|
---|
| 370 | { provide: table.CdkTable, useExisting: MatTable },
|
---|
| 371 | { provide: table.CDK_TABLE, useExisting: MatTable },
|
---|
| 372 | { provide: table._COALESCED_STYLE_SCHEDULER, useClass: table._CoalescedStyleScheduler },
|
---|
| 373 | // Prevent nested tables from seeing this table's StickyPositioningListener.
|
---|
| 374 | { provide: table.STICKY_POSITIONING_LISTENER, useValue: null },
|
---|
| 375 | ],
|
---|
| 376 | encapsulation: core.ViewEncapsulation.None,
|
---|
| 377 | // See note on CdkTable for explanation on why this uses the default change detection strategy.
|
---|
| 378 | // tslint:disable-next-line:validate-decorators
|
---|
| 379 | changeDetection: core.ChangeDetectionStrategy.Default,
|
---|
| 380 | styles: ["mat-table{display:block}mat-header-row{min-height:56px}mat-row,mat-footer-row{min-height:48px}mat-row,mat-header-row,mat-footer-row{display:flex;border-width:0;border-bottom-width:1px;border-style:solid;align-items:center;box-sizing:border-box}mat-row::after,mat-header-row::after,mat-footer-row::after{display:inline-block;min-height:inherit;content:\"\"}mat-cell:first-of-type,mat-header-cell:first-of-type,mat-footer-cell:first-of-type{padding-left:24px}[dir=rtl] mat-cell:first-of-type:not(:only-of-type),[dir=rtl] mat-header-cell:first-of-type:not(:only-of-type),[dir=rtl] mat-footer-cell:first-of-type:not(:only-of-type){padding-left:0;padding-right:24px}mat-cell:last-of-type,mat-header-cell:last-of-type,mat-footer-cell:last-of-type{padding-right:24px}[dir=rtl] mat-cell:last-of-type:not(:only-of-type),[dir=rtl] mat-header-cell:last-of-type:not(:only-of-type),[dir=rtl] mat-footer-cell:last-of-type:not(:only-of-type){padding-right:0;padding-left:24px}mat-cell,mat-header-cell,mat-footer-cell{flex:1;display:flex;align-items:center;overflow:hidden;word-wrap:break-word;min-height:inherit}table.mat-table{border-spacing:0}tr.mat-header-row{height:56px}tr.mat-row,tr.mat-footer-row{height:48px}th.mat-header-cell{text-align:left}[dir=rtl] th.mat-header-cell{text-align:right}th.mat-header-cell,td.mat-cell,td.mat-footer-cell{padding:0;border-bottom-width:1px;border-bottom-style:solid}th.mat-header-cell:first-of-type,td.mat-cell:first-of-type,td.mat-footer-cell:first-of-type{padding-left:24px}[dir=rtl] th.mat-header-cell:first-of-type:not(:only-of-type),[dir=rtl] td.mat-cell:first-of-type:not(:only-of-type),[dir=rtl] td.mat-footer-cell:first-of-type:not(:only-of-type){padding-left:0;padding-right:24px}th.mat-header-cell:last-of-type,td.mat-cell:last-of-type,td.mat-footer-cell:last-of-type{padding-right:24px}[dir=rtl] th.mat-header-cell:last-of-type:not(:only-of-type),[dir=rtl] td.mat-cell:last-of-type:not(:only-of-type),[dir=rtl] td.mat-footer-cell:last-of-type:not(:only-of-type){padding-right:0;padding-left:24px}.mat-table-sticky{position:-webkit-sticky !important;position:sticky !important}.mat-table-fixed-layout{table-layout:fixed}\n"]
|
---|
| 381 | },] }
|
---|
| 382 | ];
|
---|
| 383 |
|
---|
| 384 | /**
|
---|
| 385 | * Cell definition for the mat-table.
|
---|
| 386 | * Captures the template of a column's data row cell as well as cell-specific properties.
|
---|
| 387 | */
|
---|
| 388 | var MatCellDef = /** @class */ (function (_super) {
|
---|
| 389 | __extends(MatCellDef, _super);
|
---|
| 390 | function MatCellDef() {
|
---|
| 391 | return _super !== null && _super.apply(this, arguments) || this;
|
---|
| 392 | }
|
---|
| 393 | return MatCellDef;
|
---|
| 394 | }(table.CdkCellDef));
|
---|
| 395 | MatCellDef.decorators = [
|
---|
| 396 | { type: core.Directive, args: [{
|
---|
| 397 | selector: '[matCellDef]',
|
---|
| 398 | providers: [{ provide: table.CdkCellDef, useExisting: MatCellDef }]
|
---|
| 399 | },] }
|
---|
| 400 | ];
|
---|
| 401 | /**
|
---|
| 402 | * Header cell definition for the mat-table.
|
---|
| 403 | * Captures the template of a column's header cell and as well as cell-specific properties.
|
---|
| 404 | */
|
---|
| 405 | var MatHeaderCellDef = /** @class */ (function (_super) {
|
---|
| 406 | __extends(MatHeaderCellDef, _super);
|
---|
| 407 | function MatHeaderCellDef() {
|
---|
| 408 | return _super !== null && _super.apply(this, arguments) || this;
|
---|
| 409 | }
|
---|
| 410 | return MatHeaderCellDef;
|
---|
| 411 | }(table.CdkHeaderCellDef));
|
---|
| 412 | MatHeaderCellDef.decorators = [
|
---|
| 413 | { type: core.Directive, args: [{
|
---|
| 414 | selector: '[matHeaderCellDef]',
|
---|
| 415 | providers: [{ provide: table.CdkHeaderCellDef, useExisting: MatHeaderCellDef }]
|
---|
| 416 | },] }
|
---|
| 417 | ];
|
---|
| 418 | /**
|
---|
| 419 | * Footer cell definition for the mat-table.
|
---|
| 420 | * Captures the template of a column's footer cell and as well as cell-specific properties.
|
---|
| 421 | */
|
---|
| 422 | var MatFooterCellDef = /** @class */ (function (_super) {
|
---|
| 423 | __extends(MatFooterCellDef, _super);
|
---|
| 424 | function MatFooterCellDef() {
|
---|
| 425 | return _super !== null && _super.apply(this, arguments) || this;
|
---|
| 426 | }
|
---|
| 427 | return MatFooterCellDef;
|
---|
| 428 | }(table.CdkFooterCellDef));
|
---|
| 429 | MatFooterCellDef.decorators = [
|
---|
| 430 | { type: core.Directive, args: [{
|
---|
| 431 | selector: '[matFooterCellDef]',
|
---|
| 432 | providers: [{ provide: table.CdkFooterCellDef, useExisting: MatFooterCellDef }]
|
---|
| 433 | },] }
|
---|
| 434 | ];
|
---|
| 435 | /**
|
---|
| 436 | * Column definition for the mat-table.
|
---|
| 437 | * Defines a set of cells available for a table column.
|
---|
| 438 | */
|
---|
| 439 | var MatColumnDef = /** @class */ (function (_super) {
|
---|
| 440 | __extends(MatColumnDef, _super);
|
---|
| 441 | function MatColumnDef() {
|
---|
| 442 | return _super !== null && _super.apply(this, arguments) || this;
|
---|
| 443 | }
|
---|
| 444 | Object.defineProperty(MatColumnDef.prototype, "name", {
|
---|
| 445 | /** Unique name for this column. */
|
---|
| 446 | get: function () { return this._name; },
|
---|
| 447 | set: function (name) { this._setNameInput(name); },
|
---|
| 448 | enumerable: false,
|
---|
| 449 | configurable: true
|
---|
| 450 | });
|
---|
| 451 | /**
|
---|
| 452 | * Add "mat-column-" prefix in addition to "cdk-column-" prefix.
|
---|
| 453 | * In the future, this will only add "mat-column-" and columnCssClassName
|
---|
| 454 | * will change from type string[] to string.
|
---|
| 455 | * @docs-private
|
---|
| 456 | */
|
---|
| 457 | MatColumnDef.prototype._updateColumnCssClassName = function () {
|
---|
| 458 | _super.prototype._updateColumnCssClassName.call(this);
|
---|
| 459 | this._columnCssClassName.push("mat-column-" + this.cssClassFriendlyName);
|
---|
| 460 | };
|
---|
| 461 | return MatColumnDef;
|
---|
| 462 | }(table.CdkColumnDef));
|
---|
| 463 | MatColumnDef.decorators = [
|
---|
| 464 | { type: core.Directive, args: [{
|
---|
| 465 | selector: '[matColumnDef]',
|
---|
| 466 | inputs: ['sticky'],
|
---|
| 467 | providers: [
|
---|
| 468 | { provide: table.CdkColumnDef, useExisting: MatColumnDef },
|
---|
| 469 | { provide: 'MAT_SORT_HEADER_COLUMN_DEF', useExisting: MatColumnDef }
|
---|
| 470 | ],
|
---|
| 471 | },] }
|
---|
| 472 | ];
|
---|
| 473 | MatColumnDef.propDecorators = {
|
---|
| 474 | name: [{ type: core.Input, args: ['matColumnDef',] }]
|
---|
| 475 | };
|
---|
| 476 | /** Header cell template container that adds the right classes and role. */
|
---|
| 477 | var MatHeaderCell = /** @class */ (function (_super) {
|
---|
| 478 | __extends(MatHeaderCell, _super);
|
---|
| 479 | function MatHeaderCell() {
|
---|
| 480 | return _super !== null && _super.apply(this, arguments) || this;
|
---|
| 481 | }
|
---|
| 482 | return MatHeaderCell;
|
---|
| 483 | }(table.CdkHeaderCell));
|
---|
| 484 | MatHeaderCell.decorators = [
|
---|
| 485 | { type: core.Directive, args: [{
|
---|
| 486 | selector: 'mat-header-cell, th[mat-header-cell]',
|
---|
| 487 | host: {
|
---|
| 488 | 'class': 'mat-header-cell',
|
---|
| 489 | 'role': 'columnheader',
|
---|
| 490 | },
|
---|
| 491 | },] }
|
---|
| 492 | ];
|
---|
| 493 | /** Footer cell template container that adds the right classes and role. */
|
---|
| 494 | var MatFooterCell = /** @class */ (function (_super) {
|
---|
| 495 | __extends(MatFooterCell, _super);
|
---|
| 496 | function MatFooterCell() {
|
---|
| 497 | return _super !== null && _super.apply(this, arguments) || this;
|
---|
| 498 | }
|
---|
| 499 | return MatFooterCell;
|
---|
| 500 | }(table.CdkFooterCell));
|
---|
| 501 | MatFooterCell.decorators = [
|
---|
| 502 | { type: core.Directive, args: [{
|
---|
| 503 | selector: 'mat-footer-cell, td[mat-footer-cell]',
|
---|
| 504 | host: {
|
---|
| 505 | 'class': 'mat-footer-cell',
|
---|
| 506 | 'role': 'gridcell',
|
---|
| 507 | },
|
---|
| 508 | },] }
|
---|
| 509 | ];
|
---|
| 510 | /** Cell template container that adds the right classes and role. */
|
---|
| 511 | var MatCell = /** @class */ (function (_super) {
|
---|
| 512 | __extends(MatCell, _super);
|
---|
| 513 | function MatCell() {
|
---|
| 514 | return _super !== null && _super.apply(this, arguments) || this;
|
---|
| 515 | }
|
---|
| 516 | return MatCell;
|
---|
| 517 | }(table.CdkCell));
|
---|
| 518 | MatCell.decorators = [
|
---|
| 519 | { type: core.Directive, args: [{
|
---|
| 520 | selector: 'mat-cell, td[mat-cell]',
|
---|
| 521 | host: {
|
---|
| 522 | 'class': 'mat-cell',
|
---|
| 523 | 'role': 'gridcell',
|
---|
| 524 | },
|
---|
| 525 | },] }
|
---|
| 526 | ];
|
---|
| 527 |
|
---|
| 528 | /**
|
---|
| 529 | * Header row definition for the mat-table.
|
---|
| 530 | * Captures the header row's template and other header properties such as the columns to display.
|
---|
| 531 | */
|
---|
| 532 | var MatHeaderRowDef = /** @class */ (function (_super) {
|
---|
| 533 | __extends(MatHeaderRowDef, _super);
|
---|
| 534 | function MatHeaderRowDef() {
|
---|
| 535 | return _super !== null && _super.apply(this, arguments) || this;
|
---|
| 536 | }
|
---|
| 537 | return MatHeaderRowDef;
|
---|
| 538 | }(table.CdkHeaderRowDef));
|
---|
| 539 | MatHeaderRowDef.decorators = [
|
---|
| 540 | { type: core.Directive, args: [{
|
---|
| 541 | selector: '[matHeaderRowDef]',
|
---|
| 542 | providers: [{ provide: table.CdkHeaderRowDef, useExisting: MatHeaderRowDef }],
|
---|
| 543 | inputs: ['columns: matHeaderRowDef', 'sticky: matHeaderRowDefSticky'],
|
---|
| 544 | },] }
|
---|
| 545 | ];
|
---|
| 546 | /**
|
---|
| 547 | * Footer row definition for the mat-table.
|
---|
| 548 | * Captures the footer row's template and other footer properties such as the columns to display.
|
---|
| 549 | */
|
---|
| 550 | var MatFooterRowDef = /** @class */ (function (_super) {
|
---|
| 551 | __extends(MatFooterRowDef, _super);
|
---|
| 552 | function MatFooterRowDef() {
|
---|
| 553 | return _super !== null && _super.apply(this, arguments) || this;
|
---|
| 554 | }
|
---|
| 555 | return MatFooterRowDef;
|
---|
| 556 | }(table.CdkFooterRowDef));
|
---|
| 557 | MatFooterRowDef.decorators = [
|
---|
| 558 | { type: core.Directive, args: [{
|
---|
| 559 | selector: '[matFooterRowDef]',
|
---|
| 560 | providers: [{ provide: table.CdkFooterRowDef, useExisting: MatFooterRowDef }],
|
---|
| 561 | inputs: ['columns: matFooterRowDef', 'sticky: matFooterRowDefSticky'],
|
---|
| 562 | },] }
|
---|
| 563 | ];
|
---|
| 564 | /**
|
---|
| 565 | * Data row definition for the mat-table.
|
---|
| 566 | * Captures the data row's template and other properties such as the columns to display and
|
---|
| 567 | * a when predicate that describes when this row should be used.
|
---|
| 568 | */
|
---|
| 569 | var MatRowDef = /** @class */ (function (_super) {
|
---|
| 570 | __extends(MatRowDef, _super);
|
---|
| 571 | function MatRowDef() {
|
---|
| 572 | return _super !== null && _super.apply(this, arguments) || this;
|
---|
| 573 | }
|
---|
| 574 | return MatRowDef;
|
---|
| 575 | }(table.CdkRowDef));
|
---|
| 576 | MatRowDef.decorators = [
|
---|
| 577 | { type: core.Directive, args: [{
|
---|
| 578 | selector: '[matRowDef]',
|
---|
| 579 | providers: [{ provide: table.CdkRowDef, useExisting: MatRowDef }],
|
---|
| 580 | inputs: ['columns: matRowDefColumns', 'when: matRowDefWhen'],
|
---|
| 581 | },] }
|
---|
| 582 | ];
|
---|
| 583 | /** Header template container that contains the cell outlet. Adds the right class and role. */
|
---|
| 584 | var MatHeaderRow = /** @class */ (function (_super) {
|
---|
| 585 | __extends(MatHeaderRow, _super);
|
---|
| 586 | function MatHeaderRow() {
|
---|
| 587 | return _super !== null && _super.apply(this, arguments) || this;
|
---|
| 588 | }
|
---|
| 589 | return MatHeaderRow;
|
---|
| 590 | }(table.CdkHeaderRow));
|
---|
| 591 | MatHeaderRow.decorators = [
|
---|
| 592 | { type: core.Component, args: [{
|
---|
| 593 | selector: 'mat-header-row, tr[mat-header-row]',
|
---|
| 594 | template: table.CDK_ROW_TEMPLATE,
|
---|
| 595 | host: {
|
---|
| 596 | 'class': 'mat-header-row',
|
---|
| 597 | 'role': 'row',
|
---|
| 598 | },
|
---|
| 599 | // See note on CdkTable for explanation on why this uses the default change detection strategy.
|
---|
| 600 | // tslint:disable-next-line:validate-decorators
|
---|
| 601 | changeDetection: core.ChangeDetectionStrategy.Default,
|
---|
| 602 | encapsulation: core.ViewEncapsulation.None,
|
---|
| 603 | exportAs: 'matHeaderRow',
|
---|
| 604 | providers: [{ provide: table.CdkHeaderRow, useExisting: MatHeaderRow }]
|
---|
| 605 | },] }
|
---|
| 606 | ];
|
---|
| 607 | /** Footer template container that contains the cell outlet. Adds the right class and role. */
|
---|
| 608 | var MatFooterRow = /** @class */ (function (_super) {
|
---|
| 609 | __extends(MatFooterRow, _super);
|
---|
| 610 | function MatFooterRow() {
|
---|
| 611 | return _super !== null && _super.apply(this, arguments) || this;
|
---|
| 612 | }
|
---|
| 613 | return MatFooterRow;
|
---|
| 614 | }(table.CdkFooterRow));
|
---|
| 615 | MatFooterRow.decorators = [
|
---|
| 616 | { type: core.Component, args: [{
|
---|
| 617 | selector: 'mat-footer-row, tr[mat-footer-row]',
|
---|
| 618 | template: table.CDK_ROW_TEMPLATE,
|
---|
| 619 | host: {
|
---|
| 620 | 'class': 'mat-footer-row',
|
---|
| 621 | 'role': 'row',
|
---|
| 622 | },
|
---|
| 623 | // See note on CdkTable for explanation on why this uses the default change detection strategy.
|
---|
| 624 | // tslint:disable-next-line:validate-decorators
|
---|
| 625 | changeDetection: core.ChangeDetectionStrategy.Default,
|
---|
| 626 | encapsulation: core.ViewEncapsulation.None,
|
---|
| 627 | exportAs: 'matFooterRow',
|
---|
| 628 | providers: [{ provide: table.CdkFooterRow, useExisting: MatFooterRow }]
|
---|
| 629 | },] }
|
---|
| 630 | ];
|
---|
| 631 | /** Data row template container that contains the cell outlet. Adds the right class and role. */
|
---|
| 632 | var MatRow = /** @class */ (function (_super) {
|
---|
| 633 | __extends(MatRow, _super);
|
---|
| 634 | function MatRow() {
|
---|
| 635 | return _super !== null && _super.apply(this, arguments) || this;
|
---|
| 636 | }
|
---|
| 637 | return MatRow;
|
---|
| 638 | }(table.CdkRow));
|
---|
| 639 | MatRow.decorators = [
|
---|
| 640 | { type: core.Component, args: [{
|
---|
| 641 | selector: 'mat-row, tr[mat-row]',
|
---|
| 642 | template: table.CDK_ROW_TEMPLATE,
|
---|
| 643 | host: {
|
---|
| 644 | 'class': 'mat-row',
|
---|
| 645 | 'role': 'row',
|
---|
| 646 | },
|
---|
| 647 | // See note on CdkTable for explanation on why this uses the default change detection strategy.
|
---|
| 648 | // tslint:disable-next-line:validate-decorators
|
---|
| 649 | changeDetection: core.ChangeDetectionStrategy.Default,
|
---|
| 650 | encapsulation: core.ViewEncapsulation.None,
|
---|
| 651 | exportAs: 'matRow',
|
---|
| 652 | providers: [{ provide: table.CdkRow, useExisting: MatRow }]
|
---|
| 653 | },] }
|
---|
| 654 | ];
|
---|
| 655 | /** Row that can be used to display a message when no data is shown in the table. */
|
---|
| 656 | var MatNoDataRow = /** @class */ (function (_super) {
|
---|
| 657 | __extends(MatNoDataRow, _super);
|
---|
| 658 | function MatNoDataRow() {
|
---|
| 659 | return _super !== null && _super.apply(this, arguments) || this;
|
---|
| 660 | }
|
---|
| 661 | return MatNoDataRow;
|
---|
| 662 | }(table.CdkNoDataRow));
|
---|
| 663 | MatNoDataRow.decorators = [
|
---|
| 664 | { type: core.Directive, args: [{
|
---|
| 665 | selector: 'ng-template[matNoDataRow]',
|
---|
| 666 | providers: [{ provide: table.CdkNoDataRow, useExisting: MatNoDataRow }],
|
---|
| 667 | },] }
|
---|
| 668 | ];
|
---|
| 669 |
|
---|
| 670 | /**
|
---|
| 671 | * Column that simply shows text content for the header and row cells. Assumes that the table
|
---|
| 672 | * is using the native table implementation (`<table>`).
|
---|
| 673 | *
|
---|
| 674 | * By default, the name of this column will be the header text and data property accessor.
|
---|
| 675 | * The header text can be overridden with the `headerText` input. Cell values can be overridden with
|
---|
| 676 | * the `dataAccessor` input. Change the text justification to the start or end using the `justify`
|
---|
| 677 | * input.
|
---|
| 678 | */
|
---|
| 679 | var MatTextColumn = /** @class */ (function (_super) {
|
---|
| 680 | __extends(MatTextColumn, _super);
|
---|
| 681 | function MatTextColumn() {
|
---|
| 682 | return _super !== null && _super.apply(this, arguments) || this;
|
---|
| 683 | }
|
---|
| 684 | return MatTextColumn;
|
---|
| 685 | }(table.CdkTextColumn));
|
---|
| 686 | MatTextColumn.decorators = [
|
---|
| 687 | { type: core.Component, args: [{
|
---|
| 688 | selector: 'mat-text-column',
|
---|
| 689 | template: "\n <ng-container matColumnDef>\n <th mat-header-cell *matHeaderCellDef [style.text-align]=\"justify\">\n {{headerText}}\n </th>\n <td mat-cell *matCellDef=\"let data\" [style.text-align]=\"justify\">\n {{dataAccessor(data, name)}}\n </td>\n </ng-container>\n ",
|
---|
| 690 | encapsulation: core.ViewEncapsulation.None,
|
---|
| 691 | // Change detection is intentionally not set to OnPush. This component's template will be provided
|
---|
| 692 | // to the table to be inserted into its view. This is problematic when change detection runs since
|
---|
| 693 | // the bindings in this template will be evaluated _after_ the table's view is evaluated, which
|
---|
| 694 | // mean's the template in the table's view will not have the updated value (and in fact will cause
|
---|
| 695 | // an ExpressionChangedAfterItHasBeenCheckedError).
|
---|
| 696 | // tslint:disable-next-line:validate-decorators
|
---|
| 697 | changeDetection: core.ChangeDetectionStrategy.Default
|
---|
| 698 | },] }
|
---|
| 699 | ];
|
---|
| 700 |
|
---|
| 701 | /**
|
---|
| 702 | * @license
|
---|
| 703 | * Copyright Google LLC All Rights Reserved.
|
---|
| 704 | *
|
---|
| 705 | * Use of this source code is governed by an MIT-style license that can be
|
---|
| 706 | * found in the LICENSE file at https://angular.io/license
|
---|
| 707 | */
|
---|
| 708 | var EXPORTED_DECLARATIONS = [
|
---|
| 709 | // Table
|
---|
| 710 | MatTable,
|
---|
| 711 | MatRecycleRows,
|
---|
| 712 | // Template defs
|
---|
| 713 | MatHeaderCellDef,
|
---|
| 714 | MatHeaderRowDef,
|
---|
| 715 | MatColumnDef,
|
---|
| 716 | MatCellDef,
|
---|
| 717 | MatRowDef,
|
---|
| 718 | MatFooterCellDef,
|
---|
| 719 | MatFooterRowDef,
|
---|
| 720 | // Cell directives
|
---|
| 721 | MatHeaderCell,
|
---|
| 722 | MatCell,
|
---|
| 723 | MatFooterCell,
|
---|
| 724 | // Row directives
|
---|
| 725 | MatHeaderRow,
|
---|
| 726 | MatRow,
|
---|
| 727 | MatFooterRow,
|
---|
| 728 | MatNoDataRow,
|
---|
| 729 | MatTextColumn,
|
---|
| 730 | ];
|
---|
| 731 | var MatTableModule = /** @class */ (function () {
|
---|
| 732 | function MatTableModule() {
|
---|
| 733 | }
|
---|
| 734 | return MatTableModule;
|
---|
| 735 | }());
|
---|
| 736 | MatTableModule.decorators = [
|
---|
| 737 | { type: core.NgModule, args: [{
|
---|
| 738 | imports: [
|
---|
| 739 | table.CdkTableModule,
|
---|
| 740 | core$1.MatCommonModule,
|
---|
| 741 | ],
|
---|
| 742 | exports: [core$1.MatCommonModule, EXPORTED_DECLARATIONS],
|
---|
| 743 | declarations: EXPORTED_DECLARATIONS,
|
---|
| 744 | },] }
|
---|
| 745 | ];
|
---|
| 746 |
|
---|
| 747 | /**
|
---|
| 748 | * Corresponds to `Number.MAX_SAFE_INTEGER`. Moved out into a variable here due to
|
---|
| 749 | * flaky browser support and the value not being defined in Closure's typings.
|
---|
| 750 | */
|
---|
| 751 | var MAX_SAFE_INTEGER = 9007199254740991;
|
---|
| 752 | /** Shared base class with MDC-based implementation. */
|
---|
| 753 | var _MatTableDataSource = /** @class */ (function (_super) {
|
---|
| 754 | __extends(_MatTableDataSource, _super);
|
---|
| 755 | function _MatTableDataSource(initialData) {
|
---|
| 756 | if (initialData === void 0) { initialData = []; }
|
---|
| 757 | var _this = _super.call(this) || this;
|
---|
| 758 | /** Stream emitting render data to the table (depends on ordered data changes). */
|
---|
| 759 | _this._renderData = new rxjs.BehaviorSubject([]);
|
---|
| 760 | /** Stream that emits when a new filter string is set on the data source. */
|
---|
| 761 | _this._filter = new rxjs.BehaviorSubject('');
|
---|
| 762 | /** Used to react to internal changes of the paginator that are made by the data source itself. */
|
---|
| 763 | _this._internalPageChanges = new rxjs.Subject();
|
---|
| 764 | /**
|
---|
| 765 | * Subscription to the changes that should trigger an update to the table's rendered rows, such
|
---|
| 766 | * as filtering, sorting, pagination, or base data changes.
|
---|
| 767 | */
|
---|
| 768 | _this._renderChangesSubscription = null;
|
---|
| 769 | /**
|
---|
| 770 | * Data accessor function that is used for accessing data properties for sorting through
|
---|
| 771 | * the default sortData function.
|
---|
| 772 | * This default function assumes that the sort header IDs (which defaults to the column name)
|
---|
| 773 | * matches the data's properties (e.g. column Xyz represents data['Xyz']).
|
---|
| 774 | * May be set to a custom function for different behavior.
|
---|
| 775 | * @param data Data object that is being accessed.
|
---|
| 776 | * @param sortHeaderId The name of the column that represents the data.
|
---|
| 777 | */
|
---|
| 778 | _this.sortingDataAccessor = function (data, sortHeaderId) {
|
---|
| 779 | var value = data[sortHeaderId];
|
---|
| 780 | if (coercion._isNumberValue(value)) {
|
---|
| 781 | var numberValue = Number(value);
|
---|
| 782 | // Numbers beyond `MAX_SAFE_INTEGER` can't be compared reliably so we
|
---|
| 783 | // leave them as strings. For more info: https://goo.gl/y5vbSg
|
---|
| 784 | return numberValue < MAX_SAFE_INTEGER ? numberValue : value;
|
---|
| 785 | }
|
---|
| 786 | return value;
|
---|
| 787 | };
|
---|
| 788 | /**
|
---|
| 789 | * Gets a sorted copy of the data array based on the state of the MatSort. Called
|
---|
| 790 | * after changes are made to the filtered data or when sort changes are emitted from MatSort.
|
---|
| 791 | * By default, the function retrieves the active sort and its direction and compares data
|
---|
| 792 | * by retrieving data using the sortingDataAccessor. May be overridden for a custom implementation
|
---|
| 793 | * of data ordering.
|
---|
| 794 | * @param data The array of data that should be sorted.
|
---|
| 795 | * @param sort The connected MatSort that holds the current sort state.
|
---|
| 796 | */
|
---|
| 797 | _this.sortData = function (data, sort) {
|
---|
| 798 | var active = sort.active;
|
---|
| 799 | var direction = sort.direction;
|
---|
| 800 | if (!active || direction == '') {
|
---|
| 801 | return data;
|
---|
| 802 | }
|
---|
| 803 | return data.sort(function (a, b) {
|
---|
| 804 | var valueA = _this.sortingDataAccessor(a, active);
|
---|
| 805 | var valueB = _this.sortingDataAccessor(b, active);
|
---|
| 806 | // If there are data in the column that can be converted to a number,
|
---|
| 807 | // it must be ensured that the rest of the data
|
---|
| 808 | // is of the same type so as not to order incorrectly.
|
---|
| 809 | var valueAType = typeof valueA;
|
---|
| 810 | var valueBType = typeof valueB;
|
---|
| 811 | if (valueAType !== valueBType) {
|
---|
| 812 | if (valueAType === 'number') {
|
---|
| 813 | valueA += '';
|
---|
| 814 | }
|
---|
| 815 | if (valueBType === 'number') {
|
---|
| 816 | valueB += '';
|
---|
| 817 | }
|
---|
| 818 | }
|
---|
| 819 | // If both valueA and valueB exist (truthy), then compare the two. Otherwise, check if
|
---|
| 820 | // one value exists while the other doesn't. In this case, existing value should come last.
|
---|
| 821 | // This avoids inconsistent results when comparing values to undefined/null.
|
---|
| 822 | // If neither value exists, return 0 (equal).
|
---|
| 823 | var comparatorResult = 0;
|
---|
| 824 | if (valueA != null && valueB != null) {
|
---|
| 825 | // Check if one value is greater than the other; if equal, comparatorResult should remain 0.
|
---|
| 826 | if (valueA > valueB) {
|
---|
| 827 | comparatorResult = 1;
|
---|
| 828 | }
|
---|
| 829 | else if (valueA < valueB) {
|
---|
| 830 | comparatorResult = -1;
|
---|
| 831 | }
|
---|
| 832 | }
|
---|
| 833 | else if (valueA != null) {
|
---|
| 834 | comparatorResult = 1;
|
---|
| 835 | }
|
---|
| 836 | else if (valueB != null) {
|
---|
| 837 | comparatorResult = -1;
|
---|
| 838 | }
|
---|
| 839 | return comparatorResult * (direction == 'asc' ? 1 : -1);
|
---|
| 840 | });
|
---|
| 841 | };
|
---|
| 842 | /**
|
---|
| 843 | * Checks if a data object matches the data source's filter string. By default, each data object
|
---|
| 844 | * is converted to a string of its properties and returns true if the filter has
|
---|
| 845 | * at least one occurrence in that string. By default, the filter string has its whitespace
|
---|
| 846 | * trimmed and the match is case-insensitive. May be overridden for a custom implementation of
|
---|
| 847 | * filter matching.
|
---|
| 848 | * @param data Data object used to check against the filter.
|
---|
| 849 | * @param filter Filter string that has been set on the data source.
|
---|
| 850 | * @returns Whether the filter matches against the data
|
---|
| 851 | */
|
---|
| 852 | _this.filterPredicate = function (data, filter) {
|
---|
| 853 | // Transform the data into a lowercase string of all property values.
|
---|
| 854 | var dataStr = Object.keys(data).reduce(function (currentTerm, key) {
|
---|
| 855 | // Use an obscure Unicode character to delimit the words in the concatenated string.
|
---|
| 856 | // This avoids matches where the values of two columns combined will match the user's query
|
---|
| 857 | // (e.g. `Flute` and `Stop` will match `Test`). The character is intended to be something
|
---|
| 858 | // that has a very low chance of being typed in by somebody in a text field. This one in
|
---|
| 859 | // particular is "White up-pointing triangle with dot" from
|
---|
| 860 | // https://en.wikipedia.org/wiki/List_of_Unicode_characters
|
---|
| 861 | return currentTerm + data[key] + '◬';
|
---|
| 862 | }, '').toLowerCase();
|
---|
| 863 | // Transform the filter by converting it to lowercase and removing whitespace.
|
---|
| 864 | var transformedFilter = filter.trim().toLowerCase();
|
---|
| 865 | return dataStr.indexOf(transformedFilter) != -1;
|
---|
| 866 | };
|
---|
| 867 | _this._data = new rxjs.BehaviorSubject(initialData);
|
---|
| 868 | _this._updateChangeSubscription();
|
---|
| 869 | return _this;
|
---|
| 870 | }
|
---|
| 871 | Object.defineProperty(_MatTableDataSource.prototype, "data", {
|
---|
| 872 | /** Array of data that should be rendered by the table, where each object represents one row. */
|
---|
| 873 | get: function () { return this._data.value; },
|
---|
| 874 | set: function (data) {
|
---|
| 875 | this._data.next(data);
|
---|
| 876 | // Normally the `filteredData` is updated by the re-render
|
---|
| 877 | // subscription, but that won't happen if it's inactive.
|
---|
| 878 | if (!this._renderChangesSubscription) {
|
---|
| 879 | this._filterData(data);
|
---|
| 880 | }
|
---|
| 881 | },
|
---|
| 882 | enumerable: false,
|
---|
| 883 | configurable: true
|
---|
| 884 | });
|
---|
| 885 | Object.defineProperty(_MatTableDataSource.prototype, "filter", {
|
---|
| 886 | /**
|
---|
| 887 | * Filter term that should be used to filter out objects from the data array. To override how
|
---|
| 888 | * data objects match to this filter string, provide a custom function for filterPredicate.
|
---|
| 889 | */
|
---|
| 890 | get: function () { return this._filter.value; },
|
---|
| 891 | set: function (filter) {
|
---|
| 892 | this._filter.next(filter);
|
---|
| 893 | // Normally the `filteredData` is updated by the re-render
|
---|
| 894 | // subscription, but that won't happen if it's inactive.
|
---|
| 895 | if (!this._renderChangesSubscription) {
|
---|
| 896 | this._filterData(this.data);
|
---|
| 897 | }
|
---|
| 898 | },
|
---|
| 899 | enumerable: false,
|
---|
| 900 | configurable: true
|
---|
| 901 | });
|
---|
| 902 | Object.defineProperty(_MatTableDataSource.prototype, "sort", {
|
---|
| 903 | /**
|
---|
| 904 | * Instance of the MatSort directive used by the table to control its sorting. Sort changes
|
---|
| 905 | * emitted by the MatSort will trigger an update to the table's rendered data.
|
---|
| 906 | */
|
---|
| 907 | get: function () { return this._sort; },
|
---|
| 908 | set: function (sort) {
|
---|
| 909 | this._sort = sort;
|
---|
| 910 | this._updateChangeSubscription();
|
---|
| 911 | },
|
---|
| 912 | enumerable: false,
|
---|
| 913 | configurable: true
|
---|
| 914 | });
|
---|
| 915 | Object.defineProperty(_MatTableDataSource.prototype, "paginator", {
|
---|
| 916 | /**
|
---|
| 917 | * Instance of the MatPaginator component used by the table to control what page of the data is
|
---|
| 918 | * displayed. Page changes emitted by the MatPaginator will trigger an update to the
|
---|
| 919 | * table's rendered data.
|
---|
| 920 | *
|
---|
| 921 | * Note that the data source uses the paginator's properties to calculate which page of data
|
---|
| 922 | * should be displayed. If the paginator receives its properties as template inputs,
|
---|
| 923 | * e.g. `[pageLength]=100` or `[pageIndex]=1`, then be sure that the paginator's view has been
|
---|
| 924 | * initialized before assigning it to this data source.
|
---|
| 925 | */
|
---|
| 926 | get: function () { return this._paginator; },
|
---|
| 927 | set: function (paginator) {
|
---|
| 928 | this._paginator = paginator;
|
---|
| 929 | this._updateChangeSubscription();
|
---|
| 930 | },
|
---|
| 931 | enumerable: false,
|
---|
| 932 | configurable: true
|
---|
| 933 | });
|
---|
| 934 | /**
|
---|
| 935 | * Subscribe to changes that should trigger an update to the table's rendered rows. When the
|
---|
| 936 | * changes occur, process the current state of the filter, sort, and pagination along with
|
---|
| 937 | * the provided base data and send it to the table for rendering.
|
---|
| 938 | */
|
---|
| 939 | _MatTableDataSource.prototype._updateChangeSubscription = function () {
|
---|
| 940 | var _this = this;
|
---|
| 941 | var _a;
|
---|
| 942 | // Sorting and/or pagination should be watched if MatSort and/or MatPaginator are provided.
|
---|
| 943 | // The events should emit whenever the component emits a change or initializes, or if no
|
---|
| 944 | // component is provided, a stream with just a null event should be provided.
|
---|
| 945 | // The `sortChange` and `pageChange` acts as a signal to the combineLatests below so that the
|
---|
| 946 | // pipeline can progress to the next step. Note that the value from these streams are not used,
|
---|
| 947 | // they purely act as a signal to progress in the pipeline.
|
---|
| 948 | var sortChange = this._sort ?
|
---|
| 949 | rxjs.merge(this._sort.sortChange, this._sort.initialized) :
|
---|
| 950 | rxjs.of(null);
|
---|
| 951 | var pageChange = this._paginator ?
|
---|
| 952 | rxjs.merge(this._paginator.page, this._internalPageChanges, this._paginator.initialized) :
|
---|
| 953 | rxjs.of(null);
|
---|
| 954 | var dataStream = this._data;
|
---|
| 955 | // Watch for base data or filter changes to provide a filtered set of data.
|
---|
| 956 | var filteredData = rxjs.combineLatest([dataStream, this._filter])
|
---|
| 957 | .pipe(operators.map(function (_b) {
|
---|
| 958 | var _c = __read(_b, 1), data = _c[0];
|
---|
| 959 | return _this._filterData(data);
|
---|
| 960 | }));
|
---|
| 961 | // Watch for filtered data or sort changes to provide an ordered set of data.
|
---|
| 962 | var orderedData = rxjs.combineLatest([filteredData, sortChange])
|
---|
| 963 | .pipe(operators.map(function (_b) {
|
---|
| 964 | var _c = __read(_b, 1), data = _c[0];
|
---|
| 965 | return _this._orderData(data);
|
---|
| 966 | }));
|
---|
| 967 | // Watch for ordered data or page changes to provide a paged set of data.
|
---|
| 968 | var paginatedData = rxjs.combineLatest([orderedData, pageChange])
|
---|
| 969 | .pipe(operators.map(function (_b) {
|
---|
| 970 | var _c = __read(_b, 1), data = _c[0];
|
---|
| 971 | return _this._pageData(data);
|
---|
| 972 | }));
|
---|
| 973 | // Watched for paged data changes and send the result to the table to render.
|
---|
| 974 | (_a = this._renderChangesSubscription) === null || _a === void 0 ? void 0 : _a.unsubscribe();
|
---|
| 975 | this._renderChangesSubscription = paginatedData.subscribe(function (data) { return _this._renderData.next(data); });
|
---|
| 976 | };
|
---|
| 977 | /**
|
---|
| 978 | * Returns a filtered data array where each filter object contains the filter string within
|
---|
| 979 | * the result of the filterTermAccessor function. If no filter is set, returns the data array
|
---|
| 980 | * as provided.
|
---|
| 981 | */
|
---|
| 982 | _MatTableDataSource.prototype._filterData = function (data) {
|
---|
| 983 | var _this = this;
|
---|
| 984 | // If there is a filter string, filter out data that does not contain it.
|
---|
| 985 | // Each data object is converted to a string using the function defined by filterTermAccessor.
|
---|
| 986 | // May be overridden for customization.
|
---|
| 987 | this.filteredData = (this.filter == null || this.filter === '') ? data :
|
---|
| 988 | data.filter(function (obj) { return _this.filterPredicate(obj, _this.filter); });
|
---|
| 989 | if (this.paginator) {
|
---|
| 990 | this._updatePaginator(this.filteredData.length);
|
---|
| 991 | }
|
---|
| 992 | return this.filteredData;
|
---|
| 993 | };
|
---|
| 994 | /**
|
---|
| 995 | * Returns a sorted copy of the data if MatSort has a sort applied, otherwise just returns the
|
---|
| 996 | * data array as provided. Uses the default data accessor for data lookup, unless a
|
---|
| 997 | * sortDataAccessor function is defined.
|
---|
| 998 | */
|
---|
| 999 | _MatTableDataSource.prototype._orderData = function (data) {
|
---|
| 1000 | // If there is no active sort or direction, return the data without trying to sort.
|
---|
| 1001 | if (!this.sort) {
|
---|
| 1002 | return data;
|
---|
| 1003 | }
|
---|
| 1004 | return this.sortData(data.slice(), this.sort);
|
---|
| 1005 | };
|
---|
| 1006 | /**
|
---|
| 1007 | * Returns a paged slice of the provided data array according to the provided MatPaginator's page
|
---|
| 1008 | * index and length. If there is no paginator provided, returns the data array as provided.
|
---|
| 1009 | */
|
---|
| 1010 | _MatTableDataSource.prototype._pageData = function (data) {
|
---|
| 1011 | if (!this.paginator) {
|
---|
| 1012 | return data;
|
---|
| 1013 | }
|
---|
| 1014 | var startIndex = this.paginator.pageIndex * this.paginator.pageSize;
|
---|
| 1015 | return data.slice(startIndex, startIndex + this.paginator.pageSize);
|
---|
| 1016 | };
|
---|
| 1017 | /**
|
---|
| 1018 | * Updates the paginator to reflect the length of the filtered data, and makes sure that the page
|
---|
| 1019 | * index does not exceed the paginator's last page. Values are changed in a resolved promise to
|
---|
| 1020 | * guard against making property changes within a round of change detection.
|
---|
| 1021 | */
|
---|
| 1022 | _MatTableDataSource.prototype._updatePaginator = function (filteredDataLength) {
|
---|
| 1023 | var _this = this;
|
---|
| 1024 | Promise.resolve().then(function () {
|
---|
| 1025 | var paginator = _this.paginator;
|
---|
| 1026 | if (!paginator) {
|
---|
| 1027 | return;
|
---|
| 1028 | }
|
---|
| 1029 | paginator.length = filteredDataLength;
|
---|
| 1030 | // If the page index is set beyond the page, reduce it to the last page.
|
---|
| 1031 | if (paginator.pageIndex > 0) {
|
---|
| 1032 | var lastPageIndex = Math.ceil(paginator.length / paginator.pageSize) - 1 || 0;
|
---|
| 1033 | var newPageIndex = Math.min(paginator.pageIndex, lastPageIndex);
|
---|
| 1034 | if (newPageIndex !== paginator.pageIndex) {
|
---|
| 1035 | paginator.pageIndex = newPageIndex;
|
---|
| 1036 | // Since the paginator only emits after user-generated changes,
|
---|
| 1037 | // we need our own stream so we know to should re-render the data.
|
---|
| 1038 | _this._internalPageChanges.next();
|
---|
| 1039 | }
|
---|
| 1040 | }
|
---|
| 1041 | });
|
---|
| 1042 | };
|
---|
| 1043 | /**
|
---|
| 1044 | * Used by the MatTable. Called when it connects to the data source.
|
---|
| 1045 | * @docs-private
|
---|
| 1046 | */
|
---|
| 1047 | _MatTableDataSource.prototype.connect = function () {
|
---|
| 1048 | if (!this._renderChangesSubscription) {
|
---|
| 1049 | this._updateChangeSubscription();
|
---|
| 1050 | }
|
---|
| 1051 | return this._renderData;
|
---|
| 1052 | };
|
---|
| 1053 | /**
|
---|
| 1054 | * Used by the MatTable. Called when it disconnects from the data source.
|
---|
| 1055 | * @docs-private
|
---|
| 1056 | */
|
---|
| 1057 | _MatTableDataSource.prototype.disconnect = function () {
|
---|
| 1058 | var _a;
|
---|
| 1059 | (_a = this._renderChangesSubscription) === null || _a === void 0 ? void 0 : _a.unsubscribe();
|
---|
| 1060 | this._renderChangesSubscription = null;
|
---|
| 1061 | };
|
---|
| 1062 | return _MatTableDataSource;
|
---|
| 1063 | }(table.DataSource));
|
---|
| 1064 | /**
|
---|
| 1065 | * Data source that accepts a client-side data array and includes native support of filtering,
|
---|
| 1066 | * sorting (using MatSort), and pagination (using MatPaginator).
|
---|
| 1067 | *
|
---|
| 1068 | * Allows for sort customization by overriding sortingDataAccessor, which defines how data
|
---|
| 1069 | * properties are accessed. Also allows for filter customization by overriding filterTermAccessor,
|
---|
| 1070 | * which defines how row data is converted to a string for filter matching.
|
---|
| 1071 | *
|
---|
| 1072 | * **Note:** This class is meant to be a simple data source to help you get started. As such
|
---|
| 1073 | * it isn't equipped to handle some more advanced cases like robust i18n support or server-side
|
---|
| 1074 | * interactions. If your app needs to support more advanced use cases, consider implementing your
|
---|
| 1075 | * own `DataSource`.
|
---|
| 1076 | */
|
---|
| 1077 | var MatTableDataSource = /** @class */ (function (_super) {
|
---|
| 1078 | __extends(MatTableDataSource, _super);
|
---|
| 1079 | function MatTableDataSource() {
|
---|
| 1080 | return _super !== null && _super.apply(this, arguments) || this;
|
---|
| 1081 | }
|
---|
| 1082 | return MatTableDataSource;
|
---|
| 1083 | }(_MatTableDataSource));
|
---|
| 1084 |
|
---|
| 1085 | /**
|
---|
| 1086 | * @license
|
---|
| 1087 | * Copyright Google LLC All Rights Reserved.
|
---|
| 1088 | *
|
---|
| 1089 | * Use of this source code is governed by an MIT-style license that can be
|
---|
| 1090 | * found in the LICENSE file at https://angular.io/license
|
---|
| 1091 | */
|
---|
| 1092 |
|
---|
| 1093 | /**
|
---|
| 1094 | * Generated bundle index. Do not edit.
|
---|
| 1095 | */
|
---|
| 1096 |
|
---|
| 1097 | exports.MatCell = MatCell;
|
---|
| 1098 | exports.MatCellDef = MatCellDef;
|
---|
| 1099 | exports.MatColumnDef = MatColumnDef;
|
---|
| 1100 | exports.MatFooterCell = MatFooterCell;
|
---|
| 1101 | exports.MatFooterCellDef = MatFooterCellDef;
|
---|
| 1102 | exports.MatFooterRow = MatFooterRow;
|
---|
| 1103 | exports.MatFooterRowDef = MatFooterRowDef;
|
---|
| 1104 | exports.MatHeaderCell = MatHeaderCell;
|
---|
| 1105 | exports.MatHeaderCellDef = MatHeaderCellDef;
|
---|
| 1106 | exports.MatHeaderRow = MatHeaderRow;
|
---|
| 1107 | exports.MatHeaderRowDef = MatHeaderRowDef;
|
---|
| 1108 | exports.MatNoDataRow = MatNoDataRow;
|
---|
| 1109 | exports.MatRecycleRows = MatRecycleRows;
|
---|
| 1110 | exports.MatRow = MatRow;
|
---|
| 1111 | exports.MatRowDef = MatRowDef;
|
---|
| 1112 | exports.MatTable = MatTable;
|
---|
| 1113 | exports.MatTableDataSource = MatTableDataSource;
|
---|
| 1114 | exports.MatTableModule = MatTableModule;
|
---|
| 1115 | exports.MatTextColumn = MatTextColumn;
|
---|
| 1116 | exports._MatTableDataSource = _MatTableDataSource;
|
---|
| 1117 |
|
---|
| 1118 | Object.defineProperty(exports, '__esModule', { value: true });
|
---|
| 1119 |
|
---|
| 1120 | })));
|
---|
| 1121 | //# sourceMappingURL=material-table.umd.js.map
|
---|