@coolon/angular-ui-powerups 3.11.2 → 3.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,13 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
+ ## [3.12.0](https://bitbucket.org/coolon/angular-ui-powerups/compare/v3.11.2...v3.12.0) (2021-02-22)
6
+
7
+
8
+ ### Features
9
+
10
+ * added visible row count model to tables to support paging ([e33e8c3](https://bitbucket.org/coolon/angular-ui-powerups/commit/e33e8c328bb43481f638db42bdee8852d843ca1c))
11
+
5
12
  ### [3.11.2](https://bitbucket.org/coolon/angular-ui-powerups/compare/v3.11.1...v3.11.2) (2021-02-11)
6
13
 
7
14
 
@@ -1,14 +1,14 @@
1
1
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/common'), require('@angular/core'), require('@angular/forms'), require('@angular/material/form-field'), require('@angular/material/input'), require('@angular/material/select'), require('@angular/material/tabs'), require('@angular/platform-browser/animations'), require('@angular/cdk/portal'), require('@angular/cdk/scrolling'), require('@angular/material/autocomplete'), require('@angular/material/button'), require('@angular/material/checkbox'), require('@angular/material/divider'), require('@angular/material/icon'), require('@angular/material/menu'), require('@angular/material/progress-spinner'), require('@angular/material/table'), require('@angular/material/tooltip'), require('@fortawesome/angular-fontawesome'), require('@fortawesome/free-solid-svg-icons'), require('@coolon/pectin'), require('@typescript-plus/fast-memoize-decorator/dist/src'), require('lodash'), require('typescript-string-enums'), require('@coolon/typescript-utilities'), require('immer'), require('@angular/flex-layout'), require('@angular/material/dialog'), require('@angular/router'), require('@angular/cdk/overlay'), require('resize-observer-polyfill'), require('@angular/material/list'), require('@typescript-plus/fast-memoize-decorator'), require('reflect-metadata'), require('@angular/animations')) :
3
- typeof define === 'function' && define.amd ? define('@coolon/angular-ui-powerups', ['exports', '@angular/common', '@angular/core', '@angular/forms', '@angular/material/form-field', '@angular/material/input', '@angular/material/select', '@angular/material/tabs', '@angular/platform-browser/animations', '@angular/cdk/portal', '@angular/cdk/scrolling', '@angular/material/autocomplete', '@angular/material/button', '@angular/material/checkbox', '@angular/material/divider', '@angular/material/icon', '@angular/material/menu', '@angular/material/progress-spinner', '@angular/material/table', '@angular/material/tooltip', '@fortawesome/angular-fontawesome', '@fortawesome/free-solid-svg-icons', '@coolon/pectin', '@typescript-plus/fast-memoize-decorator/dist/src', 'lodash', 'typescript-string-enums', '@coolon/typescript-utilities', 'immer', '@angular/flex-layout', '@angular/material/dialog', '@angular/router', '@angular/cdk/overlay', 'resize-observer-polyfill', '@angular/material/list', '@typescript-plus/fast-memoize-decorator', 'reflect-metadata', '@angular/animations'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.coolon = global.coolon || {}, global.coolon['angular-ui-powerups'] = {}), global.ng.common, global.ng.core, global.ng.forms, global.ng.material.formField, global.ng.material.input, global.ng.material.select, global.ng.material.tabs, global.ng.platformBrowser.animations, global.ng.cdk.portal, global.ng.cdk.scrolling, global.ng.material.autocomplete, global.ng.material.button, global.ng.material.checkbox, global.ng.material.divider, global.ng.material.icon, global.ng.material.menu, global.ng.material.progressSpinner, global.ng.material.table, global.ng.material.tooltip, global.angularFontawesome, global.freeSolidSvgIcons, global.pectin, global.src, global._, global.typescriptStringEnums, global.typescriptUtilities, global.produce, global.ng.flexLayout, global.ng.material.dialog, global.ng.router, global.ng.cdk.overlay, global.ResizeObserver, global.ng.material.list, global.fastMemoizeDecorator, null, global.ng.animations));
5
- }(this, (function (exports, i2, i0, forms, formField, input, select, tabs, animations, portal, scrolling, autocomplete, button, checkbox, divider, icon, menu, progressSpinner, table, tooltip, angularFontawesome, freeSolidSvgIcons, pectin, src, _, typescriptStringEnums, typescriptUtilities, produce, flexLayout, i1, i1$1, overlay, ResizeObserver, list, fastMemoizeDecorator, reflectMetadata, animations$1) { 'use strict';
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/common'), require('@angular/core'), require('@angular/forms'), require('@angular/material/form-field'), require('@angular/material/input'), require('@angular/material/select'), require('@angular/material/tabs'), require('@angular/platform-browser/animations'), require('@angular/cdk/portal'), require('@angular/cdk/scrolling'), require('@angular/material/autocomplete'), require('@angular/material/button'), require('@angular/material/checkbox'), require('@angular/material/divider'), require('@angular/material/icon'), require('@angular/material/menu'), require('@angular/material/progress-spinner'), require('@angular/material/table'), require('@angular/material/tooltip'), require('@fortawesome/angular-fontawesome'), require('@fortawesome/free-solid-svg-icons'), require('@coolon/pectin'), require('@typescript-plus/fast-memoize-decorator/dist/src'), require('lodash'), require('typescript-string-enums'), require('resize-observer-polyfill'), require('@coolon/typescript-utilities'), require('immer'), require('@angular/flex-layout'), require('@angular/material/dialog'), require('@angular/router'), require('@angular/cdk/overlay'), require('@angular/material/list'), require('@typescript-plus/fast-memoize-decorator'), require('reflect-metadata'), require('@angular/animations')) :
3
+ typeof define === 'function' && define.amd ? define('@coolon/angular-ui-powerups', ['exports', '@angular/common', '@angular/core', '@angular/forms', '@angular/material/form-field', '@angular/material/input', '@angular/material/select', '@angular/material/tabs', '@angular/platform-browser/animations', '@angular/cdk/portal', '@angular/cdk/scrolling', '@angular/material/autocomplete', '@angular/material/button', '@angular/material/checkbox', '@angular/material/divider', '@angular/material/icon', '@angular/material/menu', '@angular/material/progress-spinner', '@angular/material/table', '@angular/material/tooltip', '@fortawesome/angular-fontawesome', '@fortawesome/free-solid-svg-icons', '@coolon/pectin', '@typescript-plus/fast-memoize-decorator/dist/src', 'lodash', 'typescript-string-enums', 'resize-observer-polyfill', '@coolon/typescript-utilities', 'immer', '@angular/flex-layout', '@angular/material/dialog', '@angular/router', '@angular/cdk/overlay', '@angular/material/list', '@typescript-plus/fast-memoize-decorator', 'reflect-metadata', '@angular/animations'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.coolon = global.coolon || {}, global.coolon['angular-ui-powerups'] = {}), global.ng.common, global.ng.core, global.ng.forms, global.ng.material.formField, global.ng.material.input, global.ng.material.select, global.ng.material.tabs, global.ng.platformBrowser.animations, global.ng.cdk.portal, global.ng.cdk.scrolling, global.ng.material.autocomplete, global.ng.material.button, global.ng.material.checkbox, global.ng.material.divider, global.ng.material.icon, global.ng.material.menu, global.ng.material.progressSpinner, global.ng.material.table, global.ng.material.tooltip, global.angularFontawesome, global.freeSolidSvgIcons, global.pectin, global.src, global._, global.typescriptStringEnums, global.ResizeObserver, global.typescriptUtilities, global.produce, global.ng.flexLayout, global.ng.material.dialog, global.ng.router, global.ng.cdk.overlay, global.ng.material.list, global.fastMemoizeDecorator, null, global.ng.animations));
5
+ }(this, (function (exports, i2, i0, forms, formField, input, select, tabs, animations, portal, scrolling, autocomplete, button, checkbox, divider, icon, menu, progressSpinner, table, tooltip, angularFontawesome, freeSolidSvgIcons, pectin, src, _, typescriptStringEnums, ResizeObserver, typescriptUtilities, produce, flexLayout, i1, i1$1, overlay, list, fastMemoizeDecorator, reflectMetadata, animations$1) { 'use strict';
6
6
 
7
7
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
8
8
 
9
9
  var ___default = /*#__PURE__*/_interopDefaultLegacy(_);
10
- var produce__default = /*#__PURE__*/_interopDefaultLegacy(produce);
11
10
  var ResizeObserver__default = /*#__PURE__*/_interopDefaultLegacy(ResizeObserver);
11
+ var produce__default = /*#__PURE__*/_interopDefaultLegacy(produce);
12
12
 
13
13
  /*! *****************************************************************************
14
14
  Copyright (c) Microsoft Corporation.
@@ -2328,6 +2328,113 @@
2328
2328
  __metadata("design:type", Object)
2329
2329
  ], SwitchCaseComponent.prototype, "switch", void 0);
2330
2330
 
2331
+ var Dimension = /** @class */ (function () {
2332
+ function Dimension(width, height) {
2333
+ this.width = width;
2334
+ this.height = height;
2335
+ }
2336
+ return Dimension;
2337
+ }());
2338
+
2339
+ var Point = /** @class */ (function () {
2340
+ function Point(x, y) {
2341
+ this.x = x;
2342
+ this.y = y;
2343
+ }
2344
+ Point.from = function (data) {
2345
+ return new Point(data.x, data.y);
2346
+ };
2347
+ Point.prototype.translate = function (x, y) {
2348
+ return new Point(this.x + x, this.y + y);
2349
+ };
2350
+ return Point;
2351
+ }());
2352
+
2353
+ exports.Bounds = /** @class */ (function (_super) {
2354
+ __extends(Bounds, _super);
2355
+ function Bounds(top, left, width, height) {
2356
+ var _this = _super.call(this, width, height) || this;
2357
+ _this.top = top;
2358
+ _this.left = left;
2359
+ _this.width = width;
2360
+ _this.height = height;
2361
+ return _this;
2362
+ }
2363
+ Bounds.prototype.relativePositionOf = function (point) {
2364
+ if (point instanceof MouseEvent) {
2365
+ return new Point(point.clientX - this.left, point.clientY - this.top);
2366
+ }
2367
+ else {
2368
+ return new Point(point.x - this.left, point.y - this.top);
2369
+ }
2370
+ };
2371
+ return Bounds;
2372
+ }(Dimension));
2373
+ (function (Bounds) {
2374
+ function ofElement(element) {
2375
+ var rect = element.getBoundingClientRect();
2376
+ return new Bounds(rect.top, rect.left, rect.width, rect.height);
2377
+ }
2378
+ Bounds.ofElement = ofElement;
2379
+ })(exports.Bounds || (exports.Bounds = {}));
2380
+
2381
+ var ResizeAwareComponent = /** @class */ (function (_super) {
2382
+ __extends(ResizeAwareComponent, _super);
2383
+ function ResizeAwareComponent(elementRef, ngZone) {
2384
+ var _this = _super.call(this) || this;
2385
+ _this.elementRef = elementRef;
2386
+ _this.ngZone = ngZone;
2387
+ _this._boundsModel = new pectin.MutableValueModel(new exports.Bounds(0, 0, 0, 0));
2388
+ return _this;
2389
+ }
2390
+ ResizeAwareComponent.prototype.ngAfterViewInit = function () {
2391
+ var _this = this;
2392
+ this.updateBounds();
2393
+ var element = this.elementRef.nativeElement;
2394
+ var ro = new ResizeObserver__default['default'](function (entries, observer) {
2395
+ _this.ngZone.run(function () { return _this.updateBounds(); });
2396
+ });
2397
+ ro.observe(element);
2398
+ this.onDispose(function () { return ro.disconnect(); });
2399
+ };
2400
+ Object.defineProperty(ResizeAwareComponent.prototype, "boundsModel", {
2401
+ get: function () {
2402
+ return this._boundsModel.readonly;
2403
+ },
2404
+ enumerable: false,
2405
+ configurable: true
2406
+ });
2407
+ Object.defineProperty(ResizeAwareComponent.prototype, "nativeElement", {
2408
+ get: function () {
2409
+ return this.elementRef.nativeElement;
2410
+ },
2411
+ enumerable: false,
2412
+ configurable: true
2413
+ });
2414
+ // TODO: Make this handle body scroll
2415
+ ResizeAwareComponent.prototype.relativePositionOf = function (point) {
2416
+ return this.bounds.relativePositionOf(point);
2417
+ };
2418
+ Object.defineProperty(ResizeAwareComponent.prototype, "bounds", {
2419
+ get: function () {
2420
+ return this._boundsModel.value;
2421
+ },
2422
+ enumerable: false,
2423
+ configurable: true
2424
+ });
2425
+ ResizeAwareComponent.prototype.updateBounds = function () {
2426
+ this._boundsModel.value = exports.Bounds.ofElement(this.nativeElement);
2427
+ };
2428
+ return ResizeAwareComponent;
2429
+ }(DisposableComponent));
2430
+ ResizeAwareComponent.decorators = [
2431
+ { type: i0.Directive }
2432
+ ];
2433
+ ResizeAwareComponent.ctorParameters = function () { return [
2434
+ { type: i0.ElementRef },
2435
+ { type: i0.NgZone }
2436
+ ]; };
2437
+
2331
2438
  var HEADER_CELL_RENDERER_PORTAL = Symbol('aup-cell-header-renderer-component-ref');
2332
2439
  var CELL_RENDERER_PORTAL = Symbol('aup-cell-renderer-component-ref');
2333
2440
  var CELL_EDITOR_PORTAL = Symbol('aup-cell-editor-component-ref');
@@ -3176,8 +3283,21 @@
3176
3283
  */
3177
3284
  var TableComponent = /** @class */ (function (_super) {
3178
3285
  __extends(TableComponent, _super);
3179
- function TableComponent() {
3180
- return _super.call(this) || this;
3286
+ function TableComponent(elementRef, ngZone) {
3287
+ var _this = _super.call(this, elementRef, ngZone) || this;
3288
+ // TODO: support user defined header and row heights via css vars.
3289
+ _this.headerHeight = new pectin.MutableValueModel(56);
3290
+ _this.rowHeight = new pectin.MutableValueModel(48);
3291
+ var chain = pectin.Dsl.disposeWith(_this).chain;
3292
+ _this.visibleRowCount = chain(_this.boundsModel).map(function (bounds) {
3293
+ // TODO: this doesn't take into account any css styling adjustments etc. Will invistigate if it's an issue.
3294
+ var rawRowCount = (bounds.height - _this.headerHeight.value) / _this.rowHeight.value;
3295
+ return rawRowCount < 1 ? 0 : Math.floor(rawRowCount);
3296
+ }, {
3297
+ dependsOn: [_this.headerHeight, _this.rowHeight],
3298
+ postponeWhile: chain(_this.boundsModel).pluckNumeric('height').isLessThan(1)
3299
+ });
3300
+ return _this;
3181
3301
  }
3182
3302
  TableComponent.prototype.ngOnInit = function () {
3183
3303
  var _a = pectin.Dsl.disposeWith(this), chain = _a.chain, valueOf = _a.valueOf, before = _a.before, when = _a.when, after = _a.after, observe = _a.observe, switchOn = _a.switchOn;
@@ -3198,7 +3318,7 @@
3198
3318
  this.tableModel._notifyCellClicked(columnModel, row);
3199
3319
  };
3200
3320
  return TableComponent;
3201
- }(DisposableComponent));
3321
+ }(ResizeAwareComponent));
3202
3322
  TableComponent.decorators = [
3203
3323
  { type: i0.Component, args: [{
3204
3324
  selector: 'aup-table',
@@ -3206,7 +3326,10 @@
3206
3326
  styles: [":host{align-items:stretch;display:flex;flex-direction:column}:host table{flex:1;width:100%}"]
3207
3327
  },] }
3208
3328
  ];
3209
- TableComponent.ctorParameters = function () { return []; };
3329
+ TableComponent.ctorParameters = function () { return [
3330
+ { type: i0.ElementRef },
3331
+ { type: i0.NgZone }
3332
+ ]; };
3210
3333
  TableComponent.propDecorators = {
3211
3334
  tableModel: [{ type: i0.Input }]
3212
3335
  };
@@ -5507,113 +5630,6 @@
5507
5630
  },] }
