@ts-core/angular 13.1.29 → 13.1.32
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/directive/ScrollCheckDirective.d.ts +11 -3
- package/esm2020/directive/ScrollCheckDirective.mjs +54 -17
- package/esm2020/manager/ResizeManager.mjs +2 -1
- package/esm2020/util/ViewUtil.mjs +10 -1
- package/fesm2015/ts-core-angular.mjs +63 -16
- package/fesm2015/ts-core-angular.mjs.map +1 -1
- package/fesm2020/ts-core-angular.mjs +63 -16
- package/fesm2020/ts-core-angular.mjs.map +1 -1
- package/package.json +1 -1
- package/util/ViewUtil.d.ts +2 -1
|
@@ -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,6 +1969,7 @@ 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);
|
|
1972
|
+
// Could be undefined in ssr
|
|
1963
1973
|
try {
|
|
1964
1974
|
this.sensor = new ResizeObserver(this.handler2);
|
|
1965
1975
|
this.sensor.observe(this.element);
|
|
@@ -2938,27 +2948,58 @@ class ScrollCheckDirective extends DestroyableContainer {
|
|
|
2938
2948
|
// Properties
|
|
2939
2949
|
//
|
|
2940
2950
|
//--------------------------------------------------------------------------
|
|
2951
|
+
this.top = new EventEmitter();
|
|
2952
|
+
this.bottom = new EventEmitter();
|
|
2941
2953
|
this.limitExceed = new EventEmitter();
|
|
2954
|
+
this.isTop = false;
|
|
2955
|
+
this.isBottom = false;
|
|
2942
2956
|
this.isExceedLimit = false;
|
|
2943
|
-
this.
|
|
2944
|
-
|
|
2945
|
-
|
|
2946
|
-
|
|
2947
|
-
|
|
2948
|
-
|
|
2949
|
-
|
|
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(value);
|
|
2968
|
+
}
|
|
2969
|
+
value = this.scrollValue + this.clientHeight + this.offset > this.scrollHeight;
|
|
2970
|
+
if (value !== this.isBottom) {
|
|
2971
|
+
this.isBottom = value;
|
|
2972
|
+
this.bottom.next(value);
|
|
2973
|
+
}
|
|
2974
|
+
value = this.scrollValue < this.offset;
|
|
2975
|
+
if (value !== this.isTop) {
|
|
2976
|
+
this.isTop = value;
|
|
2977
|
+
this.top.next(value);
|
|
2978
|
+
}
|
|
2979
|
+
};
|
|
2980
|
+
this.element = element.nativeElement;
|
|
2981
|
+
fromEvent(this.element, 'scroll')
|
|
2982
|
+
.pipe(debounceTime(DateUtil.MILLISECONDS_SECOND / 10), takeUntil(this.destroyed))
|
|
2983
|
+
.subscribe(this.check);
|
|
2950
2984
|
}
|
|
2951
2985
|
//--------------------------------------------------------------------------
|
|
2952
2986
|
//
|
|
2953
|
-
//
|
|
2987
|
+
// Private Properties
|
|
2954
2988
|
//
|
|
2955
2989
|
//--------------------------------------------------------------------------
|
|
2956
|
-
|
|
2957
|
-
|
|
2958
|
-
|
|
2959
|
-
|
|
2960
|
-
|
|
2961
|
-
|
|
2990
|
+
// --------------------------------------------------------------------------
|
|
2991
|
+
//
|
|
2992
|
+
// Private Properties
|
|
2993
|
+
//
|
|
2994
|
+
// --------------------------------------------------------------------------
|
|
2995
|
+
get scrollValue() {
|
|
2996
|
+
return this.element.scrollTop;
|
|
2997
|
+
}
|
|
2998
|
+
get scrollHeight() {
|
|
2999
|
+
return this.element.scrollHeight;
|
|
3000
|
+
}
|
|
3001
|
+
get clientHeight() {
|
|
3002
|
+
return this.element.clientHeight;
|
|
2962
3003
|
}
|
|
2963
3004
|
//--------------------------------------------------------------------------
|
|
2964
3005
|
//
|
|
@@ -2977,14 +3018,20 @@ class ScrollCheckDirective extends DestroyableContainer {
|
|
|
2977
3018
|
}
|
|
2978
3019
|
}
|
|
2979
3020
|
ScrollCheckDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: ScrollCheckDirective, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
|
|
2980
|
-
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 });
|
|
3021
|
+
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 });
|
|
2981
3022
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: ScrollCheckDirective, decorators: [{
|
|
2982
3023
|
type: Directive,
|
|
2983
3024
|
args: [{
|
|
2984
3025
|
selector: '[vi-scroll-check]'
|
|
2985
3026
|
}]
|
|
2986
|
-
}], ctorParameters: function () { return [{ type: i0.ElementRef }]; }, propDecorators: {
|
|
3027
|
+
}], ctorParameters: function () { return [{ type: i0.ElementRef }]; }, propDecorators: { top: [{
|
|
3028
|
+
type: Output
|
|
3029
|
+
}], bottom: [{
|
|
2987
3030
|
type: Output
|
|
3031
|
+
}], limitExceed: [{
|
|
3032
|
+
type: Output
|
|
3033
|
+
}], offset: [{
|
|
3034
|
+
type: Input
|
|
2988
3035
|
}], scrollLimit: [{
|
|
2989
3036
|
type: Input,
|
|
2990
3037
|
args: ['vi-scroll-check']
|