@taiga-ui/kit 2.25.0 → 2.26.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/bundles/taiga-ui-kit-components-carousel.umd.js +581 -0
- package/bundles/taiga-ui-kit-components-carousel.umd.js.map +1 -0
- package/bundles/taiga-ui-kit-components-carousel.umd.min.js +16 -0
- package/bundles/taiga-ui-kit-components-carousel.umd.min.js.map +1 -0
- package/bundles/taiga-ui-kit-components-tree.umd.js +62 -51
- package/bundles/taiga-ui-kit-components-tree.umd.js.map +1 -1
- package/bundles/taiga-ui-kit-components-tree.umd.min.js +2 -2
- package/bundles/taiga-ui-kit-components-tree.umd.min.js.map +1 -1
- package/bundles/taiga-ui-kit-components.umd.js +12 -4
- package/bundles/taiga-ui-kit-components.umd.js.map +1 -1
- package/bundles/taiga-ui-kit-components.umd.min.js +1 -1
- package/bundles/taiga-ui-kit-directives-highlight.umd.js +6 -1
- package/bundles/taiga-ui-kit-directives-highlight.umd.js.map +1 -1
- package/bundles/taiga-ui-kit-directives-highlight.umd.min.js +1 -1
- package/bundles/taiga-ui-kit-directives-highlight.umd.min.js.map +1 -1
- package/components/carousel/carousel-buttons.directive.d.ts +4 -0
- package/components/carousel/carousel-draggable.directive.d.ts +16 -0
- package/components/carousel/carousel-scroller.directive.d.ts +17 -0
- package/components/carousel/carousel.component.d.ts +18 -0
- package/components/carousel/carousel.directive.d.ts +18 -0
- package/components/carousel/carousel.module.d.ts +2 -0
- package/components/carousel/index.d.ts +6 -0
- package/components/carousel/package.json +13 -0
- package/components/carousel/taiga-ui-kit-components-carousel.d.ts +4 -0
- package/components/carousel/taiga-ui-kit-components-carousel.metadata.json +1 -0
- package/components/index.d.ts +1 -0
- package/components/taiga-ui-kit-components.metadata.json +1 -1
- package/components/tree/components/tree/tree.component.d.ts +6 -1
- package/components/tree/taiga-ui-kit-components-tree.metadata.json +1 -1
- package/directives/highlight/highlight.directive.d.ts +1 -0
- package/directives/highlight/taiga-ui-kit-directives-highlight.metadata.json +1 -1
- package/esm2015/components/carousel/carousel-buttons.directive.js +24 -0
- package/esm2015/components/carousel/carousel-draggable.directive.js +67 -0
- package/esm2015/components/carousel/carousel-scroller.directive.js +76 -0
- package/esm2015/components/carousel/carousel.component.js +87 -0
- package/esm2015/components/carousel/carousel.directive.js +65 -0
- package/esm2015/components/carousel/carousel.module.js +34 -0
- package/esm2015/components/carousel/index.js +7 -0
- package/esm2015/components/carousel/taiga-ui-kit-components-carousel.js +5 -0
- package/esm2015/components/index.js +2 -1
- package/esm2015/components/tree/components/tree/tree.component.js +15 -2
- package/esm2015/components/tree/components/tree-item/tree-item.component.js +2 -2
- package/esm2015/components/tree/components/tree-item-content/tree-item-content.component.js +2 -3
- package/esm2015/directives/highlight/highlight.directive.js +7 -2
- package/esm5/components/carousel/carousel-buttons.directive.js +27 -0
- package/esm5/components/carousel/carousel-draggable.directive.js +73 -0
- package/esm5/components/carousel/carousel-scroller.directive.js +82 -0
- package/esm5/components/carousel/carousel.component.js +90 -0
- package/esm5/components/carousel/carousel.directive.js +82 -0
- package/esm5/components/carousel/carousel.module.js +37 -0
- package/esm5/components/carousel/index.js +7 -0
- package/esm5/components/carousel/taiga-ui-kit-components-carousel.js +5 -0
- package/esm5/components/index.js +2 -1
- package/esm5/components/tree/components/tree/tree.component.js +15 -2
- package/esm5/components/tree/components/tree-item/tree-item.component.js +2 -2
- package/esm5/components/tree/components/tree-item-content/tree-item-content.component.js +2 -3
- package/esm5/directives/highlight/highlight.directive.js +7 -2
- package/fesm2015/taiga-ui-kit-components-carousel.js +323 -0
- package/fesm2015/taiga-ui-kit-components-carousel.js.map +1 -0
- package/fesm2015/taiga-ui-kit-components-tree.js +54 -43
- package/fesm2015/taiga-ui-kit-components-tree.js.map +1 -1
- package/fesm2015/taiga-ui-kit-components.js +1 -0
- package/fesm2015/taiga-ui-kit-components.js.map +1 -1
- package/fesm2015/taiga-ui-kit-directives-highlight.js +6 -1
- package/fesm2015/taiga-ui-kit-directives-highlight.js.map +1 -1
- package/fesm5/taiga-ui-kit-components-carousel.js +361 -0
- package/fesm5/taiga-ui-kit-components-carousel.js.map +1 -0
- package/fesm5/taiga-ui-kit-components-tree.js +63 -52
- package/fesm5/taiga-ui-kit-components-tree.js.map +1 -1
- package/fesm5/taiga-ui-kit-components.js +1 -0
- package/fesm5/taiga-ui-kit-components.js.map +1 -1
- package/fesm5/taiga-ui-kit-directives-highlight.js +6 -1
- package/fesm5/taiga-ui-kit-directives-highlight.js.map +1 -1
- package/package.json +6 -5
|
@@ -11,6 +11,7 @@ let TuiHighlightDirective = class TuiHighlightDirective {
|
|
|
11
11
|
this.elementRef = elementRef;
|
|
12
12
|
this.renderer = renderer;
|
|
13
13
|
this.tuiHighlight = '';
|
|
14
|
+
this.tuiHighlightColor = 'var(--tui-selection)';
|
|
14
15
|
this.highlight = this.setUpHighlight();
|
|
15
16
|
this.treeWalker = this.documentRef.createTreeWalker(this.elementRef.nativeElement, NodeFilter.SHOW_TEXT, svgNodeFilter, false);
|
|
16
17
|
resize$.subscribe(() => {
|
|
@@ -40,6 +41,7 @@ let TuiHighlightDirective = class TuiHighlightDirective {
|
|
|
40
41
|
const hostRect = this.elementRef.nativeElement.getBoundingClientRect();
|
|
41
42
|
const { left, top, width, height } = range.getBoundingClientRect();
|
|
42
43
|
const { style } = this.highlight;
|
|
44
|
+
style.background = this.tuiHighlightColor;
|
|
43
45
|
style.left = px(left - hostRect.left);
|
|
44
46
|
style.top = px(top - hostRect.top);
|
|
45
47
|
style.width = px(width);
|
|
@@ -56,7 +58,7 @@ let TuiHighlightDirective = class TuiHighlightDirective {
|
|
|
56
58
|
setUpHighlight() {
|
|
57
59
|
const highlight = this.renderer.createElement('div');
|
|
58
60
|
const { style } = highlight;
|
|
59
|
-
style.background =
|
|
61
|
+
style.background = this.tuiHighlightColor;
|
|
60
62
|
style.zIndex = '-1';
|
|
61
63
|
style.position = 'absolute';
|
|
62
64
|
this.renderer.appendChild(this.elementRef.nativeElement, highlight);
|
|
@@ -73,6 +75,9 @@ __decorate([
|
|
|
73
75
|
Input(),
|
|
74
76
|
tuiDefaultProp()
|
|
75
77
|
], TuiHighlightDirective.prototype, "tuiHighlight", void 0);
|
|
78
|
+
__decorate([
|
|
79
|
+
Input()
|
|
80
|
+
], TuiHighlightDirective.prototype, "tuiHighlightColor", void 0);
|
|
76
81
|
TuiHighlightDirective = __decorate([
|
|
77
82
|
Directive({
|
|
78
83
|
selector: '[tuiHighlight]',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"taiga-ui-kit-directives-highlight.js","sources":["ng://@taiga-ui/kit/directives/highlight/highlight.directive.ts","ng://@taiga-ui/kit/directives/highlight/highlight.module.ts","ng://@taiga-ui/kit/directives/highlight/taiga-ui-kit-directives-highlight.ts"],"sourcesContent":["import {DOCUMENT} from '@angular/common';\nimport {Directive, ElementRef, Inject, Input, OnChanges, Renderer2} from '@angular/core';\nimport {\n px,\n svgNodeFilter,\n tuiDefaultProp,\n TuiDestroyService,\n TuiResizeService,\n} from '@taiga-ui/cdk';\nimport {Observable} from 'rxjs';\n\n// @dynamic\n@Directive({\n selector: '[tuiHighlight]',\n host: {\n '[style.position]': '\"relative\"',\n '[style.zIndex]': '0',\n },\n providers: [TuiDestroyService, TuiResizeService],\n})\nexport class TuiHighlightDirective implements OnChanges {\n @Input()\n @tuiDefaultProp()\n tuiHighlight = '';\n\n private readonly highlight: HTMLElement = this.setUpHighlight();\n\n private readonly treeWalker = this.documentRef.createTreeWalker(\n this.elementRef.nativeElement,\n NodeFilter.SHOW_TEXT,\n svgNodeFilter,\n false,\n );\n\n constructor(\n @Inject(DOCUMENT) private readonly documentRef: Document,\n @Inject(ElementRef) private readonly elementRef: ElementRef<HTMLElement>,\n @Inject(Renderer2) private readonly renderer: Renderer2,\n @Inject(TuiResizeService) resize$: Observable<unknown>,\n ) {\n resize$.subscribe(() => {\n this.updateStyles();\n });\n }\n\n get match(): boolean {\n return this.indexOf(this.elementRef.nativeElement.textContent) !== -1;\n }\n\n ngOnChanges() {\n this.updateStyles();\n }\n\n private updateStyles() {\n this.highlight.style.display = 'none';\n\n if (!this.match) {\n return;\n }\n\n this.treeWalker.currentNode = this.elementRef.nativeElement;\n\n do {\n const index = this.indexOf(this.treeWalker.currentNode.nodeValue);\n\n if (index === -1) {\n continue;\n }\n\n const range = this.documentRef.createRange();\n\n range.setStart(this.treeWalker.currentNode, index);\n range.setEnd(this.treeWalker.currentNode, index + this.tuiHighlight.length);\n\n const hostRect = this.elementRef.nativeElement.getBoundingClientRect();\n const {left, top, width, height} = range.getBoundingClientRect();\n const {style} = this.highlight;\n\n style.left = px(left - hostRect.left);\n style.top = px(top - hostRect.top);\n style.width = px(width);\n style.height = px(height);\n style.display = 'block';\n\n return;\n } while (this.treeWalker.nextNode());\n }\n\n private indexOf(source: string | null): number {\n return !source || !this.tuiHighlight\n ? -1\n : source.toLowerCase().indexOf(this.tuiHighlight.toLowerCase());\n }\n\n private setUpHighlight(): HTMLElement {\n const highlight = this.renderer.createElement('div');\n const {style} = highlight;\n\n style.background =
|
|
1
|
+
{"version":3,"file":"taiga-ui-kit-directives-highlight.js","sources":["ng://@taiga-ui/kit/directives/highlight/highlight.directive.ts","ng://@taiga-ui/kit/directives/highlight/highlight.module.ts","ng://@taiga-ui/kit/directives/highlight/taiga-ui-kit-directives-highlight.ts"],"sourcesContent":["import {DOCUMENT} from '@angular/common';\nimport {Directive, ElementRef, Inject, Input, OnChanges, Renderer2} from '@angular/core';\nimport {\n px,\n svgNodeFilter,\n tuiDefaultProp,\n TuiDestroyService,\n TuiResizeService,\n} from '@taiga-ui/cdk';\nimport {Observable} from 'rxjs';\n\n// @dynamic\n@Directive({\n selector: '[tuiHighlight]',\n host: {\n '[style.position]': '\"relative\"',\n '[style.zIndex]': '0',\n },\n providers: [TuiDestroyService, TuiResizeService],\n})\nexport class TuiHighlightDirective implements OnChanges {\n @Input()\n @tuiDefaultProp()\n tuiHighlight = '';\n\n @Input()\n tuiHighlightColor = 'var(--tui-selection)';\n\n private readonly highlight: HTMLElement = this.setUpHighlight();\n\n private readonly treeWalker = this.documentRef.createTreeWalker(\n this.elementRef.nativeElement,\n NodeFilter.SHOW_TEXT,\n svgNodeFilter,\n false,\n );\n\n constructor(\n @Inject(DOCUMENT) private readonly documentRef: Document,\n @Inject(ElementRef) private readonly elementRef: ElementRef<HTMLElement>,\n @Inject(Renderer2) private readonly renderer: Renderer2,\n @Inject(TuiResizeService) resize$: Observable<unknown>,\n ) {\n resize$.subscribe(() => {\n this.updateStyles();\n });\n }\n\n get match(): boolean {\n return this.indexOf(this.elementRef.nativeElement.textContent) !== -1;\n }\n\n ngOnChanges() {\n this.updateStyles();\n }\n\n private updateStyles() {\n this.highlight.style.display = 'none';\n\n if (!this.match) {\n return;\n }\n\n this.treeWalker.currentNode = this.elementRef.nativeElement;\n\n do {\n const index = this.indexOf(this.treeWalker.currentNode.nodeValue);\n\n if (index === -1) {\n continue;\n }\n\n const range = this.documentRef.createRange();\n\n range.setStart(this.treeWalker.currentNode, index);\n range.setEnd(this.treeWalker.currentNode, index + this.tuiHighlight.length);\n\n const hostRect = this.elementRef.nativeElement.getBoundingClientRect();\n const {left, top, width, height} = range.getBoundingClientRect();\n const {style} = this.highlight;\n\n style.background = this.tuiHighlightColor;\n style.left = px(left - hostRect.left);\n style.top = px(top - hostRect.top);\n style.width = px(width);\n style.height = px(height);\n style.display = 'block';\n\n return;\n } while (this.treeWalker.nextNode());\n }\n\n private indexOf(source: string | null): number {\n return !source || !this.tuiHighlight\n ? -1\n : source.toLowerCase().indexOf(this.tuiHighlight.toLowerCase());\n }\n\n private setUpHighlight(): HTMLElement {\n const highlight = this.renderer.createElement('div');\n const {style} = highlight;\n\n style.background = this.tuiHighlightColor;\n style.zIndex = '-1';\n style.position = 'absolute';\n this.renderer.appendChild(this.elementRef.nativeElement, highlight);\n\n return highlight;\n }\n}\n","import {NgModule} from '@angular/core';\n\nimport {TuiHighlightDirective} from './highlight.directive';\n\n@NgModule({\n declarations: [TuiHighlightDirective],\n exports: [TuiHighlightDirective],\n})\nexport class TuiHighlightModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;AAWA;IASa,qBAAqB,GAAlC,MAAa,qBAAqB;IAiB9B,YACuC,WAAqB,EACnB,UAAmC,EACpC,QAAmB,EAC7B,OAA4B;QAHnB,gBAAW,GAAX,WAAW,CAAU;QACnB,eAAU,GAAV,UAAU,CAAyB;QACpC,aAAQ,GAAR,QAAQ,CAAW;QAjB3D,iBAAY,GAAG,EAAE,CAAC;QAGlB,sBAAiB,GAAG,sBAAsB,CAAC;QAE1B,cAAS,GAAgB,IAAI,CAAC,cAAc,EAAE,CAAC;QAE/C,eAAU,GAAG,IAAI,CAAC,WAAW,CAAC,gBAAgB,CAC3D,IAAI,CAAC,UAAU,CAAC,aAAa,EAC7B,UAAU,CAAC,SAAS,EACpB,aAAa,EACb,KAAK,CACR,CAAC;QAQE,OAAO,CAAC,SAAS,CAAC;YACd,IAAI,CAAC,YAAY,EAAE,CAAC;SACvB,CAAC,CAAC;KACN;IAED,IAAI,KAAK;QACL,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,aAAa,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC;KACzE;IAED,WAAW;QACP,IAAI,CAAC,YAAY,EAAE,CAAC;KACvB;IAEO,YAAY;QAChB,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,OAAO,GAAG,MAAM,CAAC;QAEtC,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE;YACb,OAAO;SACV;QAED,IAAI,CAAC,UAAU,CAAC,WAAW,GAAG,IAAI,CAAC,UAAU,CAAC,aAAa,CAAC;QAE5D,GAAG;YACC,MAAM,KAAK,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC;YAElE,IAAI,KAAK,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kBAAkB,CAAG;;ACRlC;;;;;;"}
|
|
@@ -0,0 +1,361 @@
|
|
|
1
|
+
import { __extends, __read, __decorate, __param } from 'tslib';
|
|
2
|
+
import { Inject, ElementRef, Input, Directive, HostBinding, HostListener, EventEmitter, Optional, Output, ContentChildren, TemplateRef, Component, ChangeDetectionStrategy, NgModule } from '@angular/core';
|
|
3
|
+
import { INTERSECTION_ROOT, IntersectionObserverModule } from '@ng-web-apis/intersection-observer';
|
|
4
|
+
import { typedFromEvent, TuiDestroyService, clamp, TUI_IS_MOBILE, TuiPanService, tuiDefaultProp, EMPTY_QUERY, TuiItemDirective, tuiPure, TuiItemModule } from '@taiga-ui/cdk';
|
|
5
|
+
import { BehaviorSubject, merge, combineLatest, interval, of, Observable, EMPTY, Subject } from 'rxjs';
|
|
6
|
+
import { mapTo, takeUntil, shareReplay, filter, switchMap, withLatestFrom, scan, startWith, distinctUntilChanged, delay, map, endWith, repeat } from 'rxjs/operators';
|
|
7
|
+
import { PAGE_VISIBILITY } from '@ng-web-apis/common';
|
|
8
|
+
import { DOCUMENT, CommonModule } from '@angular/common';
|
|
9
|
+
import { TuiPresentModule } from '@taiga-ui/kit/directives';
|
|
10
|
+
import { TUI_BUTTON_OPTIONS } from '@taiga-ui/core';
|
|
11
|
+
import { shouldCall } from '@tinkoff/ng-event-plugins';
|
|
12
|
+
|
|
13
|
+
var TuiCarouselDirective = /** @class */ (function (_super) {
|
|
14
|
+
__extends(TuiCarouselDirective, _super);
|
|
15
|
+
function TuiCarouselDirective(destroy$, elementRef, visible$) {
|
|
16
|
+
var _this = _super.call(this, function (subscriber) { return _this.output$.subscribe(subscriber); }) || this;
|
|
17
|
+
_this.destroy$ = destroy$;
|
|
18
|
+
_this.elementRef = elementRef;
|
|
19
|
+
_this.visible$ = visible$;
|
|
20
|
+
_this.index$ = new BehaviorSubject(NaN);
|
|
21
|
+
_this.duration$ = new BehaviorSubject(0);
|
|
22
|
+
_this.running$ = merge(typedFromEvent(_this.elementRef.nativeElement, 'mouseenter').pipe(mapTo(false)), typedFromEvent(_this.elementRef.nativeElement, 'mouseleave').pipe(mapTo(true)), _this.visible$).pipe(takeUntil(_this.destroy$), shareReplay(1));
|
|
23
|
+
_this.output$ = combineLatest([
|
|
24
|
+
_this.index$.pipe(filter(function (v) { return !isNaN(v); })),
|
|
25
|
+
_this.duration$,
|
|
26
|
+
]).pipe(switchMap(function (_a) {
|
|
27
|
+
var _b = __read(_a, 2), index = _b[0], duration = _b[1];
|
|
28
|
+
return duration
|
|
29
|
+
? interval(duration).pipe(withLatestFrom(_this.running$), filter(function (_a) {
|
|
30
|
+
var _b = __read(_a, 2), _ = _b[0], running = _b[1];
|
|
31
|
+
return running;
|
|
32
|
+
}), scan(function (acc) { return ++acc; }, index), startWith(index))
|
|
33
|
+
: of(index);
|
|
34
|
+
}), distinctUntilChanged());
|
|
35
|
+
// So that initial position is scrolled to instantly
|
|
36
|
+
_this.inited = false;
|
|
37
|
+
return _this;
|
|
38
|
+
}
|
|
39
|
+
Object.defineProperty(TuiCarouselDirective.prototype, "index", {
|
|
40
|
+
set: function (index) {
|
|
41
|
+
this.index$.next(index);
|
|
42
|
+
},
|
|
43
|
+
enumerable: true,
|
|
44
|
+
configurable: true
|
|
45
|
+
});
|
|
46
|
+
Object.defineProperty(TuiCarouselDirective.prototype, "duration", {
|
|
47
|
+
set: function (duration) {
|
|
48
|
+
this.duration$.next(duration);
|
|
49
|
+
},
|
|
50
|
+
enumerable: true,
|
|
51
|
+
configurable: true
|
|
52
|
+
});
|
|
53
|
+
TuiCarouselDirective.prototype.ngOnInit = function () {
|
|
54
|
+
if (isNaN(this.index$.value)) {
|
|
55
|
+
this.index$.next(0);
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
TuiCarouselDirective.prototype.prev = function () {
|
|
59
|
+
this.index$.next(this.index$.value - 1);
|
|
60
|
+
};
|
|
61
|
+
TuiCarouselDirective.prototype.next = function () {
|
|
62
|
+
this.index$.next(this.index$.value + 1);
|
|
63
|
+
};
|
|
64
|
+
TuiCarouselDirective.ctorParameters = function () { return [
|
|
65
|
+
{ type: Observable, decorators: [{ type: Inject, args: [TuiDestroyService,] }] },
|
|
66
|
+
{ type: ElementRef, decorators: [{ type: Inject, args: [ElementRef,] }] },
|
|
67
|
+
{ type: Observable, decorators: [{ type: Inject, args: [PAGE_VISIBILITY,] }] }
|
|
68
|
+
]; };
|
|
69
|
+
__decorate([
|
|
70
|
+
Input()
|
|
71
|
+
], TuiCarouselDirective.prototype, "index", null);
|
|
72
|
+
__decorate([
|
|
73
|
+
Input()
|
|
74
|
+
], TuiCarouselDirective.prototype, "duration", null);
|
|
75
|
+
TuiCarouselDirective = __decorate([
|
|
76
|
+
Directive({
|
|
77
|
+
selector: 'tui-carousel',
|
|
78
|
+
exportAs: 'tui-carousel',
|
|
79
|
+
providers: [TuiDestroyService],
|
|
80
|
+
}),
|
|
81
|
+
__param(0, Inject(TuiDestroyService)),
|
|
82
|
+
__param(1, Inject(ElementRef)),
|
|
83
|
+
__param(2, Inject(PAGE_VISIBILITY))
|
|
84
|
+
], TuiCarouselDirective);
|
|
85
|
+
return TuiCarouselDirective;
|
|
86
|
+
}(Observable));
|
|
87
|
+
|
|
88
|
+
// @dynamic
|
|
89
|
+
var TuiCarouselDraggableDirective = /** @class */ (function (_super) {
|
|
90
|
+
__extends(TuiCarouselDraggableDirective, _super);
|
|
91
|
+
function TuiCarouselDraggableDirective(documentRef, isMobile, elementRef, pan$) {
|
|
92
|
+
var _this = _super.call(this, function (subscriber) { return _this.transform$.subscribe(subscriber); }) || this;
|
|
93
|
+
_this.documentRef = documentRef;
|
|
94
|
+
_this.isMobile = isMobile;
|
|
95
|
+
_this.elementRef = elementRef;
|
|
96
|
+
_this.pan$ = pan$;
|
|
97
|
+
_this.transform$ = _this.isMobile
|
|
98
|
+
? EMPTY
|
|
99
|
+
: _this.pan$.pipe(filter(function () { return _this.draggable; }), scan(function (acc, _a) {
|
|
100
|
+
var _b = __read(_a, 1), cur = _b[0];
|
|
101
|
+
return acc + cur;
|
|
102
|
+
}, 0), takeUntil(typedFromEvent(_this.documentRef, 'mouseup').pipe(delay(0))), map(function (x) { return "translateX(" + clamp(x, _this.min, _this.max) + "px)"; }), endWith(null), repeat());
|
|
103
|
+
_this.min = -Infinity;
|
|
104
|
+
_this.max = Infinity;
|
|
105
|
+
_this.draggable = true;
|
|
106
|
+
_this.transitioned = false;
|
|
107
|
+
return _this;
|
|
108
|
+
}
|
|
109
|
+
TuiCarouselDraggableDirective.prototype.onMouseDown = function () {
|
|
110
|
+
var _a = this.elementRef.nativeElement, scrollLeft = _a.scrollLeft, scrollWidth = _a.scrollWidth, clientWidth = _a.clientWidth;
|
|
111
|
+
this.max = scrollLeft;
|
|
112
|
+
this.min = clientWidth - Math.round(scrollWidth) + Math.round(scrollLeft);
|
|
113
|
+
this.transitioned = true;
|
|
114
|
+
};
|
|
115
|
+
TuiCarouselDraggableDirective.prototype.onTransitionEnd = function (target) {
|
|
116
|
+
if (this.elementRef.nativeElement.firstElementChild === target) {
|
|
117
|
+
this.transitioned = false;
|
|
118
|
+
}
|
|
119
|
+
};
|
|
120
|
+
TuiCarouselDraggableDirective.ctorParameters = function () { return [
|
|
121
|
+
{ type: Document, decorators: [{ type: Inject, args: [DOCUMENT,] }] },
|
|
122
|
+
{ type: Boolean, decorators: [{ type: Inject, args: [TUI_IS_MOBILE,] }] },
|
|
123
|
+
{ type: ElementRef, decorators: [{ type: Inject, args: [INTERSECTION_ROOT,] }] },
|
|
124
|
+
{ type: Observable, decorators: [{ type: Inject, args: [TuiPanService,] }] }
|
|
125
|
+
]; };
|
|
126
|
+
__decorate([
|
|
127
|
+
Input(),
|
|
128
|
+
HostBinding('class._draggable'),
|
|
129
|
+
tuiDefaultProp()
|
|
130
|
+
], TuiCarouselDraggableDirective.prototype, "draggable", void 0);
|
|
131
|
+
__decorate([
|
|
132
|
+
HostBinding('class._transitioned')
|
|
133
|
+
], TuiCarouselDraggableDirective.prototype, "transitioned", void 0);
|
|
134
|
+
__decorate([
|
|
135
|
+
HostListener('mousedown.silent')
|
|
136
|
+
], TuiCarouselDraggableDirective.prototype, "onMouseDown", null);
|
|
137
|
+
__decorate([
|
|
138
|
+
HostListener('transitionend', ['$event.target'])
|
|
139
|
+
], TuiCarouselDraggableDirective.prototype, "onTransitionEnd", null);
|
|
140
|
+
TuiCarouselDraggableDirective = __decorate([
|
|
141
|
+
Directive({
|
|
142
|
+
selector: 'tui-carousel[draggable]',
|
|
143
|
+
providers: [TuiPanService],
|
|
144
|
+
}),
|
|
145
|
+
__param(0, Inject(DOCUMENT)),
|
|
146
|
+
__param(1, Inject(TUI_IS_MOBILE)),
|
|
147
|
+
__param(2, Inject(INTERSECTION_ROOT)),
|
|
148
|
+
__param(3, Inject(TuiPanService))
|
|
149
|
+
], TuiCarouselDraggableDirective);
|
|
150
|
+
return TuiCarouselDraggableDirective;
|
|
151
|
+
}(Observable));
|
|
152
|
+
|
|
153
|
+
var TuiCarouselComponent = /** @class */ (function () {
|
|
154
|
+
function TuiCarouselComponent(transform$, index$) {
|
|
155
|
+
var _this = this;
|
|
156
|
+
this.transform$ = transform$;
|
|
157
|
+
this.index$ = index$;
|
|
158
|
+
this.intersected$ = new Subject();
|
|
159
|
+
this.itemsCount = 1;
|
|
160
|
+
this.index = 0;
|
|
161
|
+
this.indexChange = new EventEmitter();
|
|
162
|
+
this.manual$ = this.index$.pipe(map(function (index) { return _this.loopback(index); }));
|
|
163
|
+
this.attached = false;
|
|
164
|
+
this.items = EMPTY_QUERY;
|
|
165
|
+
}
|
|
166
|
+
TuiCarouselComponent.prototype.getStyle = function (itemsCount) {
|
|
167
|
+
var percent = 100 / itemsCount + "%";
|
|
168
|
+
return {
|
|
169
|
+
flexBasis: percent,
|
|
170
|
+
minWidth: percent,
|
|
171
|
+
maxWidth: percent,
|
|
172
|
+
};
|
|
173
|
+
};
|
|
174
|
+
TuiCarouselComponent.prototype.onIntersection = function (_a, index) {
|
|
175
|
+
var intersectionRatio = _a.intersectionRatio, intersectionRect = _a.intersectionRect, rootBounds = _a.rootBounds;
|
|
176
|
+
if (!this.attached ||
|
|
177
|
+
!intersectionRatio ||
|
|
178
|
+
intersectionRatio === 1 ||
|
|
179
|
+
// Phantom intersections due to width wobble on drag
|
|
180
|
+
intersectionRect.left > Number(rootBounds === null || rootBounds === void 0 ? void 0 : rootBounds.left)) {
|
|
181
|
+
return;
|
|
182
|
+
}
|
|
183
|
+
this.indexChange.emit(index - Math.floor(this.itemsCount / 2));
|
|
184
|
+
};
|
|
185
|
+
TuiCarouselComponent.prototype.onPresent = function (attached) {
|
|
186
|
+
this.attached = attached;
|
|
187
|
+
};
|
|
188
|
+
TuiCarouselComponent.prototype.loopback = function (index) {
|
|
189
|
+
var safe = this.items.length || index + 1;
|
|
190
|
+
var remainder = index % safe;
|
|
191
|
+
return remainder < 0 ? remainder + this.items.length : remainder;
|
|
192
|
+
};
|
|
193
|
+
TuiCarouselComponent.ctorParameters = function () { return [
|
|
194
|
+
{ type: Observable, decorators: [{ type: Optional }, { type: Inject, args: [TuiCarouselDraggableDirective,] }] },
|
|
195
|
+
{ type: Observable, decorators: [{ type: Inject, args: [TuiCarouselDirective,] }] }
|
|
196
|
+
]; };
|
|
197
|
+
__decorate([
|
|
198
|
+
Input(),
|
|
199
|
+
tuiDefaultProp()
|
|
200
|
+
], TuiCarouselComponent.prototype, "itemsCount", void 0);
|
|
201
|
+
__decorate([
|
|
202
|
+
Input(),
|
|
203
|
+
tuiDefaultProp()
|
|
204
|
+
], TuiCarouselComponent.prototype, "index", void 0);
|
|
205
|
+
__decorate([
|
|
206
|
+
Output()
|
|
207
|
+
], TuiCarouselComponent.prototype, "indexChange", void 0);
|
|
208
|
+
__decorate([
|
|
209
|
+
ContentChildren(TuiItemDirective, { read: TemplateRef })
|
|
210
|
+
], TuiCarouselComponent.prototype, "items", void 0);
|
|
211
|
+
__decorate([
|
|
212
|
+
tuiPure
|
|
213
|
+
], TuiCarouselComponent.prototype, "getStyle", null);
|
|
214
|
+
TuiCarouselComponent = __decorate([
|
|
215
|
+
Component({
|
|
216
|
+
selector: 'tui-carousel',
|
|
217
|
+
template: "<ng-container *ngIf=\"items.changes | async\"></ng-container>\n<div\n *ngIf=\"{\n manual: manual$ | async,\n intersected: indexChange | async\n } as state\"\n waIntersectionObserver\n waIntersectionThreshold=\"0,1\"\n waIntersectionRootMargin=\"100px 100000px 100px -51%\"\n class=\"t-items\"\n [class.t-items_visible]=\"attached\"\n [style.transform]=\"transform$ | async\"\n (tuiPresentChange)=\"onPresent($event)\"\n>\n <div\n *ngFor=\"let item of items; let i = index\"\n tuiCarouselScroller\n class=\"t-item\"\n [scroll]=\"attached && i === state.manual && i !== state.intersected\"\n [index]=\"i\"\n [current]=\"state.intersected\"\n [ngStyle]=\"getStyle(itemsCount)\"\n (waIntersectionObservee)=\"onIntersection($event[0], i)\"\n >\n <ng-container [ngTemplateOutlet]=\"item\"></ng-container>\n </div>\n</div>\n<div class=\"t-content\">\n <ng-content></ng-content>\n</div>\n",
|
|
218
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
219
|
+
providers: [
|
|
220
|
+
{
|
|
221
|
+
provide: INTERSECTION_ROOT,
|
|
222
|
+
useExisting: ElementRef,
|
|
223
|
+
},
|
|
224
|
+
],
|
|
225
|
+
styles: [":host{scrollbar-width:none;-ms-overflow-style:none;position:relative;display:block;overflow:auto;overscroll-behavior-x:none;-ms-scroll-snap-type:x mandatory;scroll-snap-type:x mandatory}:host::-webkit-scrollbar,:host::-webkit-scrollbar-thumb{background:0 0;width:0;height:0}:host._transitioned{-ms-scroll-snap-type:none;scroll-snap-type:none}:host._draggable{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}:host._draggable:hover{cursor:-webkit-grab;cursor:grab}:host._draggable:active{cursor:-webkit-grabbing;cursor:grabbing}.t-items{display:flex;align-items:center;visibility:hidden}.t-items_visible{visibility:visible}.t-items:not([style*=transform]){transition-property:transform;transition-duration:var(--tui-duration,300ms);transition-timing-function:ease-in-out}.t-item{padding:0 1.25rem;flex:1;min-width:100%;max-width:100%;box-sizing:border-box;scroll-snap-align:start;scroll-snap-stop:always}.t-content{position:sticky;left:0;display:flex;justify-content:center}"]
|
|
226
|
+
}),
|
|
227
|
+
__param(0, Optional()),
|
|
228
|
+
__param(0, Inject(TuiCarouselDraggableDirective)),
|
|
229
|
+
__param(1, Inject(TuiCarouselDirective))
|
|
230
|
+
], TuiCarouselComponent);
|
|
231
|
+
return TuiCarouselComponent;
|
|
232
|
+
}());
|
|
233
|
+
|
|
234
|
+
// TODO: remove in ivy compilation
|
|
235
|
+
var CAROUSEL_BUTTON_OPTIONS = {
|
|
236
|
+
appearance: "secondary" /* Secondary */,
|
|
237
|
+
shape: 'rounded',
|
|
238
|
+
size: 'm',
|
|
239
|
+
};
|
|
240
|
+
var TuiCarouselButtonsDirective = /** @class */ (function () {
|
|
241
|
+
function TuiCarouselButtonsDirective() {
|
|
242
|
+
}
|
|
243
|
+
TuiCarouselButtonsDirective = __decorate([
|
|
244
|
+
Directive({
|
|
245
|
+
selector: '[tuiCarouselButtons]',
|
|
246
|
+
providers: [
|
|
247
|
+
{
|
|
248
|
+
provide: TUI_BUTTON_OPTIONS,
|
|
249
|
+
useValue: CAROUSEL_BUTTON_OPTIONS,
|
|
250
|
+
},
|
|
251
|
+
],
|
|
252
|
+
})
|
|
253
|
+
], TuiCarouselButtonsDirective);
|
|
254
|
+
return TuiCarouselButtonsDirective;
|
|
255
|
+
}());
|
|
256
|
+
|
|
257
|
+
function shouldScroll() {
|
|
258
|
+
var _a;
|
|
259
|
+
return !this.isMobile && !!((_a = this.draggable) === null || _a === void 0 ? void 0 : _a.draggable) && this.index === this.current;
|
|
260
|
+
}
|
|
261
|
+
// @dynamic
|
|
262
|
+
var TuiCarouselScrollerDirective = /** @class */ (function () {
|
|
263
|
+
function TuiCarouselScrollerDirective(draggable, isMobile, directive, elementRef, root) {
|
|
264
|
+
this.draggable = draggable;
|
|
265
|
+
this.isMobile = isMobile;
|
|
266
|
+
this.directive = directive;
|
|
267
|
+
this.elementRef = elementRef;
|
|
268
|
+
this.root = root;
|
|
269
|
+
this.index = 0;
|
|
270
|
+
this.current = 0;
|
|
271
|
+
}
|
|
272
|
+
Object.defineProperty(TuiCarouselScrollerDirective.prototype, "scroll", {
|
|
273
|
+
set: function (scroll) {
|
|
274
|
+
if (scroll) {
|
|
275
|
+
this.scrollTo(this.directive.inited ? 'smooth' : 'auto');
|
|
276
|
+
}
|
|
277
|
+
},
|
|
278
|
+
enumerable: true,
|
|
279
|
+
configurable: true
|
|
280
|
+
});
|
|
281
|
+
TuiCarouselScrollerDirective.prototype.onMouseUp = function (_e) {
|
|
282
|
+
var left = this.root.nativeElement.getBoundingClientRect().left;
|
|
283
|
+
var rect = this.elementRef.nativeElement.getBoundingClientRect();
|
|
284
|
+
var parentElement = this.elementRef.nativeElement.parentElement;
|
|
285
|
+
parentElement.style.transform = "translateX(" + (rect.left - left) + "px)";
|
|
286
|
+
this.scrollTo();
|
|
287
|
+
};
|
|
288
|
+
TuiCarouselScrollerDirective.prototype.scrollTo = function (behavior) {
|
|
289
|
+
if (behavior === void 0) { behavior = 'auto'; }
|
|
290
|
+
this.directive.inited = true;
|
|
291
|
+
this.root.nativeElement.scrollTo({
|
|
292
|
+
left: this.elementRef.nativeElement.offsetLeft,
|
|
293
|
+
behavior: behavior,
|
|
294
|
+
});
|
|
295
|
+
};
|
|
296
|
+
TuiCarouselScrollerDirective.ctorParameters = function () { return [
|
|
297
|
+
{ type: TuiCarouselDraggableDirective, decorators: [{ type: Optional }, { type: Inject, args: [TuiCarouselDraggableDirective,] }] },
|
|
298
|
+
{ type: Boolean, decorators: [{ type: Inject, args: [TUI_IS_MOBILE,] }] },
|
|
299
|
+
{ type: TuiCarouselDirective, decorators: [{ type: Inject, args: [TuiCarouselDirective,] }] },
|
|
300
|
+
{ type: ElementRef, decorators: [{ type: Inject, args: [ElementRef,] }] },
|
|
301
|
+
{ type: ElementRef, decorators: [{ type: Inject, args: [INTERSECTION_ROOT,] }] }
|
|
302
|
+
]; };
|
|
303
|
+
__decorate([
|
|
304
|
+
Input()
|
|
305
|
+
], TuiCarouselScrollerDirective.prototype, "scroll", null);
|
|
306
|
+
__decorate([
|
|
307
|
+
Input()
|
|
308
|
+
], TuiCarouselScrollerDirective.prototype, "index", void 0);
|
|
309
|
+
__decorate([
|
|
310
|
+
Input()
|
|
311
|
+
], TuiCarouselScrollerDirective.prototype, "current", void 0);
|
|
312
|
+
__decorate([
|
|
313
|
+
HostListener('document:mouseup.init', ['$event']),
|
|
314
|
+
HostListener('document:mouseup.silent', ['$event']),
|
|
315
|
+
shouldCall(shouldScroll)
|
|
316
|
+
], TuiCarouselScrollerDirective.prototype, "onMouseUp", null);
|
|
317
|
+
TuiCarouselScrollerDirective = __decorate([
|
|
318
|
+
Directive({
|
|
319
|
+
selector: '[tuiCarouselScroller]',
|
|
320
|
+
}),
|
|
321
|
+
__param(0, Optional()),
|
|
322
|
+
__param(0, Inject(TuiCarouselDraggableDirective)),
|
|
323
|
+
__param(1, Inject(TUI_IS_MOBILE)),
|
|
324
|
+
__param(2, Inject(TuiCarouselDirective)),
|
|
325
|
+
__param(3, Inject(ElementRef)),
|
|
326
|
+
__param(4, Inject(INTERSECTION_ROOT))
|
|
327
|
+
], TuiCarouselScrollerDirective);
|
|
328
|
+
return TuiCarouselScrollerDirective;
|
|
329
|
+
}());
|
|
330
|
+
|
|
331
|
+
var TuiCarouselModule = /** @class */ (function () {
|
|
332
|
+
function TuiCarouselModule() {
|
|
333
|
+
}
|
|
334
|
+
TuiCarouselModule = __decorate([
|
|
335
|
+
NgModule({
|
|
336
|
+
imports: [CommonModule, IntersectionObserverModule, TuiItemModule, TuiPresentModule],
|
|
337
|
+
declarations: [
|
|
338
|
+
TuiCarouselComponent,
|
|
339
|
+
TuiCarouselDirective,
|
|
340
|
+
TuiCarouselScrollerDirective,
|
|
341
|
+
TuiCarouselDraggableDirective,
|
|
342
|
+
TuiCarouselButtonsDirective,
|
|
343
|
+
],
|
|
344
|
+
exports: [
|
|
345
|
+
TuiCarouselComponent,
|
|
346
|
+
TuiCarouselDirective,
|
|
347
|
+
TuiCarouselButtonsDirective,
|
|
348
|
+
TuiCarouselDraggableDirective,
|
|
349
|
+
TuiItemDirective,
|
|
350
|
+
],
|
|
351
|
+
})
|
|
352
|
+
], TuiCarouselModule);
|
|
353
|
+
return TuiCarouselModule;
|
|
354
|
+
}());
|
|
355
|
+
|
|
356
|
+
/**
|
|
357
|
+
* Generated bundle index. Do not edit.
|
|
358
|
+
*/
|
|
359
|
+
|
|
360
|
+
export { CAROUSEL_BUTTON_OPTIONS, TuiCarouselButtonsDirective, TuiCarouselComponent, TuiCarouselDirective, TuiCarouselDraggableDirective, TuiCarouselModule, TuiCarouselScrollerDirective, shouldScroll };
|
|
361
|
+
//# sourceMappingURL=taiga-ui-kit-components-carousel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"taiga-ui-kit-components-carousel.js","sources":["ng://@taiga-ui/kit/components/carousel/carousel.directive.ts","ng://@taiga-ui/kit/components/carousel/carousel-draggable.directive.ts","ng://@taiga-ui/kit/components/carousel/carousel.component.ts","ng://@taiga-ui/kit/components/carousel/carousel-buttons.directive.ts","ng://@taiga-ui/kit/components/carousel/carousel-scroller.directive.ts","ng://@taiga-ui/kit/components/carousel/carousel.module.ts","ng://@taiga-ui/kit/components/carousel/taiga-ui-kit-components-carousel.ts"],"sourcesContent":["import {Directive, ElementRef, Inject, Input, OnInit} from '@angular/core';\nimport {PAGE_VISIBILITY} from '@ng-web-apis/common';\nimport {TuiDestroyService, typedFromEvent} from '@taiga-ui/cdk';\nimport {BehaviorSubject, combineLatest, interval, merge, Observable, of} from 'rxjs';\nimport {\n distinctUntilChanged,\n filter,\n mapTo,\n scan,\n shareReplay,\n startWith,\n switchMap,\n takeUntil,\n withLatestFrom,\n} from 'rxjs/operators';\n\n@Directive({\n selector: 'tui-carousel',\n exportAs: 'tui-carousel',\n providers: [TuiDestroyService],\n})\nexport class TuiCarouselDirective extends Observable<number> implements OnInit {\n private readonly index$ = new BehaviorSubject<number>(NaN);\n\n private readonly duration$ = new BehaviorSubject(0);\n\n private readonly running$ = merge(\n typedFromEvent(this.elementRef.nativeElement, 'mouseenter').pipe(mapTo(false)),\n typedFromEvent(this.elementRef.nativeElement, 'mouseleave').pipe(mapTo(true)),\n this.visible$,\n ).pipe(takeUntil(this.destroy$), shareReplay(1));\n\n private readonly output$ = combineLatest([\n this.index$.pipe(filter(v => !isNaN(v))),\n this.duration$,\n ]).pipe(\n switchMap(([index, duration]) =>\n duration\n ? interval(duration).pipe(\n withLatestFrom(this.running$),\n filter(([_, running]) => running),\n scan(acc => ++acc, index),\n startWith(index),\n )\n : of(index),\n ),\n distinctUntilChanged(),\n );\n\n @Input()\n set index(index: number) {\n this.index$.next(index);\n }\n\n @Input()\n set duration(duration: number) {\n this.duration$.next(duration);\n }\n\n // So that initial position is scrolled to instantly\n inited = false;\n\n constructor(\n @Inject(TuiDestroyService) private readonly destroy$: Observable<unknown>,\n @Inject(ElementRef) private readonly elementRef: ElementRef<HTMLElement>,\n @Inject(PAGE_VISIBILITY) private readonly visible$: Observable<boolean>,\n ) {\n super(subscriber => this.output$.subscribe(subscriber));\n }\n\n ngOnInit() {\n if (isNaN(this.index$.value)) {\n this.index$.next(0);\n }\n }\n\n prev() {\n this.index$.next(this.index$.value - 1);\n }\n\n next() {\n this.index$.next(this.index$.value + 1);\n }\n}\n","import {DOCUMENT} from '@angular/common';\nimport {\n Directive,\n ElementRef,\n HostBinding,\n HostListener,\n Inject,\n Input,\n} from '@angular/core';\nimport {INTERSECTION_ROOT} from '@ng-web-apis/intersection-observer';\nimport {\n clamp,\n TUI_IS_MOBILE,\n tuiDefaultProp,\n TuiPanService,\n typedFromEvent,\n} from '@taiga-ui/cdk';\nimport {EMPTY, Observable} from 'rxjs';\nimport {delay, endWith, filter, map, repeat, scan, takeUntil} from 'rxjs/operators';\n\n// @dynamic\n@Directive({\n selector: 'tui-carousel[draggable]',\n providers: [TuiPanService],\n})\nexport class TuiCarouselDraggableDirective extends Observable<string | null> {\n private readonly transform$ = this.isMobile\n ? EMPTY\n : this.pan$.pipe(\n filter(() => this.draggable),\n scan((acc, [cur]) => acc + cur, 0),\n takeUntil(typedFromEvent(this.documentRef, 'mouseup').pipe(delay(0))),\n map(x => `translateX(${clamp(x, this.min, this.max)}px)`),\n endWith(null),\n repeat(),\n );\n\n private min = -Infinity;\n private max = Infinity;\n\n @Input()\n @HostBinding('class._draggable')\n @tuiDefaultProp()\n draggable = true;\n\n @HostBinding('class._transitioned')\n transitioned = false;\n\n constructor(\n @Inject(DOCUMENT) private readonly documentRef: Document,\n @Inject(TUI_IS_MOBILE) private readonly isMobile: boolean,\n @Inject(INTERSECTION_ROOT) private readonly elementRef: ElementRef<HTMLElement>,\n @Inject(TuiPanService)\n private readonly pan$: Observable<readonly [number, number]>,\n ) {\n super(subscriber => this.transform$.subscribe(subscriber));\n }\n\n @HostListener('mousedown.silent')\n onMouseDown() {\n const {scrollLeft, scrollWidth, clientWidth} = this.elementRef.nativeElement;\n\n this.max = scrollLeft;\n this.min = clientWidth - Math.round(scrollWidth) + Math.round(scrollLeft);\n this.transitioned = true;\n }\n\n @HostListener('transitionend', ['$event.target'])\n onTransitionEnd(target: HTMLElement) {\n if (this.elementRef.nativeElement.firstElementChild === target) {\n this.transitioned = false;\n }\n }\n}\n","import {\n ChangeDetectionStrategy,\n Component,\n ContentChildren,\n ElementRef,\n EventEmitter,\n Inject,\n Input,\n Optional,\n Output,\n QueryList,\n TemplateRef,\n} from '@angular/core';\nimport {INTERSECTION_ROOT} from '@ng-web-apis/intersection-observer';\nimport {EMPTY_QUERY, tuiDefaultProp, TuiItemDirective, tuiPure} from '@taiga-ui/cdk';\nimport {Observable, Subject} from 'rxjs';\nimport {map} from 'rxjs/operators';\n\nimport {TuiCarouselDirective} from './carousel.directive';\nimport {TuiCarouselDraggableDirective} from './carousel-draggable.directive';\n\n@Component({\n selector: 'tui-carousel',\n templateUrl: 'carousel.template.html',\n styleUrls: ['carousel.style.less'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n providers: [\n {\n provide: INTERSECTION_ROOT,\n useExisting: ElementRef,\n },\n ],\n})\nexport class TuiCarouselComponent {\n readonly intersected$ = new Subject<number>();\n\n @Input()\n @tuiDefaultProp()\n itemsCount = 1;\n\n @Input()\n @tuiDefaultProp()\n index = 0;\n\n @Output()\n readonly indexChange = new EventEmitter<number>();\n\n readonly manual$ = this.index$.pipe(map(index => this.loopback(index)));\n\n attached = false;\n\n @ContentChildren(TuiItemDirective, {read: TemplateRef})\n readonly items: QueryList<TemplateRef<any>> = EMPTY_QUERY;\n\n constructor(\n @Optional()\n @Inject(TuiCarouselDraggableDirective)\n readonly transform$: Observable<string | null> | null,\n @Inject(TuiCarouselDirective) private readonly index$: Observable<number>,\n ) {}\n\n @tuiPure\n getStyle(itemsCount: number): Partial<CSSStyleDeclaration> {\n const percent = `${100 / itemsCount}%`;\n\n return {\n flexBasis: percent,\n minWidth: percent,\n maxWidth: percent,\n };\n }\n\n onIntersection(\n {intersectionRatio, intersectionRect, rootBounds}: IntersectionObserverEntry,\n index: number,\n ) {\n if (\n !this.attached ||\n !intersectionRatio ||\n intersectionRatio === 1 ||\n // Phantom intersections due to width wobble on drag\n intersectionRect.left > Number(rootBounds?.left)\n ) {\n return;\n }\n\n this.indexChange.emit(index - Math.floor(this.itemsCount / 2));\n }\n\n onPresent(attached: boolean) {\n this.attached = attached;\n }\n\n private loopback(index: number) {\n const safe = this.items.length || index + 1;\n const remainder = index % safe;\n\n return remainder < 0 ? remainder + this.items.length : remainder;\n }\n}\n","import {Directive} from '@angular/core';\nimport {ButtonOptions, TUI_BUTTON_OPTIONS, TuiAppearance} from '@taiga-ui/core';\n\n// TODO: remove in ivy compilation\nexport const CAROUSEL_BUTTON_OPTIONS: ButtonOptions = {\n appearance: TuiAppearance.Secondary,\n shape: 'rounded',\n size: 'm',\n};\n\n@Directive({\n selector: '[tuiCarouselButtons]',\n providers: [\n {\n provide: TUI_BUTTON_OPTIONS,\n useValue: CAROUSEL_BUTTON_OPTIONS,\n },\n ],\n})\nexport class TuiCarouselButtonsDirective {}\n","import {\n Directive,\n ElementRef,\n HostListener,\n Inject,\n Input,\n Optional,\n} from '@angular/core';\nimport {INTERSECTION_ROOT} from '@ng-web-apis/intersection-observer';\nimport {TUI_IS_MOBILE} from '@taiga-ui/cdk';\nimport {shouldCall} from '@tinkoff/ng-event-plugins';\n\nimport {TuiCarouselDirective} from './carousel.directive';\nimport {TuiCarouselDraggableDirective} from './carousel-draggable.directive';\n\nexport function shouldScroll(this: TuiCarouselScrollerDirective): boolean {\n return !this.isMobile && !!this.draggable?.draggable && this.index === this.current;\n}\n\n// @dynamic\n@Directive({\n selector: '[tuiCarouselScroller]',\n})\nexport class TuiCarouselScrollerDirective {\n @Input()\n set scroll(scroll: boolean) {\n if (scroll) {\n this.scrollTo(this.directive.inited ? 'smooth' : 'auto');\n }\n }\n\n @Input()\n index = 0;\n\n @Input()\n current = 0;\n\n constructor(\n @Optional()\n @Inject(TuiCarouselDraggableDirective)\n readonly draggable: TuiCarouselDraggableDirective | null,\n @Inject(TUI_IS_MOBILE) readonly isMobile: boolean,\n @Inject(TuiCarouselDirective) private readonly directive: TuiCarouselDirective,\n @Inject(ElementRef) private readonly elementRef: ElementRef<HTMLElement>,\n @Inject(INTERSECTION_ROOT) private readonly root: ElementRef<HTMLElement>,\n ) {}\n\n @HostListener('document:mouseup.init', ['$event'])\n @HostListener('document:mouseup.silent', ['$event'])\n @shouldCall(shouldScroll)\n onMouseUp(_e: unknown) {\n const {left} = this.root.nativeElement.getBoundingClientRect();\n const rect = this.elementRef.nativeElement.getBoundingClientRect();\n const {parentElement} = this.elementRef.nativeElement;\n\n parentElement!.style.transform = `translateX(${rect.left - left}px)`;\n this.scrollTo();\n }\n\n private scrollTo(behavior: ScrollBehavior = 'auto') {\n this.directive.inited = true;\n this.root.nativeElement.scrollTo({\n left: this.elementRef.nativeElement.offsetLeft,\n behavior,\n });\n }\n}\n","import {CommonModule} from '@angular/common';\nimport {NgModule} from '@angular/core';\nimport {IntersectionObserverModule} from '@ng-web-apis/intersection-observer';\nimport {TuiItemDirective, TuiItemModule} from '@taiga-ui/cdk';\nimport {TuiPresentModule} from '@taiga-ui/kit/directives';\n\nimport {TuiCarouselComponent} from './carousel.component';\nimport {TuiCarouselDirective} from './carousel.directive';\nimport {TuiCarouselButtonsDirective} from './carousel-buttons.directive';\nimport {TuiCarouselDraggableDirective} from './carousel-draggable.directive';\nimport {TuiCarouselScrollerDirective} from './carousel-scroller.directive';\n\n@NgModule({\n imports: [CommonModule, IntersectionObserverModule, TuiItemModule, TuiPresentModule],\n declarations: [\n TuiCarouselComponent,\n TuiCarouselDirective,\n TuiCarouselScrollerDirective,\n TuiCarouselDraggableDirective,\n TuiCarouselButtonsDirective,\n ],\n exports: [\n TuiCarouselComponent,\n TuiCarouselDirective,\n TuiCarouselButtonsDirective,\n TuiCarouselDraggableDirective,\n TuiItemDirective,\n ],\n})\nexport class TuiCarouselModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;;;;IAqB0C,wCAAkB;IAyCxD,8BACgD,QAA6B,EACpC,UAAmC,EAC9B,QAA6B;QAH3E,YAKI,kBAAM,UAAA,UAAU,IAAI,OAAA,KAAI,CAAC,OAAO,CAAC,SAAS,CAAC,UAAU,CAAC,GAAA,CAAC,SAC1D;QAL+C,cAAQ,GAAR,QAAQ,CAAqB;QACpC,gBAAU,GAAV,UAAU,CAAyB;QAC9B,cAAQ,GAAR,QAAQ,CAAqB;QA3C1D,YAAM,GAAG,IAAI,eAAe,CAAS,GAAG,CAAC,CAAC;QAE1C,eAAS,GAAG,IAAI,eAAe,CAAC,CAAC,CAAC,CAAC;QAEnC,cAAQ,GAAG,KAAK,CAC7B,cAAc,CAAC,KAAI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QACnD,UAAU,CAAC,YAAY,CAAC;iEAQxB;IAlCQ,4BAA4B;QAHxC,SAAS,CAAC;YACP,QAAQ,EAAE,uBAAuB;SACpC,CAAC;QAgBO,WAAA,QAAQ,EAAE,CAAA;QACV,WAAA,MAAM,CAAC,6BAA6B,CAAC,CAAA;QAErC,WAAA,MAAM,CAAC,aAAa,CAAC,CAAA;QACrB,WAAA,MAAM,CAAC,oBAAoB,CAAC,CAAA;QAC5B,WAAA,MAAM,CAAC,UAAU,CAAC,CAAA;QAClB,WAAA,MAAM,CAAC,iBAAiB,CAAC,CAAA;OArBrB,4BAA4B,CA2CxC;IAAD,mCAAC;CA3CD;;;ICMA;KAAiC;IAApB,iBAAiB;QAjB7B,QAAQ,CAAC;YACN,OAAO,EAAE,CAAC,YAAY,EAAE,0BAA0B,EAAE,aAAa,EAAE,gBAAgB,CAAC;YACpF,YAAY,EAAE;gBACV,oBAAoB;gBACpB,oBAAoB;gBACpB,4BAA4B;gBAC5B,6BAA6B;gBAC7B,2BAA2B;aAC9B;YACD,OAAO,EAAE;gBACL,oBAAoB;gBACpB,oBAAoB;gBACpB,2BAA2B;gBAC3B,6BAA6B;gBAC7B,gBAAgB;aACnB;SACJ,CAAC;OACW,iBAAiB,CAAG;IAAD,wBAAC;CAAjC;;AC7BA;;;;;;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { __decorate, __param } from 'tslib';
|
|
2
|
-
import { Input, Directive, Inject, forwardRef, HostBinding, Component, ChangeDetectionStrategy, InjectionToken,
|
|
2
|
+
import { Input, Directive, Inject, forwardRef, HostBinding, Component, ChangeDetectionStrategy, InjectionToken, SkipSelf, ElementRef, ContentChildren, Optional, ViewChild, EventEmitter, Output, Injectable, NgModule } from '@angular/core';
|
|
3
3
|
import { EMPTY_ARRAY, tuiDefaultProp, ALWAYS_TRUE_HANDLER, EMPTY_FUNCTION, EMPTY_QUERY, isPresent } from '@taiga-ui/cdk';
|
|
4
4
|
import { POLYMORPHEUS_CONTEXT, PolymorpheusComponent, PolymorpheusModule } from '@tinkoff/ng-polymorpheus';
|
|
5
5
|
import { Subject } from 'rxjs';
|
|
@@ -49,8 +49,7 @@ var TuiTreeItemContentComponent = /** @class */ (function () {
|
|
|
49
49
|
configurable: true
|
|
50
50
|
});
|
|
51
51
|
TuiTreeItemContentComponent.prototype.onClick = function () {
|
|
52
|
-
|
|
53
|
-
(_a = this.controller) === null || _a === void 0 ? void 0 : _a.toggle(this.context.$implicit);
|
|
52
|
+
this.controller.toggle(this.context.$implicit);
|
|
54
53
|
};
|
|
55
54
|
TuiTreeItemContentComponent.ctorParameters = function () { return [
|
|
56
55
|
{ type: undefined, decorators: [{ type: Inject, args: [POLYMORPHEUS_CONTEXT,] }] },
|
|
@@ -93,54 +92,6 @@ var TUI_TREE_LEVEL = new InjectionToken('Nesting level of current TreeView node'
|
|
|
93
92
|
factory: function () { return -1; },
|
|
94
93
|
});
|
|
95
94
|
|
|
96
|
-
var TuiTreeComponent = /** @class */ (function () {
|
|
97
|
-
function TuiTreeComponent(directive) {
|
|
98
|
-
this.directive = directive;
|
|
99
|
-
this.content = function (_a) {
|
|
100
|
-
var $implicit = _a.$implicit;
|
|
101
|
-
return String($implicit);
|
|
102
|
-
};
|
|
103
|
-
}
|
|
104
|
-
TuiTreeComponent_1 = TuiTreeComponent;
|
|
105
|
-
Object.defineProperty(TuiTreeComponent.prototype, "children", {
|
|
106
|
-
get: function () {
|
|
107
|
-
var _a, _b;
|
|
108
|
-
return ((_b = (_a = this.directive) === null || _a === void 0 ? void 0 : _a.childrenHandler(this.value)) !== null && _b !== void 0 ? _b : TuiTreeChildrenDirective.defaultHandler(this.value));
|
|
109
|
-
},
|
|
110
|
-
enumerable: true,
|
|
111
|
-
configurable: true
|
|
112
|
-
});
|
|
113
|
-
var TuiTreeComponent_1;
|
|
114
|
-
TuiTreeComponent.ctorParameters = function () { return [
|
|
115
|
-
{ type: TuiTreeChildrenDirective, decorators: [{ type: Optional }, { type: Inject, args: [TuiTreeChildrenDirective,] }] }
|
|
116
|
-
]; };
|
|
117
|
-
__decorate([
|
|
118
|
-
Input()
|
|
119
|
-
], TuiTreeComponent.prototype, "value", void 0);
|
|
120
|
-
__decorate([
|
|
121
|
-
Input()
|
|
122
|
-
], TuiTreeComponent.prototype, "content", void 0);
|
|
123
|
-
TuiTreeComponent = TuiTreeComponent_1 = __decorate([
|
|
124
|
-
Component({
|
|
125
|
-
selector: 'tui-tree[value]',
|
|
126
|
-
template: "<tui-tree-item #view [tuiTreeNode]=\"value\">\n <div\n *ngIf=\"value !== children\"\n polymorpheus-outlet\n [content]=\"content\"\n [context]=\"{$implicit: value, node: view}\"\n ></div>\n <tui-tree\n *ngFor=\"let child of children\"\n [value]=\"child\"\n [content]=\"content\"\n ></tui-tree>\n</tui-tree-item>\n",
|
|
127
|
-
providers: [
|
|
128
|
-
{
|
|
129
|
-
provide: TUI_TREE_NODE,
|
|
130
|
-
useExisting: TuiTreeComponent_1,
|
|
131
|
-
},
|
|
132
|
-
],
|
|
133
|
-
host: {
|
|
134
|
-
role: 'tree',
|
|
135
|
-
},
|
|
136
|
-
styles: [":host{position:relative;display:block}"]
|
|
137
|
-
}),
|
|
138
|
-
__param(0, Optional()),
|
|
139
|
-
__param(0, Inject(TuiTreeChildrenDirective))
|
|
140
|
-
], TuiTreeComponent);
|
|
141
|
-
return TuiTreeComponent;
|
|
142
|
-
}());
|
|
143
|
-
|
|
144
95
|
var TUI_TREE_ITEM_PROVIDERS = [
|
|
145
96
|
{
|
|
146
97
|
provide: TUI_TREE_LEVEL,
|
|
@@ -200,7 +151,7 @@ var TuiTreeItemComponent = /** @class */ (function () {
|
|
|
200
151
|
TuiTreeItemComponent = __decorate([
|
|
201
152
|
Component({
|
|
202
153
|
selector: 'tui-tree-item',
|
|
203
|
-
template: "<ng-template #template><ng-content></ng-content></ng-template>\n<div\n polymorpheus-outlet\n
|
|
154
|
+
template: "<ng-template #template><ng-content></ng-content></ng-template>\n<div\n polymorpheus-outlet\n [content]=\"content\"\n [context]=\"{$implicit: this, template: template}\"\n></div>\n<tui-expand\n *ngIf=\"isExpandable\"\n role=\"group\"\n class=\"t-children\"\n [expanded]=\"expanded$ | async\"\n>\n <div>\n <ng-content select=\"tui-tree-item\"></ng-content>\n <ng-content select=\"tui-tree\"></ng-content>\n </div>\n</tui-expand>\n<ng-container *ngIf=\"attached$ | async\"></ng-container>\n",
|
|
204
155
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
205
156
|
providers: TUI_TREE_ITEM_PROVIDERS,
|
|
206
157
|
host: {
|
|
@@ -216,6 +167,66 @@ var TuiTreeItemComponent = /** @class */ (function () {
|
|
|
216
167
|
return TuiTreeItemComponent;
|
|
217
168
|
}());
|
|
218
169
|
|
|
170
|
+
var TuiTreeComponent = /** @class */ (function () {
|
|
171
|
+
function TuiTreeComponent(directive) {
|
|
172
|
+
this.directive = directive;
|
|
173
|
+
this.content = function (_a) {
|
|
174
|
+
var $implicit = _a.$implicit;
|
|
175
|
+
return String($implicit);
|
|
176
|
+
};
|
|
177
|
+
}
|
|
178
|
+
TuiTreeComponent_1 = TuiTreeComponent;
|
|
179
|
+
Object.defineProperty(TuiTreeComponent.prototype, "children", {
|
|
180
|
+
get: function () {
|
|
181
|
+
var _a, _b;
|
|
182
|
+
return ((_b = (_a = this.directive) === null || _a === void 0 ? void 0 : _a.childrenHandler(this.value)) !== null && _b !== void 0 ? _b : TuiTreeChildrenDirective.defaultHandler(this.value));
|
|
183
|
+
},
|
|
184
|
+
enumerable: true,
|
|
185
|
+
configurable: true
|
|
186
|
+
});
|
|
187
|
+
TuiTreeComponent.prototype.ngDoCheck = function () {
|
|
188
|
+
var _a, _b;
|
|
189
|
+
(_a = this.item) === null || _a === void 0 ? void 0 : _a.ngDoCheck();
|
|
190
|
+
(_b = this.child) === null || _b === void 0 ? void 0 : _b.ngDoCheck();
|
|
191
|
+
};
|
|
192
|
+
var TuiTreeComponent_1;
|
|
193
|
+
TuiTreeComponent.ctorParameters = function () { return [
|
|
194
|
+
{ type: TuiTreeChildrenDirective, decorators: [{ type: Optional }, { type: Inject, args: [TuiTreeChildrenDirective,] }] }
|
|
195
|
+
]; };
|
|
196
|
+
__decorate([
|
|
197
|
+
Input()
|
|
198
|
+
], TuiTreeComponent.prototype, "value", void 0);
|
|
199
|
+
__decorate([
|
|
200
|
+
Input()
|
|
201
|
+
], TuiTreeComponent.prototype, "content", void 0);
|
|
202
|
+
__decorate([
|
|
203
|
+
ViewChild(TuiTreeItemComponent)
|
|
204
|
+
], TuiTreeComponent.prototype, "item", void 0);
|
|
205
|
+
__decorate([
|
|
206
|
+
ViewChild(TuiTreeComponent_1)
|
|
207
|
+
], TuiTreeComponent.prototype, "child", void 0);
|
|
208
|
+
TuiTreeComponent = TuiTreeComponent_1 = __decorate([
|
|
209
|
+
Component({
|
|
210
|
+
selector: 'tui-tree[value]',
|
|
211
|
+
template: "<tui-tree-item #view [tuiTreeNode]=\"value\">\n <div\n *ngIf=\"value !== children\"\n polymorpheus-outlet\n [content]=\"content\"\n [context]=\"{$implicit: value, node: view}\"\n ></div>\n <tui-tree\n *ngFor=\"let child of children\"\n [value]=\"child\"\n [content]=\"content\"\n ></tui-tree>\n</tui-tree-item>\n",
|
|
212
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
213
|
+
providers: [
|
|
214
|
+
{
|
|
215
|
+
provide: TUI_TREE_NODE,
|
|
216
|
+
useExisting: TuiTreeComponent_1,
|
|
217
|
+
},
|
|
218
|
+
],
|
|
219
|
+
host: {
|
|
220
|
+
role: 'tree',
|
|
221
|
+
},
|
|
222
|
+
styles: [":host{position:relative;display:block}"]
|
|
223
|
+
}),
|
|
224
|
+
__param(0, Optional()),
|
|
225
|
+
__param(0, Inject(TuiTreeChildrenDirective))
|
|
226
|
+
], TuiTreeComponent);
|
|
227
|
+
return TuiTreeComponent;
|
|
228
|
+
}());
|
|
229
|
+
|
|
219
230
|
var TuiTreeControllerDirective = /** @class */ (function () {
|
|
220
231
|
function TuiTreeControllerDirective() {
|
|
221
232
|
this.fallback = true;
|