@ts-core/angular 13.1.28 → 13.1.31

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.
@@ -508,6 +508,15 @@ class ViewUtil {
508
508
  static getStageHeight() {
509
509
  return ViewUtil.window.innerHeight || ViewUtil.document.body.clientHeight;
510
510
  }
511
+ static getCanvasContext2d(container, options) {
512
+ let canvas = ViewUtil.parseElement(container);
513
+ try {
514
+ return canvas.getContext('2d', options);
515
+ }
516
+ catch (error) {
517
+ return null;
518
+ }
519
+ }
511
520
  static getBoundingRectangle(container) {
512
521
  container = ViewUtil.parseElement(container);
513
522
  if (_.isNil(container) || _.isNil(container.getBoundingClientRect)) {
@@ -1960,8 +1969,12 @@ class ResizeManager {
1960
1969
  this.element = ViewUtil.parseElement(element);
1961
1970
  this.subject = new BehaviorSubject({ width: ViewUtil.getWidth(this.element), height: ViewUtil.getHeight(this.element) });
1962
1971
  // this.sensor = new ResizeSensor(this.element, this.handler);
1963
- this.sensor = new ResizeObserver(this.handler2);
1964
- this.sensor.observe(this.element);
1972
+ // Could be undefined in ssr
1973
+ try {
1974
+ this.sensor = new ResizeObserver(this.handler2);
1975
+ this.sensor.observe(this.element);
1976
+ }
1977
+ catch (error) { }
1965
1978
  }
1966
1979
  // --------------------------------------------------------------------------
1967
1980
  //
@@ -2935,27 +2948,56 @@ class ScrollCheckDirective extends DestroyableContainer {
2935
2948
  // Properties
2936
2949
  //
2937
2950
  //--------------------------------------------------------------------------
2951
+ this.top = new EventEmitter();
2952
+ this.bottom = new EventEmitter();
2938
2953
  this.limitExceed = new EventEmitter();
2954
+ this.isTop = false;
2955
+ this.isBottom = false;
2939
2956
  this.isExceedLimit = false;
2940
- this._scrollValue = element.nativeElement.scrollTop;
2941
- fromEvent(element.nativeElement, 'scroll')
2942
- .pipe(debounceTime(DateUtil.MILISECONDS_SECOND / 10), takeUntil(this.destroyed))
2943
- .subscribe(() => {
2944
- this._scrollValue = element.nativeElement.scrollTop;
2945
- this.check();
2946
- });
2957
+ this.offset = 50;
2958
+ //--------------------------------------------------------------------------
2959
+ //
2960
+ // Protected Methods
2961
+ //
2962
+ //--------------------------------------------------------------------------
2963
+ this.check = () => {
2964
+ let value = this.scrollValue >= this.scrollLimit;
2965
+ if (value !== this.isExceedLimit) {
2966
+ this.isExceedLimit = value;
2967
+ this.limitExceed.emit(this.isExceedLimit);
2968
+ }
2969
+ value = this.scrollValue + this.clientHeight + this.offset > this.scrollHeight;
2970
+ if (value != this.isBottom) {
2971
+ this.bottom.next(value);
2972
+ }
2973
+ value = this.scrollValue < this.offset;
2974
+ if (value != this.isTop) {
2975
+ this.top.next(value);
2976
+ }
2977
+ };
2978
+ this.element = element.nativeElement;
2979
+ fromEvent(this.element, 'scroll')
2980
+ .pipe(debounceTime(DateUtil.MILLISECONDS_SECOND / 10), takeUntil(this.destroyed))
2981
+ .subscribe(this.check);
2947
2982
  }
2948
2983
  //--------------------------------------------------------------------------
2949
2984
  //
2950
- // Protected Methods
2985
+ // Private Properties
2951
2986
  //
2952
2987
  //--------------------------------------------------------------------------
2953
- check() {
2954
- let value = this._scrollValue >= this.scrollLimit;
2955
- if (value !== this.isExceedLimit) {
2956
- this.isExceedLimit = value;
2957
- this.limitExceed.emit(this.isExceedLimit);
2958
- }
2988
+ // --------------------------------------------------------------------------
2989
+ //
2990
+ // Private Properties
2991
+ //
2992
+ // --------------------------------------------------------------------------
2993
+ get scrollValue() {
2994
+ return this.element.scrollTop;
2995
+ }
2996
+ get scrollHeight() {
2997
+ return this.element.scrollHeight;
2998
+ }
2999
+ get clientHeight() {
3000
+ return this.element.clientHeight;
2959
3001
  }
2960
3002
  //--------------------------------------------------------------------------
2961
3003
  //
@@ -2974,14 +3016,20 @@ class ScrollCheckDirective extends DestroyableContainer {
2974
3016
  }
2975
3017
  }
2976
3018
  ScrollCheckDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: ScrollCheckDirective, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
2977
- ScrollCheckDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.3.11", type: ScrollCheckDirective, selector: "[vi-scroll-check]", inputs: { scrollLimit: ["vi-scroll-check", "scrollLimit"] }, outputs: { limitExceed: "limitExceed" }, usesInheritance: true, ngImport: i0 });
3019
+ ScrollCheckDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.3.11", type: ScrollCheckDirective, selector: "[vi-scroll-check]", inputs: { offset: "offset", scrollLimit: ["vi-scroll-check", "scrollLimit"] }, outputs: { top: "top", bottom: "bottom", limitExceed: "limitExceed" }, usesInheritance: true, ngImport: i0 });
2978
3020
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: ScrollCheckDirective, decorators: [{
2979
3021
  type: Directive,
2980
3022
  args: [{
2981
3023
  selector: '[vi-scroll-check]'
2982
3024
  }]
2983
- }], ctorParameters: function () { return [{ type: i0.ElementRef }]; }, propDecorators: { limitExceed: [{
3025
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }]; }, propDecorators: { top: [{
3026
+ type: Output
3027
+ }], bottom: [{
2984
3028
  type: Output
3029
+ }], limitExceed: [{
3030
+ type: Output
3031
+ }], offset: [{
3032
+ type: Input
2985
3033
  }], scrollLimit: [{
2986
3034
  type: Input,
2987
3035
  args: ['vi-scroll-check']