@ng-doc/ui-kit 22.0.0-beta.2 → 22.0.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/README.md +20 -29
- package/fesm2022/ng-doc-ui-kit-cdk-combobox-host.mjs +43 -22
- package/fesm2022/ng-doc-ui-kit-cdk-combobox-host.mjs.map +1 -1
- package/fesm2022/ng-doc-ui-kit-classes-base-input.mjs +24 -13
- package/fesm2022/ng-doc-ui-kit-classes-base-input.mjs.map +1 -1
- package/fesm2022/ng-doc-ui-kit-classes-overlay-ref.mjs +62 -22
- package/fesm2022/ng-doc-ui-kit-classes-overlay-ref.mjs.map +1 -1
- package/fesm2022/ng-doc-ui-kit-components-blockquote.mjs +39 -14
- package/fesm2022/ng-doc-ui-kit-components-blockquote.mjs.map +1 -1
- package/fesm2022/ng-doc-ui-kit-components-button-icon.mjs +30 -18
- package/fesm2022/ng-doc-ui-kit-components-button-icon.mjs.map +1 -1
- package/fesm2022/ng-doc-ui-kit-components-button-toggle.mjs +12 -9
- package/fesm2022/ng-doc-ui-kit-components-button-toggle.mjs.map +1 -1
- package/fesm2022/ng-doc-ui-kit-components-button.mjs +15 -24
- package/fesm2022/ng-doc-ui-kit-components-button.mjs.map +1 -1
- package/fesm2022/ng-doc-ui-kit-components-checkbox.mjs +13 -13
- package/fesm2022/ng-doc-ui-kit-components-checkbox.mjs.map +1 -1
- package/fesm2022/ng-doc-ui-kit-components-clear-control.mjs +14 -9
- package/fesm2022/ng-doc-ui-kit-components-clear-control.mjs.map +1 -1
- package/fesm2022/ng-doc-ui-kit-components-combobox.mjs +30 -26
- package/fesm2022/ng-doc-ui-kit-components-combobox.mjs.map +1 -1
- package/fesm2022/ng-doc-ui-kit-components-data-list-group.mjs +37 -38
- package/fesm2022/ng-doc-ui-kit-components-data-list-group.mjs.map +1 -1
- package/fesm2022/ng-doc-ui-kit-components-data-list.mjs +32 -39
- package/fesm2022/ng-doc-ui-kit-components-data-list.mjs.map +1 -1
- package/fesm2022/ng-doc-ui-kit-components-dialog-outlet.mjs +23 -20
- package/fesm2022/ng-doc-ui-kit-components-dialog-outlet.mjs.map +1 -1
- package/fesm2022/ng-doc-ui-kit-components-dot.mjs +20 -16
- package/fesm2022/ng-doc-ui-kit-components-dot.mjs.map +1 -1
- package/fesm2022/ng-doc-ui-kit-components-dropdown.mjs +120 -125
- package/fesm2022/ng-doc-ui-kit-components-dropdown.mjs.map +1 -1
- package/fesm2022/ng-doc-ui-kit-components-expander.mjs +17 -17
- package/fesm2022/ng-doc-ui-kit-components-expander.mjs.map +1 -1
- package/fesm2022/ng-doc-ui-kit-components-floated-border.mjs +4 -4
- package/fesm2022/ng-doc-ui-kit-components-floated-border.mjs.map +1 -1
- package/fesm2022/ng-doc-ui-kit-components-floated-content.mjs +16 -17
- package/fesm2022/ng-doc-ui-kit-components-floated-content.mjs.map +1 -1
- package/fesm2022/ng-doc-ui-kit-components-focus-control.mjs +20 -12
- package/fesm2022/ng-doc-ui-kit-components-focus-control.mjs.map +1 -1
- package/fesm2022/ng-doc-ui-kit-components-icon.mjs +175 -54
- package/fesm2022/ng-doc-ui-kit-components-icon.mjs.map +1 -1
- package/fesm2022/ng-doc-ui-kit-components-input-wrapper.mjs +43 -46
- package/fesm2022/ng-doc-ui-kit-components-input-wrapper.mjs.map +1 -1
- package/fesm2022/ng-doc-ui-kit-components-label.mjs +14 -16
- package/fesm2022/ng-doc-ui-kit-components-label.mjs.map +1 -1
- package/fesm2022/ng-doc-ui-kit-components-line.mjs +7 -4
- package/fesm2022/ng-doc-ui-kit-components-line.mjs.map +1 -1
- package/fesm2022/ng-doc-ui-kit-components-list.mjs +24 -8
- package/fesm2022/ng-doc-ui-kit-components-list.mjs.map +1 -1
- package/fesm2022/ng-doc-ui-kit-components-magnifier-controller.mjs +7 -3
- package/fesm2022/ng-doc-ui-kit-components-magnifier-controller.mjs.map +1 -1
- package/fesm2022/ng-doc-ui-kit-components-magnifier.mjs +31 -15
- package/fesm2022/ng-doc-ui-kit-components-magnifier.mjs.map +1 -1
- package/fesm2022/ng-doc-ui-kit-components-option-group.mjs +22 -27
- package/fesm2022/ng-doc-ui-kit-components-option-group.mjs.map +1 -1
- package/fesm2022/ng-doc-ui-kit-components-option.mjs +28 -22
- package/fesm2022/ng-doc-ui-kit-components-option.mjs.map +1 -1
- package/fesm2022/ng-doc-ui-kit-components-overlay-container.mjs +56 -52
- package/fesm2022/ng-doc-ui-kit-components-overlay-container.mjs.map +1 -1
- package/fesm2022/ng-doc-ui-kit-components-overlay-pointer.mjs +19 -21
- package/fesm2022/ng-doc-ui-kit-components-overlay-pointer.mjs.map +1 -1
- package/fesm2022/ng-doc-ui-kit-components-pane.mjs +91 -69
- package/fesm2022/ng-doc-ui-kit-components-pane.mjs.map +1 -1
- package/fesm2022/ng-doc-ui-kit-components-selection.mjs +173 -76
- package/fesm2022/ng-doc-ui-kit-components-selection.mjs.map +1 -1
- package/fesm2022/ng-doc-ui-kit-components-sidenav.mjs +23 -22
- package/fesm2022/ng-doc-ui-kit-components-sidenav.mjs.map +1 -1
- package/fesm2022/ng-doc-ui-kit-components-spinner.mjs +14 -12
- package/fesm2022/ng-doc-ui-kit-components-spinner.mjs.map +1 -1
- package/fesm2022/ng-doc-ui-kit-components-tab-group.mjs +86 -61
- package/fesm2022/ng-doc-ui-kit-components-tab-group.mjs.map +1 -1
- package/fesm2022/ng-doc-ui-kit-components-tab-routes-group.mjs +16 -13
- package/fesm2022/ng-doc-ui-kit-components-tab-routes-group.mjs.map +1 -1
- package/fesm2022/ng-doc-ui-kit-components-tag.mjs +23 -24
- package/fesm2022/ng-doc-ui-kit-components-tag.mjs.map +1 -1
- package/fesm2022/ng-doc-ui-kit-components-text.mjs +37 -52
- package/fesm2022/ng-doc-ui-kit-components-text.mjs.map +1 -1
- package/fesm2022/ng-doc-ui-kit-components-toggle.mjs +82 -57
- package/fesm2022/ng-doc-ui-kit-components-toggle.mjs.map +1 -1
- package/fesm2022/ng-doc-ui-kit-components-wrapper.mjs +7 -4
- package/fesm2022/ng-doc-ui-kit-components-wrapper.mjs.map +1 -1
- package/fesm2022/ng-doc-ui-kit-directives-autofocus.mjs +13 -10
- package/fesm2022/ng-doc-ui-kit-directives-autofocus.mjs.map +1 -1
- package/fesm2022/ng-doc-ui-kit-directives-checked-change.mjs +30 -26
- package/fesm2022/ng-doc-ui-kit-directives-checked-change.mjs.map +1 -1
- package/fesm2022/ng-doc-ui-kit-directives-data.mjs +8 -5
- package/fesm2022/ng-doc-ui-kit-directives-data.mjs.map +1 -1
- package/fesm2022/ng-doc-ui-kit-directives-dropdown-handler.mjs +19 -18
- package/fesm2022/ng-doc-ui-kit-directives-dropdown-handler.mjs.map +1 -1
- package/fesm2022/ng-doc-ui-kit-directives-dropdown-origin.mjs +3 -4
- package/fesm2022/ng-doc-ui-kit-directives-dropdown-origin.mjs.map +1 -1
- package/fesm2022/ng-doc-ui-kit-directives-event-switcher.mjs +22 -19
- package/fesm2022/ng-doc-ui-kit-directives-event-switcher.mjs.map +1 -1
- package/fesm2022/ng-doc-ui-kit-directives-focus-catcher.mjs +30 -25
- package/fesm2022/ng-doc-ui-kit-directives-focus-catcher.mjs.map +1 -1
- package/fesm2022/ng-doc-ui-kit-directives-focusable.mjs +13 -16
- package/fesm2022/ng-doc-ui-kit-directives-focusable.mjs.map +1 -1
- package/fesm2022/ng-doc-ui-kit-directives-fullscreen.mjs +90 -0
- package/fesm2022/ng-doc-ui-kit-directives-fullscreen.mjs.map +1 -0
- package/fesm2022/ng-doc-ui-kit-directives-hotkey.mjs +34 -28
- package/fesm2022/ng-doc-ui-kit-directives-hotkey.mjs.map +1 -1
- package/fesm2022/ng-doc-ui-kit-directives-input-number.mjs +10 -12
- package/fesm2022/ng-doc-ui-kit-directives-input-number.mjs.map +1 -1
- package/fesm2022/ng-doc-ui-kit-directives-input-string.mjs +9 -12
- package/fesm2022/ng-doc-ui-kit-directives-input-string.mjs.map +1 -1
- package/fesm2022/ng-doc-ui-kit-directives-radio-group.mjs +7 -4
- package/fesm2022/ng-doc-ui-kit-directives-radio-group.mjs.map +1 -1
- package/fesm2022/ng-doc-ui-kit-directives-rotator.mjs +16 -22
- package/fesm2022/ng-doc-ui-kit-directives-rotator.mjs.map +1 -1
- package/fesm2022/ng-doc-ui-kit-directives-tooltip.mjs +105 -101
- package/fesm2022/ng-doc-ui-kit-directives-tooltip.mjs.map +1 -1
- package/fesm2022/ng-doc-ui-kit-directives.mjs +1 -1
- package/fesm2022/ng-doc-ui-kit-interceptors.mjs +24 -21
- package/fesm2022/ng-doc-ui-kit-interceptors.mjs.map +1 -1
- package/fesm2022/ng-doc-ui-kit-observables.mjs +2 -58
- package/fesm2022/ng-doc-ui-kit-observables.mjs.map +1 -1
- package/fesm2022/ng-doc-ui-kit-pipes-as-array.mjs +3 -4
- package/fesm2022/ng-doc-ui-kit-pipes-as-array.mjs.map +1 -1
- package/fesm2022/ng-doc-ui-kit-pipes-bind.mjs +3 -4
- package/fesm2022/ng-doc-ui-kit-pipes-bind.mjs.map +1 -1
- package/fesm2022/ng-doc-ui-kit-pipes-execute.mjs +3 -4
- package/fesm2022/ng-doc-ui-kit-pipes-execute.mjs.map +1 -1
- package/fesm2022/ng-doc-ui-kit-pipes-highlighter.mjs +3 -4
- package/fesm2022/ng-doc-ui-kit-pipes-highlighter.mjs.map +1 -1
- package/fesm2022/ng-doc-ui-kit-services-dialog.mjs +14 -8
- package/fesm2022/ng-doc-ui-kit-services-dialog.mjs.map +1 -1
- package/fesm2022/ng-doc-ui-kit-services-notify.mjs +13 -8
- package/fesm2022/ng-doc-ui-kit-services-notify.mjs.map +1 -1
- package/fesm2022/ng-doc-ui-kit-services-overlay-strategy.mjs +15 -11
- package/fesm2022/ng-doc-ui-kit-services-overlay-strategy.mjs.map +1 -1
- package/fesm2022/ng-doc-ui-kit-services-overlay.mjs +20 -9
- package/fesm2022/ng-doc-ui-kit-services-overlay.mjs.map +1 -1
- package/fesm2022/ng-doc-ui-kit-services-scroll.mjs +11 -13
- package/fesm2022/ng-doc-ui-kit-services-scroll.mjs.map +1 -1
- package/fesm2022/ng-doc-ui-kit-tokens.mjs +29 -3
- package/fesm2022/ng-doc-ui-kit-tokens.mjs.map +1 -1
- package/package.json +27 -30
- package/styles/main.css +271 -34
- package/types/ng-doc-ui-kit-cdk-combobox-host.d.ts +16 -8
- package/types/ng-doc-ui-kit-classes-base-input.d.ts +12 -1
- package/types/ng-doc-ui-kit-classes-overlay-ref.d.ts +27 -4
- package/types/ng-doc-ui-kit-components-blockquote.d.ts +22 -5
- package/types/ng-doc-ui-kit-components-button-icon.d.ts +23 -5
- package/types/ng-doc-ui-kit-components-button-toggle.d.ts +5 -1
- package/types/ng-doc-ui-kit-components-button.d.ts +6 -6
- package/types/ng-doc-ui-kit-components-checkbox.d.ts +5 -3
- package/types/ng-doc-ui-kit-components-clear-control.d.ts +7 -0
- package/types/ng-doc-ui-kit-components-combobox.d.ts +19 -9
- package/types/ng-doc-ui-kit-components-data-list-group.d.ts +16 -11
- package/types/ng-doc-ui-kit-components-data-list.d.ts +21 -11
- package/types/ng-doc-ui-kit-components-dialog-outlet.d.ts +11 -6
- package/types/ng-doc-ui-kit-components-dot.d.ts +10 -5
- package/types/ng-doc-ui-kit-components-dropdown.d.ts +39 -27
- package/types/ng-doc-ui-kit-components-expander.d.ts +9 -7
- package/types/ng-doc-ui-kit-components-floated-content.d.ts +8 -6
- package/types/ng-doc-ui-kit-components-focus-control.d.ts +10 -4
- package/types/ng-doc-ui-kit-components-icon.d.ts +49 -14
- package/types/ng-doc-ui-kit-components-input-wrapper.d.ts +31 -17
- package/types/ng-doc-ui-kit-components-label.d.ts +8 -5
- package/types/ng-doc-ui-kit-components-line.d.ts +3 -0
- package/types/ng-doc-ui-kit-components-list.d.ts +14 -3
- package/types/ng-doc-ui-kit-components-magnifier-controller.d.ts +5 -1
- package/types/ng-doc-ui-kit-components-magnifier.d.ts +19 -4
- package/types/ng-doc-ui-kit-components-option-group.d.ts +12 -8
- package/types/ng-doc-ui-kit-components-option.d.ts +9 -2
- package/types/ng-doc-ui-kit-components-overlay-container.d.ts +18 -15
- package/types/ng-doc-ui-kit-components-overlay-pointer.d.ts +10 -6
- package/types/ng-doc-ui-kit-components-pane.d.ts +25 -9
- package/types/ng-doc-ui-kit-components-selection.d.ts +59 -21
- package/types/ng-doc-ui-kit-components-sidenav.d.ts +17 -8
- package/types/ng-doc-ui-kit-components-spinner.d.ts +7 -3
- package/types/ng-doc-ui-kit-components-tab-group.d.ts +43 -22
- package/types/ng-doc-ui-kit-components-tab-routes-group.d.ts +4 -2
- package/types/ng-doc-ui-kit-components-tag.d.ts +13 -6
- package/types/ng-doc-ui-kit-components-text.d.ts +21 -19
- package/types/ng-doc-ui-kit-components-toggle.d.ts +13 -7
- package/types/ng-doc-ui-kit-components-wrapper.d.ts +3 -0
- package/types/ng-doc-ui-kit-directives-autofocus.d.ts +7 -5
- package/types/ng-doc-ui-kit-directives-checked-change.d.ts +15 -11
- package/types/ng-doc-ui-kit-directives-data.d.ts +6 -4
- package/types/ng-doc-ui-kit-directives-dropdown-handler.d.ts +5 -3
- package/types/ng-doc-ui-kit-directives-event-switcher.d.ts +11 -6
- package/types/ng-doc-ui-kit-directives-focus-catcher.d.ts +11 -8
- package/types/ng-doc-ui-kit-directives-focusable.d.ts +6 -3
- package/types/ng-doc-ui-kit-directives-fullscreen.d.ts +39 -0
- package/types/ng-doc-ui-kit-directives-hotkey.d.ts +14 -7
- package/types/ng-doc-ui-kit-directives-input-number.d.ts +3 -2
- package/types/ng-doc-ui-kit-directives-input-string.d.ts +2 -2
- package/types/ng-doc-ui-kit-directives-radio-group.d.ts +4 -0
- package/types/ng-doc-ui-kit-directives-rotator.d.ts +8 -8
- package/types/ng-doc-ui-kit-directives-tooltip.d.ts +35 -23
- package/types/ng-doc-ui-kit-directives.d.ts +1 -1
- package/types/ng-doc-ui-kit-interceptors.d.ts +18 -2
- package/types/ng-doc-ui-kit-interfaces.d.ts +20 -4
- package/types/ng-doc-ui-kit-observables.d.ts +2 -19
- package/types/ng-doc-ui-kit-services-dialog.d.ts +10 -1
- package/types/ng-doc-ui-kit-services-notify.d.ts +9 -1
- package/types/ng-doc-ui-kit-services-overlay-strategy.d.ts +5 -3
- package/types/ng-doc-ui-kit-services-overlay.d.ts +14 -3
- package/types/ng-doc-ui-kit-services-scroll.d.ts +4 -5
- package/fesm2022/ng-doc-ui-kit-decorators.mjs +0 -53
- package/fesm2022/ng-doc-ui-kit-decorators.mjs.map +0 -1
- package/fesm2022/ng-doc-ui-kit-directives-let.mjs +0 -43
- package/fesm2022/ng-doc-ui-kit-directives-let.mjs.map +0 -1
- package/types/ng-doc-ui-kit-decorators.d.ts +0 -12
- package/types/ng-doc-ui-kit-directives-let.d.ts +0 -22
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ng-doc-ui-kit-components-text.mjs","sources":["../../../../libs/ui-kit/components/text/text-left.directive.ts","../../../../libs/ui-kit/components/text/text-right.directive.ts","../../../../libs/ui-kit/components/text/text.component.ts","../../../../libs/ui-kit/components/text/text.component.html","../../../../libs/ui-kit/components/text/ng-doc-ui-kit-components-text.ts"],"sourcesContent":["import { Directive } from '@angular/core';\n\n/** Using to display content on the left side */\n@Directive({\n selector: '[ngDocTextLeft]',\n
|
|
1
|
+
{"version":3,"file":"ng-doc-ui-kit-components-text.mjs","sources":["../../../../libs/ui-kit/components/text/text-left.directive.ts","../../../../libs/ui-kit/components/text/text-right.directive.ts","../../../../libs/ui-kit/components/text/text.component.ts","../../../../libs/ui-kit/components/text/text.component.html","../../../../libs/ui-kit/components/text/ng-doc-ui-kit-components-text.ts"],"sourcesContent":["import { Directive } from '@angular/core';\n\n/** Using to display content on the left side */\n@Directive({\n selector: '[ngDocTextLeft]',\n})\nexport class NgDocTextLeftDirective {}\n","import { Directive } from '@angular/core';\n\n/** Using to display content on the right side */\n@Directive({\n selector: '[ngDocTextRight]',\n})\nexport class NgDocTextRightDirective {}\n","import { ChangeDetectionStrategy, Component, contentChild, input } from '@angular/core';\nimport { NgDocSize, NgDocTextAlign, NgDocTextColor } from '@ng-doc/ui-kit/types';\n\nimport { NgDocTextLeftDirective } from './text-left.directive';\nimport { NgDocTextRightDirective } from './text-right.directive';\n\n/**\n * Text with the UI Kit typography, optionally with content on its left or right side\n * (`ngDocTextLeft`, `ngDocTextRight`).\n */\n@Component({\n selector: '[ng-doc-text]',\n templateUrl: './text.component.html',\n styleUrls: ['./text.component.scss'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n host: {\n class: 'ngde',\n '[attr.data-ng-doc-text-size]': 'size()',\n '[attr.data-ng-doc-text-color]': 'color()',\n '[attr.data-ng-doc-text-align]': 'align()',\n '[attr.data-ng-doc-text-absolute]': 'absoluteContent()',\n },\n})\nexport class NgDocTextComponent {\n /** Text size */\n readonly size = input<NgDocSize>('medium');\n\n /** Text color */\n readonly color = input<NgDocTextColor>('normal');\n\n /** Text align */\n readonly align = input<NgDocTextAlign>('left');\n\n /** Positions the side content absolutely, so it does not take space from the text. */\n readonly absoluteContent = input<boolean>(false);\n\n /** Content projected with `ngDocTextLeft`. */\n readonly leftContent = contentChild(NgDocTextLeftDirective);\n\n /** Content projected with `ngDocTextRight`. */\n readonly rightContent = contentChild(NgDocTextRightDirective);\n}\n","@if (leftContent()) {\n <span class=\"ng-doc-text-left\">\n <ng-content select=\"[ngDocTextLeft]\"></ng-content>\n </span>\n}\n<span class=\"ng-doc-text\">\n <ng-content></ng-content>\n</span>\n@if (rightContent()) {\n <span class=\"ng-doc-text-right\">\n <ng-content select=\"[ngDocTextRight]\"></ng-content>\n </span>\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;AAEA;MAIa,sBAAsB,CAAA;8GAAtB,sBAAsB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA,CAAA;kGAAtB,sBAAsB,EAAA,YAAA,EAAA,IAAA,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AAA,IAAA,EAAA,CAAA,EAAA,CAAA,UAAA,CAAA,MAAA,sBAAsB,8FAGrB,uBAAuB,CAAA,EAAA,EAAA,QAAA,EAAA,IAAA,EAAA,CAAA,EAAA,CAAA,EAAA,EAAA,CAAA;;AExC9D;;AAEG;;;;"}
|
|
@@ -1,90 +1,115 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { inject,
|
|
2
|
+
import { inject, DOCUMENT, DestroyRef, viewChild, signal, afterNextRender, ChangeDetectionStrategy, Component } from '@angular/core';
|
|
3
3
|
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
4
4
|
import { NgDocPositionUtils } from '@ng-doc/ui-kit/utils';
|
|
5
5
|
import { DIStateControl, DICompareHost, injectHostControl } from 'di-controls';
|
|
6
6
|
import { fromEvent } from 'rxjs';
|
|
7
7
|
import { filter, switchMap, pairwise, map, tap, startWith, takeUntil, last } from 'rxjs/operators';
|
|
8
8
|
|
|
9
|
+
/**
|
|
10
|
+
* Switch control. It works with forms (`ngModel`, reactive forms, `[formField]`) and with host
|
|
11
|
+
* controls; the circle can be clicked or dragged.
|
|
12
|
+
*/
|
|
9
13
|
class NgDocToggleComponent extends DIStateControl {
|
|
10
14
|
constructor() {
|
|
11
15
|
super({
|
|
12
16
|
host: injectHostControl({ optional: true }),
|
|
13
17
|
compareHost: inject(DICompareHost, { optional: true }),
|
|
14
|
-
onIncomingUpdate: () =>
|
|
15
|
-
this.setState(!!this.checked());
|
|
16
|
-
},
|
|
18
|
+
onIncomingUpdate: () => this.setState(!!this.checked()),
|
|
17
19
|
});
|
|
18
|
-
this.
|
|
20
|
+
this.document = inject(DOCUMENT);
|
|
21
|
+
this.toggleDestroyRef = inject(DestroyRef);
|
|
22
|
+
this.wrapper = viewChild('wrapper', /* @ts-ignore */
|
|
23
|
+
...(ngDevMode ? [{ debugName: "wrapper" }] : /* istanbul ignore next */ []));
|
|
24
|
+
this.circle = viewChild('circle', /* @ts-ignore */
|
|
25
|
+
...(ngDevMode ? [{ debugName: "circle" }] : /* istanbul ignore next */ []));
|
|
26
|
+
/** Whether the user is dragging the circle. */
|
|
27
|
+
this.dragging = signal(false, /* @ts-ignore */
|
|
28
|
+
...(ngDevMode ? [{ debugName: "dragging" }] : /* istanbul ignore next */ []));
|
|
19
29
|
this.maxPixelValue = 0;
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
this.
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
this.renderer.setStyle(this.circle.nativeElement, 'transition', transition)));
|
|
33
|
-
}), takeUntilDestroyed(this['destroyRef']))
|
|
34
|
-
.subscribe((deltaX) => {
|
|
35
|
-
deltaX === null ? this.toggle() : this.detectByCoordinates();
|
|
36
|
-
});
|
|
37
|
-
}
|
|
30
|
+
// The track is measured once it is rendered (and only in the browser); a value written by a
|
|
31
|
+
// form before that is shown from here.
|
|
32
|
+
afterNextRender(() => {
|
|
33
|
+
const wrapper = this.wrapper()?.nativeElement;
|
|
34
|
+
const circle = this.circle()?.nativeElement;
|
|
35
|
+
if (!wrapper || !circle) {
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
this.maxPixelValue = Math.max(wrapper.offsetWidth - circle.offsetWidth - 6, 0);
|
|
39
|
+
this.setState(!!this.checked());
|
|
40
|
+
this.listenToDrag(circle);
|
|
41
|
+
});
|
|
38
42
|
}
|
|
39
43
|
updateModel(value) {
|
|
40
44
|
super.updateModel(value);
|
|
41
|
-
this.setState(!!this.checked);
|
|
45
|
+
this.setState(!!this.checked());
|
|
46
|
+
}
|
|
47
|
+
onWrapperClick() {
|
|
48
|
+
if (!this.disabled) {
|
|
49
|
+
this.toggle();
|
|
50
|
+
}
|
|
42
51
|
}
|
|
43
52
|
setState(isSelected) {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
this.renderer.setStyle(this.circle.nativeElement, 'transform', `translateX(0)`);
|
|
53
|
+
const circle = this.circle()?.nativeElement;
|
|
54
|
+
if (circle) {
|
|
55
|
+
this.renderer.setStyle(circle, 'transform', isSelected ? `translateX(${this.maxPixelValue}px)` : 'translateX(0)');
|
|
56
|
+
}
|
|
49
57
|
}
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
58
|
+
listenToDrag(circle) {
|
|
59
|
+
fromEvent(circle, 'mousedown')
|
|
60
|
+
.pipe(filter(() => !this.disabled), switchMap(() => {
|
|
61
|
+
const transition = circle.style.transition;
|
|
62
|
+
this.renderer.setStyle(circle, 'transition', '');
|
|
63
|
+
this.dragging.set(true);
|
|
64
|
+
return fromEvent(this.document.body, 'mousemove').pipe(pairwise(), map(([newEvent, oldEvent]) => oldEvent.clientX - newEvent.clientX), filter((deltaX) => deltaX !== 0), tap((deltaX) => this.changeCirclePosition(deltaX)), startWith(null), takeUntil(fromEvent(this.document.body, 'mouseup').pipe(tap(() => this.dragging.set(false)))), last(), tap(() => this.renderer.setStyle(circle, 'transition', transition)));
|
|
65
|
+
}), takeUntilDestroyed(this.toggleDestroyRef))
|
|
66
|
+
.subscribe((deltaX) => {
|
|
67
|
+
// Without a drag the press is a click on the circle. While dragging, the track ignores
|
|
68
|
+
// pointer events, so the click that follows does not reach its handler as well.
|
|
69
|
+
if (deltaX === null) {
|
|
70
|
+
this.toggle();
|
|
71
|
+
}
|
|
72
|
+
else {
|
|
73
|
+
this.detectByCoordinates();
|
|
74
|
+
}
|
|
75
|
+
});
|
|
53
76
|
}
|
|
54
77
|
detectByCoordinates() {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
const
|
|
59
|
-
|
|
60
|
-
circleCenterLeft > wrapperMiddle
|
|
61
|
-
|
|
78
|
+
const wrapper = this.wrapper()?.nativeElement;
|
|
79
|
+
const circle = this.circle()?.nativeElement;
|
|
80
|
+
if (!this.disabled && wrapper && circle) {
|
|
81
|
+
const wrapperMiddle = NgDocPositionUtils.getElementPosition(wrapper).x + wrapper.offsetWidth / 2;
|
|
82
|
+
const circleCenterLeft = NgDocPositionUtils.getElementPosition(circle).x + circle.offsetWidth / 2;
|
|
83
|
+
if (circleCenterLeft > wrapperMiddle) {
|
|
84
|
+
this.check();
|
|
85
|
+
}
|
|
86
|
+
else {
|
|
87
|
+
this.uncheck();
|
|
88
|
+
}
|
|
89
|
+
this.setState(!!this.checked());
|
|
62
90
|
}
|
|
63
91
|
}
|
|
64
92
|
changeCirclePosition(delta) {
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
93
|
+
const wrapper = this.wrapper()?.nativeElement;
|
|
94
|
+
const circle = this.circle()?.nativeElement;
|
|
95
|
+
if (wrapper && circle) {
|
|
96
|
+
const wrapperLeft = NgDocPositionUtils.getElementPosition(wrapper).x;
|
|
97
|
+
const circleLeft = NgDocPositionUtils.getElementPosition(circle).x;
|
|
68
98
|
const newPosition = Math.max(Math.min(circleLeft - wrapperLeft - 3 + delta, this.maxPixelValue), 0);
|
|
69
|
-
this.renderer.setStyle(
|
|
99
|
+
this.renderer.setStyle(circle, 'transform', `translateX(${newPosition}px)`);
|
|
70
100
|
}
|
|
71
101
|
}
|
|
72
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.
|
|
73
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "
|
|
102
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.2.1", ngImport: i0, type: NgDocToggleComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
103
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "22.2.1", type: NgDocToggleComponent, isStandalone: true, selector: "ng-doc-toggle", host: { properties: { "attr.data-ng-doc-dragging": "dragging()", "attr.data-checked": "checked()", "attr.data-disabled": "disabled" } }, viewQueries: [{ propertyName: "wrapper", first: true, predicate: ["wrapper"], descendants: true, isSignal: true }, { propertyName: "circle", first: true, predicate: ["circle"], descendants: true, isSignal: true }], usesInheritance: true, ngImport: i0, template: "<div class=\"ng-doc-toggle-wrapper\" (click)=\"onWrapperClick()\" #wrapper>\n <div class=\"ng-doc-toggle-circle\" #circle></div>\n</div>\n", styles: [":host .ng-doc-toggle-wrapper{position:relative;display:inline-block;width:40px;height:22px;border-radius:24px;background-color:var(--ng-doc-base-3);cursor:pointer;transition:background-color var(--ng-doc-transition)}:host .ng-doc-toggle-wrapper .ng-doc-toggle-circle{position:absolute;left:3px;top:3px;height:calc(var(--ng-doc-base-gutter) * 2);width:calc(var(--ng-doc-base-gutter) * 2);border-radius:50%;background-color:var(--ng-doc-base-0);-webkit-user-select:none;user-select:none;transition:transform var(--ng-doc-transition);box-shadow:0 2px 1px -1px #0003,0 1px 1px #00000024,0 1px 3px #0000001f}:host[data-checked=true] .ng-doc-toggle-wrapper{background-color:var(--ng-doc-primary)}:host[data-ng-doc-dragging=true]{cursor:grabbing}:host[data-ng-doc-dragging=true] .ng-doc-toggle-wrapper{pointer-events:none}:host[data-disabled=true] .ng-doc-toggle-wrapper{background-color:var(--ng-doc-base-2);cursor:unset}:host[data-disabled=true][data-checked=true] .ng-doc-toggle-wrapper{background-color:var(--ng-doc-base-3)}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
74
104
|
}
|
|
75
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.
|
|
105
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.1", ngImport: i0, type: NgDocToggleComponent, decorators: [{
|
|
76
106
|
type: Component,
|
|
77
|
-
args: [{ selector: 'ng-doc-toggle', changeDetection: ChangeDetectionStrategy.OnPush,
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
args: ['circle', { static: true }]
|
|
84
|
-
}], dragging: [{
|
|
85
|
-
type: HostBinding,
|
|
86
|
-
args: ['attr.data-ng-doc-dragging']
|
|
87
|
-
}] } });
|
|
107
|
+
args: [{ selector: 'ng-doc-toggle', changeDetection: ChangeDetectionStrategy.OnPush, host: {
|
|
108
|
+
'[attr.data-ng-doc-dragging]': 'dragging()',
|
|
109
|
+
'[attr.data-checked]': 'checked()',
|
|
110
|
+
'[attr.data-disabled]': 'disabled',
|
|
111
|
+
}, template: "<div class=\"ng-doc-toggle-wrapper\" (click)=\"onWrapperClick()\" #wrapper>\n <div class=\"ng-doc-toggle-circle\" #circle></div>\n</div>\n", styles: [":host .ng-doc-toggle-wrapper{position:relative;display:inline-block;width:40px;height:22px;border-radius:24px;background-color:var(--ng-doc-base-3);cursor:pointer;transition:background-color var(--ng-doc-transition)}:host .ng-doc-toggle-wrapper .ng-doc-toggle-circle{position:absolute;left:3px;top:3px;height:calc(var(--ng-doc-base-gutter) * 2);width:calc(var(--ng-doc-base-gutter) * 2);border-radius:50%;background-color:var(--ng-doc-base-0);-webkit-user-select:none;user-select:none;transition:transform var(--ng-doc-transition);box-shadow:0 2px 1px -1px #0003,0 1px 1px #00000024,0 1px 3px #0000001f}:host[data-checked=true] .ng-doc-toggle-wrapper{background-color:var(--ng-doc-primary)}:host[data-ng-doc-dragging=true]{cursor:grabbing}:host[data-ng-doc-dragging=true] .ng-doc-toggle-wrapper{pointer-events:none}:host[data-disabled=true] .ng-doc-toggle-wrapper{background-color:var(--ng-doc-base-2);cursor:unset}:host[data-disabled=true][data-checked=true] .ng-doc-toggle-wrapper{background-color:var(--ng-doc-base-3)}\n"] }]
|
|
112
|
+
}], ctorParameters: () => [], propDecorators: { wrapper: [{ type: i0.ViewChild, args: ['wrapper', { isSignal: true }] }], circle: [{ type: i0.ViewChild, args: ['circle', { isSignal: true }] }] } });
|
|
88
113
|
|
|
89
114
|
/**
|
|
90
115
|
* Generated bundle index. Do not edit.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ng-doc-ui-kit-components-toggle.mjs","sources":["../../../../libs/ui-kit/components/toggle/toggle.component.ts","../../../../libs/ui-kit/components/toggle/toggle.component.html","../../../../libs/ui-kit/components/toggle/ng-doc-ui-kit-components-toggle.ts"],"sourcesContent":["import {\n ChangeDetectionStrategy,\n Component,\n ElementRef,\n HostBinding,\n inject,\n OnInit,\n ViewChild,\n} from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport { ControlValueAccessor } from '@angular/forms';\nimport { NgDocPositionUtils } from '@ng-doc/ui-kit/utils';\nimport { DICompareHost, DIStateControl, injectHostControl } from 'di-controls';\nimport { fromEvent } from 'rxjs';\nimport { filter, last, map, pairwise, startWith, switchMap, takeUntil, tap } from 'rxjs/operators';\n\n@Component({\n selector: 'ng-doc-toggle',\n templateUrl: './toggle.component.html',\n styleUrls: ['./toggle.component.scss'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n standalone: true,\n})\nexport class NgDocToggleComponent<T>\n extends DIStateControl<T>\n implements OnInit, ControlValueAccessor\n{\n @ViewChild('wrapper', { static: true })\n private wrapper?: ElementRef<HTMLElement>;\n\n @ViewChild('circle', { static: true })\n private circle?: ElementRef<HTMLElement>;\n\n @HostBinding('attr.data-ng-doc-dragging')\n dragging: boolean = false;\n\n private maxPixelValue: number = 0;\n\n constructor() {\n super({\n host: injectHostControl({ optional: true }),\n compareHost: inject(DICompareHost, { optional: true }),\n onIncomingUpdate: () => {\n this.setState(!!this.checked());\n },\n });\n }\n\n override ngOnInit(): void {\n super.ngOnInit();\n if (this.wrapper && this.circle) {\n this.maxPixelValue =\n this.wrapper.nativeElement.offsetWidth - this.circle.nativeElement.offsetWidth - 6;\n fromEvent(this.circle.nativeElement, 'mousedown')\n .pipe(\n filter(() => !this.disabled),\n switchMap(() => {\n const transition: string = this.circle?.nativeElement.style.transition ?? '';\n this.renderer.setStyle(this.circle?.nativeElement, 'transition', '');\n this.setDragging(true);\n\n return fromEvent(document.body, 'mousemove').pipe(\n pairwise(),\n map(\n ([newEvent, oldEvent]: [Event, Event]) =>\n [newEvent, oldEvent] as [MouseEvent, MouseEvent],\n ),\n map(\n ([newEvent, oldEvent]: [MouseEvent, MouseEvent]) =>\n oldEvent.clientX - newEvent.clientX,\n ),\n filter((deltaX: number) => deltaX !== 0),\n tap((deltaX: number) => this.changeCirclePosition(deltaX)),\n startWith(null),\n takeUntil(\n fromEvent(document.body, 'mouseup').pipe(tap(() => this.setDragging(false))),\n ),\n last(),\n tap(\n () =>\n this.circle &&\n this.renderer.setStyle(this.circle.nativeElement, 'transition', transition),\n ),\n );\n }),\n takeUntilDestroyed(this['destroyRef']),\n )\n .subscribe((deltaX: number | null) => {\n deltaX === null ? this.toggle() : this.detectByCoordinates();\n });\n }\n }\n\n override updateModel(value: boolean | T | null): void {\n super.updateModel(value);\n this.setState(!!this.checked);\n }\n\n protected setState(isSelected: boolean): void {\n isSelected\n ? this.circle &&\n this.renderer.setStyle(\n this.circle.nativeElement,\n 'transform',\n `translateX(${this.maxPixelValue}px)`,\n )\n : this.circle &&\n this.renderer.setStyle(this.circle.nativeElement, 'transform', `translateX(0)`);\n }\n\n private setDragging(value: boolean): void {\n this.dragging = value;\n this.changeDetectorRef.markForCheck();\n }\n\n private detectByCoordinates(): void {\n if (!this.disabled && this.wrapper && this.circle) {\n const wrapperMiddle: number =\n NgDocPositionUtils.getElementPosition(this.wrapper.nativeElement).x +\n this.wrapper.nativeElement.offsetWidth / 2;\n const circleCenterLeft: number =\n NgDocPositionUtils.getElementPosition(this.circle.nativeElement).x +\n this.circle.nativeElement.offsetWidth / 2;\n circleCenterLeft > wrapperMiddle ? this.check() : this.uncheck();\n this.setState(!!this.checked);\n }\n }\n\n private changeCirclePosition(delta: number): void {\n if (this.wrapper && this.circle) {\n const wrapperLeft: number = NgDocPositionUtils.getElementPosition(\n this.wrapper.nativeElement,\n ).x;\n const circleLeft: number = NgDocPositionUtils.getElementPosition(this.circle.nativeElement).x;\n const newPosition: number = Math.max(\n Math.min(circleLeft - wrapperLeft - 3 + delta, this.maxPixelValue),\n 0,\n );\n this.renderer.setStyle(\n this.circle.nativeElement,\n 'transform',\n `translateX(${newPosition}px)`,\n );\n }\n }\n}\n","<div class=\"ng-doc-toggle-wrapper\" (click)=\"toggle()\" #wrapper>\n\t<div class=\"ng-doc-toggle-circle\" #circle></div>\n</div>\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;AAuBM,MAAO,oBACX,SAAQ,cAAiB,CAAA;AAczB,IAAA,WAAA,GAAA;AACE,QAAA,KAAK,CAAC;YACJ,IAAI,EAAE,iBAAiB,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;YAC3C,WAAW,EAAE,MAAM,CAAC,aAAa,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;YACtD,gBAAgB,EAAE,MAAK;gBACrB,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC;YACjC,CAAC;AACF,SAAA,CAAC;QAXJ,IAAA,CAAA,QAAQ,GAAY,KAAK;QAEjB,IAAA,CAAA,aAAa,GAAW,CAAC;IAUjC;IAES,QAAQ,GAAA;QACf,KAAK,CAAC,QAAQ,EAAE;QAChB,IAAI,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC,MAAM,EAAE;AAC/B,YAAA,IAAI,CAAC,aAAa;AAChB,gBAAA,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,WAAW,GAAG,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,WAAW,GAAG,CAAC;YACpF,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC,aAAa,EAAE,WAAW;AAC7C,iBAAA,IAAI,CACH,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,EAC5B,SAAS,CAAC,MAAK;AACb,gBAAA,MAAM,UAAU,GAAW,IAAI,CAAC,MAAM,EAAE,aAAa,CAAC,KAAK,CAAC,UAAU,IAAI,EAAE;AAC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EAAA,CAAA,igCAAA,CAAA,EAAA;;sBAMf,SAAS;AAAC,gBAAA,IAAA,EAAA,CAAA,SAAS,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE;;sBAGrC,SAAS;AAAC,gBAAA,IAAA,EAAA,CAAA,QAAQ,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE;;sBAGpC,WAAW;uBAAC,2BAA2B;;;AEjC1C;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"ng-doc-ui-kit-components-toggle.mjs","sources":["../../../../libs/ui-kit/components/toggle/toggle.component.ts","../../../../libs/ui-kit/components/toggle/toggle.component.html","../../../../libs/ui-kit/components/toggle/ng-doc-ui-kit-components-toggle.ts"],"sourcesContent":["import {\n afterNextRender,\n ChangeDetectionStrategy,\n Component,\n DestroyRef,\n DOCUMENT,\n ElementRef,\n inject,\n signal,\n viewChild,\n} from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport { ControlValueAccessor } from '@angular/forms';\nimport { NgDocPositionUtils } from '@ng-doc/ui-kit/utils';\nimport { DICompareHost, DIStateControl, injectHostControl } from 'di-controls';\nimport { fromEvent } from 'rxjs';\nimport { filter, last, map, pairwise, startWith, switchMap, takeUntil, tap } from 'rxjs/operators';\n\n/**\n * Switch control. It works with forms (`ngModel`, reactive forms, `[formField]`) and with host\n * controls; the circle can be clicked or dragged.\n */\n@Component({\n selector: 'ng-doc-toggle',\n templateUrl: './toggle.component.html',\n styleUrls: ['./toggle.component.scss'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n host: {\n '[attr.data-ng-doc-dragging]': 'dragging()',\n '[attr.data-checked]': 'checked()',\n '[attr.data-disabled]': 'disabled',\n },\n})\nexport class NgDocToggleComponent<T> extends DIStateControl<T> implements ControlValueAccessor {\n private readonly document = inject(DOCUMENT);\n private readonly toggleDestroyRef = inject(DestroyRef);\n private readonly wrapper = viewChild<ElementRef<HTMLElement>>('wrapper');\n private readonly circle = viewChild<ElementRef<HTMLElement>>('circle');\n\n /** Whether the user is dragging the circle. */\n protected readonly dragging = signal(false);\n\n private maxPixelValue: number = 0;\n\n constructor() {\n super({\n host: injectHostControl({ optional: true }),\n compareHost: inject(DICompareHost, { optional: true }),\n onIncomingUpdate: () => this.setState(!!this.checked()),\n });\n\n // The track is measured once it is rendered (and only in the browser); a value written by a\n // form before that is shown from here.\n afterNextRender(() => {\n const wrapper: HTMLElement | undefined = this.wrapper()?.nativeElement;\n const circle: HTMLElement | undefined = this.circle()?.nativeElement;\n\n if (!wrapper || !circle) {\n return;\n }\n\n this.maxPixelValue = Math.max(wrapper.offsetWidth - circle.offsetWidth - 6, 0);\n this.setState(!!this.checked());\n this.listenToDrag(circle);\n });\n }\n\n override updateModel(value: boolean | T | null): void {\n super.updateModel(value);\n this.setState(!!this.checked());\n }\n\n protected onWrapperClick(): void {\n if (!this.disabled) {\n this.toggle();\n }\n }\n\n protected setState(isSelected: boolean): void {\n const circle: HTMLElement | undefined = this.circle()?.nativeElement;\n\n if (circle) {\n this.renderer.setStyle(\n circle,\n 'transform',\n isSelected ? `translateX(${this.maxPixelValue}px)` : 'translateX(0)',\n );\n }\n }\n\n private listenToDrag(circle: HTMLElement): void {\n fromEvent(circle, 'mousedown')\n .pipe(\n filter(() => !this.disabled),\n switchMap(() => {\n const transition: string = circle.style.transition;\n this.renderer.setStyle(circle, 'transition', '');\n this.dragging.set(true);\n\n return fromEvent<MouseEvent>(this.document.body, 'mousemove').pipe(\n pairwise(),\n map(\n ([newEvent, oldEvent]: [MouseEvent, MouseEvent]) =>\n oldEvent.clientX - newEvent.clientX,\n ),\n filter((deltaX: number) => deltaX !== 0),\n tap((deltaX: number) => this.changeCirclePosition(deltaX)),\n startWith(null),\n takeUntil(\n fromEvent(this.document.body, 'mouseup').pipe(tap(() => this.dragging.set(false))),\n ),\n last(),\n tap(() => this.renderer.setStyle(circle, 'transition', transition)),\n );\n }),\n takeUntilDestroyed(this.toggleDestroyRef),\n )\n .subscribe((deltaX: number | null) => {\n // Without a drag the press is a click on the circle. While dragging, the track ignores\n // pointer events, so the click that follows does not reach its handler as well.\n if (deltaX === null) {\n this.toggle();\n } else {\n this.detectByCoordinates();\n }\n });\n }\n\n private detectByCoordinates(): void {\n const wrapper: HTMLElement | undefined = this.wrapper()?.nativeElement;\n const circle: HTMLElement | undefined = this.circle()?.nativeElement;\n\n if (!this.disabled && wrapper && circle) {\n const wrapperMiddle: number =\n NgDocPositionUtils.getElementPosition(wrapper).x + wrapper.offsetWidth / 2;\n const circleCenterLeft: number =\n NgDocPositionUtils.getElementPosition(circle).x + circle.offsetWidth / 2;\n\n if (circleCenterLeft > wrapperMiddle) {\n this.check();\n } else {\n this.uncheck();\n }\n\n this.setState(!!this.checked());\n }\n }\n\n private changeCirclePosition(delta: number): void {\n const wrapper: HTMLElement | undefined = this.wrapper()?.nativeElement;\n const circle: HTMLElement | undefined = this.circle()?.nativeElement;\n\n if (wrapper && circle) {\n const wrapperLeft: number = NgDocPositionUtils.getElementPosition(wrapper).x;\n const circleLeft: number = NgDocPositionUtils.getElementPosition(circle).x;\n const newPosition: number = Math.max(\n Math.min(circleLeft - wrapperLeft - 3 + delta, this.maxPixelValue),\n 0,\n );\n\n this.renderer.setStyle(circle, 'transform', `translateX(${newPosition}px)`);\n }\n }\n}\n","<div class=\"ng-doc-toggle-wrapper\" (click)=\"onWrapperClick()\" #wrapper>\n <div class=\"ng-doc-toggle-circle\" #circle></div>\n</div>\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;AAkBA;;;AAGG;AAYG,MAAO,oBAAwB,SAAQ,cAAiB,CAAA;AAW5D,IAAA,WAAA,GAAA;AACE,QAAA,KAAK,CAAC;YACJ,IAAI,EAAE,iBAAiB,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;YAC3C,WAAW,EAAE,MAAM,CAAC,aAAa,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;AACtD,YAAA,gBAA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AA,EAAA,cAAA,EAAA,EAAA,OAAA,EAAA,CAAA,EAAA,IAAA,EAAA,EAAA,CAAA,SAAA,EAAA,IAAA,EAAA,CAAA,SAAS,gEACV,QAAQ,EAAA,EAAA,QAAA,EAAA,IAAA,EAAA,CAAA,EAAA,CAAA,EAAA,EAAA,CAAA;;AErCvE;;AAEG;;;;"}
|
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
2
|
import { ChangeDetectionStrategy, Component } from '@angular/core';
|
|
3
3
|
|
|
4
|
+
/**
|
|
5
|
+
* Wraps an input and its controls; the border takes the focus color while it holds focus.
|
|
6
|
+
*/
|
|
4
7
|
class NgDocWrapperComponent {
|
|
5
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.
|
|
6
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "22.
|
|
8
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.2.1", ngImport: i0, type: NgDocWrapperComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
9
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "22.2.1", type: NgDocWrapperComponent, isStandalone: true, selector: "ng-doc-wrapper", ngImport: i0, template: ` <ng-content></ng-content> `, isInline: true, styles: [":host[data-ng-doc-focused=true]{--ng-doc-floated-border-color: var(--ng-doc-floated-focus-border-color, var(--ng-doc-primary))}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
7
10
|
}
|
|
8
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.
|
|
11
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.1", ngImport: i0, type: NgDocWrapperComponent, decorators: [{
|
|
9
12
|
type: Component,
|
|
10
|
-
args: [{ selector: 'ng-doc-wrapper', template: ` <ng-content></ng-content> `, changeDetection: ChangeDetectionStrategy.OnPush,
|
|
13
|
+
args: [{ selector: 'ng-doc-wrapper', template: ` <ng-content></ng-content> `, changeDetection: ChangeDetectionStrategy.OnPush, styles: [":host[data-ng-doc-focused=true]{--ng-doc-floated-border-color: var(--ng-doc-floated-focus-border-color, var(--ng-doc-primary))}\n"] }]
|
|
11
14
|
}] });
|
|
12
15
|
|
|
13
16
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ng-doc-ui-kit-components-wrapper.mjs","sources":["../../../../libs/ui-kit/components/wrapper/wrapper.component.ts","../../../../libs/ui-kit/components/wrapper/ng-doc-ui-kit-components-wrapper.ts"],"sourcesContent":["import { ChangeDetectionStrategy, Component } from '@angular/core';\n\n@Component({\n
|
|
1
|
+
{"version":3,"file":"ng-doc-ui-kit-components-wrapper.mjs","sources":["../../../../libs/ui-kit/components/wrapper/wrapper.component.ts","../../../../libs/ui-kit/components/wrapper/ng-doc-ui-kit-components-wrapper.ts"],"sourcesContent":["import { ChangeDetectionStrategy, Component } from '@angular/core';\n\n/**\n * Wraps an input and its controls; the border takes the focus color while it holds focus.\n */\n@Component({\n selector: 'ng-doc-wrapper',\n template: ` <ng-content></ng-content> `,\n styleUrls: ['./wrapper.component.scss'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class NgDocWrapperComponent {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;AAEA;;AAEG;MAOU,qBAAqB,CAAA;8GAArB,qBAAqB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA,CAAA;AAArB,IAAA,SAAA,IAAA,CAAA,IAAA,GAAA,EAAA,CAAA,oBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,IAAA,EAAA,qBAAqB,0EAJtB,CAAA,2BAAA,CAA6B,EAAA,QAAA,EAAA,IAAA,EAAA,MAAA,EAAA,CAAA,mIAAA,CAAA,EAAA,eAAA,EAAA,EAAA,CAAA,uBAAA,CAAA,MAAA,EAAA,CAAA,CAAA;;2FAI5B,qBAAqB,EAAA,UAAA,EAAA,CAAA;kBANjC,SAAS;AACE,YAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,gBAAgB,EAAA,QAAA,EAChB,CAAA,2BAAA,CAA6B,EAAA,eAAA,EAEtB,uBAAuB,CAAC,MAAM,EAAA,MAAA,EAAA,CAAA,mIAAA,CAAA,EAAA;;;ACTjD;;AAEG;;;;"}
|
|
@@ -1,33 +1,36 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { inject, ElementRef,
|
|
2
|
+
import { inject, ElementRef, input, Directive } from '@angular/core';
|
|
3
3
|
import { NgDocFocusUtils } from '@ng-doc/ui-kit/utils';
|
|
4
4
|
|
|
5
|
+
/**
|
|
6
|
+
* Focuses the host when it is created, if the host can take keyboard focus.
|
|
7
|
+
*/
|
|
5
8
|
class NgDocAutofocusDirective {
|
|
6
9
|
constructor() {
|
|
7
10
|
this.elementRef = inject(ElementRef);
|
|
8
|
-
|
|
11
|
+
/** Selects the whole value of an `input` host after focusing it. */
|
|
12
|
+
this.selectAll = input(false, /* @ts-ignore */
|
|
13
|
+
...(ngDevMode ? [{ debugName: "selectAll" }] : /* istanbul ignore next */ []));
|
|
9
14
|
}
|
|
10
15
|
ngOnInit() {
|
|
11
16
|
const element = this.elementRef.nativeElement;
|
|
12
17
|
if (NgDocFocusUtils.isNativeKeyboardFocusable(element)) {
|
|
13
18
|
element.focus();
|
|
14
19
|
}
|
|
15
|
-
if (this.selectAll && element instanceof HTMLInputElement) {
|
|
20
|
+
if (this.selectAll() && element instanceof HTMLInputElement) {
|
|
21
|
+
// The value of a bound input is written after the directive initializes.
|
|
16
22
|
Promise.resolve().then(() => element.select());
|
|
17
23
|
}
|
|
18
24
|
}
|
|
19
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.
|
|
20
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "
|
|
25
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.2.1", ngImport: i0, type: NgDocAutofocusDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
26
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.2.1", type: NgDocAutofocusDirective, isStandalone: true, selector: "[ngDocAutofocus]", inputs: { selectAll: { classPropertyName: "selectAll", publicName: "selectAll", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0 }); }
|
|
21
27
|
}
|
|
22
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.
|
|
28
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.1", ngImport: i0, type: NgDocAutofocusDirective, decorators: [{
|
|
23
29
|
type: Directive,
|
|
24
30
|
args: [{
|
|
25
31
|
selector: '[ngDocAutofocus]',
|
|
26
|
-
standalone: true,
|
|
27
32
|
}]
|
|
28
|
-
}],
|
|
29
|
-
type: Input
|
|
30
|
-
}] } });
|
|
33
|
+
}], propDecorators: { selectAll: [{ type: i0.Input, args: [{ isSignal: true, alias: "selectAll", required: false }] }] } });
|
|
31
34
|
|
|
32
35
|
/**
|
|
33
36
|
* Generated bundle index. Do not edit.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ng-doc-ui-kit-directives-autofocus.mjs","sources":["../../../../libs/ui-kit/directives/autofocus/autofocus.directive.ts","../../../../libs/ui-kit/directives/autofocus/ng-doc-ui-kit-directives-autofocus.ts"],"sourcesContent":["import { Directive, ElementRef, inject,
|
|
1
|
+
{"version":3,"file":"ng-doc-ui-kit-directives-autofocus.mjs","sources":["../../../../libs/ui-kit/directives/autofocus/autofocus.directive.ts","../../../../libs/ui-kit/directives/autofocus/ng-doc-ui-kit-directives-autofocus.ts"],"sourcesContent":["import { Directive, ElementRef, inject, input, OnInit } from '@angular/core';\nimport { NgDocFocusUtils } from '@ng-doc/ui-kit/utils';\n\n/**\n * Focuses the host when it is created, if the host can take keyboard focus.\n */\n@Directive({\n selector: '[ngDocAutofocus]',\n})\nexport class NgDocAutofocusDirective implements OnInit {\n private readonly elementRef = inject<ElementRef<HTMLElement>>(ElementRef);\n\n /** Selects the whole value of an `input` host after focusing it. */\n readonly selectAll = input<boolean>(false);\n\n ngOnInit(): void {\n const element: HTMLElement = this.elementRef.nativeElement;\n\n if (NgDocFocusUtils.isNativeKeyboardFocusable(element)) {\n element.focus();\n }\n\n if (this.selectAll() && element instanceof HTMLInputElement) {\n // The value of a bound input is written after the directive initializes.\n Promise.resolve().then(() => element.select());\n }\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;AAGA;;AAEG;MAIU,uBAAuB,CAAA;AAHpC,IAAA,WAAA,GAAA;AAImB,QAAA,IAAA,CAAA,UAAU,GAAG,MAAM,CAA0B,UAAU,CAAC;;QAGhE,IAAA,CAAA,SAAS,GAAG,KAAK,CAAU,KAAK;sFAAC;AAc3C,IAAA;IAZC,QAAQ,GAAA;AACN,QAAA,MAAM,OAAO,GAAgB,IAAI,CAAC,UAAU,CAAC,aAAa;AAE1D,QAAA,IAAI,eAAe,CAAC,yBAAyB,CAAC,OAAO,CAAC,EAAE;YACtD,OAAO,CAAC,KAAK,EAAE;QACjB;QAEA,IAAI,IAAI,CAAC,SAAS,EAAE,IAAI,OAAO,YAAY,gBAAgB,EAAE;;AAE3D,YAAA,OAAO,CAAC,OAAO,EAAE,CAAC,IAAI,CAAC,MAAM,OAAO,CAAC,MAAM,EAAE,CAAC;QAChD;IACF;8GAjBW,uBAAuB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA,CAAA;kGAAvB,uBAAuB,EAAA,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,kBAAA,EAAA,MAAA,EAAA,EAAA,SAAA,EAAA,EAAA,iBAAA,EAAA,WAAA,EAAA,UAAA,EAAA,WAAA,EAAA,QAAA,EAAA,IAAA,EAAA,UAAA,EAAA,KAAA,EAAA,iBAAA,EAAA,IAAA,EAAA,EAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA,CAAA;;2FAAvB,uBAAuB,EAAA,UAAA,EAAA,CAAA;kBAHnC,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,QAAQ,EAAE,kBAAkB;AAC7B,iBAAA;;;ACRD;;AAEG;;;;"}
|
|
@@ -1,41 +1,45 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import {
|
|
2
|
+
import { input, output, linkedSignal, Directive } from '@angular/core';
|
|
3
3
|
|
|
4
|
+
/**
|
|
5
|
+
* Binds the checked state of a native checkbox: `true`, `false`, or `null` for the
|
|
6
|
+
* indeterminate state. Use `[ngDocChecked]` and `(ngDocCheckedChange)`, or both at once with
|
|
7
|
+
* `[(ngDocChecked)]`.
|
|
8
|
+
*/
|
|
4
9
|
class NgDocCheckedChangeDirective {
|
|
5
|
-
set ngDocChecked(checked) {
|
|
6
|
-
this.updateProperty('checked', checked || false);
|
|
7
|
-
this.updateProperty('indeterminate', checked === null);
|
|
8
|
-
}
|
|
9
10
|
constructor() {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
// An input and a separate output rather than `model()`: the change event carries the user's
|
|
12
|
+
// choice, which is never indeterminate, so it stays a `boolean`.
|
|
13
|
+
/** Checked state; `null` shows the checkbox as indeterminate. */
|
|
14
|
+
// eslint-disable-next-line @angular-eslint/prefer-signal-model
|
|
15
|
+
this.ngDocChecked = input(false, /* @ts-ignore */
|
|
16
|
+
...(ngDevMode ? [{ debugName: "ngDocChecked" }] : /* istanbul ignore next */ []));
|
|
17
|
+
/** Emits the new checked state when the user changes it. */
|
|
18
|
+
this.ngDocCheckedChange = output();
|
|
19
|
+
/** What the checkbox shows: the bound state until the user changes it. */
|
|
20
|
+
this.state = linkedSignal(() => this.ngDocChecked(), /* @ts-ignore */
|
|
21
|
+
...(ngDevMode ? [{ debugName: "state" }] : /* istanbul ignore next */ []));
|
|
14
22
|
}
|
|
15
23
|
onChange(target) {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
this.renderer.setProperty(this.element.nativeElement, property, value);
|
|
24
|
+
const checked = target instanceof HTMLInputElement ? target.checked : false;
|
|
25
|
+
// The user's choice ends the indeterminate state, even when the bound value stays `null`.
|
|
26
|
+
this.state.set(checked);
|
|
27
|
+
this.ngDocCheckedChange.emit(checked);
|
|
21
28
|
}
|
|
22
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.
|
|
23
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "
|
|
29
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.2.1", ngImport: i0, type: NgDocCheckedChangeDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
30
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.2.1", type: NgDocCheckedChangeDirective, isStandalone: true, selector: "input[ngDocChecked], input[ngDocCheckedChange]", inputs: { ngDocChecked: { classPropertyName: "ngDocChecked", publicName: "ngDocChecked", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { ngDocCheckedChange: "ngDocCheckedChange" }, host: { listeners: { "change": "onChange($event.target)" }, properties: { "checked": "!!state()", "indeterminate": "state() === null" } }, ngImport: i0 }); }
|
|
24
31
|
}
|
|
25
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.
|
|
32
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.1", ngImport: i0, type: NgDocCheckedChangeDirective, decorators: [{
|
|
26
33
|
type: Directive,
|
|
27
34
|
args: [{
|
|
28
35
|
selector: 'input[ngDocChecked], input[ngDocCheckedChange]',
|
|
29
|
-
|
|
36
|
+
host: {
|
|
37
|
+
'[checked]': '!!state()',
|
|
38
|
+
'[indeterminate]': 'state() === null',
|
|
39
|
+
'(change)': 'onChange($event.target)',
|
|
40
|
+
},
|
|
30
41
|
}]
|
|
31
|
-
}],
|
|
32
|
-
type: Input
|
|
33
|
-
}], ngDocCheckedChange: [{
|
|
34
|
-
type: Output
|
|
35
|
-
}], onChange: [{
|
|
36
|
-
type: HostListener,
|
|
37
|
-
args: ['change', ['$event.target']]
|
|
38
|
-
}] } });
|
|
42
|
+
}], propDecorators: { ngDocChecked: [{ type: i0.Input, args: [{ isSignal: true, alias: "ngDocChecked", required: false }] }], ngDocCheckedChange: [{ type: i0.Output, args: ["ngDocCheckedChange"] }] } });
|
|
39
43
|
|
|
40
44
|
/**
|
|
41
45
|
* Generated bundle index. Do not edit.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ng-doc-ui-kit-directives-checked-change.mjs","sources":["../../../../libs/ui-kit/directives/checked-change/checked-change.directive.ts","../../../../libs/ui-kit/directives/checked-change/ng-doc-ui-kit-directives-checked-change.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"ng-doc-ui-kit-directives-checked-change.mjs","sources":["../../../../libs/ui-kit/directives/checked-change/checked-change.directive.ts","../../../../libs/ui-kit/directives/checked-change/ng-doc-ui-kit-directives-checked-change.ts"],"sourcesContent":["import { Directive, input, linkedSignal, output } from '@angular/core';\n\n/**\n * Binds the checked state of a native checkbox: `true`, `false`, or `null` for the\n * indeterminate state. Use `[ngDocChecked]` and `(ngDocCheckedChange)`, or both at once with\n * `[(ngDocChecked)]`.\n */\n@Directive({\n selector: 'input[ngDocChecked], input[ngDocCheckedChange]',\n host: {\n '[checked]': '!!state()',\n '[indeterminate]': 'state() === null',\n '(change)': 'onChange($event.target)',\n },\n})\nexport class NgDocCheckedChangeDirective {\n // An input and a separate output rather than `model()`: the change event carries the user's\n // choice, which is never indeterminate, so it stays a `boolean`.\n /** Checked state; `null` shows the checkbox as indeterminate. */\n // eslint-disable-next-line @angular-eslint/prefer-signal-model\n readonly ngDocChecked = input<boolean | null>(false);\n\n /** Emits the new checked state when the user changes it. */\n readonly ngDocCheckedChange = output<boolean>();\n\n /** What the checkbox shows: the bound state until the user changes it. */\n protected readonly state = linkedSignal<boolean | null>(() => this.ngDocChecked());\n\n protected onChange(target: EventTarget | null): void {\n const checked: boolean = target instanceof HTMLInputElement ? target.checked : false;\n\n // The user's choice ends the indeterminate state, even when the bound value stays `null`.\n this.state.set(checked);\n this.ngDocCheckedChange.emit(checked);\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;AAEA;;;;AAIG;MASU,2BAA2B,CAAA;AARxC,IAAA,WAAA,GAAA;;;;;QAaW,IAAA,CAAA,YAAY,GAAG,KAAK,CAAiB,KAAK;yFAAC;;QAG3C,IAAA,CAAA,kBAAkB,GAAG,MAAM,EAAW;;QAG5B,IAAA,CAAA,KAAK,GAAG,YAAY,CAAiB,MAAM,IAAI,CAAC,YAAY,EAAE;kFAAC;AASnF,IAAA;AAPW,IAAA,QAAQ,CAAC,MAA0B,EAAA;AAC3C,QAAA,MAAM,OAAO,GAAY,MAAM,YAAY,gBAAgB,GAAG,MAAM,CAAC,OAAO,GAAG,KAAK;;AAGpF,QAAA,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC;AACvB,QAAA,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,OAAO,CAAC;IACvC;8GAnBW,2BAA2B,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA,CAAA;kGAA3B,2BAA2B,EAAA,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,gDAAA,EAAA,MAAA,EAAA,EAAA,YAAA,EAAA,EAAA,iBAAA,EAAA,cAAA,EAAA,UAAA,EAAA,cAAA,EAAA,QAAA,EAAA,IAAA,EAAA,UAAA,EAAA,KAAA,EAAA,iBAAA,EAAA,IAAA,EAAA,EAAA,EAAA,OAAA,EAAA,EAAA,kBAAA,EAAA,oBAAA,EAAA,EAAA,IAAA,EAAA,EAAA,SAAA,EAAA,EAAA,QAAA,EAAA,yBAAA,EAAA,EAAA,UAAA,EAAA,EAAA,SAAA,EAAA,WAAA,EAAA,eAAA,EAAA,kBAAA,EAAA,EAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA,CAAA;;2FAA3B,2BAA2B,EAAA,UAAA,EAAA,CAAA;kBARvC,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,QAAQ,EAAE,gDAAgD;AAC1D,oBAAA,IAAI,EAAE;AACJ,wBAAA,WAAW,EAAE,WAAW;AACxB,wBAAA,iBAAiB,EAAE,kBAAkB;AACrC,wBAAA,UAAU,EAAE,yBAAyB;AACtC,qBAAA;AACF,iBAAA;;;ACdD;;AAEG;;;;"}
|
|
@@ -1,21 +1,24 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
2
|
import { inject, TemplateRef, ViewContainerRef, Directive } from '@angular/core';
|
|
3
3
|
|
|
4
|
+
/**
|
|
5
|
+
* Keeps its template unrendered, so that a parent can query it (with `read: TemplateRef`) and
|
|
6
|
+
* render it somewhere else, for example in a dropdown.
|
|
7
|
+
*/
|
|
4
8
|
class NgDocDataDirective {
|
|
5
9
|
constructor() {
|
|
6
10
|
this.template = inject(TemplateRef);
|
|
7
11
|
this.viewContainerRef = inject(ViewContainerRef);
|
|
8
12
|
}
|
|
9
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.
|
|
10
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.
|
|
13
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.2.1", ngImport: i0, type: NgDocDataDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
14
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.2.1", type: NgDocDataDirective, isStandalone: true, selector: "[ngDocData]", ngImport: i0 }); }
|
|
11
15
|
}
|
|
12
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.
|
|
16
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.1", ngImport: i0, type: NgDocDataDirective, decorators: [{
|
|
13
17
|
type: Directive,
|
|
14
18
|
args: [{
|
|
15
19
|
selector: '[ngDocData]',
|
|
16
|
-
standalone: true,
|
|
17
20
|
}]
|
|
18
|
-
}]
|
|
21
|
+
}] });
|
|
19
22
|
|
|
20
23
|
/**
|
|
21
24
|
* Generated bundle index. Do not edit.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ng-doc-ui-kit-directives-data.mjs","sources":["../../../../libs/ui-kit/directives/data/data.directive.ts","../../../../libs/ui-kit/directives/data/ng-doc-ui-kit-directives-data.ts"],"sourcesContent":["import { Directive, inject, TemplateRef, ViewContainerRef } from '@angular/core';\n\n@Directive({\n selector: '[ngDocData]',\n
|
|
1
|
+
{"version":3,"file":"ng-doc-ui-kit-directives-data.mjs","sources":["../../../../libs/ui-kit/directives/data/data.directive.ts","../../../../libs/ui-kit/directives/data/ng-doc-ui-kit-directives-data.ts"],"sourcesContent":["import { Directive, inject, TemplateRef, ViewContainerRef } from '@angular/core';\n\n/**\n * Keeps its template unrendered, so that a parent can query it (with `read: TemplateRef`) and\n * render it somewhere else, for example in a dropdown.\n */\n@Directive({\n selector: '[ngDocData]',\n})\nexport class NgDocDataDirective {\n protected readonly template = inject<TemplateRef<unknown>>(TemplateRef);\n protected readonly viewContainerRef = inject(ViewContainerRef);\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;AAEA;;;AAGG;MAIU,kBAAkB,CAAA;AAH/B,IAAA,WAAA,GAAA;AAIqB,QAAA,IAAA,CAAA,QAAQ,GAAG,MAAM,CAAuB,WAAW,CAAC;AACpD,QAAA,IAAA,CAAA,gBAAgB,GAAG,MAAM,CAAC,gBAAgB,CAAC;AAC/D,IAAA;8GAHY,kBAAkB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA,CAAA;kGAAlB,kBAAkB,EAAA,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,aAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA,CAAA;;2FAAlB,kBAAkB,EAAA,UAAA,EAAA,CAAA;kBAH9B,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,QAAQ,EAAE,aAAa;AACxB,iBAAA;;;ACRD;;AAEG;;;;"}
|
|
@@ -1,36 +1,37 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import {
|
|
3
|
-
import '@ng-doc/ui-kit/components/dropdown';
|
|
2
|
+
import { input, Directive } from '@angular/core';
|
|
4
3
|
|
|
4
|
+
/** Opens the dropdown on ArrowDown and closes it on Escape while the host has focus. */
|
|
5
5
|
class NgDocDropdownHandlerDirective {
|
|
6
|
+
constructor() {
|
|
7
|
+
/** The dropdown the host controls. */
|
|
8
|
+
this.dropdown = input(undefined, { ...(ngDevMode ? { debugName: "dropdown" } : /* istanbul ignore next */ {}), alias: 'ngDocDropdownHandler' });
|
|
9
|
+
}
|
|
6
10
|
keyboardEvent(event) {
|
|
7
|
-
|
|
8
|
-
|
|
11
|
+
const dropdown = this.dropdown();
|
|
12
|
+
if (dropdown) {
|
|
13
|
+
if (event.key === 'ArrowDown' && !dropdown.isOpened) {
|
|
9
14
|
event.preventDefault();
|
|
10
|
-
|
|
15
|
+
dropdown.open();
|
|
11
16
|
}
|
|
12
|
-
if (event.key === 'Escape' &&
|
|
17
|
+
if (event.key === 'Escape' && dropdown.isOpened) {
|
|
13
18
|
event.preventDefault();
|
|
14
|
-
|
|
19
|
+
dropdown.close();
|
|
15
20
|
}
|
|
16
21
|
}
|
|
17
22
|
}
|
|
18
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.
|
|
19
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "
|
|
23
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.2.1", ngImport: i0, type: NgDocDropdownHandlerDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
24
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.2.1", type: NgDocDropdownHandlerDirective, isStandalone: true, selector: "[ngDocDropdownHandler]", inputs: { dropdown: { classPropertyName: "dropdown", publicName: "ngDocDropdownHandler", isSignal: true, isRequired: false, transformFunction: null } }, host: { listeners: { "keydown": "keyboardEvent($event)" } }, ngImport: i0 }); }
|
|
20
25
|
}
|
|
21
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.
|
|
26
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.1", ngImport: i0, type: NgDocDropdownHandlerDirective, decorators: [{
|
|
22
27
|
type: Directive,
|
|
23
28
|
args: [{
|
|
24
29
|
selector: '[ngDocDropdownHandler]',
|
|
25
|
-
|
|
30
|
+
host: {
|
|
31
|
+
'(keydown)': 'keyboardEvent($event)',
|
|
32
|
+
},
|
|
26
33
|
}]
|
|
27
|
-
}], propDecorators: { dropdown: [{
|
|
28
|
-
type: Input,
|
|
29
|
-
args: ['ngDocDropdownHandler']
|
|
30
|
-
}], keyboardEvent: [{
|
|
31
|
-
type: HostListener,
|
|
32
|
-
args: ['keydown', ['$event']]
|
|
33
|
-
}] } });
|
|
34
|
+
}], propDecorators: { dropdown: [{ type: i0.Input, args: [{ isSignal: true, alias: "ngDocDropdownHandler", required: false }] }] } });
|
|
34
35
|
|
|
35
36
|
/**
|
|
36
37
|
* Generated bundle index. Do not edit.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ng-doc-ui-kit-directives-dropdown-handler.mjs","sources":["../../../../libs/ui-kit/directives/dropdown-handler/dropdown-handler.directive.ts","../../../../libs/ui-kit/directives/dropdown-handler/ng-doc-ui-kit-directives-dropdown-handler.ts"],"sourcesContent":["import { Directive,
|
|
1
|
+
{"version":3,"file":"ng-doc-ui-kit-directives-dropdown-handler.mjs","sources":["../../../../libs/ui-kit/directives/dropdown-handler/dropdown-handler.directive.ts","../../../../libs/ui-kit/directives/dropdown-handler/ng-doc-ui-kit-directives-dropdown-handler.ts"],"sourcesContent":["import { Directive, input } from '@angular/core';\nimport { NgDocDropdownComponent } from '@ng-doc/ui-kit/components/dropdown';\n\n/** Opens the dropdown on ArrowDown and closes it on Escape while the host has focus. */\n@Directive({\n selector: '[ngDocDropdownHandler]',\n host: {\n '(keydown)': 'keyboardEvent($event)',\n },\n})\nexport class NgDocDropdownHandlerDirective {\n /** The dropdown the host controls. */\n readonly dropdown = input<NgDocDropdownComponent | undefined>(undefined, {\n alias: 'ngDocDropdownHandler',\n });\n\n keyboardEvent(event: KeyboardEvent): void {\n const dropdown: NgDocDropdownComponent | undefined = this.dropdown();\n\n if (dropdown) {\n if (event.key === 'ArrowDown' && !dropdown.isOpened) {\n event.preventDefault();\n dropdown.open();\n }\n\n if (event.key === 'Escape' && dropdown.isOpened) {\n event.preventDefault();\n dropdown.close();\n }\n }\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;AAGA;MAOa,6BAA6B,CAAA;AAN1C,IAAA,WAAA,GAAA;;QAQW,IAAA,CAAA,QAAQ,GAAG,KAAK,CAAqC,SAAS,gFACrE,KAAK,EAAE,sBAAsB,EAAA,C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