@taiga-ui/cdk 2.50.2 → 2.52.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-cdk-directives-copy-processor.umd.js +7 -7
- package/bundles/taiga-ui-cdk-directives-copy-processor.umd.js.map +1 -1
- package/bundles/taiga-ui-cdk-directives-copy-processor.umd.min.js +1 -1
- package/bundles/taiga-ui-cdk-directives-copy-processor.umd.min.js.map +1 -1
- package/bundles/taiga-ui-cdk-directives-overscroll.umd.js +4 -1
- package/bundles/taiga-ui-cdk-directives-overscroll.umd.js.map +1 -1
- package/bundles/taiga-ui-cdk-directives-overscroll.umd.min.js +1 -1
- package/bundles/taiga-ui-cdk-directives-overscroll.umd.min.js.map +1 -1
- package/bundles/taiga-ui-cdk-exceptions.umd.js +39 -0
- package/bundles/taiga-ui-cdk-exceptions.umd.js.map +1 -1
- package/bundles/taiga-ui-cdk-exceptions.umd.min.js +1 -1
- package/bundles/taiga-ui-cdk-exceptions.umd.min.js.map +1 -1
- package/bundles/taiga-ui-cdk-utils-dom.umd.js +26 -0
- package/bundles/taiga-ui-cdk-utils-dom.umd.js.map +1 -1
- package/bundles/taiga-ui-cdk-utils-dom.umd.min.js +1 -1
- package/bundles/taiga-ui-cdk-utils-dom.umd.min.js.map +1 -1
- package/directives/copy-processor/taiga-ui-cdk-directives-copy-processor.metadata.json +1 -1
- package/esm2015/directives/copy-processor/copy-processor.directive.js +5 -4
- package/esm2015/directives/overscroll/overscroll.directive.js +5 -2
- package/esm2015/exceptions/invalid-day.exception.js +8 -1
- package/esm2015/exceptions/invalid-month.exception.js +8 -1
- package/esm2015/exceptions/invalid-year.exception.js +8 -1
- package/esm2015/utils/dom/get-selected-text.js +16 -0
- package/esm2015/utils/dom/index.js +3 -1
- package/esm2015/utils/dom/is-form-field.js +8 -0
- package/esm5/directives/copy-processor/copy-processor.directive.js +5 -4
- package/esm5/directives/overscroll/overscroll.directive.js +5 -2
- package/esm5/exceptions/invalid-day.exception.js +14 -1
- package/esm5/exceptions/invalid-month.exception.js +14 -1
- package/esm5/exceptions/invalid-year.exception.js +14 -1
- package/esm5/utils/dom/get-selected-text.js +17 -0
- package/esm5/utils/dom/index.js +3 -1
- package/esm5/utils/dom/is-form-field.js +8 -0
- package/exceptions/invalid-day.exception.d.ts +6 -0
- package/exceptions/invalid-month.exception.d.ts +6 -0
- package/exceptions/invalid-year.exception.d.ts +6 -0
- package/exceptions/taiga-ui-cdk-exceptions.metadata.json +1 -1
- package/fesm2015/taiga-ui-cdk-directives-copy-processor.js +4 -3
- package/fesm2015/taiga-ui-cdk-directives-copy-processor.js.map +1 -1
- package/fesm2015/taiga-ui-cdk-directives-overscroll.js +4 -1
- package/fesm2015/taiga-ui-cdk-directives-overscroll.js.map +1 -1
- package/fesm2015/taiga-ui-cdk-exceptions.js +22 -1
- package/fesm2015/taiga-ui-cdk-exceptions.js.map +1 -1
- package/fesm2015/taiga-ui-cdk-utils-dom.js +24 -1
- package/fesm2015/taiga-ui-cdk-utils-dom.js.map +1 -1
- package/fesm5/taiga-ui-cdk-directives-copy-processor.js +4 -3
- package/fesm5/taiga-ui-cdk-directives-copy-processor.js.map +1 -1
- package/fesm5/taiga-ui-cdk-directives-overscroll.js +4 -1
- package/fesm5/taiga-ui-cdk-directives-overscroll.js.map +1 -1
- package/fesm5/taiga-ui-cdk-exceptions.js +37 -1
- package/fesm5/taiga-ui-cdk-exceptions.js.map +1 -1
- package/fesm5/taiga-ui-cdk-utils-dom.js +25 -1
- package/fesm5/taiga-ui-cdk-utils-dom.js.map +1 -1
- package/package.json +1 -1
- package/schematics/ng-update/constants/modules.js +1 -0
- package/schematics/ng-update/constants/services.js +9 -0
- package/schematics/ng-update/constants/templates.d.ts +17 -0
- package/schematics/ng-update/constants/templates.js +32 -0
- package/schematics/ng-update/constants/types.js +30 -0
- package/schematics/ng-update/index.js +39 -4
- package/schematics/ng-update/steps/migrate-date-time.d.ts +1 -0
- package/schematics/ng-update/steps/migrate-date-time.js +152 -0
- package/schematics/ng-update/steps/migrate-progress.d.ts +3 -0
- package/schematics/ng-update/steps/migrate-progress.js +41 -0
- package/schematics/ng-update/steps/migrate-sliders/index.d.ts +2 -2
- package/schematics/ng-update/steps/migrate-sliders/index.js +3 -3
- package/schematics/ng-update/steps/migrate-sliders/migrate-input-range.d.ts +2 -2
- package/schematics/ng-update/steps/migrate-sliders/migrate-input-range.js +32 -27
- package/schematics/ng-update/steps/migrate-sliders/migrate-input-slider.d.ts +2 -2
- package/schematics/ng-update/steps/migrate-sliders/migrate-input-slider.js +30 -22
- package/schematics/ng-update/steps/migrate-templates.d.ts +2 -2
- package/schematics/ng-update/steps/migrate-templates.js +61 -21
- package/schematics/ng-update/steps/miscellaneous.js +2 -6
- package/schematics/ng-update/steps/replace-services.js +5 -1
- package/schematics/ng-update/steps/show-warnings.js +1 -1
- package/schematics/utils/colored-log.d.ts +2 -0
- package/schematics/utils/colored-log.js +10 -0
- package/schematics/utils/insert-todo.d.ts +2 -0
- package/schematics/utils/insert-todo.js +8 -0
- package/schematics/utils/templates/elements.d.ts +1 -0
- package/schematics/utils/templates/elements.js +9 -19
- package/schematics/utils/templates/ng-component-input-manipulations.js +2 -1
- package/utils/dom/get-selected-text.d.ts +9 -0
- package/utils/dom/index.d.ts +2 -0
- package/utils/dom/is-form-field.d.ts +1 -0
- package/utils/dom/taiga-ui-cdk-utils-dom.metadata.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"__symbolic":"module","version":4,"metadata":{"TuiComputedDocumentException":{"__symbolic":"class","extends":{"__symbolic":"reference","name":"Error"},"members":{"__ctor__":[{"__symbolic":"constructor"}]}},"TuiDocumentSelectionException":{"__symbolic":"class","extends":{"__symbolic":"reference","name":"Error"},"members":{"__ctor__":[{"__symbolic":"constructor"}]}},"InvalidDayException":{"__symbolic":"class","extends":{"__symbolic":"reference","name":"Error"},"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","name":"number"}]}]}},"InvalidMonthException":{"__symbolic":"class","extends":{"__symbolic":"reference","name":"Error"},"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","name":"number"}]}]}},"InvalidYearException":{"__symbolic":"class","extends":{"__symbolic":"reference","name":"Error"},"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","name":"number"}]}]}},"TuiNoHostException":{"__symbolic":"class","extends":{"__symbolic":"reference","name":"Error"},"members":{"__ctor__":[{"__symbolic":"constructor"}]}},"TuiOwnerDocumentException":{"__symbolic":"class","extends":{"__symbolic":"reference","name":"Error"},"members":{"__ctor__":[{"__symbolic":"constructor"}]}},"TuiPureException":{"__symbolic":"class","extends":{"__symbolic":"reference","name":"Error"},"members":{"__ctor__":[{"__symbolic":"constructor"}]}},"TuiTableSortKeyException":{"__symbolic":"class","extends":{"__symbolic":"reference","name":"Error"},"members":{"__ctor__":[{"__symbolic":"constructor"}]}},"TuiTsParserException":{"__symbolic":"class","extends":{"__symbolic":"reference","name":"Error"},"members":{"__ctor__":[{"__symbolic":"constructor"}]}},"TuiValueChangesException":{"__symbolic":"class","extends":{"__symbolic":"reference","name":"Error"},"members":{"__ctor__":[{"__symbolic":"constructor"}]}},"TuiValuePresentException":{"__symbolic":"class","extends":{"__symbolic":"reference","name":"Error"},"members":{"__ctor__":[{"__symbolic":"constructor"}]}},"TuiXmlParsingException":{"__symbolic":"class","extends":{"__symbolic":"reference","name":"Error"},"members":{"__ctor__":[{"__symbolic":"constructor"}]}}},"origins":{"TuiComputedDocumentException":"./computed-document.exception","TuiDocumentSelectionException":"./document-selection.exception","InvalidDayException":"./invalid-day.exception","InvalidMonthException":"./invalid-month.exception","InvalidYearException":"./invalid-year.exception","TuiNoHostException":"./no-host.exception","TuiOwnerDocumentException":"./owner-document.exception","TuiPureException":"./pure.exception","TuiTableSortKeyException":"./table-sort-key.exception","TuiTsParserException":"./ts-parser.exception","TuiValueChangesException":"./value-changes.exception","TuiValuePresentException":"./value-present.exception","TuiXmlParsingException":"./xml-parsing.exception"},"importAs":"@taiga-ui/cdk/exceptions"}
|
|
1
|
+
{"__symbolic":"module","version":4,"metadata":{"TuiComputedDocumentException":{"__symbolic":"class","extends":{"__symbolic":"reference","name":"Error"},"members":{"__ctor__":[{"__symbolic":"constructor"}]}},"TuiDocumentSelectionException":{"__symbolic":"class","extends":{"__symbolic":"reference","name":"Error"},"members":{"__ctor__":[{"__symbolic":"constructor"}]}},"InvalidDayException":{"__symbolic":"class","extends":{"__symbolic":"reference","name":"Error"},"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","name":"number"}]}]}},"TuiInvalidDayException":{"__symbolic":"class","extends":{"__symbolic":"reference","name":"InvalidDayException"},"members":{}},"InvalidMonthException":{"__symbolic":"class","extends":{"__symbolic":"reference","name":"Error"},"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","name":"number"}]}]}},"TuiInvalidMonthException":{"__symbolic":"class","extends":{"__symbolic":"reference","name":"InvalidMonthException"},"members":{}},"InvalidYearException":{"__symbolic":"class","extends":{"__symbolic":"reference","name":"Error"},"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","name":"number"}]}]}},"TuiInvalidYearException":{"__symbolic":"class","extends":{"__symbolic":"reference","name":"InvalidYearException"},"members":{}},"TuiNoHostException":{"__symbolic":"class","extends":{"__symbolic":"reference","name":"Error"},"members":{"__ctor__":[{"__symbolic":"constructor"}]}},"TuiOwnerDocumentException":{"__symbolic":"class","extends":{"__symbolic":"reference","name":"Error"},"members":{"__ctor__":[{"__symbolic":"constructor"}]}},"TuiPureException":{"__symbolic":"class","extends":{"__symbolic":"reference","name":"Error"},"members":{"__ctor__":[{"__symbolic":"constructor"}]}},"TuiTableSortKeyException":{"__symbolic":"class","extends":{"__symbolic":"reference","name":"Error"},"members":{"__ctor__":[{"__symbolic":"constructor"}]}},"TuiTsParserException":{"__symbolic":"class","extends":{"__symbolic":"reference","name":"Error"},"members":{"__ctor__":[{"__symbolic":"constructor"}]}},"TuiValueChangesException":{"__symbolic":"class","extends":{"__symbolic":"reference","name":"Error"},"members":{"__ctor__":[{"__symbolic":"constructor"}]}},"TuiValuePresentException":{"__symbolic":"class","extends":{"__symbolic":"reference","name":"Error"},"members":{"__ctor__":[{"__symbolic":"constructor"}]}},"TuiXmlParsingException":{"__symbolic":"class","extends":{"__symbolic":"reference","name":"Error"},"members":{"__ctor__":[{"__symbolic":"constructor"}]}}},"origins":{"TuiComputedDocumentException":"./computed-document.exception","TuiDocumentSelectionException":"./document-selection.exception","InvalidDayException":"./invalid-day.exception","TuiInvalidDayException":"./invalid-day.exception","InvalidMonthException":"./invalid-month.exception","TuiInvalidMonthException":"./invalid-month.exception","InvalidYearException":"./invalid-year.exception","TuiInvalidYearException":"./invalid-year.exception","TuiNoHostException":"./no-host.exception","TuiOwnerDocumentException":"./owner-document.exception","TuiPureException":"./pure.exception","TuiTableSortKeyException":"./table-sort-key.exception","TuiTsParserException":"./ts-parser.exception","TuiValueChangesException":"./value-changes.exception","TuiValuePresentException":"./value-present.exception","TuiXmlParsingException":"./xml-parsing.exception"},"importAs":"@taiga-ui/cdk/exceptions"}
|
|
@@ -2,6 +2,7 @@ import { __decorate, __param } from 'tslib';
|
|
|
2
2
|
import { Inject, Input, HostListener, Directive, NgModule } from '@angular/core';
|
|
3
3
|
import { WINDOW } from '@ng-web-apis/common';
|
|
4
4
|
import { tuiDefaultProp } from '@taiga-ui/cdk/decorators';
|
|
5
|
+
import { tuiGetSelectedText } from '@taiga-ui/cdk/utils';
|
|
5
6
|
import { identity } from 'rxjs';
|
|
6
7
|
|
|
7
8
|
// @dynamic
|
|
@@ -12,9 +13,9 @@ let TuiCopyProcessorDirective = class TuiCopyProcessorDirective {
|
|
|
12
13
|
}
|
|
13
14
|
onCopy(event) {
|
|
14
15
|
var _a;
|
|
15
|
-
const
|
|
16
|
-
if (
|
|
17
|
-
(_a = event.clipboardData) === null || _a === void 0 ? void 0 : _a.setData('text/plain', this.tuiCopyProcessor(
|
|
16
|
+
const text = tuiGetSelectedText(this.windowRef);
|
|
17
|
+
if (text) {
|
|
18
|
+
(_a = event.clipboardData) === null || _a === void 0 ? void 0 : _a.setData('text/plain', this.tuiCopyProcessor(text));
|
|
18
19
|
}
|
|
19
20
|
}
|
|
20
21
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"taiga-ui-cdk-directives-copy-processor.js","sources":["ng://@taiga-ui/cdk/directives/copy-processor/copy-processor.directive.ts","ng://@taiga-ui/cdk/directives/copy-processor/copy-processor.module.ts","ng://@taiga-ui/cdk/directives/copy-processor/taiga-ui-cdk-directives-copy-processor.ts"],"sourcesContent":["import {Directive, HostListener, Inject, Input} from '@angular/core';\nimport {WINDOW} from '@ng-web-apis/common';\nimport {tuiDefaultProp} from '@taiga-ui/cdk/decorators';\nimport {TuiStringHandler} from '@taiga-ui/cdk/types';\nimport {identity} from 'rxjs';\n\n// @dynamic\n@Directive({\n selector: '[tuiCopyProcessor]',\n})\nexport class TuiCopyProcessorDirective {\n @Input()\n @tuiDefaultProp()\n tuiCopyProcessor: TuiStringHandler<string> = identity;\n\n constructor(@Inject(WINDOW) private readonly windowRef: Window) {}\n\n @HostListener('copy.prevent', ['$event'])\n onCopy(event: ClipboardEvent): void {\n const
|
|
1
|
+
{"version":3,"file":"taiga-ui-cdk-directives-copy-processor.js","sources":["ng://@taiga-ui/cdk/directives/copy-processor/copy-processor.directive.ts","ng://@taiga-ui/cdk/directives/copy-processor/copy-processor.module.ts","ng://@taiga-ui/cdk/directives/copy-processor/taiga-ui-cdk-directives-copy-processor.ts"],"sourcesContent":["import {Directive, HostListener, Inject, Input} from '@angular/core';\nimport {WINDOW} from '@ng-web-apis/common';\nimport {tuiDefaultProp} from '@taiga-ui/cdk/decorators';\nimport {TuiStringHandler} from '@taiga-ui/cdk/types';\nimport {tuiGetSelectedText} from '@taiga-ui/cdk/utils';\nimport {identity} from 'rxjs';\n\n// @dynamic\n@Directive({\n selector: '[tuiCopyProcessor]',\n})\nexport class TuiCopyProcessorDirective {\n @Input()\n @tuiDefaultProp()\n tuiCopyProcessor: TuiStringHandler<string> = identity;\n\n constructor(@Inject(WINDOW) private readonly windowRef: Window) {}\n\n @HostListener('copy.prevent', ['$event'])\n onCopy(event: ClipboardEvent): void {\n const text = tuiGetSelectedText(this.windowRef);\n\n if (text) {\n event.clipboardData?.setData('text/plain', this.tuiCopyProcessor(text));\n }\n }\n}\n","import {NgModule} from '@angular/core';\n\nimport {TuiCopyProcessorDirective} from './copy-processor.directive';\n\n@NgModule({\n declarations: [TuiCopyProcessorDirective],\n exports: [TuiCopyProcessorDirective],\n})\nexport class TuiCopyProcessorModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;AAOA;IAIa,yBAAyB,GAAtC,MAAa,yBAAyB;IAKlC,YAA6C,SAAiB;QAAjB,cAAS,GAAT,SAAS,CAAQ;QAF9D,qBAAgB,GAA6B,QAAQ,CAAC;KAEY;IAGlE,MAAM,CAAC,KAAqB;;QACxB,MAAM,IAAI,GAAG,kBAAkB,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QAEhD,IAAI,IAAI,EAAE;YACN,MAAA,KAAK,CAAC,aAAa,0CAAE,OAAO,CAAC,YAAY,EAAE,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,EAAE;SAC3E;KACJ;EACJ;;YAV2D,MAAM,uBAAjD,MAAM,SAAC,MAAM;;AAF1B;IAFC,KAAK,EAAE;IACP,cAAc,EAAE;mEACqC;AAKtD;IADC,YAAY,CAAC,cAAc,EAAE,CAAC,QAAQ,CAAC,CAAC;uDAOxC;AAdQ,yBAAyB;IAHrC,SAAS,CAAC;QACP,QAAQ,EAAE,oBAAoB;KACjC,CAAC;IAMe,WAAA,MAAM,CAAC,MAAM,CAAC,CAAA;GALlB,yBAAyB,CAerC;;IClBY,sBAAsB,GAAnC,MAAa,sBAAsB;EAAG;AAAzB,sBAAsB;IAJlC,QAAQ,CAAC;QACN,YAAY,EAAE,CAAC,yBAAyB,CAAC;QACzC,OAAO,EAAE,CAAC,yBAAyB,CAAC;KACvC,CAAC;GACW,sBAAsB,CAAG;;ACRtC;;;;;;"}
|
|
@@ -48,9 +48,12 @@ let TuiOverscrollDirective = class TuiOverscrollDirective {
|
|
|
48
48
|
return this.enabled ? 'contain' : null;
|
|
49
49
|
}
|
|
50
50
|
processEvent(event, vertical, negative) {
|
|
51
|
+
var _a;
|
|
51
52
|
const { target, currentTarget, cancelable } = event;
|
|
52
53
|
// TODO: iframe warning
|
|
53
|
-
if (!cancelable ||
|
|
54
|
+
if (!cancelable ||
|
|
55
|
+
!(target instanceof Element) ||
|
|
56
|
+
((_a = target) === null || _a === void 0 ? void 0 : _a.type) === 'range') {
|
|
54
57
|
return;
|
|
55
58
|
}
|
|
56
59
|
// This is all what's needed in Chrome/Firefox thanks to CSS overscroll-behavior
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"taiga-ui-cdk-directives-overscroll.js","sources":["ng://@taiga-ui/cdk/directives/overscroll/overscroll.directive.ts","ng://@taiga-ui/cdk/directives/overscroll/overscroll.module.ts","ng://@taiga-ui/cdk/directives/overscroll/taiga-ui-cdk-directives-overscroll.ts"],"sourcesContent":["import {Directive, ElementRef, HostBinding, Inject, Input, NgZone} from '@angular/core';\nimport {tuiZonefree, typedFromEvent} from '@taiga-ui/cdk/observables';\nimport {TuiDestroyService} from '@taiga-ui/cdk/services';\nimport {TuiEventWith, TuiOverscrollModeT} from '@taiga-ui/cdk/types';\nimport {canScroll, getScrollParent} from '@taiga-ui/cdk/utils/dom';\nimport {Observable} from 'rxjs';\nimport {filter, switchMap, takeUntil, tap} from 'rxjs/operators';\n\n/**\n * Directive to isolate scrolling, i.e. prevent body scroll behind modal dialog\n * @dynamic\n */\n@Directive({\n selector: '[tuiOverscroll]',\n providers: [TuiDestroyService],\n})\nexport class TuiOverscrollDirective {\n @Input('tuiOverscroll')\n mode: TuiOverscrollModeT | '' = 'scroll';\n\n constructor(\n @Inject(ElementRef) {nativeElement}: ElementRef<HTMLElement>,\n @Inject(NgZone) ngZone: NgZone,\n @Inject(TuiDestroyService) destroy$: Observable<void>,\n ) {\n typedFromEvent(nativeElement, 'wheel', {passive: false})\n .pipe(\n filter(() => this.enabled),\n tuiZonefree(ngZone),\n takeUntil(destroy$),\n )\n .subscribe(event => {\n this.processEvent(\n event,\n !!event.deltaY,\n event.deltaY ? event.deltaY < 0 : event.deltaX < 0,\n );\n });\n\n typedFromEvent(nativeElement, 'touchstart', {passive: true})\n .pipe(\n switchMap(({touches}) => {\n let {clientX, clientY} = touches[0];\n let deltaX = 0;\n let deltaY = 0;\n let vertical: boolean;\n\n return typedFromEvent(nativeElement, 'touchmove', {\n passive: false,\n }).pipe(\n filter(() => this.enabled),\n tap(event => {\n // We have to have it in tap instead of subscribe due to variables in closure\n const changedTouch = event.changedTouches[0];\n\n deltaX = clientX - changedTouch.clientX;\n deltaY = clientY - changedTouch.clientY;\n clientX = changedTouch.clientX;\n clientY = changedTouch.clientY;\n\n if (vertical === undefined) {\n vertical = Math.abs(deltaY) > Math.abs(deltaX);\n }\n\n this.processEvent(\n event,\n vertical,\n vertical ? deltaY < 0 : deltaX < 0,\n );\n }),\n );\n }),\n tuiZonefree(ngZone),\n takeUntil(destroy$),\n )\n .subscribe();\n }\n\n get enabled(): boolean {\n return this.mode !== 'none';\n }\n\n @HostBinding('style.overscrollBehavior')\n get overscrollBehavior(): 'contain' | null {\n return this.enabled ? 'contain' : null;\n }\n\n private processEvent(\n event: TuiEventWith<Event, HTMLElement>,\n vertical: boolean,\n negative: boolean,\n ): void {\n const {target, currentTarget, cancelable} = event;\n\n // TODO: iframe warning\n if (!cancelable
|
|
1
|
+
{"version":3,"file":"taiga-ui-cdk-directives-overscroll.js","sources":["ng://@taiga-ui/cdk/directives/overscroll/overscroll.directive.ts","ng://@taiga-ui/cdk/directives/overscroll/overscroll.module.ts","ng://@taiga-ui/cdk/directives/overscroll/taiga-ui-cdk-directives-overscroll.ts"],"sourcesContent":["import {Directive, ElementRef, HostBinding, Inject, Input, NgZone} from '@angular/core';\nimport {tuiZonefree, typedFromEvent} from '@taiga-ui/cdk/observables';\nimport {TuiDestroyService} from '@taiga-ui/cdk/services';\nimport {TuiEventWith, TuiOverscrollModeT} from '@taiga-ui/cdk/types';\nimport {canScroll, getScrollParent} from '@taiga-ui/cdk/utils/dom';\nimport {Observable} from 'rxjs';\nimport {filter, switchMap, takeUntil, tap} from 'rxjs/operators';\n\n/**\n * Directive to isolate scrolling, i.e. prevent body scroll behind modal dialog\n * @dynamic\n */\n@Directive({\n selector: '[tuiOverscroll]',\n providers: [TuiDestroyService],\n})\nexport class TuiOverscrollDirective {\n @Input('tuiOverscroll')\n mode: TuiOverscrollModeT | '' = 'scroll';\n\n constructor(\n @Inject(ElementRef) {nativeElement}: ElementRef<HTMLElement>,\n @Inject(NgZone) ngZone: NgZone,\n @Inject(TuiDestroyService) destroy$: Observable<void>,\n ) {\n typedFromEvent(nativeElement, 'wheel', {passive: false})\n .pipe(\n filter(() => this.enabled),\n tuiZonefree(ngZone),\n takeUntil(destroy$),\n )\n .subscribe(event => {\n this.processEvent(\n event,\n !!event.deltaY,\n event.deltaY ? event.deltaY < 0 : event.deltaX < 0,\n );\n });\n\n typedFromEvent(nativeElement, 'touchstart', {passive: true})\n .pipe(\n switchMap(({touches}) => {\n let {clientX, clientY} = touches[0];\n let deltaX = 0;\n let deltaY = 0;\n let vertical: boolean;\n\n return typedFromEvent(nativeElement, 'touchmove', {\n passive: false,\n }).pipe(\n filter(() => this.enabled),\n tap(event => {\n // We have to have it in tap instead of subscribe due to variables in closure\n const changedTouch = event.changedTouches[0];\n\n deltaX = clientX - changedTouch.clientX;\n deltaY = clientY - changedTouch.clientY;\n clientX = changedTouch.clientX;\n clientY = changedTouch.clientY;\n\n if (vertical === undefined) {\n vertical = Math.abs(deltaY) > Math.abs(deltaX);\n }\n\n this.processEvent(\n event,\n vertical,\n vertical ? deltaY < 0 : deltaX < 0,\n );\n }),\n );\n }),\n tuiZonefree(ngZone),\n takeUntil(destroy$),\n )\n .subscribe();\n }\n\n get enabled(): boolean {\n return this.mode !== 'none';\n }\n\n @HostBinding('style.overscrollBehavior')\n get overscrollBehavior(): 'contain' | null {\n return this.enabled ? 'contain' : null;\n }\n\n private processEvent(\n event: TuiEventWith<Event, HTMLElement>,\n vertical: boolean,\n negative: boolean,\n ): void {\n const {target, currentTarget, cancelable} = event;\n\n // TODO: iframe warning\n if (\n !cancelable ||\n !(target instanceof Element) ||\n (target as HTMLInputElement)?.type === 'range'\n ) {\n return;\n }\n\n // This is all what's needed in Chrome/Firefox thanks to CSS overscroll-behavior\n if (\n this.mode === 'all' &&\n ((vertical && !currentTarget.contains(getScrollParent(target))) ||\n (!vertical && !currentTarget.contains(getScrollParent(target, false))))\n ) {\n event.preventDefault();\n\n return;\n }\n\n // This is Safari/IE/Edge fallback\n if (\n vertical &&\n ((negative && !canScroll(target, currentTarget, true, false)) ||\n (!negative && !canScroll(target, currentTarget, true, true)))\n ) {\n event.preventDefault();\n\n return;\n }\n\n if (\n !vertical &&\n ((negative && !canScroll(target, currentTarget, false, false)) ||\n (!negative && !canScroll(target, currentTarget, false, true)))\n ) {\n event.preventDefault();\n }\n }\n}\n","import {NgModule} from '@angular/core';\n\nimport {TuiOverscrollDirective} from './overscroll.directive';\n\n@NgModule({\n declarations: [TuiOverscrollDirective],\n exports: [TuiOverscrollDirective],\n})\nexport class TuiOverscrollModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;AAQA;;;;IAQa,sBAAsB,GAAnC,MAAa,sBAAsB;IAI/B,YACwB,EAAC,aAAa,EAA0B,EAC5C,MAAc,EACH,QAA0B;QALzD,SAAI,GAA4B,QAAQ,CAAC;QAOrC,cAAc,CAAC,aAAa,EAAE,OAAO,EAAE,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AK,CAAC,cAAc,EAAE,CAAC;YAEvB,OAAO;SACV;QAED,IACI,CAAC,QAAQ;aACR,CAAC,QAAQ,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,aAAa,EAAE,KAAK,EAAE,KAAK,CAAC;iBACxD,CAAC,QAAQ,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,aAAa,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC,CAAC,EACpE;YACE,KAAK,CAAC,cAAc,EAAE,CAAC;SAC1B;KACJ;EACJ;;YAhH4C,UAAU,uBAA9C,MAAM,SAAC,UAAU;YACM,MAAM,uBAA7B,MAAM,SAAC,MAAM;YACuB,UAAU,uBAA9C,MAAM,SAAC,iBAAiB;;AAL7B;IADC,KAAK,CAAC,eAAe,CAAC;oDACkB;AAiEzC;IADC,WAAW,CAAC,0BAA0B,CAAC;gEAGvC;AArEQ,sBAAsB;IAJlC,SAAS,CAAC;QACP,QAAQ,EAAE,iBAAiB;QAC3B,SAAS,EAAE,CAAC,iBAAiB,CAAC;KACjC,CAAC;IAMO,WAAA,MAAM,CAAC,UAAU,CAAC,CAAA;IAClB,WAAA,MAAM,CAAC,MAAM,CAAC,CAAA;IACd,WAAA,MAAM,CAAC,iBAAiB,CAAC,CAAA;GAPrB,sBAAsB,CAqHlC;;IC7HY,mBAAmB,GAAhC,MAAa,mBAAmB;EAAG;AAAtB,mBAAmB;IAJ/B,QAAQ,CAAC;QACN,YAAY,EAAE,CAAC,sBAAsB,CAAC;QACtC,OAAO,EAAE,CAAC,sBAAsB,CAAC;KACpC,CAAC;GACW,mBAAmB,CAAG;;ACRnC;;;;;;"}
|
|
@@ -10,23 +10,44 @@ class TuiDocumentSelectionException extends Error {
|
|
|
10
10
|
}
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
+
/**
|
|
14
|
+
* @deprecated: use {@link TuiInvalidDayException}
|
|
15
|
+
* TODO: remove in v3.0
|
|
16
|
+
*/
|
|
17
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
13
18
|
class InvalidDayException extends Error {
|
|
14
19
|
constructor(day) {
|
|
15
20
|
super(`Invalid day: ${day}`);
|
|
16
21
|
}
|
|
17
22
|
}
|
|
23
|
+
class TuiInvalidDayException extends InvalidDayException {
|
|
24
|
+
}
|
|
18
25
|
|
|
26
|
+
/**
|
|
27
|
+
* @deprecated: use {@link TuiInvalidMonthException}
|
|
28
|
+
* TODO: remove in v3.0
|
|
29
|
+
*/
|
|
30
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
19
31
|
class InvalidMonthException extends Error {
|
|
20
32
|
constructor(month) {
|
|
21
33
|
super(`Invalid month: ${month}`);
|
|
22
34
|
}
|
|
23
35
|
}
|
|
36
|
+
class TuiInvalidMonthException extends InvalidMonthException {
|
|
37
|
+
}
|
|
24
38
|
|
|
39
|
+
/**
|
|
40
|
+
* @deprecated: use {@link TuiInvalidYearException}
|
|
41
|
+
* TODO: remove in v3.0
|
|
42
|
+
*/
|
|
43
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
25
44
|
class InvalidYearException extends Error {
|
|
26
45
|
constructor(year) {
|
|
27
46
|
super(`Invalid year: ${year}`);
|
|
28
47
|
}
|
|
29
48
|
}
|
|
49
|
+
class TuiInvalidYearException extends InvalidYearException {
|
|
50
|
+
}
|
|
30
51
|
|
|
31
52
|
class TuiNoHostException extends Error {
|
|
32
53
|
constructor() {
|
|
@@ -80,5 +101,5 @@ class TuiXmlParsingException extends Error {
|
|
|
80
101
|
* Generated bundle index. Do not edit.
|
|
81
102
|
*/
|
|
82
103
|
|
|
83
|
-
export { InvalidDayException, InvalidMonthException, InvalidYearException, TuiComputedDocumentException, TuiDocumentSelectionException, TuiNoHostException, TuiOwnerDocumentException, TuiPureException, TuiTableSortKeyException, TuiTsParserException, TuiValueChangesException, TuiValuePresentException, TuiXmlParsingException };
|
|
104
|
+
export { InvalidDayException, InvalidMonthException, InvalidYearException, TuiComputedDocumentException, TuiDocumentSelectionException, TuiInvalidDayException, TuiInvalidMonthException, TuiInvalidYearException, TuiNoHostException, TuiOwnerDocumentException, TuiPureException, TuiTableSortKeyException, TuiTsParserException, TuiValueChangesException, TuiValuePresentException, TuiXmlParsingException };
|
|
84
105
|
//# sourceMappingURL=taiga-ui-cdk-exceptions.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"taiga-ui-cdk-exceptions.js","sources":["ng://@taiga-ui/cdk/exceptions/computed-document.exception.ts","ng://@taiga-ui/cdk/exceptions/document-selection.exception.ts","ng://@taiga-ui/cdk/exceptions/invalid-day.exception.ts","ng://@taiga-ui/cdk/exceptions/invalid-month.exception.ts","ng://@taiga-ui/cdk/exceptions/invalid-year.exception.ts","ng://@taiga-ui/cdk/exceptions/no-host.exception.ts","ng://@taiga-ui/cdk/exceptions/owner-document.exception.ts","ng://@taiga-ui/cdk/exceptions/pure.exception.ts","ng://@taiga-ui/cdk/exceptions/table-sort-key.exception.ts","ng://@taiga-ui/cdk/exceptions/ts-parser.exception.ts","ng://@taiga-ui/cdk/exceptions/value-changes.exception.ts","ng://@taiga-ui/cdk/exceptions/value-present.exception.ts","ng://@taiga-ui/cdk/exceptions/xml-parsing.exception.ts","ng://@taiga-ui/cdk/exceptions/taiga-ui-cdk-exceptions.ts"],"sourcesContent":["export class TuiComputedDocumentException extends Error {\n constructor() {\n super('Only use computedDocument after load event');\n }\n}\n","export class TuiDocumentSelectionException extends Error {\n constructor() {\n super('Failed to get document selection');\n }\n}\n","
|
|
1
|
+
{"version":3,"file":"taiga-ui-cdk-exceptions.js","sources":["ng://@taiga-ui/cdk/exceptions/computed-document.exception.ts","ng://@taiga-ui/cdk/exceptions/document-selection.exception.ts","ng://@taiga-ui/cdk/exceptions/invalid-day.exception.ts","ng://@taiga-ui/cdk/exceptions/invalid-month.exception.ts","ng://@taiga-ui/cdk/exceptions/invalid-year.exception.ts","ng://@taiga-ui/cdk/exceptions/no-host.exception.ts","ng://@taiga-ui/cdk/exceptions/owner-document.exception.ts","ng://@taiga-ui/cdk/exceptions/pure.exception.ts","ng://@taiga-ui/cdk/exceptions/table-sort-key.exception.ts","ng://@taiga-ui/cdk/exceptions/ts-parser.exception.ts","ng://@taiga-ui/cdk/exceptions/value-changes.exception.ts","ng://@taiga-ui/cdk/exceptions/value-present.exception.ts","ng://@taiga-ui/cdk/exceptions/xml-parsing.exception.ts","ng://@taiga-ui/cdk/exceptions/taiga-ui-cdk-exceptions.ts"],"sourcesContent":["export class TuiComputedDocumentException extends Error {\n constructor() {\n super('Only use computedDocument after load event');\n }\n}\n","export class TuiDocumentSelectionException extends Error {\n constructor() {\n super('Failed to get document selection');\n }\n}\n","/**\n * @deprecated: use {@link TuiInvalidDayException}\n * TODO: remove in v3.0\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport class InvalidDayException extends Error {\n constructor(day: number) {\n super(`Invalid day: ${day}`);\n }\n}\n\nexport class TuiInvalidDayException extends InvalidDayException {}\n","/**\n * @deprecated: use {@link TuiInvalidMonthException}\n * TODO: remove in v3.0\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport class InvalidMonthException extends Error {\n constructor(month: number) {\n super(`Invalid month: ${month}`);\n }\n}\n\nexport class TuiInvalidMonthException extends InvalidMonthException {}\n","/**\n * @deprecated: use {@link TuiInvalidYearException}\n * TODO: remove in v3.0\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport class InvalidYearException extends Error {\n constructor(year: number) {\n super(`Invalid year: ${year}`);\n }\n}\n\nexport class TuiInvalidYearException extends InvalidYearException {}\n","export class TuiNoHostException extends Error {\n constructor() {\n super('Portals cannot be used without TuiPortalHostComponent');\n }\n}\n","export class TuiOwnerDocumentException extends Error {\n constructor() {\n super('Element does not have ownerDocument');\n }\n}\n","export class TuiPureException extends Error {\n constructor() {\n super('tuiPure can only be used with functions or getters');\n }\n}\n","export class TuiTableSortKeyException extends Error {\n constructor() {\n super('Trying to sort with no key');\n }\n}\n","export class TuiTsParserException extends Error {\n constructor() {\n super('TsFileParser: 1 component/module per ts-file');\n }\n}\n","export class TuiValueChangesException extends Error {\n constructor() {\n super('Control does not have valueChanges');\n }\n}\n","export class TuiValuePresentException extends Error {\n constructor() {\n super('Value must present');\n }\n}\n","export class TuiXmlParsingException extends Error {\n constructor() {\n super('Error parsing XML string');\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":"MAAa,4BAA6B,SAAQ,KAAK;IACnD;QACI,KAAK,CAAC,4CAA4C,CAAC,CAAC;KACvD;;;MCHQ,6BAA8B,SAAQ,KAAK;IACpD;QACI,KAAK,CAAC,kCAAkC,CAAC,CAAC;KAC7C;;;ACHL;;;;AAIA;MACa,mBAAoB,SAAQ,KAAK;IAC1C,YAAY,GAAW;QACnB,KAAK,CAAC,gBAAgB,GAAG,EAAE,CAAC,CAAC;KAChC;CACJ;MAEY,sBAAuB,SAAQ,mBAAmB;;;ACX/D;;;;AAIA;MACa,qBAAsB,SAAQ,KAAK;IAC5C,YAAY,KAAa;QACrB,KAAK,CAAC,kBAAkB,KAAK,EAAE,CAAC,CAAC;KACpC;CACJ;MAEY,wBAAyB,SAAQ,qBAAqB;;;ACXnE;;;;AAIA;MACa,oBAAqB,SAAQ,KAAK;IAC3C,YAAY,IAAY;QACpB,KAAK,CAAC,iBAAiB,IAAI,EAAE,CAAC,CAAC;KAClC;CACJ;MAEY,uBAAwB,SAAQ,oBAAoB;;;MCXpD,kBAAmB,SAAQ,KAAK;IACzC;QACI,KAAK,CAAC,uDAAuD,CAAC,CAAC;KAClE;;;MCHQ,yBAA0B,SAAQ,KAAK;IAChD;QACI,KAAK,CAAC,qCAAqC,CAAC,CAAC;KAChD;;;MCHQ,gBAAiB,SAAQ,KAAK;IACvC;QACI,KAAK,CAAC,oDAAoD,CAAC,CAAC;KAC/D;;;MCHQ,wBAAyB,SAAQ,KAAK;IAC/C;QACI,KAAK,CAAC,4BAA4B,CAAC,CAAC;KACvC;;;MCHQ,oBAAqB,SAAQ,KAAK;IAC3C;QACI,KAAK,CAAC,8CAA8C,CAAC,CAAC;KACzD;;;MCHQ,wBAAyB,SAAQ,KAAK;IAC/C;QACI,KAAK,CAAC,oCAAoC,CAAC,CAAC;KAC/C;;;MCHQ,wBAAyB,SAAQ,KAAK;IAC/C;QACI,KAAK,CAAC,oBAAoB,CAAC,CAAC;KAC/B;;;MCHQ,sBAAuB,SAAQ,KAAK;IAC7C;QACI,KAAK,CAAC,0BAA0B,CAAC,CAAC;KACrC;;;ACHL;;;;;;"}
|
|
@@ -176,6 +176,29 @@ function getScrollParent(element, vertical = true) {
|
|
|
176
176
|
return getScrollParent(element.parentElement, vertical);
|
|
177
177
|
}
|
|
178
178
|
|
|
179
|
+
function tuiIsFormFieldElement(element) {
|
|
180
|
+
const textfield = element;
|
|
181
|
+
return (!!textfield &&
|
|
182
|
+
'value' in textfield &&
|
|
183
|
+
'selectionStart' in textfield &&
|
|
184
|
+
'selectionEnd' in textfield);
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
/**
|
|
188
|
+
* @description:
|
|
189
|
+
* cross browser way to get selected text
|
|
190
|
+
*
|
|
191
|
+
* History:
|
|
192
|
+
* BUG - window.getSelection() fails when text selected in a form field
|
|
193
|
+
* https://bugzilla.mozilla.org/show_bug.cgi?id=85686
|
|
194
|
+
*/
|
|
195
|
+
function tuiGetSelectedText({ getSelection, document }) {
|
|
196
|
+
var _a;
|
|
197
|
+
return tuiIsFormFieldElement(document.activeElement)
|
|
198
|
+
? document.activeElement.value.slice(document.activeElement.selectionStart || 0, document.activeElement.selectionEnd || 0)
|
|
199
|
+
: ((_a = getSelection()) === null || _a === void 0 ? void 0 : _a.toString()) || null;
|
|
200
|
+
}
|
|
201
|
+
|
|
179
202
|
function isCurrentTarget({ target, currentTarget }) {
|
|
180
203
|
return target === currentTarget;
|
|
181
204
|
}
|
|
@@ -205,5 +228,5 @@ function isNodeIn(node, selector) {
|
|
|
205
228
|
* Generated bundle index. Do not edit.
|
|
206
229
|
*/
|
|
207
230
|
|
|
208
|
-
export { canScroll, containsOrAfter, getActualTarget, getClipboardDataText, getClosestElement, getDocumentOrShadowRoot, getElementObscurers, getElementOffset, getScrollParent, isCurrentTarget, isInsideIframe, isNodeIn, tuiCustomEvent };
|
|
231
|
+
export { canScroll, containsOrAfter, getActualTarget, getClipboardDataText, getClosestElement, getDocumentOrShadowRoot, getElementObscurers, getElementOffset, getScrollParent, isCurrentTarget, isInsideIframe, isNodeIn, tuiCustomEvent, tuiGetSelectedText, tuiIsFormFieldElement };
|
|
209
232
|
//# sourceMappingURL=taiga-ui-cdk-utils-dom.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"taiga-ui-cdk-utils-dom.js","sources":["ng://@taiga-ui/cdk/utils/dom/can-scroll.ts","ng://@taiga-ui/cdk/utils/dom/contains-or-after.ts","ng://@taiga-ui/cdk/utils/dom/custom-event.ts","ng://@taiga-ui/cdk/utils/dom/get-actual-target.ts","ng://@taiga-ui/cdk/utils/dom/get-clipboard-data-text.ts","ng://@taiga-ui/cdk/utils/dom/get-closest-element.ts","ng://@taiga-ui/cdk/utils/dom/get-document-or-shadow-root.ts","ng://@taiga-ui/cdk/utils/dom/get-element-obscurers.ts","ng://@taiga-ui/cdk/utils/dom/get-element-offset.ts","ng://@taiga-ui/cdk/utils/dom/get-scroll-parent.ts","ng://@taiga-ui/cdk/utils/dom/is-current-target.ts","ng://@taiga-ui/cdk/utils/dom/is-inside-iframe.ts","ng://@taiga-ui/cdk/utils/dom/is-node-in.ts","ng://@taiga-ui/cdk/utils/dom/taiga-ui-cdk-utils-dom.ts"],"sourcesContent":["export function canScroll(\n element: Element,\n rootElement: Element,\n vertical: boolean,\n scrollEnd: boolean,\n): boolean {\n return vertical\n ? canScrollVertical(element, rootElement, scrollEnd)\n : canScrollHorizontal(element, rootElement, scrollEnd);\n}\n\nfunction canScrollVertical(\n element: Element,\n rootElement: Element,\n scrollEnd: boolean,\n): boolean {\n let currentElement = element;\n\n while (currentElement !== rootElement.parentElement) {\n if (\n (Math.floor(currentElement.scrollTop) > 0 && !scrollEnd) ||\n (Math.ceil(currentElement.scrollTop + currentElement.clientHeight) <\n currentElement.scrollHeight &&\n scrollEnd)\n ) {\n return true;\n }\n\n if (currentElement.parentElement) {\n currentElement = currentElement.parentElement;\n } else {\n return false;\n }\n }\n\n return false;\n}\n\nfunction canScrollHorizontal(\n element: Element,\n rootElement: Element,\n scrollEnd: boolean,\n): boolean {\n let currentElement = element;\n\n while (currentElement !== rootElement.parentElement) {\n if (\n (Math.floor(currentElement.scrollLeft) > 0 && !scrollEnd) ||\n (Math.ceil(currentElement.scrollLeft + currentElement.clientWidth) <\n currentElement.scrollWidth &&\n scrollEnd)\n ) {\n return true;\n }\n\n if (currentElement.parentElement) {\n currentElement = currentElement.parentElement;\n } else {\n return false;\n }\n }\n\n return false;\n}\n","export function containsOrAfter(current: Node, node: Node): boolean {\n return (\n current.contains(node) ||\n !!(node.compareDocumentPosition(current) & Node.DOCUMENT_POSITION_PRECEDING)\n );\n}\n","/** @deprecated only needed for IE, remove in 3.0 */\nexport function tuiCustomEvent<T = null>(\n name: string,\n {bubbles = false, cancelable = false, detail = null}: CustomEventInit<T | null> = {},\n documentRef: Document,\n): CustomEvent {\n if (typeof CustomEvent === 'function') {\n return new CustomEvent(name, {bubbles, cancelable, detail});\n }\n\n const customEvent = documentRef.createEvent('CustomEvent');\n\n customEvent.initCustomEvent(name, bubbles, cancelable, detail);\n\n return customEvent;\n}\n","/**\n * Gets actual target from open Shadow DOM if event happened within it\n */\nexport function getActualTarget(event: Event): Node {\n if ('composedPath' in event) {\n return (event as any).composedPath()[0];\n }\n\n return (event as any).target;\n}\n","const DEFAULT_FORMAT = 'text/plain';\n\n/**\n * Gets text from data of clipboardEvent, it also works in IE and Edge browsers\n */\nexport function getClipboardDataText(\n event: ClipboardEvent,\n format: string = DEFAULT_FORMAT,\n): string {\n return 'clipboardData' in event && event.clipboardData !== null\n ? event.clipboardData.getData(format) ||\n event.clipboardData.getData(DEFAULT_FORMAT)\n : (event as any).target.ownerDocument.defaultView.clipboardData.getData('text');\n}\n","/**\n * Gets closest element by selector i.e. {@link Element.closest}\n * @deprecated only needed for IE, remove in 3.0\n */\nexport function getClosestElement(element: Element, selector: string): Element | null {\n const closest = Element.prototype.closest;\n\n if (closest) {\n return closest.call(element, selector);\n }\n\n const matchesSelector =\n Element.prototype.matches || (Element.prototype as any).msMatchesSelector;\n\n do {\n if (matchesSelector.call(element, selector)) {\n return element;\n }\n\n (element as Element | null) = element.parentElement;\n } while (element !== null);\n\n return null;\n}\n","export function getDocumentOrShadowRoot(node: Node): DocumentOrShadowRoot {\n return 'getRootNode' in node && node.isConnected\n ? (node.getRootNode() as Document)\n : node.ownerDocument!;\n}\n","import {clamp} from '@taiga-ui/cdk/utils/math';\nimport {isPresent} from '@taiga-ui/cdk/utils/miscellaneous';\n\nimport {getDocumentOrShadowRoot} from './get-document-or-shadow-root';\n\n/**\n * Returns array of Elements covering edges of given element or null if at least one edge middle point is visible\n *\n * CAUTION: Empty array means element if offscreen i.e. covered by no elements, rather than not covered\n */\nexport function getElementObscurers(element: Element): readonly Element[] | null {\n const {ownerDocument} = element;\n\n if (!ownerDocument || !ownerDocument.defaultView) {\n return null;\n }\n\n const {innerWidth, innerHeight} = ownerDocument.defaultView;\n const documentRef = getDocumentOrShadowRoot(element);\n const rect = element.getBoundingClientRect();\n const left = clamp(Math.round(rect.left) + 2, 0, innerWidth);\n const top = clamp(Math.round(rect.top) + 2, 0, innerHeight);\n const right = clamp(Math.round(rect.right) - 2, 0, innerWidth);\n const bottom = clamp(Math.round(rect.bottom) - 2, 0, innerHeight);\n const horizontalMiddle = clamp(Math.round(rect.left + rect.width / 2), 0, innerWidth);\n const verticalMiddle = clamp(Math.round(rect.top + rect.height / 2), 0, innerHeight);\n const elements = [\n documentRef.elementFromPoint(horizontalMiddle, top),\n documentRef.elementFromPoint(horizontalMiddle, bottom),\n documentRef.elementFromPoint(left, verticalMiddle),\n documentRef.elementFromPoint(right, verticalMiddle),\n ];\n const nonNull = elements.filter(isPresent);\n\n if (!nonNull.length) {\n return nonNull;\n }\n\n const filtered = nonNull.filter(el => !element.contains(el));\n\n return filtered.length === 4 ? filtered : null;\n}\n","import {tuiAssert} from '@taiga-ui/cdk/classes';\n\n/**\n * Calculates offset for an element relative to it's parent several levels above\n *\n * @param host parent element\n * @param element\n * @return object with offsetTop and offsetLeft number properties\n */\nexport function getElementOffset(\n host: Element,\n element: HTMLElement,\n): {offsetTop: number; offsetLeft: number} {\n tuiAssert.assert(host.contains(element), 'Host must contain element');\n\n let {offsetTop, offsetLeft, offsetParent} = element;\n\n // TODO: iframe warning\n while (offsetParent && offsetParent instanceof HTMLElement && offsetParent !== host) {\n offsetTop += offsetParent.offsetTop;\n offsetLeft += offsetParent.offsetLeft;\n offsetParent = offsetParent.offsetParent;\n }\n\n return {offsetTop, offsetLeft};\n}\n","/**\n * Finds nearest parent with scroll in it\n *\n * @param element initial element\n * @param vertical flag for orientation of scroll\n */\nexport function getScrollParent(\n element: Element | null,\n vertical: boolean = true,\n): Element | null {\n if (element === null) {\n return null;\n }\n\n if (vertical && element.scrollHeight > element.clientHeight) {\n return element;\n }\n\n if (!vertical && element.scrollWidth > element.clientWidth) {\n return element;\n }\n\n return getScrollParent(element.parentElement, vertical);\n}\n","export function isCurrentTarget({target, currentTarget}: Event): boolean {\n return target === currentTarget;\n}\n","/**\n * Checks if an app is running inside <iframe /> tag\n */\nexport function isInsideIframe(windowRef: Window): boolean {\n return windowRef.parent !== windowRef;\n}\n","import {getClosestElement} from './get-closest-element';\n\n/**\n * Checks if node is inside a specific selector\n *\n * @param node\n * @param selector\n * @return true if node is inside a particular selector\n */\nexport function isNodeIn(node: Node, selector: string): boolean {\n return node.nodeType === Node.TEXT_NODE\n ? !!node.parentElement && !!getClosestElement(node.parentElement, selector)\n : node.nodeType === Node.ELEMENT_NODE &&\n !!getClosestElement(node as Element, selector);\n}\n","/**\n *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K,SAAS,CAAC;AAC1C;;ACHA;;;;;;;SAOgB,QAAQ,CAAC,IAAU,EAAE,QAAgB;IACjD,OAAO,IAAI,CAAC,QAAQ,KAAK,IAAI,CAAC,SAAS;UACjC,CAAC,CAAC,IAAI,CAAC,aAAa,IAAI,CAAC,CAAC,iBAAiB,CAAC,IAAI,CAAC,aAAa,EAAE,QAAQ,CAAC;UACzE,IAAI,CAAC,QAAQ,KAAK,IAAI,CAAC,YAAY;YAC/B,CAAC,CAAC,iBAAiB,CAAC,IAAe,EAAE,QAAQ,CAAC,CAAC;AAC7D;;ACdA;;;;;;"}
|
|
1
|
+
{"version":3,"file":"taiga-ui-cdk-utils-dom.js","sources":["ng://@taiga-ui/cdk/utils/dom/can-scroll.ts","ng://@taiga-ui/cdk/utils/dom/contains-or-after.ts","ng://@taiga-ui/cdk/utils/dom/custom-event.ts","ng://@taiga-ui/cdk/utils/dom/get-actual-target.ts","ng://@taiga-ui/cdk/utils/dom/get-clipboard-data-text.ts","ng://@taiga-ui/cdk/utils/dom/get-closest-element.ts","ng://@taiga-ui/cdk/utils/dom/get-document-or-shadow-root.ts","ng://@taiga-ui/cdk/utils/dom/get-element-obscurers.ts","ng://@taiga-ui/cdk/utils/dom/get-element-offset.ts","ng://@taiga-ui/cdk/utils/dom/get-scroll-parent.ts","ng://@taiga-ui/cdk/utils/dom/is-form-field.ts","ng://@taiga-ui/cdk/utils/dom/get-selected-text.ts","ng://@taiga-ui/cdk/utils/dom/is-current-target.ts","ng://@taiga-ui/cdk/utils/dom/is-inside-iframe.ts","ng://@taiga-ui/cdk/utils/dom/is-node-in.ts","ng://@taiga-ui/cdk/utils/dom/taiga-ui-cdk-utils-dom.ts"],"sourcesContent":["export function canScroll(\n element: Element,\n rootElement: Element,\n vertical: boolean,\n scrollEnd: boolean,\n): boolean {\n return vertical\n ? canScrollVertical(element, rootElement, scrollEnd)\n : canScrollHorizontal(element, rootElement, scrollEnd);\n}\n\nfunction canScrollVertical(\n element: Element,\n rootElement: Element,\n scrollEnd: boolean,\n): boolean {\n let currentElement = element;\n\n while (currentElement !== rootElement.parentElement) {\n if (\n (Math.floor(currentElement.scrollTop) > 0 && !scrollEnd) ||\n (Math.ceil(currentElement.scrollTop + currentElement.clientHeight) <\n currentElement.scrollHeight &&\n scrollEnd)\n ) {\n return true;\n }\n\n if (currentElement.parentElement) {\n currentElement = currentElement.parentElement;\n } else {\n return false;\n }\n }\n\n return false;\n}\n\nfunction canScrollHorizontal(\n element: Element,\n rootElement: Element,\n scrollEnd: boolean,\n): boolean {\n let currentElement = element;\n\n while (currentElement !== rootElement.parentElement) {\n if (\n (Math.floor(currentElement.scrollLeft) > 0 && !scrollEnd) ||\n (Math.ceil(currentElement.scrollLeft + currentElement.clientWidth) <\n currentElement.scrollWidth &&\n scrollEnd)\n ) {\n return true;\n }\n\n if (currentElement.parentElement) {\n currentElement = currentElement.parentElement;\n } else {\n return false;\n }\n }\n\n return false;\n}\n","export function containsOrAfter(current: Node, node: Node): boolean {\n return (\n current.contains(node) ||\n !!(node.compareDocumentPosition(current) & Node.DOCUMENT_POSITION_PRECEDING)\n );\n}\n","/** @deprecated only needed for IE, remove in 3.0 */\nexport function tuiCustomEvent<T = null>(\n name: string,\n {bubbles = false, cancelable = false, detail = null}: CustomEventInit<T | null> = {},\n documentRef: Document,\n): CustomEvent {\n if (typeof CustomEvent === 'function') {\n return new CustomEvent(name, {bubbles, cancelable, detail});\n }\n\n const customEvent = documentRef.createEvent('CustomEvent');\n\n customEvent.initCustomEvent(name, bubbles, cancelable, detail);\n\n return customEvent;\n}\n","/**\n * Gets actual target from open Shadow DOM if event happened within it\n */\nexport function getActualTarget(event: Event): Node {\n if ('composedPath' in event) {\n return (event as any).composedPath()[0];\n }\n\n return (event as any).target;\n}\n","const DEFAULT_FORMAT = 'text/plain';\n\n/**\n * Gets text from data of clipboardEvent, it also works in IE and Edge browsers\n */\nexport function getClipboardDataText(\n event: ClipboardEvent,\n format: string = DEFAULT_FORMAT,\n): string {\n return 'clipboardData' in event && event.clipboardData !== null\n ? event.clipboardData.getData(format) ||\n event.clipboardData.getData(DEFAULT_FORMAT)\n : (event as any).target.ownerDocument.defaultView.clipboardData.getData('text');\n}\n","/**\n * Gets closest element by selector i.e. {@link Element.closest}\n * @deprecated only needed for IE, remove in 3.0\n */\nexport function getClosestElement(element: Element, selector: string): Element | null {\n const closest = Element.prototype.closest;\n\n if (closest) {\n return closest.call(element, selector);\n }\n\n const matchesSelector =\n Element.prototype.matches || (Element.prototype as any).msMatchesSelector;\n\n do {\n if (matchesSelector.call(element, selector)) {\n return element;\n }\n\n (element as Element | null) = element.parentElement;\n } while (element !== null);\n\n return null;\n}\n","export function getDocumentOrShadowRoot(node: Node): DocumentOrShadowRoot {\n return 'getRootNode' in node && node.isConnected\n ? (node.getRootNode() as Document)\n : node.ownerDocument!;\n}\n","import {clamp} from '@taiga-ui/cdk/utils/math';\nimport {isPresent} from '@taiga-ui/cdk/utils/miscellaneous';\n\nimport {getDocumentOrShadowRoot} from './get-document-or-shadow-root';\n\n/**\n * Returns array of Elements covering edges of given element or null if at least one edge middle point is visible\n *\n * CAUTION: Empty array means element if offscreen i.e. covered by no elements, rather than not covered\n */\nexport function getElementObscurers(element: Element): readonly Element[] | null {\n const {ownerDocument} = element;\n\n if (!ownerDocument || !ownerDocument.defaultView) {\n return null;\n }\n\n const {innerWidth, innerHeight} = ownerDocument.defaultView;\n const documentRef = getDocumentOrShadowRoot(element);\n const rect = element.getBoundingClientRect();\n const left = clamp(Math.round(rect.left) + 2, 0, innerWidth);\n const top = clamp(Math.round(rect.top) + 2, 0, innerHeight);\n const right = clamp(Math.round(rect.right) - 2, 0, innerWidth);\n const bottom = clamp(Math.round(rect.bottom) - 2, 0, innerHeight);\n const horizontalMiddle = clamp(Math.round(rect.left + rect.width / 2), 0, innerWidth);\n const verticalMiddle = clamp(Math.round(rect.top + rect.height / 2), 0, innerHeight);\n const elements = [\n documentRef.elementFromPoint(horizontalMiddle, top),\n documentRef.elementFromPoint(horizontalMiddle, bottom),\n documentRef.elementFromPoint(left, verticalMiddle),\n documentRef.elementFromPoint(right, verticalMiddle),\n ];\n const nonNull = elements.filter(isPresent);\n\n if (!nonNull.length) {\n return nonNull;\n }\n\n const filtered = nonNull.filter(el => !element.contains(el));\n\n return filtered.length === 4 ? filtered : null;\n}\n","import {tuiAssert} from '@taiga-ui/cdk/classes';\n\n/**\n * Calculates offset for an element relative to it's parent several levels above\n *\n * @param host parent element\n * @param element\n * @return object with offsetTop and offsetLeft number properties\n */\nexport function getElementOffset(\n host: Element,\n element: HTMLElement,\n): {offsetTop: number; offsetLeft: number} {\n tuiAssert.assert(host.contains(element), 'Host must contain element');\n\n let {offsetTop, offsetLeft, offsetParent} = element;\n\n // TODO: iframe warning\n while (offsetParent && offsetParent instanceof HTMLElement && offsetParent !== host) {\n offsetTop += offsetParent.offsetTop;\n offsetLeft += offsetParent.offsetLeft;\n offsetParent = offsetParent.offsetParent;\n }\n\n return {offsetTop, offsetLeft};\n}\n","/**\n * Finds nearest parent with scroll in it\n *\n * @param element initial element\n * @param vertical flag for orientation of scroll\n */\nexport function getScrollParent(\n element: Element | null,\n vertical: boolean = true,\n): Element | null {\n if (element === null) {\n return null;\n }\n\n if (vertical && element.scrollHeight > element.clientHeight) {\n return element;\n }\n\n if (!vertical && element.scrollWidth > element.clientWidth) {\n return element;\n }\n\n return getScrollParent(element.parentElement, vertical);\n}\n","export function tuiIsFormFieldElement(\n element: unknown | null,\n): element is HTMLInputElement | HTMLTextAreaElement {\n const textfield = element as Record<string, unknown> | null;\n\n return (\n !!textfield &&\n 'value' in textfield &&\n 'selectionStart' in textfield &&\n 'selectionEnd' in textfield\n );\n}\n","import {tuiIsFormFieldElement} from './is-form-field';\n\n/**\n * @description:\n * cross browser way to get selected text\n *\n * History:\n * BUG - window.getSelection() fails when text selected in a form field\n * https://bugzilla.mozilla.org/show_bug.cgi?id=85686\n */\nexport function tuiGetSelectedText({getSelection, document}: Window): string | null {\n return tuiIsFormFieldElement(document.activeElement)\n ? document.activeElement.value.slice(\n document.activeElement.selectionStart || 0,\n document.activeElement.selectionEnd || 0,\n )\n : getSelection()?.toString() || null;\n}\n","export function isCurrentTarget({target, currentTarget}: Event): boolean {\n return target === currentTarget;\n}\n","/**\n * Checks if an app is running inside <iframe /> tag\n */\nexport function isInsideIframe(windowRef: Window): boolean {\n return windowRef.parent !== windowRef;\n}\n","import {getClosestElement} from './get-closest-element';\n\n/**\n * Checks if node is inside a specific selector\n *\n * @param node\n * @param selector\n * @return true if node is inside a particular selector\n */\nexport function isNodeIn(node: Node, selector: string): boolean {\n return node.nodeType === Node.TEXT_NODE\n ? !!node.parentElement && !!getClosestElement(node.parentElement, selector)\n : node.nodeType === Node.ELEMENT_NODE &&\n !!getClosestElement(node as Element, selector);\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;SAAgB,SAAS,CACrB,OAAgB,EAChB,WAAoB,EACpB,QAAiB,EACjB,SAAkB;IAElB,OAAO,QAAQ;UACT,iBAAiB,CAAC,OAAO,EAAE,WAAW,EAAE,SAAS,CAAC;UAClD,mBAAmB,CAAC,OAAO,EAAE,WAAW,EAAE,SAAS,CAAC,CAAC;AAC/D,CAAC;AAED,SAAS,iBAAiB,CACtB,OAAgB,EAChB,WAAoB,EACpB,SAAkB;IAElB,IAAI,cAAc,GAAG,OAAO,CAAC;IAE7B,OAAO,cAAc,KAAK,WAAW,CAAC,aAAa,EAAE;QACjD,IACI,CAAC,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS;aACtD,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,SAAS,GAAG,cAAc,CAAC,YAAY,CAAC;gBAC9D,cAAc,CAAC,YAAY;gBAC3B,SAAS,CAAC,EAChB;YACE,OAAO,IAAI,CAAC;SACf;QAED,IAAI,cAAc,CAAC,aAAa,EAAE;YAC9B,cAAc,GAAG,cAAc,C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AAI,CAAC,aAAa,EAAE,QAAQ,CAAC;UACzE,IAAI,CAAC,QAAQ,KAAK,IAAI,CAAC,YAAY;YAC/B,CAAC,CAAC,iBAAiB,CAAC,IAAe,EAAE,QAAQ,CAAC,CAAC;AAC7D;;ACdA;;;;;;"}
|
|
@@ -2,6 +2,7 @@ import { __decorate, __param } from 'tslib';
|
|
|
2
2
|
import { Inject, Input, HostListener, Directive, NgModule } from '@angular/core';
|
|
3
3
|
import { WINDOW } from '@ng-web-apis/common';
|
|
4
4
|
import { tuiDefaultProp } from '@taiga-ui/cdk/decorators';
|
|
5
|
+
import { tuiGetSelectedText } from '@taiga-ui/cdk/utils';
|
|
5
6
|
import { identity } from 'rxjs';
|
|
6
7
|
|
|
7
8
|
// @dynamic
|
|
@@ -12,9 +13,9 @@ var TuiCopyProcessorDirective = /** @class */ (function () {
|
|
|
12
13
|
}
|
|
13
14
|
TuiCopyProcessorDirective.prototype.onCopy = function (event) {
|
|
14
15
|
var _a;
|
|
15
|
-
var
|
|
16
|
-
if (
|
|
17
|
-
(_a = event.clipboardData) === null || _a === void 0 ? void 0 : _a.setData('text/plain', this.tuiCopyProcessor(
|
|
16
|
+
var text = tuiGetSelectedText(this.windowRef);
|
|
17
|
+
if (text) {
|
|
18
|
+
(_a = event.clipboardData) === null || _a === void 0 ? void 0 : _a.setData('text/plain', this.tuiCopyProcessor(text));
|
|
18
19
|
}
|
|
19
20
|
};
|
|
20
21
|
TuiCopyProcessorDirective.ctorParameters = function () { return [
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"taiga-ui-cdk-directives-copy-processor.js","sources":["ng://@taiga-ui/cdk/directives/copy-processor/copy-processor.directive.ts","ng://@taiga-ui/cdk/directives/copy-processor/copy-processor.module.ts","ng://@taiga-ui/cdk/directives/copy-processor/taiga-ui-cdk-directives-copy-processor.ts"],"sourcesContent":["import {Directive, HostListener, Inject, Input} from '@angular/core';\nimport {WINDOW} from '@ng-web-apis/common';\nimport {tuiDefaultProp} from '@taiga-ui/cdk/decorators';\nimport {TuiStringHandler} from '@taiga-ui/cdk/types';\nimport {identity} from 'rxjs';\n\n// @dynamic\n@Directive({\n selector: '[tuiCopyProcessor]',\n})\nexport class TuiCopyProcessorDirective {\n @Input()\n @tuiDefaultProp()\n tuiCopyProcessor: TuiStringHandler<string> = identity;\n\n constructor(@Inject(WINDOW) private readonly windowRef: Window) {}\n\n @HostListener('copy.prevent', ['$event'])\n onCopy(event: ClipboardEvent): void {\n const
|
|
1
|
+
{"version":3,"file":"taiga-ui-cdk-directives-copy-processor.js","sources":["ng://@taiga-ui/cdk/directives/copy-processor/copy-processor.directive.ts","ng://@taiga-ui/cdk/directives/copy-processor/copy-processor.module.ts","ng://@taiga-ui/cdk/directives/copy-processor/taiga-ui-cdk-directives-copy-processor.ts"],"sourcesContent":["import {Directive, HostListener, Inject, Input} from '@angular/core';\nimport {WINDOW} from '@ng-web-apis/common';\nimport {tuiDefaultProp} from '@taiga-ui/cdk/decorators';\nimport {TuiStringHandler} from '@taiga-ui/cdk/types';\nimport {tuiGetSelectedText} from '@taiga-ui/cdk/utils';\nimport {identity} from 'rxjs';\n\n// @dynamic\n@Directive({\n selector: '[tuiCopyProcessor]',\n})\nexport class TuiCopyProcessorDirective {\n @Input()\n @tuiDefaultProp()\n tuiCopyProcessor: TuiStringHandler<string> = identity;\n\n constructor(@Inject(WINDOW) private readonly windowRef: Window) {}\n\n @HostListener('copy.prevent', ['$event'])\n onCopy(event: ClipboardEvent): void {\n const text = tuiGetSelectedText(this.windowRef);\n\n if (text) {\n event.clipboardData?.setData('text/plain', this.tuiCopyProcessor(text));\n }\n }\n}\n","import {NgModule} from '@angular/core';\n\nimport {TuiCopyProcessorDirective} from './copy-processor.directive';\n\n@NgModule({\n declarations: [TuiCopyProcessorDirective],\n exports: [TuiCopyProcessorDirective],\n})\nexport class TuiCopyProcessorModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;AAOA;;IASI,mCAA6C,SAAiB;QAAjB,cAAS,GAAT,SAAS,CAAQ;QAF9D,qBAAgB,GAA6B,QAAQ,CAAC;KAEY;IAGlE,0CAAM,GAAN,UAAO,KAAqB;;QACxB,IAAM,IAAI,GAAG,kBAAkB,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QAEhD,IAAI,IAAI,EAAE;YACN,MAAA,KAAK,CAAC,aAAa,0CAAE,OAAO,CAAC,YAAY,EAAE,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,EAAE;SAC3E;KACJ;;gBATuD,MAAM,uBAAjD,MAAM,SAAC,MAAM;;IAF1B;QAFC,KAAK,EAAE;QACP,cAAc,EAAE;uEACqC;IAKtD;QADC,YAAY,CAAC,cAAc,EAAE,CAAC,QAAQ,CAAC,CAAC;2DAOxC;IAdQ,yBAAyB;QAHrC,SAAS,CAAC;YACP,QAAQ,EAAE,oBAAoB;SACjC,CAAC;QAMe,WAAA,MAAM,CAAC,MAAM,CAAC,CAAA;OALlB,yBAAyB,CAerC;IAAD,gCAAC;CAfD;;;ICHA;KAAsC;IAAzB,sBAAsB;QAJlC,QAAQ,CAAC;YACN,YAAY,EAAE,CAAC,yBAAyB,CAAC;YACzC,OAAO,EAAE,CAAC,yBAAyB,CAAC;SACvC,CAAC;OACW,sBAAsB,CAAG;IAAD,6BAAC;CAAtC;;ACRA;;;;;;"}
|
|
@@ -59,9 +59,12 @@ var TuiOverscrollDirective = /** @class */ (function () {
|
|
|
59
59
|
configurable: true
|
|
60
60
|
});
|
|
61
61
|
TuiOverscrollDirective.prototype.processEvent = function (event, vertical, negative) {
|
|
62
|
+
var _a;
|
|
62
63
|
var target = event.target, currentTarget = event.currentTarget, cancelable = event.cancelable;
|
|
63
64
|
// TODO: iframe warning
|
|
64
|
-
if (!cancelable ||
|
|
65
|
+
if (!cancelable ||
|
|
66
|
+
!(target instanceof Element) ||
|
|
67
|
+
((_a = target) === null || _a === void 0 ? void 0 : _a.type) === 'range') {
|
|
65
68
|
return;
|
|
66
69
|
}
|
|
67
70
|
// This is all what's needed in Chrome/Firefox thanks to CSS overscroll-behavior
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"taiga-ui-cdk-directives-overscroll.js","sources":["ng://@taiga-ui/cdk/directives/overscroll/overscroll.directive.ts","ng://@taiga-ui/cdk/directives/overscroll/overscroll.module.ts","ng://@taiga-ui/cdk/directives/overscroll/taiga-ui-cdk-directives-overscroll.ts"],"sourcesContent":["import {Directive, ElementRef, HostBinding, Inject, Input, NgZone} from '@angular/core';\nimport {tuiZonefree, typedFromEvent} from '@taiga-ui/cdk/observables';\nimport {TuiDestroyService} from '@taiga-ui/cdk/services';\nimport {TuiEventWith, TuiOverscrollModeT} from '@taiga-ui/cdk/types';\nimport {canScroll, getScrollParent} from '@taiga-ui/cdk/utils/dom';\nimport {Observable} from 'rxjs';\nimport {filter, switchMap, takeUntil, tap} from 'rxjs/operators';\n\n/**\n * Directive to isolate scrolling, i.e. prevent body scroll behind modal dialog\n * @dynamic\n */\n@Directive({\n selector: '[tuiOverscroll]',\n providers: [TuiDestroyService],\n})\nexport class TuiOverscrollDirective {\n @Input('tuiOverscroll')\n mode: TuiOverscrollModeT | '' = 'scroll';\n\n constructor(\n @Inject(ElementRef) {nativeElement}: ElementRef<HTMLElement>,\n @Inject(NgZone) ngZone: NgZone,\n @Inject(TuiDestroyService) destroy$: Observable<void>,\n ) {\n typedFromEvent(nativeElement, 'wheel', {passive: false})\n .pipe(\n filter(() => this.enabled),\n tuiZonefree(ngZone),\n takeUntil(destroy$),\n )\n .subscribe(event => {\n this.processEvent(\n event,\n !!event.deltaY,\n event.deltaY ? event.deltaY < 0 : event.deltaX < 0,\n );\n });\n\n typedFromEvent(nativeElement, 'touchstart', {passive: true})\n .pipe(\n switchMap(({touches}) => {\n let {clientX, clientY} = touches[0];\n let deltaX = 0;\n let deltaY = 0;\n let vertical: boolean;\n\n return typedFromEvent(nativeElement, 'touchmove', {\n passive: false,\n }).pipe(\n filter(() => this.enabled),\n tap(event => {\n // We have to have it in tap instead of subscribe due to variables in closure\n const changedTouch = event.changedTouches[0];\n\n deltaX = clientX - changedTouch.clientX;\n deltaY = clientY - changedTouch.clientY;\n clientX = changedTouch.clientX;\n clientY = changedTouch.clientY;\n\n if (vertical === undefined) {\n vertical = Math.abs(deltaY) > Math.abs(deltaX);\n }\n\n this.processEvent(\n event,\n vertical,\n vertical ? deltaY < 0 : deltaX < 0,\n );\n }),\n );\n }),\n tuiZonefree(ngZone),\n takeUntil(destroy$),\n )\n .subscribe();\n }\n\n get enabled(): boolean {\n return this.mode !== 'none';\n }\n\n @HostBinding('style.overscrollBehavior')\n get overscrollBehavior(): 'contain' | null {\n return this.enabled ? 'contain' : null;\n }\n\n private processEvent(\n event: TuiEventWith<Event, HTMLElement>,\n vertical: boolean,\n negative: boolean,\n ): void {\n const {target, currentTarget, cancelable} = event;\n\n // TODO: iframe warning\n if (!cancelable
|
|
1
|
+
{"version":3,"file":"taiga-ui-cdk-directives-overscroll.js","sources":["ng://@taiga-ui/cdk/directives/overscroll/overscroll.directive.ts","ng://@taiga-ui/cdk/directives/overscroll/overscroll.module.ts","ng://@taiga-ui/cdk/directives/overscroll/taiga-ui-cdk-directives-overscroll.ts"],"sourcesContent":["import {Directive, ElementRef, HostBinding, Inject, Input, NgZone} from '@angular/core';\nimport {tuiZonefree, typedFromEvent} from '@taiga-ui/cdk/observables';\nimport {TuiDestroyService} from '@taiga-ui/cdk/services';\nimport {TuiEventWith, TuiOverscrollModeT} from '@taiga-ui/cdk/types';\nimport {canScroll, getScrollParent} from '@taiga-ui/cdk/utils/dom';\nimport {Observable} from 'rxjs';\nimport {filter, switchMap, takeUntil, tap} from 'rxjs/operators';\n\n/**\n * Directive to isolate scrolling, i.e. prevent body scroll behind modal dialog\n * @dynamic\n */\n@Directive({\n selector: '[tuiOverscroll]',\n providers: [TuiDestroyService],\n})\nexport class TuiOverscrollDirective {\n @Input('tuiOverscroll')\n mode: TuiOverscrollModeT | '' = 'scroll';\n\n constructor(\n @Inject(ElementRef) {nativeElement}: ElementRef<HTMLElement>,\n @Inject(NgZone) ngZone: NgZone,\n @Inject(TuiDestroyService) destroy$: Observable<void>,\n ) {\n typedFromEvent(nativeElement, 'wheel', {passive: false})\n .pipe(\n filter(() => this.enabled),\n tuiZonefree(ngZone),\n takeUntil(destroy$),\n )\n .subscribe(event => {\n this.processEvent(\n event,\n !!event.deltaY,\n event.deltaY ? event.deltaY < 0 : event.deltaX < 0,\n );\n });\n\n typedFromEvent(nativeElement, 'touchstart', {passive: true})\n .pipe(\n switchMap(({touches}) => {\n let {clientX, clientY} = touches[0];\n let deltaX = 0;\n let deltaY = 0;\n let vertical: boolean;\n\n return typedFromEvent(nativeElement, 'touchmove', {\n passive: false,\n }).pipe(\n filter(() => this.enabled),\n tap(event => {\n // We have to have it in tap instead of subscribe due to variables in closure\n const changedTouch = event.changedTouches[0];\n\n deltaX = clientX - changedTouch.clientX;\n deltaY = clientY - changedTouch.clientY;\n clientX = changedTouch.clientX;\n clientY = changedTouch.clientY;\n\n if (vertical === undefined) {\n vertical = Math.abs(deltaY) > Math.abs(deltaX);\n }\n\n this.processEvent(\n event,\n vertical,\n vertical ? deltaY < 0 : deltaX < 0,\n );\n }),\n );\n }),\n tuiZonefree(ngZone),\n takeUntil(destroy$),\n )\n .subscribe();\n }\n\n get enabled(): boolean {\n return this.mode !== 'none';\n }\n\n @HostBinding('style.overscrollBehavior')\n get overscrollBehavior(): 'contain' | null {\n return this.enabled ? 'contain' : null;\n }\n\n private processEvent(\n event: TuiEventWith<Event, HTMLElement>,\n vertical: boolean,\n negative: boolean,\n ): void {\n const {target, currentTarget, cancelable} = event;\n\n // TODO: iframe warning\n if (\n !cancelable ||\n !(target instanceof Element) ||\n (target as HTMLInputElement)?.type === 'range'\n ) {\n return;\n }\n\n // This is all what's needed in Chrome/Firefox thanks to CSS overscroll-behavior\n if (\n this.mode === 'all' &&\n ((vertical && !currentTarget.contains(getScrollParent(target))) ||\n (!vertical && !currentTarget.contains(getScrollParent(target, false))))\n ) {\n event.preventDefault();\n\n return;\n }\n\n // This is Safari/IE/Edge fallback\n if (\n vertical &&\n ((negative && !canScroll(target, currentTarget, true, false)) ||\n (!negative && !canScroll(target, currentTarget, true, true)))\n ) {\n event.preventDefault();\n\n return;\n }\n\n if (\n !vertical &&\n ((negative && !canScroll(target, currentTarget, false, false)) ||\n (!negative && !canScroll(target, currentTarget, false, true)))\n ) {\n event.preventDefault();\n }\n }\n}\n","import {NgModule} from '@angular/core';\n\nimport {TuiOverscrollDirective} from './overscroll.directive';\n\n@NgModule({\n declarations: [TuiOverscrollDirective],\n exports: [TuiOverscrollDirective],\n})\nexport class TuiOverscrollModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;AAQA;;;;;IAYI,gCACwB,EAAwC,EAC5C,MAAc,EACH,QAA0B;QAHzD,iBAwDC;YAvDwB,gCAAa;QAHtC,SAAI,GAA4B,QAAQ,CAAC;QAOrC,cAAc,CAAC,aAAa,EAAE,OAAO,EAAE,EAAC,OAAO,EAAE,KAAK,EAAC,CAAC;aACnD,IAAI,CACD,MAAM,CAAC,cAAM,OAAA,KAAI,CAAC,OAAO,GAAA,CAAC,EAC1B,WAAW,CAAC,MAAM,CAAC,EACnB,SAAS,CAAC,QAAQ,CAAC,CACtB;aACA,SAAS,CAAC,UAAA,KAAK;YACZ,KAAI,CAAC,YAAY,CACb,KAAK,EACL,CAAC,CAAC,KAAK,CAAC,MAAM,EACd,KAAK,CAAC,MAAM,GAAG,KAAK,CAAC,MAAM,GAAG,CAAC,GAAG,KAAK,CAAC,MAAM,GAAG,CAAC,CACrD,CAAC;SACL,CAAC,CAAC;QAEP,cAAc,CAAC,aAAa,EAAE,YAAY,EAAE,EAAC,OAAO,EAAE,IAAI,EAAC,CAAC;aACvD,IAAI,CACD,SAAS,CAAC,UAAC,EAAS;gBAAR,oBAAO;YACX,IAAA,e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AA0B,CAAC;oEAGvC;IArEQ,sBAAsB;QAJlC,SAAS,CAAC;YACP,QAAQ,EAAE,iBAAiB;YAC3B,SAAS,EAAE,CAAC,iBAAiB,CAAC;SACjC,CAAC;QAMO,WAAA,MAAM,CAAC,UAAU,CAAC,CAAA;QAClB,WAAA,MAAM,CAAC,MAAM,CAAC,CAAA;QACd,WAAA,MAAM,CAAC,iBAAiB,CAAC,CAAA;OAPrB,sBAAsB,CAqHlC;IAAD,6BAAC;CArHD;;;ICRA;KAAmC;IAAtB,mBAAmB;QAJ/B,QAAQ,CAAC;YACN,YAAY,EAAE,CAAC,sBAAsB,CAAC;YACtC,OAAO,EAAE,CAAC,sBAAsB,CAAC;SACpC,CAAC;OACW,mBAAmB,CAAG;IAAD,0BAAC;CAAnC;;ACRA;;;;;;"}
|
|
@@ -16,6 +16,11 @@ var TuiDocumentSelectionException = /** @class */ (function (_super) {
|
|
|
16
16
|
return TuiDocumentSelectionException;
|
|
17
17
|
}(Error));
|
|
18
18
|
|
|
19
|
+
/**
|
|
20
|
+
* @deprecated: use {@link TuiInvalidDayException}
|
|
21
|
+
* TODO: remove in v3.0
|
|
22
|
+
*/
|
|
23
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
19
24
|
var InvalidDayException = /** @class */ (function (_super) {
|
|
20
25
|
__extends(InvalidDayException, _super);
|
|
21
26
|
function InvalidDayException(day) {
|
|
@@ -23,7 +28,19 @@ var InvalidDayException = /** @class */ (function (_super) {
|
|
|
23
28
|
}
|
|
24
29
|
return InvalidDayException;
|
|
25
30
|
}(Error));
|
|
31
|
+
var TuiInvalidDayException = /** @class */ (function (_super) {
|
|
32
|
+
__extends(TuiInvalidDayException, _super);
|
|
33
|
+
function TuiInvalidDayException() {
|
|
34
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
35
|
+
}
|
|
36
|
+
return TuiInvalidDayException;
|
|
37
|
+
}(InvalidDayException));
|
|
26
38
|
|
|
39
|
+
/**
|
|
40
|
+
* @deprecated: use {@link TuiInvalidMonthException}
|
|
41
|
+
* TODO: remove in v3.0
|
|
42
|
+
*/
|
|
43
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
27
44
|
var InvalidMonthException = /** @class */ (function (_super) {
|
|
28
45
|
__extends(InvalidMonthException, _super);
|
|
29
46
|
function InvalidMonthException(month) {
|
|
@@ -31,7 +48,19 @@ var InvalidMonthException = /** @class */ (function (_super) {
|
|
|
31
48
|
}
|
|
32
49
|
return InvalidMonthException;
|
|
33
50
|
}(Error));
|
|
51
|
+
var TuiInvalidMonthException = /** @class */ (function (_super) {
|
|
52
|
+
__extends(TuiInvalidMonthException, _super);
|
|
53
|
+
function TuiInvalidMonthException() {
|
|
54
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
55
|
+
}
|
|
56
|
+
return TuiInvalidMonthException;
|
|
57
|
+
}(InvalidMonthException));
|
|
34
58
|
|
|
59
|
+
/**
|
|
60
|
+
* @deprecated: use {@link TuiInvalidYearException}
|
|
61
|
+
* TODO: remove in v3.0
|
|
62
|
+
*/
|
|
63
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
35
64
|
var InvalidYearException = /** @class */ (function (_super) {
|
|
36
65
|
__extends(InvalidYearException, _super);
|
|
37
66
|
function InvalidYearException(year) {
|
|
@@ -39,6 +68,13 @@ var InvalidYearException = /** @class */ (function (_super) {
|
|
|
39
68
|
}
|
|
40
69
|
return InvalidYearException;
|
|
41
70
|
}(Error));
|
|
71
|
+
var TuiInvalidYearException = /** @class */ (function (_super) {
|
|
72
|
+
__extends(TuiInvalidYearException, _super);
|
|
73
|
+
function TuiInvalidYearException() {
|
|
74
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
75
|
+
}
|
|
76
|
+
return TuiInvalidYearException;
|
|
77
|
+
}(InvalidYearException));
|
|
42
78
|
|
|
43
79
|
var TuiNoHostException = /** @class */ (function (_super) {
|
|
44
80
|
__extends(TuiNoHostException, _super);
|
|
@@ -108,5 +144,5 @@ var TuiXmlParsingException = /** @class */ (function (_super) {
|
|
|
108
144
|
* Generated bundle index. Do not edit.
|
|
109
145
|
*/
|
|
110
146
|
|
|
111
|
-
export { InvalidDayException, InvalidMonthException, InvalidYearException, TuiComputedDocumentException, TuiDocumentSelectionException, TuiNoHostException, TuiOwnerDocumentException, TuiPureException, TuiTableSortKeyException, TuiTsParserException, TuiValueChangesException, TuiValuePresentException, TuiXmlParsingException };
|
|
147
|
+
export { InvalidDayException, InvalidMonthException, InvalidYearException, TuiComputedDocumentException, TuiDocumentSelectionException, TuiInvalidDayException, TuiInvalidMonthException, TuiInvalidYearException, TuiNoHostException, TuiOwnerDocumentException, TuiPureException, TuiTableSortKeyException, TuiTsParserException, TuiValueChangesException, TuiValuePresentException, TuiXmlParsingException };
|
|
112
148
|
//# sourceMappingURL=taiga-ui-cdk-exceptions.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"taiga-ui-cdk-exceptions.js","sources":["ng://@taiga-ui/cdk/exceptions/computed-document.exception.ts","ng://@taiga-ui/cdk/exceptions/document-selection.exception.ts","ng://@taiga-ui/cdk/exceptions/invalid-day.exception.ts","ng://@taiga-ui/cdk/exceptions/invalid-month.exception.ts","ng://@taiga-ui/cdk/exceptions/invalid-year.exception.ts","ng://@taiga-ui/cdk/exceptions/no-host.exception.ts","ng://@taiga-ui/cdk/exceptions/owner-document.exception.ts","ng://@taiga-ui/cdk/exceptions/pure.exception.ts","ng://@taiga-ui/cdk/exceptions/table-sort-key.exception.ts","ng://@taiga-ui/cdk/exceptions/ts-parser.exception.ts","ng://@taiga-ui/cdk/exceptions/value-changes.exception.ts","ng://@taiga-ui/cdk/exceptions/value-present.exception.ts","ng://@taiga-ui/cdk/exceptions/xml-parsing.exception.ts","ng://@taiga-ui/cdk/exceptions/taiga-ui-cdk-exceptions.ts"],"sourcesContent":["export class TuiComputedDocumentException extends Error {\n constructor() {\n super('Only use computedDocument after load event');\n }\n}\n","export class TuiDocumentSelectionException extends Error {\n constructor() {\n super('Failed to get document selection');\n }\n}\n","
|
|
1
|
+
{"version":3,"file":"taiga-ui-cdk-exceptions.js","sources":["ng://@taiga-ui/cdk/exceptions/computed-document.exception.ts","ng://@taiga-ui/cdk/exceptions/document-selection.exception.ts","ng://@taiga-ui/cdk/exceptions/invalid-day.exception.ts","ng://@taiga-ui/cdk/exceptions/invalid-month.exception.ts","ng://@taiga-ui/cdk/exceptions/invalid-year.exception.ts","ng://@taiga-ui/cdk/exceptions/no-host.exception.ts","ng://@taiga-ui/cdk/exceptions/owner-document.exception.ts","ng://@taiga-ui/cdk/exceptions/pure.exception.ts","ng://@taiga-ui/cdk/exceptions/table-sort-key.exception.ts","ng://@taiga-ui/cdk/exceptions/ts-parser.exception.ts","ng://@taiga-ui/cdk/exceptions/value-changes.exception.ts","ng://@taiga-ui/cdk/exceptions/value-present.exception.ts","ng://@taiga-ui/cdk/exceptions/xml-parsing.exception.ts","ng://@taiga-ui/cdk/exceptions/taiga-ui-cdk-exceptions.ts"],"sourcesContent":["export class TuiComputedDocumentException extends Error {\n constructor() {\n super('Only use computedDocument after load event');\n }\n}\n","export class TuiDocumentSelectionException extends Error {\n constructor() {\n super('Failed to get document selection');\n }\n}\n","/**\n * @deprecated: use {@link TuiInvalidDayException}\n * TODO: remove in v3.0\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport class InvalidDayException extends Error {\n constructor(day: number) {\n super(`Invalid day: ${day}`);\n }\n}\n\nexport class TuiInvalidDayException extends InvalidDayException {}\n","/**\n * @deprecated: use {@link TuiInvalidMonthException}\n * TODO: remove in v3.0\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport class InvalidMonthException extends Error {\n constructor(month: number) {\n super(`Invalid month: ${month}`);\n }\n}\n\nexport class TuiInvalidMonthException extends InvalidMonthException {}\n","/**\n * @deprecated: use {@link TuiInvalidYearException}\n * TODO: remove in v3.0\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport class InvalidYearException extends Error {\n constructor(year: number) {\n super(`Invalid year: ${year}`);\n }\n}\n\nexport class TuiInvalidYearException extends InvalidYearException {}\n","export class TuiNoHostException extends Error {\n constructor() {\n super('Portals cannot be used without TuiPortalHostComponent');\n }\n}\n","export class TuiOwnerDocumentException extends Error {\n constructor() {\n super('Element does not have ownerDocument');\n }\n}\n","export class TuiPureException extends Error {\n constructor() {\n super('tuiPure can only be used with functions or getters');\n }\n}\n","export class TuiTableSortKeyException extends Error {\n constructor() {\n super('Trying to sort with no key');\n }\n}\n","export class TuiTsParserException extends Error {\n constructor() {\n super('TsFileParser: 1 component/module per ts-file');\n }\n}\n","export class TuiValueChangesException extends Error {\n constructor() {\n super('Control does not have valueChanges');\n }\n}\n","export class TuiValuePresentException extends Error {\n constructor() {\n super('Value must present');\n }\n}\n","export class TuiXmlParsingException extends Error {\n constructor() {\n super('Error parsing XML string');\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;IAAkD,gDAAK;IACnD;eACI,kBAAM,4CAA4C,CAAC;KACtD;IACL,mCAAC;AAAD,CAJA,CAAkD,KAAK;;;ICAJ,iDAAK;IACpD;eACI,kBAAM,kCAAkC,CAAC;KAC5C;IACL,oCAAC;AAAD,CAJA,CAAmD,KAAK;;ACAxD;;;;AAIA;;IACyC,uCAAK;IAC1C,6BAAY,GAAW;eACnB,kBAAM,kBAAgB,GAAK,CAAC;KAC/B;IACL,0BAAC;AAAD,CAJA,CAAyC,KAAK,GAI7C;;IAE2C,0CAAmB;IAA/D;;KAAkE;IAAD,6BAAC;AAAD,CAAjE,CAA4C,mBAAmB;;ACX/D;;;;AAIA;;IAC2C,yCAAK;IAC5C,+BAAY,KAAa;eACrB,kBAAM,oBAAkB,KAAO,CAAC;KACnC;IACL,4BAAC;AAAD,CAJA,CAA2C,KAAK,GAI/C;;IAE6C,4CAAqB;IAAnE;;KAAsE;IAAD,+BAAC;AAAD,CAArE,CAA8C,qBAAqB;;ACXnE;;;;AAIA;;IAC0C,wCAAK;IAC3C,8BAAY,IAAY;eACpB,kBAAM,mBAAiB,IAAM,CAAC;KACjC;IACL,2BAAC;AAAD,CAJA,CAA0C,KAAK,GAI9C;;IAE4C,2CAAoB;IAAjE;;KAAoE;IAAD,8BAAC;AAAD,CAAnE,CAA6C,oBAAoB;;;ICXzB,sCAAK;IACzC;eACI,kBAAM,uDAAuD,CAAC;KACjE;IACL,yBAAC;AAAD,CAJA,CAAwC,KAAK;;;ICAE,6CAAK;IAChD;eACI,kBAAM,qCAAqC,CAAC;KAC/C;IACL,gCAAC;AAAD,CAJA,CAA+C,KAAK;;;ICAd,oCAAK;IACvC;eACI,kBAAM,oDAAoD,CAAC;KAC9D;IACL,uBAAC;AAAD,CAJA,CAAsC,KAAK;;;ICAG,4CAAK;IAC/C;eACI,kBAAM,4BAA4B,CAAC;KACtC;IACL,+BAAC;AAAD,CAJA,CAA8C,KAAK;;;ICAT,wCAAK;IAC3C;eACI,kBAAM,8CAA8C,CAAC;KACxD;IACL,2BAAC;AAAD,CAJA,CAA0C,KAAK;;;ICAD,4CAAK;IAC/C;eACI,kBAAM,oCAAoC,CAAC;KAC9C;IACL,+BAAC;AAAD,CAJA,CAA8C,KAAK;;;ICAL,4CAAK;IAC/C;eACI,kBAAM,oBAAoB,CAAC;KAC9B;IACL,+BAAC;AAAD,CAJA,CAA8C,KAAK;;;ICAP,0CAAK;IAC7C;eACI,kBAAM,0BAA0B,CAAC;KACpC;IACL,6BAAC;AAAD,CAJA,CAA4C,KAAK;;ACAjD;;;;;;"}
|
|
@@ -179,6 +179,30 @@ function getScrollParent(element, vertical) {
|
|
|
179
179
|
return getScrollParent(element.parentElement, vertical);
|
|
180
180
|
}
|
|
181
181
|
|
|
182
|
+
function tuiIsFormFieldElement(element) {
|
|
183
|
+
var textfield = element;
|
|
184
|
+
return (!!textfield &&
|
|
185
|
+
'value' in textfield &&
|
|
186
|
+
'selectionStart' in textfield &&
|
|
187
|
+
'selectionEnd' in textfield);
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
/**
|
|
191
|
+
* @description:
|
|
192
|
+
* cross browser way to get selected text
|
|
193
|
+
*
|
|
194
|
+
* History:
|
|
195
|
+
* BUG - window.getSelection() fails when text selected in a form field
|
|
196
|
+
* https://bugzilla.mozilla.org/show_bug.cgi?id=85686
|
|
197
|
+
*/
|
|
198
|
+
function tuiGetSelectedText(_a) {
|
|
199
|
+
var getSelection = _a.getSelection, document = _a.document;
|
|
200
|
+
var _b;
|
|
201
|
+
return tuiIsFormFieldElement(document.activeElement)
|
|
202
|
+
? document.activeElement.value.slice(document.activeElement.selectionStart || 0, document.activeElement.selectionEnd || 0)
|
|
203
|
+
: ((_b = getSelection()) === null || _b === void 0 ? void 0 : _b.toString()) || null;
|
|
204
|
+
}
|
|
205
|
+
|
|
182
206
|
function isCurrentTarget(_a) {
|
|
183
207
|
var target = _a.target, currentTarget = _a.currentTarget;
|
|
184
208
|
return target === currentTarget;
|
|
@@ -209,5 +233,5 @@ function isNodeIn(node, selector) {
|
|
|
209
233
|
* Generated bundle index. Do not edit.
|
|
210
234
|
*/
|
|
211
235
|
|
|
212
|
-
export { canScroll, containsOrAfter, getActualTarget, getClipboardDataText, getClosestElement, getDocumentOrShadowRoot, getElementObscurers, getElementOffset, getScrollParent, isCurrentTarget, isInsideIframe, isNodeIn, tuiCustomEvent };
|
|
236
|
+
export { canScroll, containsOrAfter, getActualTarget, getClipboardDataText, getClosestElement, getDocumentOrShadowRoot, getElementObscurers, getElementOffset, getScrollParent, isCurrentTarget, isInsideIframe, isNodeIn, tuiCustomEvent, tuiGetSelectedText, tuiIsFormFieldElement };
|
|
213
237
|
//# sourceMappingURL=taiga-ui-cdk-utils-dom.js.map
|