5508
5631
  ];
5509
5632
 
5510
- var Dimension = /** @class */ (function () {
5511
- function Dimension(width, height) {
5512
- this.width = width;
5513
- this.height = height;
5514
- }
5515
- return Dimension;
5516
- }());
5517
-
5518
- var Point = /** @class */ (function () {
5519
- function Point(x, y) {
5520
- this.x = x;
5521
- this.y = y;
5522
- }
5523
- Point.from = function (data) {
5524
- return new Point(data.x, data.y);
5525
- };
5526
- Point.prototype.translate = function (x, y) {
5527
- return new Point(this.x + x, this.y + y);
5528
- };
5529
- return Point;
5530
- }());
5531
-
5532
- exports.Bounds = /** @class */ (function (_super) {
5533
- __extends(Bounds, _super);
5534
- function Bounds(top, left, width, height) {
5535
- var _this = _super.call(this, width, height) || this;
5536
- _this.top = top;
5537
- _this.left = left;
5538
- _this.width = width;
5539
- _this.height = height;
5540
- return _this;
5541
- }
5542
- Bounds.prototype.relativePositionOf = function (point) {
5543
- if (point instanceof MouseEvent) {
5544
- return new Point(point.clientX - this.left, point.clientY - this.top);
5545
- }
5546
- else {
5547
- return new Point(point.x - this.left, point.y - this.top);
5548
- }
5549
- };
5550
- return Bounds;
5551
- }(Dimension));
5552
- (function (Bounds) {
5553
- function ofElement(element) {
5554
- var rect = element.getBoundingClientRect();
5555
- return new Bounds(rect.top, rect.left, rect.width, rect.height);
5556
- }
5557
- Bounds.ofElement = ofElement;
5558
- })(exports.Bounds || (exports.Bounds = {}));
5559
-
5560
- var ResizeAwareComponent = /** @class */ (function (_super) {
5561
- __extends(ResizeAwareComponent, _super);
5562
- function ResizeAwareComponent(elementRef, ngZone) {
5563
- var _this = _super.call(this) || this;
5564
- _this.elementRef = elementRef;
5565
- _this.ngZone = ngZone;
5566
- _this._boundsModel = new pectin.MutableValueModel(new exports.Bounds(0, 0, 0, 0));
5567
- return _this;
5568
- }
5569
- ResizeAwareComponent.prototype.ngAfterViewInit = function () {
5570
- var _this = this;
5571
- this.updateBounds();
5572
- var element = this.elementRef.nativeElement;
5573
- var ro = new ResizeObserver__default['default'](function (entries, observer) {
5574
- _this.ngZone.run(function () { return _this.updateBounds(); });
5575
- });
5576
- ro.observe(element);
5577
- this.onDispose(function () { return ro.disconnect(); });
5578
- };
5579
- Object.defineProperty(ResizeAwareComponent.prototype, "boundsModel", {
5580
- get: function () {
5581
- return this._boundsModel.readonly;
5582
- },
5583
- enumerable: false,
5584
- configurable: true
5585
- });
5586
- Object.defineProperty(ResizeAwareComponent.prototype, "nativeElement", {
5587
- get: function () {
5588
- return this.elementRef.nativeElement;
5589
- },
5590
- enumerable: false,
5591
- configurable: true
5592
- });
5593
- // TODO: Make this handle body scroll
5594
- ResizeAwareComponent.prototype.relativePositionOf = function (point) {
5595
- return this.bounds.relativePositionOf(point);
5596
- };
5597
- Object.defineProperty(ResizeAwareComponent.prototype, "bounds", {
5598
- get: function () {
5599
- return this._boundsModel.value;
5600
- },
5601
- enumerable: false,
5602
- configurable: true
5603
- });
5604
- ResizeAwareComponent.prototype.updateBounds = function () {
5605
- this._boundsModel.value = exports.Bounds.ofElement(this.nativeElement);
5606
- };
5607
- return ResizeAwareComponent;
5608
- }(DisposableComponent));
5609
- ResizeAwareComponent.decorators = [
5610
- { type: i0.Directive }
5611
- ];
5612
- ResizeAwareComponent.ctorParameters = function () { return [
5613
- { type: i0.ElementRef },
5614
- { type: i0.NgZone }
5615
- ]; };
5616
-
5617
5633
  /**
5618
5634
  * Example:
5619
5635
  * @example