@ng-doc/ui-kit 22.0.0-beta.1 → 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 +9 -4
- package/fesm2022/ng-doc-ui-kit-components-magnifier-controller.mjs.map +1 -1
- package/fesm2022/ng-doc-ui-kit-components-magnifier.mjs +39 -18
- 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 +7 -9
- 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/fesm2022/ng-doc-ui-kit-types.mjs +0 -1
- package/fesm2022/ng-doc-ui-kit-types.mjs.map +1 -1
- package/package.json +31 -33
- package/styles/main.css +275 -38
- 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-dropdown-origin.d.ts +0 -2
- 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/types/ng-doc-ui-kit-types.d.ts +2 -2
- 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
package/README.md
CHANGED
|
@@ -1,37 +1,28 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
<h1 align="center" style="margin-bottom: 0; border-bottom: 0">NgDoc</h1>
|
|
9
|
-
<p align="center">
|
|
10
|
-
Create user-friendly documentation for your projects with ease!
|
|
11
|
-
<br />
|
|
12
|
-
<a href="https://ng-doc.com/">Documentation</a>
|
|
13
|
-
·
|
|
14
|
-
<a href="https://github.com/ng-doc/ng-doc/issues/new/choose">Report Bug</a>
|
|
15
|
-
·
|
|
16
|
-
<a href="https://github.com/ng-doc/ng-doc/issues/new/choose">Request Feature</a>
|
|
17
|
-
|
|
18
|
-
[![GitHub Workflow Status][build-shield]][build-url]
|
|
1
|
+
# 🎨 @ng-doc/ui-kit
|
|
2
|
+
|
|
3
|
+
The UI components (buttons, dropdowns, tabs and more) that NgDoc sites are built from.
|
|
4
|
+
|
|
5
|
+
It's part of [NgDoc](https://ng-doc.com/) 📚, the documentation engine for Angular projects.
|
|
6
|
+
|
|
19
7
|
[![NPM][npm-shield]][npm-url]
|
|
20
8
|
[![MIT License][license-shield]][license-url]
|
|
21
9
|
|
|
22
|
-
|
|
23
|
-
|
|
10
|
+
## 🚀 Getting started
|
|
11
|
+
|
|
12
|
+
You don't need to install this package by hand. Add NgDoc to your project and it sets up
|
|
13
|
+
everything it needs:
|
|
24
14
|
|
|
25
|
-
|
|
15
|
+
```bash
|
|
16
|
+
ng add @ng-doc/add
|
|
17
|
+
```
|
|
26
18
|
|
|
27
|
-
##
|
|
19
|
+
## 📖 Learn more
|
|
28
20
|
|
|
29
|
-
|
|
30
|
-
|
|
21
|
+
- [Documentation](https://ng-doc.com/)
|
|
22
|
+
- [GitHub repository](https://github.com/ng-doc/ng-doc)
|
|
23
|
+
- [Report a bug or request a feature](https://github.com/ng-doc/ng-doc/issues/new/choose)
|
|
31
24
|
|
|
32
|
-
[npm-shield]: https://img.shields.io/npm/v
|
|
33
|
-
[npm-url]: https://www.npmjs.com/package/@ng-doc/
|
|
25
|
+
[npm-shield]: https://img.shields.io/npm/v/%40ng-doc%2Fui-kit.svg?style=for-the-badge
|
|
26
|
+
[npm-url]: https://www.npmjs.com/package/@ng-doc/ui-kit
|
|
34
27
|
[license-shield]: https://img.shields.io/github/license/ng-doc/ng-doc.svg?style=for-the-badge
|
|
35
|
-
[license-url]: https://github.com/
|
|
36
|
-
[build-shield]: https://img.shields.io/github/actions/workflow/status/ng-doc/ng-doc/release.yml?style=for-the-badge&branch=release
|
|
37
|
-
[build-url]: https://github.com/ng-doc/ng-doc/actions
|
|
28
|
+
[license-url]: https://github.com/ng-doc/ng-doc/blob/main/LICENSE
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import {
|
|
3
|
-
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
2
|
+
import { viewChild, ElementRef, contentChild, effect, untracked, forwardRef, Input, ChangeDetectionStrategy, Component } from '@angular/core';
|
|
4
3
|
import { NgDocBaseInput, NgDocOverlayHost, NgDocInputHost, NgDocDisplayValueHost, NgDocListHost } from '@ng-doc/ui-kit/classes';
|
|
5
4
|
import { NgDocDropdownComponent } from '@ng-doc/ui-kit/components/dropdown';
|
|
6
5
|
import { NgDocDropdownHandlerDirective } from '@ng-doc/ui-kit/directives/dropdown-handler';
|
|
7
6
|
import { NgDocFocusCatcherDirective } from '@ng-doc/ui-kit/directives/focus-catcher';
|
|
8
|
-
import { ngDocZoneOptimize } from '@ng-doc/ui-kit/observables';
|
|
9
7
|
import { DIControl, DIStateControl, injectHostControl, DI_DEFAULT_COMPARE, provideHostControl, provideCompareHost } from 'di-controls';
|
|
10
8
|
import { filter } from 'rxjs/operators';
|
|
11
9
|
|
|
10
|
+
/** Connects a text field, a dropdown and a list into a combobox. */
|
|
12
11
|
class NgDocComboboxHostComponent extends DIControl {
|
|
13
12
|
constructor() {
|
|
14
13
|
super({
|
|
@@ -19,15 +18,43 @@ class NgDocComboboxHostComponent extends DIControl {
|
|
|
19
18
|
}
|
|
20
19
|
},
|
|
21
20
|
});
|
|
21
|
+
// `compareFn` and `displayValueFn` stay plain inputs: `DICompareHost` and
|
|
22
|
+
// `NgDocDisplayValueHost` call them as functions.
|
|
23
|
+
/** Compares an option with the value. */
|
|
24
|
+
// eslint-disable-next-line @angular-eslint/prefer-signals -- read as a plain function by DICompareHost
|
|
22
25
|
this.compareFn = DI_DEFAULT_COMPARE;
|
|
26
|
+
/** Turns the value into the text of the field. */
|
|
27
|
+
// eslint-disable-next-line @angular-eslint/prefer-signals -- read as a plain function by NgDocDisplayValueHost
|
|
23
28
|
this.displayValueFn = String;
|
|
24
29
|
this.positions = ['bottom-center', 'top-center'];
|
|
25
|
-
this
|
|
30
|
+
// Not `required`: overlay code may read the origin before this view has rendered.
|
|
31
|
+
this.originQuery = viewChild('origin', { ...(ngDevMode ? { debugName: "originQuery" } : /* istanbul ignore next */ {}), read: ElementRef });
|
|
32
|
+
this.dropdownQuery = contentChild(NgDocDropdownComponent, /* @ts-ignore */
|
|
33
|
+
...(ngDevMode ? [{ debugName: "dropdownQuery" }] : /* istanbul ignore next */ []));
|
|
34
|
+
this.inputQuery = contentChild(NgDocBaseInput, /* @ts-ignore */
|
|
35
|
+
...(ngDevMode ? [{ debugName: "inputQuery" }] : /* istanbul ignore next */ []));
|
|
36
|
+
// Typing in the focused field opens the options.
|
|
37
|
+
effect((onCleanup) => {
|
|
38
|
+
const input = this.inputQuery();
|
|
39
|
+
if (input) {
|
|
40
|
+
const subscription = input.changes
|
|
41
|
+
.pipe(filter(() => input.isFocused))
|
|
42
|
+
.subscribe(() => untracked(() => this.dropdown?.open()));
|
|
43
|
+
onCleanup(() => subscription.unsubscribe());
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
/** Origin of the dropdown (`NgDocOverlayHost`). */
|
|
48
|
+
get origin() {
|
|
49
|
+
return this.originQuery();
|
|
50
|
+
}
|
|
51
|
+
/** The dropdown with the options. */
|
|
52
|
+
get dropdown() {
|
|
53
|
+
return this.dropdownQuery();
|
|
26
54
|
}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
.subscribe(() => this.dropdown?.open());
|
|
55
|
+
/** The text field of the combobox. */
|
|
56
|
+
get inputControl() {
|
|
57
|
+
return this.inputQuery();
|
|
31
58
|
}
|
|
32
59
|
get listHostOrigin() {
|
|
33
60
|
return this.inputControl?.elementRef;
|
|
@@ -41,13 +68,14 @@ class NgDocComboboxHostComponent extends DIControl {
|
|
|
41
68
|
get panelClass() {
|
|
42
69
|
return `ng-doc-combobox-host-overlay`;
|
|
43
70
|
}
|
|
71
|
+
/** Opens the dropdown when the field is clicked. */
|
|
44
72
|
clickEvent() {
|
|
45
73
|
if (!this.disabled) {
|
|
46
74
|
this.dropdown?.open();
|
|
47
75
|
}
|
|
48
76
|
}
|
|
49
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
50
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "
|
|
77
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.2.1", ngImport: i0, type: NgDocComboboxHostComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
78
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "22.2.1", type: NgDocComboboxHostComponent, isStandalone: true, selector: "ng-doc-combobox-host", inputs: { compareFn: "compareFn", displayValueFn: "displayValueFn" }, providers: [
|
|
51
79
|
provideHostControl(forwardRef(() => NgDocComboboxHostComponent)),
|
|
52
80
|
provideCompareHost(forwardRef(() => NgDocComboboxHostComponent)),
|
|
53
81
|
{
|
|
@@ -66,9 +94,9 @@ class NgDocComboboxHostComponent extends DIControl {
|
|
|
66
94
|
provide: NgDocListHost,
|
|
67
95
|
useExisting: forwardRef(() => NgDocComboboxHostComponent),
|
|
68
96
|
},
|
|
69
|
-
], queries: [{ propertyName: "
|
|
97
|
+
], queries: [{ propertyName: "dropdownQuery", first: true, predicate: NgDocDropdownComponent, descendants: true, isSignal: true }, { propertyName: "inputQuery", first: true, predicate: NgDocBaseInput, descendants: true, isSignal: true }], viewQueries: [{ propertyName: "originQuery", first: true, predicate: ["origin"], descendants: true, read: ElementRef, isSignal: true }], usesInheritance: true, ngImport: i0, template: "<label\n\tclass=\"ng-doc-dropdown-host\"\n\tngDocFocusCatcher\n\t[ngDocDropdownHandler]=\"dropdown\"\n\t(click)=\"clickEvent()\"\n\t#origin>\n\t<ng-content></ng-content>\n</label>\n", styles: [":host{position:relative;display:block;width:100%}::ng-deep .ng-doc-combobox-host-overlay .ng-doc-overlay-content{display:block;max-height:300px;overflow:auto}\n"], dependencies: [{ kind: "directive", type: NgDocFocusCatcherDirective, selector: "[ngDocFocusCatcher]", outputs: ["focusEvent", "blurEvent"], exportAs: ["ngDocFocusCatcher"] }, { kind: "directive", type: NgDocDropdownHandlerDirective, selector: "[ngDocDropdownHandler]", inputs: ["ngDocDropdownHandler"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
70
98
|
}
|
|
71
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
99
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.1", ngImport: i0, type: NgDocComboboxHostComponent, decorators: [{
|
|
72
100
|
type: Component,
|
|
73
101
|
args: [{ selector: 'ng-doc-combobox-host', providers: [
|
|
74
102
|
provideHostControl(forwardRef(() => NgDocComboboxHostComponent)),
|
|
@@ -94,16 +122,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImpor
|
|
|
94
122
|
type: Input
|
|
95
123
|
}], displayValueFn: [{
|
|
96
124
|
type: Input
|
|
97
|
-
}],
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
}], dropdown: [{
|
|
101
|
-
type: ContentChild,
|
|
102
|
-
args: [NgDocDropdownComponent]
|
|
103
|
-
}], inputControl: [{
|
|
104
|
-
type: ContentChild,
|
|
105
|
-
args: [NgDocBaseInput]
|
|
106
|
-
}] } });
|
|
125
|
+
}], originQuery: [{ type: i0.ViewChild, args: ['origin', { ...{
|
|
126
|
+
read: ElementRef,
|
|
127
|
+
}, isSignal: true }] }], dropdownQuery: [{ type: i0.ContentChild, args: [i0.forwardRef(() => NgDocDropdownComponent), { isSignal: true }] }], inputQuery: [{ type: i0.ContentChild, args: [i0.forwardRef(() => NgDocBaseInput), { isSignal: true }] }] } });
|
|
107
128
|
|
|
108
129
|
/**
|
|
109
130
|
* Generated bundle index. Do not edit.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ng-doc-ui-kit-cdk-combobox-host.mjs","sources":["../../../../libs/ui-kit/cdk/combobox-host/combobox-host.component.ts","../../../../libs/ui-kit/cdk/combobox-host/combobox-host.component.html","../../../../libs/ui-kit/cdk/combobox-host/ng-doc-ui-kit-cdk-combobox-host.ts"],"sourcesContent":["import {\n
|
|
1
|
+
{"version":3,"file":"ng-doc-ui-kit-cdk-combobox-host.mjs","sources":["../../../../libs/ui-kit/cdk/combobox-host/combobox-host.component.ts","../../../../libs/ui-kit/cdk/combobox-host/combobox-host.component.html","../../../../libs/ui-kit/cdk/combobox-host/ng-doc-ui-kit-cdk-combobox-host.ts"],"sourcesContent":["import {\n ChangeDetectionStrategy,\n Component,\n contentChild,\n effect,\n ElementRef,\n forwardRef,\n Input,\n untracked,\n viewChild,\n} from '@angular/core';\nimport {\n NgDocBaseInput,\n NgDocDisplayValueHost,\n NgDocInputHost,\n NgDocListHost,\n NgDocOverlayHost,\n} from '@ng-doc/ui-kit/classes';\nimport { NgDocDropdownComponent } from '@ng-doc/ui-kit/components/dropdown';\nimport { NgDocDropdownHandlerDirective } from '@ng-doc/ui-kit/directives/dropdown-handler';\nimport { NgDocFocusCatcherDirective } from '@ng-doc/ui-kit/directives/focus-catcher';\nimport { NgDocDisplayValueFunction, NgDocOverlayPosition } from '@ng-doc/ui-kit/types';\nimport {\n DI_DEFAULT_COMPARE,\n DICompareFunction,\n DICompareHost,\n DIControl,\n DIStateControl,\n injectHostControl,\n provideCompareHost,\n provideHostControl,\n} from 'di-controls';\nimport { filter } from 'rxjs/operators';\n\n/** Connects a text field, a dropdown and a list into a combobox. */\n@Component({\n selector: 'ng-doc-combobox-host',\n templateUrl: './combobox-host.component.html',\n styleUrls: ['./combobox-host.component.scss'],\n providers: [\n provideHostControl(forwardRef(() => NgDocComboboxHostComponent)),\n provideCompareHost(forwardRef(() => NgDocComboboxHostComponent)),\n {\n provide: NgDocOverlayHost,\n useExisting: forwardRef(() => NgDocComboboxHostComponent),\n },\n {\n provide: NgDocInputHost,\n useExisting: forwardRef(() => NgDocComboboxHostComponent),\n },\n {\n provide: NgDocDisplayValueHost,\n useExisting: forwardRef(() => NgDocComboboxHostComponent),\n },\n {\n provide: NgDocListHost,\n useExisting: forwardRef(() => NgDocComboboxHostComponent),\n },\n ],\n changeDetection: ChangeDetectionStrategy.OnPush,\n imports: [NgDocFocusCatcherDirective, NgDocDropdownHandlerDirective],\n})\nexport class NgDocComboboxHostComponent<T>\n extends DIControl<T>\n implements\n NgDocOverlayHost,\n NgDocInputHost<string>,\n DICompareHost<T>,\n NgDocDisplayValueHost<T>,\n NgDocListHost\n{\n // `compareFn` and `displayValueFn` stay plain inputs: `DICompareHost` and\n // `NgDocDisplayValueHost` call them as functions.\n /** Compares an option with the value. */\n // eslint-disable-next-line @angular-eslint/prefer-signals -- read as a plain function by DICompareHost\n @Input()\n compareFn: DICompareFunction<T> = DI_DEFAULT_COMPARE;\n\n /** Turns the value into the text of the field. */\n // eslint-disable-next-line @angular-eslint/prefer-signals -- read as a plain function by NgDocDisplayValueHost\n @Input()\n displayValueFn: NgDocDisplayValueFunction<T> = String;\n\n readonly positions: NgDocOverlayPosition[] = ['bottom-center', 'top-center'];\n\n // Not `required`: overlay code may read the origin before this view has rendered.\n private readonly originQuery = viewChild<string, ElementRef<HTMLElement>>('origin', {\n read: ElementRef,\n });\n private readonly dropdownQuery = contentChild(NgDocDropdownComponent);\n private readonly inputQuery = contentChild<NgDocBaseInput<string>>(NgDocBaseInput);\n\n constructor() {\n super({\n host: injectHostControl({ skipSelf: true, optional: true }),\n onChildControlChange: (control) => {\n if (control instanceof DIStateControl) {\n this.dropdown?.close();\n }\n },\n });\n\n // Typing in the focused field opens the options.\n effect((onCleanup) => {\n const input: NgDocBaseInput<string> | undefined = this.inputQuery();\n\n if (input) {\n const subscription = input.changes\n .pipe(filter(() => input.isFocused))\n .subscribe(() => untracked(() => this.dropdown?.open()));\n\n onCleanup(() => subscription.unsubscribe());\n }\n });\n }\n\n /** Origin of the dropdown (`NgDocOverlayHost`). */\n get origin(): ElementRef<HTMLElement> | undefined {\n return this.originQuery();\n }\n\n /** The dropdown with the options. */\n get dropdown(): NgDocDropdownComponent | undefined {\n return this.dropdownQuery();\n }\n\n /** The text field of the combobox. */\n get inputControl(): NgDocBaseInput<string> | undefined {\n return this.inputQuery();\n }\n\n get listHostOrigin(): ElementRef<HTMLElement> | undefined {\n return this.inputControl?.elementRef;\n }\n\n get searchText(): string {\n return this.hasValue ? '' : this.inputControl?.value || '';\n }\n\n get width(): number {\n return this.origin?.nativeElement.offsetWidth || 0;\n }\n\n get panelClass(): string {\n return `ng-doc-combobox-host-overlay`;\n }\n\n /** Opens the dropdown when the field is clicked. */\n clickEvent(): void {\n if (!this.disabled) {\n this.dropdown?.open();\n }\n }\n}\n","<label\n\tclass=\"ng-doc-dropdown-host\"\n\tngDocFocusCatcher\n\t[ngDocDropdownHandler]=\"dropdown\"\n\t(click)=\"clickEvent()\"\n\t#origin>\n\t<ng-content></ng-content>\n</label>\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;AAkCA;AA4BM,MAAO,0BACX,SAAQ,SAAY,CAAA;AA6BpB,IAAA,WAAA,GAAA;AACE,QAAA,KAAK,CAAC;AACJ,YAAA,IAAI,EAAE,iBAAiB,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;AAC3D,YAAA,oBAAoB,EAAE,CAAC,OAAO,KAAI;AAChC,gBAAA,IAAI,OAAO,YAAY,cAAc,EAAE;AACrC,oBAAA,IAAI,CAAC,QAAQ,EAAE,KAAK,EAAE;gBACxB;YACF,CAAC;AACF,SAAA,CAAC;;;;;QAxBJ,IAAA,CAAA,SAAS,GAAyB,kBAAkB;;;QAKpD,IAAA,CAAA,cAAc,GAAiC,MAAM;AAE5C,QAAA,IAAA,CAAA,SAAS,GAA2B,CAAC,eAAe,EAAE,YAAY,CAAC;;QAG3D,IAAA,CAAA,WAAW,GAAG,SAAS,CAAkC,QAAQ,mFAChF,IAAI,EAAE,UAAU,EAAA,CAChB;QACe,IAAA,CAAA,aAAa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,CAAC;AAC1D,yBAAA;AACD,wBAAA;AACE,4BAAA,OAAO,EAAE,aAAa;AACtB,4BAAA,WAAW,EAAE,UAAU,CAAC,gCAAgC,CAAC;AAC1D,yBAAA;qBACF,EAAA,eAAA,EACgB,uBAAuB,CAAC,MAAM,EAAA,OAAA,EACtC,CAAC,0BAA0B,EAAE,6BAA6B,CAAC,EAAA,QAAA,EAAA,uLAAA,EAAA,MAAA,EAAA,CAAA,kKAAA,CAAA,EAAA;;sBAenE;;sBAKA;AAMyE,aAAA,CAAA,EAAA,WAAA,EAAA,CAAA,EAAA,IAAA,EAAA,EAAA,CAAA,SAAA,EAAA,IAAA,EAAA,CAAA,QAAQ,EAAA,EAAA,GAAE;AAClF,4BAAA,IAAI,EAAE,UAAU;yBACjB,EAAA,QAAA,EAAA,IAAA,EAAA,CAAA,EAAA,CAAA,EAAA,aAAA,EAAA,CAAA,EAAA,IAAA,EAAA,EAAA,CAAA,YAAA,EAAA,IAAA,EAAA,CAAA,EAAA,CAAA,UAAA,CAAA,MAC6C,sBAAsB,4FACD,cAAc,CAAA,EAAA,EAAA,QAAA,EAAA,IAAA,EAAA,CAAA,EAAA,CAAA,EAAA,EAAA,CAAA;;AE1FnF;;AAEG;;;;"}
|
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { inject, ElementRef, DOCUMENT,
|
|
2
|
+
import { inject, ElementRef, DOCUMENT, Directive } from '@angular/core';
|
|
3
3
|
import { DIControl, injectHostControl } from 'di-controls';
|
|
4
4
|
import { Subject } from 'rxjs';
|
|
5
5
|
|
|
6
|
+
/**
|
|
7
|
+
* Base class of the directives that turn a native `input` into a UI Kit control
|
|
8
|
+
* (`ngDocInputString`, `ngDocInputNumber`). Input wrappers and comboboxes query it to read the
|
|
9
|
+
* state of their input.
|
|
10
|
+
*/
|
|
6
11
|
class NgDocBaseInput extends DIControl {
|
|
7
12
|
constructor(config) {
|
|
8
13
|
super({
|
|
@@ -10,30 +15,34 @@ class NgDocBaseInput extends DIControl {
|
|
|
10
15
|
...config,
|
|
11
16
|
});
|
|
12
17
|
this.elementRef = inject(ElementRef);
|
|
18
|
+
/** Emits after the input updates its model from a user edit. */
|
|
13
19
|
this.changes = new Subject();
|
|
14
20
|
this.document = inject(DOCUMENT);
|
|
15
21
|
}
|
|
16
|
-
|
|
17
|
-
return 'ng-doc-input';
|
|
18
|
-
}
|
|
22
|
+
/** Placeholder of the native input. */
|
|
19
23
|
get placeholder() {
|
|
20
24
|
return this.elementRef.nativeElement.placeholder || '';
|
|
21
25
|
}
|
|
26
|
+
/** Whether the native input has focus. */
|
|
22
27
|
get isFocused() {
|
|
23
28
|
return this.document.activeElement === this.elementRef.nativeElement;
|
|
24
29
|
}
|
|
30
|
+
/** Whether the native input is read-only. */
|
|
25
31
|
get isReadonly() {
|
|
26
32
|
return this.elementRef.nativeElement.readOnly;
|
|
27
33
|
}
|
|
34
|
+
/** Current text of the native input. */
|
|
28
35
|
get value() {
|
|
29
36
|
return this.elementRef.nativeElement.value;
|
|
30
37
|
}
|
|
38
|
+
/** Focuses the native input. */
|
|
31
39
|
focus() {
|
|
32
40
|
this.elementRef.nativeElement.focus();
|
|
33
41
|
}
|
|
42
|
+
/** Replays the `-blink` animation class on the native input. */
|
|
34
43
|
blink() {
|
|
35
44
|
this.renderer.removeClass(this.elementRef.nativeElement, '-blink');
|
|
36
|
-
//
|
|
45
|
+
// Reading the layout restarts the CSS animation when the class is added again.
|
|
37
46
|
this.elementRef.nativeElement.offsetWidth;
|
|
38
47
|
this.renderer.addClass(this.elementRef.nativeElement, '-blink');
|
|
39
48
|
}
|
|
@@ -41,15 +50,17 @@ class NgDocBaseInput extends DIControl {
|
|
|
41
50
|
super.updateModel(value);
|
|
42
51
|
this.changes.next();
|
|
43
52
|
}
|
|
44
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
45
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "
|
|
53
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.2.1", ngImport: i0, type: NgDocBaseInput, deps: "invalid", target: i0.ɵɵFactoryTarget.Directive }); }
|
|
54
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.2.1", type: NgDocBaseInput, isStandalone: true, host: { classAttribute: "ng-doc-input" }, usesInheritance: true, ngImport: i0 }); }
|
|
46
55
|
}
|
|
47
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
48
|
-
type: Directive
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
56
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.1", ngImport: i0, type: NgDocBaseInput, decorators: [{
|
|
57
|
+
type: Directive,
|
|
58
|
+
args: [{
|
|
59
|
+
host: {
|
|
60
|
+
class: 'ng-doc-input',
|
|
61
|
+
},
|
|
62
|
+
}]
|
|
63
|
+
}], ctorParameters: () => [{ type: undefined }] });
|
|
53
64
|
|
|
54
65
|
/**
|
|
55
66
|
* Generated bundle index. Do not edit.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ng-doc-ui-kit-classes-base-input.mjs","sources":["../../../../libs/ui-kit/classes/base-input/base-input.ts","../../../../libs/ui-kit/classes/base-input/ng-doc-ui-kit-classes-base-input.ts"],"sourcesContent":["import { Directive, DOCUMENT, ElementRef,
|
|
1
|
+
{"version":3,"file":"ng-doc-ui-kit-classes-base-input.mjs","sources":["../../../../libs/ui-kit/classes/base-input/base-input.ts","../../../../libs/ui-kit/classes/base-input/ng-doc-ui-kit-classes-base-input.ts"],"sourcesContent":["import { Directive, DOCUMENT, ElementRef, inject } from '@angular/core';\nimport { DIControl, injectHostControl } from 'di-controls';\nimport { DIControlConfig } from 'di-controls/controls';\nimport { Subject } from 'rxjs';\n\n/**\n * Base class of the directives that turn a native `input` into a UI Kit control\n * (`ngDocInputString`, `ngDocInputNumber`). Input wrappers and comboboxes query it to read the\n * state of their input.\n */\n@Directive({\n host: {\n class: 'ng-doc-input',\n },\n})\nexport abstract class NgDocBaseInput<T> extends DIControl<T> {\n override readonly elementRef: ElementRef<HTMLInputElement> = inject(ElementRef);\n\n /** Emits after the input updates its model from a user edit. */\n readonly changes: Subject<void> = new Subject();\n\n protected readonly document = inject(DOCUMENT);\n\n protected constructor(config?: DIControlConfig<T, T>) {\n super({\n host: injectHostControl({ optional: true }),\n ...config,\n });\n }\n\n /** Placeholder of the native input. */\n get placeholder(): string {\n return this.elementRef.nativeElement.placeholder || '';\n }\n\n /** Whether the native input has focus. */\n get isFocused(): boolean {\n return this.document.activeElement === this.elementRef.nativeElement;\n }\n\n /** Whether the native input is read-only. */\n get isReadonly(): boolean {\n return this.elementRef.nativeElement.readOnly;\n }\n\n /** Current text of the native input. */\n get value(): string {\n return this.elementRef.nativeElement.value;\n }\n\n /** Focuses the native input. */\n focus(): void {\n this.elementRef.nativeElement.focus();\n }\n\n /** Replays the `-blink` animation class on the native input. */\n blink(): void {\n this.renderer.removeClass(this.elementRef.nativeElement, '-blink');\n // Reading the layout restarts the CSS animation when the class is added again.\n this.elementRef.nativeElement.offsetWidth;\n this.renderer.addClass(this.elementRef.nativeElement, '-blink');\n }\n\n override updateModel(value: T | null) {\n super.updateModel(value);\n\n this.changes.next();\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;AAKA;;;;AAIG;AAMG,MAAgB,cAAkB,SAAQ,SAAY,CAAA;AAQ1D,IAAA,WAAA,CAAsB,MAA8B,EAAA;AAClD,QAAA,KAAK,CAAC;YACJ,IAAI,EAAE,iBAAiB,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;AAC3C,YAAA,GAAG,MAAM;AACV,SAAA,CAAC;AAXc,QAAA,IAAA,CAAA,UAAU,GAAiC,MAAM,CAAC,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,cAAA,EAAA,EAAA,eAAA,EAAA,IAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA,CAAA;;2FAAd,cAAc,EAAA,UAAA,EAAA,CAAA;kBALnC,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,IAAI,EAAE;AACJ,wBAAA,KAAK,EAAE,cAAc;AACtB,qBAAA;AACF,iBAAA;;;ACdD;;AAEG;;;;"}
|
|
@@ -1,33 +1,51 @@
|
|
|
1
1
|
import { FlexibleConnectedPositionStrategy } from '@angular/cdk/overlay';
|
|
2
|
+
import { NgZone, untracked, afterEveryRender } from '@angular/core';
|
|
2
3
|
import { NavigationEnd } from '@angular/router';
|
|
3
4
|
import { isPresent } from '@ng-doc/core';
|
|
4
5
|
import { toElement } from '@ng-doc/ui-kit/helpers';
|
|
5
|
-
import {
|
|
6
|
-
import { fromEvent, merge, NEVER } from 'rxjs';
|
|
7
|
-
import { switchMap, filter, takeUntil, take,
|
|
6
|
+
import { fromSubscribe } from '@ng-doc/ui-kit/observables';
|
|
7
|
+
import { fromEvent, merge, NEVER, Subject } from 'rxjs';
|
|
8
|
+
import { switchMap, filter, takeUntil, take, map, debounceTime, pairwise } from 'rxjs/operators';
|
|
8
9
|
|
|
10
|
+
/**
|
|
11
|
+
* A handle to an opened overlay (a dropdown, a tooltip or a dialog).
|
|
12
|
+
*
|
|
13
|
+
* `NgDocOverlayService.open()` creates it, and the overlay content can inject it to close itself.
|
|
14
|
+
*/
|
|
9
15
|
class NgDocOverlayRef {
|
|
10
|
-
|
|
16
|
+
/**
|
|
17
|
+
* @param overlayRef - The CDK overlay that hosts the container.
|
|
18
|
+
* @param overlayConfig - The configuration the overlay was opened with.
|
|
19
|
+
* @param overlayContainer - The container component rendered inside the overlay.
|
|
20
|
+
* @param injector - Injector the overlay uses to follow application renders. It must be able to
|
|
21
|
+
* inject NgZone; the component or environment injector of the opener is enough.
|
|
22
|
+
* @param router - Closes the overlay after a navigation when `disposeOnRouteNavigation` is set.
|
|
23
|
+
* @param location - Closes the overlay on a location change when `disposeOnNavigation` is set.
|
|
24
|
+
*/
|
|
25
|
+
constructor(overlayRef, overlayConfig, overlayContainer, injector, router, location) {
|
|
11
26
|
this.overlayRef = overlayRef;
|
|
12
27
|
this.overlayConfig = overlayConfig;
|
|
13
28
|
this.overlayContainer = overlayContainer;
|
|
14
|
-
this.
|
|
29
|
+
this.injector = injector;
|
|
15
30
|
this.router = router;
|
|
16
31
|
this.location = location;
|
|
17
32
|
this.overlayResult = null;
|
|
18
33
|
this.opened = true;
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
34
|
+
// The CDK dispatchers emit outside clicks and key presses inside the Angular zone, and a
|
|
35
|
+
// zoneless application needs no zone at all, so the streams below are subscribed directly.
|
|
36
|
+
if (this.overlayConfig.closeIfOutsideClick) {
|
|
37
|
+
this.afterOpen()
|
|
38
|
+
.pipe(switchMap(() => this.overlayRef.outsidePointerEvents()), filter((event) => this.outsideClickChecker(event)), takeUntil(this.overlayRef.detachments()))
|
|
39
|
+
.subscribe(() => this.close());
|
|
40
|
+
}
|
|
41
|
+
if (this.overlayConfig.closeIfInnerClick) {
|
|
42
|
+
fromEvent(this.overlayRef.overlayElement, 'click')
|
|
43
|
+
.pipe(takeUntil(this.overlayRef.detachments()))
|
|
44
|
+
.subscribe(() => this.close());
|
|
45
|
+
}
|
|
28
46
|
if (this.router && this.overlayConfig.disposeOnRouteNavigation) {
|
|
29
47
|
this.router.events
|
|
30
|
-
.pipe(filter((event) => event instanceof NavigationEnd),
|
|
48
|
+
.pipe(filter((event) => event instanceof NavigationEnd), takeUntil(this.overlayRef.detachments()))
|
|
31
49
|
.subscribe(() => this.close());
|
|
32
50
|
}
|
|
33
51
|
if (this.location && this.overlayConfig.disposeOnNavigation) {
|
|
@@ -40,14 +58,9 @@ class NgDocOverlayRef {
|
|
|
40
58
|
.pipe(take(1), takeUntil(this.overlayRef.detachments()))
|
|
41
59
|
.subscribe(() => this.close());
|
|
42
60
|
}
|
|
43
|
-
/* Update position if origin changes its position */
|
|
44
61
|
const origin = toElement(this.overlayConfig.origin);
|
|
45
62
|
if (origin instanceof HTMLElement) {
|
|
46
|
-
this.
|
|
47
|
-
.pipe(debounceTime(10), map(() => origin.getBoundingClientRect()), pairwise(), filter(([a, b]) => isPresent(a) &&
|
|
48
|
-
isPresent(b) &&
|
|
49
|
-
(a.x !== b.x || a.y !== b.y || a.width !== b.width || a.height !== b.height)), ngDocZoneDetach(this.ngZone), takeUntil(this.overlayRef.detachments()))
|
|
50
|
-
.subscribe(() => this.overlayRef.updatePosition());
|
|
63
|
+
this.followOrigin(origin);
|
|
51
64
|
}
|
|
52
65
|
}
|
|
53
66
|
/** Sets focus to overlay */
|
|
@@ -68,7 +81,7 @@ class NgDocOverlayRef {
|
|
|
68
81
|
}
|
|
69
82
|
/**
|
|
70
83
|
* Closes overlay
|
|
71
|
-
* @param closeResult
|
|
84
|
+
* @param closeResult - The value `beforeClose()` and `afterClose()` emit.
|
|
72
85
|
*/
|
|
73
86
|
close(closeResult) {
|
|
74
87
|
this.overlayResult = isPresent(closeResult) ? closeResult : null;
|
|
@@ -94,6 +107,33 @@ class NgDocOverlayRef {
|
|
|
94
107
|
? this.overlayConfig.positionStrategy.positionChanges
|
|
95
108
|
: NEVER;
|
|
96
109
|
}
|
|
110
|
+
/**
|
|
111
|
+
* Repositions the overlay when its origin moves or resizes.
|
|
112
|
+
*
|
|
113
|
+
* The origin is measured after application renders rather than when the zone becomes stable,
|
|
114
|
+
* which never happens in a zoneless application. The debounce timer starts outside the Angular zone so that it
|
|
115
|
+
* does not trigger another change detection (and another render) in a zone.js application.
|
|
116
|
+
* @param origin - The element the overlay is connected to.
|
|
117
|
+
*/
|
|
118
|
+
followOrigin(origin) {
|
|
119
|
+
const ngZone = this.injector.get(NgZone);
|
|
120
|
+
const renders = new Subject();
|
|
121
|
+
// `untracked` lets an overlay open from a reactive context (an effect, for example), where
|
|
122
|
+
// `afterEveryRender` refuses to register.
|
|
123
|
+
const afterRender = untracked(() => afterEveryRender(() => ngZone.runOutsideAngular(() => renders.next()), {
|
|
124
|
+
injector: this.injector,
|
|
125
|
+
}));
|
|
126
|
+
renders
|
|
127
|
+
.pipe(debounceTime(10), map(() => origin.getBoundingClientRect()), pairwise(), filter(([a, b]) => a.x !== b.x || a.y !== b.y || a.width !== b.width || a.height !== b.height), takeUntil(this.overlayRef.detachments()))
|
|
128
|
+
.subscribe(() => this.overlayRef.updatePosition());
|
|
129
|
+
this.overlayRef
|
|
130
|
+
.detachments()
|
|
131
|
+
.pipe(take(1))
|
|
132
|
+
.subscribe(() => {
|
|
133
|
+
afterRender.destroy();
|
|
134
|
+
renders.complete();
|
|
135
|
+
});
|
|
136
|
+
}
|
|
97
137
|
outsideClickChecker(event) {
|
|
98
138
|
const target = event.target;
|
|
99
139
|
if (target instanceof Element) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ng-doc-ui-kit-classes-overlay-ref.mjs","sources":["../../../../libs/ui-kit/classes/overlay-ref/overlay-ref.ts","../../../../libs/ui-kit/classes/overlay-ref/ng-doc-ui-kit-classes-overlay-ref.ts"],"sourcesContent":["import {\n ConnectedOverlayPositionChange,\n FlexibleConnectedPositionStrategy,\n OverlayRef,\n} from '@angular/cdk/overlay';\nimport { Location } from '@angular/common';\nimport { NgZone } from '@angular/core';\nimport { Event, NavigationEnd, Router } from '@angular/router';\nimport { isPresent } from '@ng-doc/core';\nimport { toElement } from '@ng-doc/ui-kit/helpers';\nimport { NgDocOverlayConfig, NgDocOverlayContainer } from '@ng-doc/ui-kit/interfaces';\nimport { fromSubscribe, ngDocZoneDetach, ngDocZoneOptimize } from '@ng-doc/ui-kit/observables';\nimport { NgDocOverlayAnimationEvent } from '@ng-doc/ui-kit/types';\nimport { fromEvent, merge, NEVER, Observable } from 'rxjs';\nimport { debounceTime, filter, map, pairwise, switchMap, take, takeUntil } from 'rxjs/operators';\n\nexport class NgDocOverlayRef<T = unknown> {\n private overlayResult: T | null = null;\n private opened: boolean = true;\n\n constructor(\n readonly overlayRef: OverlayRef,\n private readonly overlayConfig: NgDocOverlayConfig,\n readonly overlayContainer: NgDocOverlayContainer,\n private readonly ngZone: NgZone,\n private readonly router?: Router,\n private readonly location?: Location,\n ) {\n /* Closes overlay when it was outside click */\n this.afterOpen()\n .pipe(\n switchMap(() =>\n this.ngZone.runOutsideAngular(() => this.overlayRef.outsidePointerEvents()),\n ),\n filter(\n (event: MouseEvent) =>\n !!this.overlayConfig.closeIfOutsideClick && this.outsideClickChecker(event),\n ),\n ngDocZoneOptimize(this.ngZone),\n )\n .subscribe(() => this.close());\n\n /* Closes overlay when it was inner click */\n fromEvent(this.overlayRef.overlayElement, 'click')\n .pipe(\n filter(() => !!this.overlayConfig.closeIfInnerClick),\n takeUntil(this.overlayRef.detachments()),\n ngDocZoneOptimize(this.ngZone),\n )\n .subscribe(() => this.close());\n\n /* Closes overlay if route was changed */\n if (this.router && this.overlayConfig.disposeOnRouteNavigation) {\n this.router.events\n .pipe(\n filter((event: Event) => event instanceof NavigationEnd),\n ngDocZoneOptimize(this.ngZone),\n takeUntil(this.overlayRef.detachments()),\n )\n .subscribe(() => this.close());\n }\n\n if (this.location && this.overlayConfig.disposeOnNavigation) {\n fromSubscribe(this.location)\n .pipe(takeUntil(this.overlayRef.detachments()))\n .subscribe(() => this.close());\n }\n\n if (!this.overlayConfig.disableClose) {\n merge(\n this.overlayRef.backdropClick(),\n this.overlayRef.keydownEvents().pipe(filter((e: KeyboardEvent) => e.code === 'Escape')),\n )\n .pipe(take(1), takeUntil(this.overlayRef.detachments()))\n .subscribe(() => this.close());\n }\n\n /* Update position if origin changes its position */\n const origin: unknown = toElement(this.overlayConfig.origin);\n\n if (origin instanceof HTMLElement) {\n this.ngZone.onStable\n .pipe(\n debounceTime(10),\n map(() => origin.getBoundingClientRect()),\n pairwise(),\n filter(\n ([a, b]: [DOMRect, DOMRect]) =>\n isPresent(a) &&\n isPresent(b) &&\n (a.x !== b.x || a.y !== b.y || a.width !== b.width || a.height !== b.height),\n ),\n ngDocZoneDetach(this.ngZone),\n takeUntil(this.overlayRef.detachments()),\n )\n .subscribe(() => this.overlayRef.updatePosition());\n }\n }\n\n /** Sets focus to overlay */\n focus(): void {\n this.overlayContainer.focus();\n }\n\n /** Overlay has focus */\n get isFocused(): boolean {\n return this.overlayContainer.isFocused;\n }\n\n /** Overlay is opened */\n get isOpened(): boolean {\n return this.opened;\n }\n\n /** Overlay has attached */\n get hasAttached(): boolean {\n return this.overlayRef.hasAttached();\n }\n\n /**\n * Closes overlay\n * @param closeResult\n */\n close(closeResult?: T): void {\n this.overlayResult = isPresent(closeResult) ? closeResult : null;\n this.afterClose().subscribe(() => void this.overlayRef.detach());\n this.overlayContainer.close();\n this.overlayRef.detachBackdrop();\n this.opened = false;\n }\n\n beforeOpen(): Observable<void> {\n return this.overlayContainer.animationEvent.pipe(\n filter((event: NgDocOverlayAnimationEvent) => event === 'beforeOpen'),\n take(1),\n map(() => void 0),\n );\n }\n\n afterOpen(): Observable<void> {\n return this.overlayContainer.animationEvent.pipe(\n filter((event: NgDocOverlayAnimationEvent) => event === 'afterOpen'),\n take(1),\n map(() => void 0),\n );\n }\n\n beforeClose(): Observable<T | null> {\n return merge(\n this.overlayContainer.animationEvent.pipe(\n filter((event: NgDocOverlayAnimationEvent) => event === 'beforeClose'),\n ),\n this.overlayRef.detachments(),\n ).pipe(\n take(1),\n map(() => this.overlayResult),\n );\n }\n\n afterClose(): Observable<T | null> {\n return merge(\n this.overlayContainer.animationEvent.pipe(\n filter((event: NgDocOverlayAnimationEvent) => event === 'afterClose'),\n ),\n this.overlayRef.detachments(),\n ).pipe(\n take(1),\n map(() => this.overlayResult),\n );\n }\n\n positionChanges(): Observable<ConnectedOverlayPositionChange> {\n return this.overlayConfig.positionStrategy instanceof FlexibleConnectedPositionStrategy\n ? this.overlayConfig.positionStrategy.positionChanges\n : NEVER;\n }\n\n private outsideClickChecker(event: MouseEvent): boolean {\n const target: EventTarget | null = event.target;\n if (target instanceof Element) {\n const origin: unknown = toElement(this.overlayConfig.origin);\n if (origin instanceof HTMLElement) {\n return !origin.contains(target);\n }\n }\n return true;\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;MAgBa,eAAe,CAAA;IAI1B,WAAA,CACW,UAAsB,EACd,aAAiC,EACzC,gBAAuC,EAC/B,MAAc,EACd,MAAe,EACf,QAAmB,EAAA;QAL3B,IAAA,CAAA,UAAU,GAAV,UAAU;QACF,IAAA,CAAA,aAAa,GAAb,aAAa;QACrB,IAAA,CAAA,gBAAgB,GAAhB,gBAAgB;QACR,IAAA,CAAA,MAAM,GAAN,MAAM;QACN,IAAA,CAAA,MAAM,GAAN,MAAM;QACN,IAAA,CAAA,QAAQ,GAAR,QAAQ;QATnB,IAAA,CAAA,aAAa,GAAa,IAAI;QAC9B,IAAA,CAAA,MAAM,GAAY,IAAI;;QAW5B,IAAI,CAAC,SAAS;aACX,IAAI,CACH,SAAS,CAAC,MACR,IAAI,CAAC,MAAM,CAAC,iBAAiB,CAAC,MAAM,IAAI,CAAC,UAAU,CAAC,oBAAoB,EAAE,CAAC,CAC5E,EACD,MAAM,CACJ,CAAC,KAAiB,KAChB,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,mBAAmB,IAAI,IAAI,CAAC,mBAAmB,CAAC,KAAK,CAAC,CAC9E,EACD,iBAAiB,CAAC,IAAI,CAAC,MAAM,CAAC;aAE/B,SAAS,CAAC,MAAM,IAAI,CAAC,KAAK,EAAE,CAAC;;QAGhC,SAAS,CAAC,IAAI,CAAC,UAAU,CAAC,cAAc,EAAE,OAAO;AAC9C,aAAA,IAAI,CACH,MAAM,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,iBAAiB,CAAC,EACpD,SAAS,CAAC,IAAI,C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B;IACH;IAEA,eAAe,GAAA;AACb,QAAA,OAAO,IAAI,CAAC,aAAa,CAAC,gBAAgB,YAAY;AACpD,cAAE,IAAI,CAAC,aAAa,CAAC,gBAAgB,CAAC;cACpC,KAAK;IACX;AAEQ,IAAA,mBAAmB,CAAC,KAAiB,EAAA;AAC3C,QAAA,MAAM,MAAM,GAAuB,KAAK,CAAC,MAAM;AAC/C,QAAA,IAAI,MAAM,YAAY,OAAO,EAAE;YAC7B,MAAM,MAAM,GAAY,SAAS,CAAC,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC;AAC5D,YAAA,IAAI,MAAM,YAAY,WAAW,EAAE;AACjC,gBAAA,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC;YACjC;QACF;AACA,QAAA,OAAO,IAAI;IACb;AACD;;AC3LD;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"ng-doc-ui-kit-classes-overlay-ref.mjs","sources":["../../../../libs/ui-kit/classes/overlay-ref/overlay-ref.ts","../../../../libs/ui-kit/classes/overlay-ref/ng-doc-ui-kit-classes-overlay-ref.ts"],"sourcesContent":["import {\n ConnectedOverlayPositionChange,\n FlexibleConnectedPositionStrategy,\n OverlayRef,\n} from '@angular/cdk/overlay';\nimport { Location } from '@angular/common';\nimport { afterEveryRender, AfterRenderRef, Injector, NgZone, untracked } from '@angular/core';\nimport { Event, NavigationEnd, Router } from '@angular/router';\nimport { isPresent } from '@ng-doc/core';\nimport { toElement } from '@ng-doc/ui-kit/helpers';\nimport { NgDocOverlayConfig, NgDocOverlayContainer } from '@ng-doc/ui-kit/interfaces';\nimport { fromSubscribe } from '@ng-doc/ui-kit/observables';\nimport { NgDocOverlayAnimationEvent } from '@ng-doc/ui-kit/types';\nimport { fromEvent, merge, NEVER, Observable, Subject } from 'rxjs';\nimport { debounceTime, filter, map, pairwise, switchMap, take, takeUntil } from 'rxjs/operators';\n\n/**\n * A handle to an opened overlay (a dropdown, a tooltip or a dialog).\n *\n * `NgDocOverlayService.open()` creates it, and the overlay content can inject it to close itself.\n */\nexport class NgDocOverlayRef<T = unknown> {\n private overlayResult: T | null = null;\n private opened: boolean = true;\n\n /**\n * @param overlayRef - The CDK overlay that hosts the container.\n * @param overlayConfig - The configuration the overlay was opened with.\n * @param overlayContainer - The container component rendered inside the overlay.\n * @param injector - Injector the overlay uses to follow application renders. It must be able to\n * inject NgZone; the component or environment injector of the opener is enough.\n * @param router - Closes the overlay after a navigation when `disposeOnRouteNavigation` is set.\n * @param location - Closes the overlay on a location change when `disposeOnNavigation` is set.\n */\n constructor(\n readonly overlayRef: OverlayRef,\n private readonly overlayConfig: NgDocOverlayConfig,\n readonly overlayContainer: NgDocOverlayContainer,\n private readonly injector: Injector,\n private readonly router?: Router,\n private readonly location?: Location,\n ) {\n // The CDK dispatchers emit outside clicks and key presses inside the Angular zone, and a\n // zoneless application needs no zone at all, so the streams below are subscribed directly.\n if (this.overlayConfig.closeIfOutsideClick) {\n this.afterOpen()\n .pipe(\n switchMap(() => this.overlayRef.outsidePointerEvents()),\n filter((event: MouseEvent) => this.outsideClickChecker(event)),\n takeUntil(this.overlayRef.detachments()),\n )\n .subscribe(() => this.close());\n }\n\n if (this.overlayConfig.closeIfInnerClick) {\n fromEvent(this.overlayRef.overlayElement, 'click')\n .pipe(takeUntil(this.overlayRef.detachments()))\n .subscribe(() => this.close());\n }\n\n if (this.router && this.overlayConfig.disposeOnRouteNavigation) {\n this.router.events\n .pipe(\n filter((event: Event) => event instanceof NavigationEnd),\n takeUntil(this.overlayRef.detachments()),\n )\n .subscribe(() => this.close());\n }\n\n if (this.location && this.overlayConfig.disposeOnNavigation) {\n fromSubscribe(this.location)\n .pipe(takeUntil(this.overlayRef.detachments()))\n .subscribe(() => this.close());\n }\n\n if (!this.overlayConfig.disableClose) {\n merge(\n this.overlayRef.backdropClick(),\n this.overlayRef.keydownEvents().pipe(filter((e: KeyboardEvent) => e.code === 'Escape')),\n )\n .pipe(take(1), takeUntil(this.overlayRef.detachments()))\n .subscribe(() => this.close());\n }\n\n const origin: unknown = toElement(this.overlayConfig.origin);\n\n if (origin instanceof HTMLElement) {\n this.followOrigin(origin);\n }\n }\n\n /** Sets focus to overlay */\n focus(): void {\n this.overlayContainer.focus();\n }\n\n /** Overlay has focus */\n get isFocused(): boolean {\n return this.overlayContainer.isFocused;\n }\n\n /** Overlay is opened */\n get isOpened(): boolean {\n return this.opened;\n }\n\n /** Overlay has attached */\n get hasAttached(): boolean {\n return this.overlayRef.hasAttached();\n }\n\n /**\n * Closes overlay\n * @param closeResult - The value `beforeClose()` and `afterClose()` emit.\n */\n close(closeResult?: T): void {\n this.overlayResult = isPresent(closeResult) ? closeResult : null;\n this.afterClose().subscribe(() => void this.overlayRef.detach());\n this.overlayContainer.close();\n this.overlayRef.detachBackdrop();\n this.opened = false;\n }\n\n beforeOpen(): Observable<void> {\n return this.overlayContainer.animationEvent.pipe(\n filter((event: NgDocOverlayAnimationEvent) => event === 'beforeOpen'),\n take(1),\n map(() => void 0),\n );\n }\n\n afterOpen(): Observable<void> {\n return this.overlayContainer.animationEvent.pipe(\n filter((event: NgDocOverlayAnimationEvent) => event === 'afterOpen'),\n take(1),\n map(() => void 0),\n );\n }\n\n beforeClose(): Observable<T | null> {\n return merge(\n this.overlayContainer.animationEvent.pipe(\n filter((event: NgDocOverlayAnimationEvent) => event === 'beforeClose'),\n ),\n this.overlayRef.detachments(),\n ).pipe(\n take(1),\n map(() => this.overlayResult),\n );\n }\n\n afterClose(): Observable<T | null> {\n return merge(\n this.overlayContainer.animationEvent.pipe(\n filter((event: NgDocOverlayAnimationEvent) => event === 'afterClose'),\n ),\n this.overlayRef.detachments(),\n ).pipe(\n take(1),\n map(() => this.overlayResult),\n );\n }\n\n positionChanges(): Observable<ConnectedOverlayPositionChange> {\n return this.overlayConfig.positionStrategy instanceof FlexibleConnectedPositionStrategy\n ? this.overlayConfig.positionStrategy.positionChanges\n : NEVER;\n }\n\n /**\n * Repositions the overlay when its origin moves or resizes.\n *\n * The origin is measured after application renders rather than when the zone becomes stable,\n * which never happens in a zoneless application. The debounce timer starts outside the Angular zone so that it\n * does not trigger another change detection (and another render) in a zone.js application.\n * @param origin - The element the overlay is connected to.\n */\n private followOrigin(origin: HTMLElement): void {\n const ngZone: NgZone = this.injector.get(NgZone);\n const renders: Subject<void> = new Subject<void>();\n // `untracked` lets an overlay open from a reactive context (an effect, for example), where\n // `afterEveryRender` refuses to register.\n const afterRender: AfterRenderRef = untracked(() =>\n afterEveryRender(() => ngZone.runOutsideAngular(() => renders.next()), {\n injector: this.injector,\n }),\n );\n\n renders\n .pipe(\n debounceTime(10),\n map(() => origin.getBoundingClientRect()),\n pairwise(),\n filter(\n ([a, b]: [DOMRect, DOMRect]) =>\n a.x !== b.x || a.y !== b.y || a.width !== b.width || a.height !== b.height,\n ),\n takeUntil(this.overlayRef.detachments()),\n )\n .subscribe(() => this.overlayRef.updatePosition());\n\n this.overlayRef\n .detachments()\n .pipe(take(1))\n .subscribe(() => {\n afterRender.destroy();\n renders.complete();\n });\n }\n\n private outsideClickChecker(event: MouseEvent): boolean {\n const target: EventTarget | null = event.target;\n if (target instanceof Element) {\n const origin: unknown = toElement(this.overlayConfig.origin);\n if (origin instanceof HTMLElement) {\n return !origin.contains(target);\n }\n }\n return true;\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;AAgBA;;;;AAIG;MACU,eAAe,CAAA;AAI1B;;;;;;;;AAQG;IACH,WAAA,CACW,UAAsB,EACd,aAAiC,EACzC,gBAAuC,EAC/B,QAAkB,EAClB,MAAe,EACf,QAAmB,EAAA;QAL3B,IAAA,CAAA,UAAU,GAAV,UAAU;QACF,IAAA,CAAA,aAAa,GAAb,aAAa;QACrB,IAAA,CAAA,gBAAgB,GAAhB,gBAAgB;QACR,IAAA,CAAA,QAAQ,GAAR,QAAQ;QACR,IAAA,CAAA,MAAM,GAAN,MAAM;QACN,IAAA,CAAA,QAAQ,GAA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GAAuB,KAAK,CAAC,MAAM;AAC/C,QAAA,IAAI,MAAM,YAAY,OAAO,EAAE;YAC7B,MAAM,MAAM,GAAY,SAAS,CAAC,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC;AAC5D,YAAA,IAAI,MAAM,YAAY,WAAW,EAAE;AACjC,gBAAA,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC;YACjC;QACF;AACA,QAAA,OAAO,IAAI;IACb;AACD;;AC5ND;;AAEG;;;;"}
|
|
@@ -1,25 +1,50 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import {
|
|
2
|
+
import { input, computed, ChangeDetectionStrategy, Component } from '@angular/core';
|
|
3
3
|
import { NgDocIconComponent } from '@ng-doc/ui-kit/components/icon';
|
|
4
4
|
|
|
5
|
+
/** The icon and the title each built-in callout type shows. */
|
|
6
|
+
const BLOCKQUOTE_PRESETS = {
|
|
7
|
+
note: { icon: 'info', label: 'Note' },
|
|
8
|
+
warning: { icon: 'alert-triangle', label: 'Warning' },
|
|
9
|
+
alert: { icon: 'alert-circle', label: 'Alert' },
|
|
10
|
+
success: { icon: 'check', label: 'Success' },
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* A callout. A Markdown blockquote whose first word is a bold type name, such as Note, renders
|
|
14
|
+
* as this component.
|
|
15
|
+
*
|
|
16
|
+
* The `note`, `warning`, `alert` and `success` types show their icon and their name as a title
|
|
17
|
+
* ("Note", "Warning", ...). A callout with a custom `icon` shows no type title, only its `label`
|
|
18
|
+
* when it has one. The `default` type has neither an icon nor a title.
|
|
19
|
+
*/
|
|
5
20
|
class NgDocBlockquoteComponent {
|
|
6
21
|
constructor() {
|
|
7
|
-
|
|
22
|
+
/** Callout type; it selects the colour, the icon and the title. */
|
|
23
|
+
this.type = input('default', /* @ts-ignore */
|
|
24
|
+
...(ngDevMode ? [{ debugName: "type" }] : /* istanbul ignore next */ []));
|
|
25
|
+
/** Name of an icon that replaces the type's icon; the type title is not shown then. */
|
|
26
|
+
this.icon = input(undefined, /* @ts-ignore */
|
|
27
|
+
...(ngDevMode ? [{ debugName: "icon" }] : /* istanbul ignore next */ []));
|
|
28
|
+
/** A title that replaces the type title, for example "Deprecated". */
|
|
29
|
+
this.label = input(undefined, /* @ts-ignore */
|
|
30
|
+
...(ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []));
|
|
31
|
+
/** The icon that is shown, if any. */
|
|
32
|
+
this.iconName = computed(() => this.icon() || BLOCKQUOTE_PRESETS[this.type()]?.icon, /* @ts-ignore */
|
|
33
|
+
...(ngDevMode ? [{ debugName: "iconName" }] : /* istanbul ignore next */ []));
|
|
34
|
+
/** The title that is shown, if any. */
|
|
35
|
+
this.title = computed(() => this.label() || (this.icon() ? undefined : BLOCKQUOTE_PRESETS[this.type()]?.label), /* @ts-ignore */
|
|
36
|
+
...(ngDevMode ? [{ debugName: "title" }] : /* istanbul ignore next */ []));
|
|
8
37
|
}
|
|
9
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
10
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "
|
|
38
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.2.1", ngImport: i0, type: NgDocBlockquoteComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
39
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.2.1", type: NgDocBlockquoteComponent, isStandalone: true, selector: "blockquote[ng-doc-blockquote]", inputs: { type: { classPropertyName: "type", publicName: "type", isSignal: true, isRequired: false, transformFunction: null }, icon: { classPropertyName: "icon", publicName: "icon", isSignal: true, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "attr.data-ng-doc-type": "type()", "attr.data-ng-doc-has-icon": "iconName() ? \"\" : null" } }, ngImport: i0, template: "@if (iconName(); as iconName) {\n <div class=\"ng-doc-blockquote-icon\" aria-hidden=\"true\">\n <ng-doc-icon [icon]=\"iconName\" size=\"24\"></ng-doc-icon>\n </div>\n}\n<div class=\"ng-doc-blockquote\">\n @if (title(); as title) {\n <span class=\"ng-doc-blockquote-title\">{{ title }}</span>\n }\n <ng-content></ng-content>\n</div>\n", styles: [":host{font-family:var(--ng-doc-font-family);font-variant:no-contextual;color:var(--ng-doc-text);line-height:var(--ng-doc-line-height);font-size:var(--ng-doc-font-size);font-weight:var(--ng-doc-font-weight);position:relative;display:grid;grid-template-columns:minmax(0,1fr);column-gap:var(--ng-doc-space-3);padding:var(--ng-doc-space-3) var(--ng-doc-space-4);border-radius:var(--ng-doc-radius-lg);margin:var(--ng-doc-blockquote-margin);background:color-mix(in oklab,var(--ng-doc-blockquote-background, var(--ng-doc-hue-neutral)) var(--ng-doc-mix-soft),var(--ng-doc-background));border:1px solid color-mix(in oklab,var(--ng-doc-blockquote-border-color, var(--ng-doc-hue-neutral)) var(--ng-doc-mix-border),var(--ng-doc-background));overflow:hidden;--ng-doc-code-margin: var(--ng-doc-base-gutter) 0}:host[data-ng-doc-has-icon]{grid-template-columns:20px minmax(0,1fr)}:host[data-ng-doc-type=note]{--ng-doc-blockquote-background: var(--ng-doc-info);--ng-doc-blockquote-border-color: var(--ng-doc-info);--ng-doc-icon-color: var(--ng-doc-info)}:host[data-ng-doc-type=warning]{--ng-doc-blockquote-background: var(--ng-doc-warning);--ng-doc-blockquote-border-color: var(--ng-doc-warning);--ng-doc-icon-color: var(--ng-doc-warning)}:host[data-ng-doc-type=alert]{--ng-doc-blockquote-background: var(--ng-doc-alert);--ng-doc-blockquote-border-color: var(--ng-doc-alert);--ng-doc-icon-color: var(--ng-doc-alert)}:host[data-ng-doc-type=success]{--ng-doc-blockquote-background: var(--ng-doc-success);--ng-doc-blockquote-border-color: var(--ng-doc-success);--ng-doc-icon-color: var(--ng-doc-success)}:host .ng-doc-blockquote-icon{display:flex;padding-top:3px}:host .ng-doc-blockquote-icon ng-doc-icon{width:18px;height:18px}:host .ng-doc-blockquote-icon ::ng-deep svg{width:100%;height:100%}:host .ng-doc-blockquote{min-width:0;text-decoration:none}:host .ng-doc-blockquote-title{display:block;font-weight:600;color:color-mix(in oklab,var(--ng-doc-blockquote-border-color, var(--ng-doc-hue-neutral)) var(--ng-doc-mix-strong),var(--ng-doc-heading-color))}:host ::ng-deep code.ng-doc-code-with-link a{color:color-mix(in oklab,var(--ng-doc-link-color) var(--ng-doc-mix-syntax, 80%),var(--ng-doc-heading-color))}:host ::ng-deep p{margin:0}\n"], dependencies: [{ kind: "component", type: NgDocIconComponent, selector: "ng-doc-icon", inputs: ["icon", "customIcon", "size"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
11
40
|
}
|
|
12
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
41
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.1", ngImport: i0, type: NgDocBlockquoteComponent, decorators: [{
|
|
13
42
|
type: Component,
|
|
14
|
-
args: [{ selector: 'blockquote[ng-doc-blockquote]', changeDetection: ChangeDetectionStrategy.OnPush, imports: [NgDocIconComponent],
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
args: ['attr.data-ng-doc-type']
|
|
20
|
-
}], icon: [{
|
|
21
|
-
type: Input
|
|
22
|
-
}] } });
|
|
43
|
+
args: [{ selector: 'blockquote[ng-doc-blockquote]', changeDetection: ChangeDetectionStrategy.OnPush, imports: [NgDocIconComponent], host: {
|
|
44
|
+
'[attr.data-ng-doc-type]': 'type()',
|
|
45
|
+
'[attr.data-ng-doc-has-icon]': 'iconName() ? "" : null',
|
|
46
|
+
}, template: "@if (iconName(); as iconName) {\n <div class=\"ng-doc-blockquote-icon\" aria-hidden=\"true\">\n <ng-doc-icon [icon]=\"iconName\" size=\"24\"></ng-doc-icon>\n </div>\n}\n<div class=\"ng-doc-blockquote\">\n @if (title(); as title) {\n <span class=\"ng-doc-blockquote-title\">{{ title }}</span>\n }\n <ng-content></ng-content>\n</div>\n", styles: [":host{font-family:var(--ng-doc-font-family);font-variant:no-contextual;color:var(--ng-doc-text);line-height:var(--ng-doc-line-height);font-size:var(--ng-doc-font-size);font-weight:var(--ng-doc-font-weight);position:relative;display:grid;grid-template-columns:minmax(0,1fr);column-gap:var(--ng-doc-space-3);padding:var(--ng-doc-space-3) var(--ng-doc-space-4);border-radius:var(--ng-doc-radius-lg);margin:var(--ng-doc-blockquote-margin);background:color-mix(in oklab,var(--ng-doc-blockquote-background, var(--ng-doc-hue-neutral)) var(--ng-doc-mix-soft),var(--ng-doc-background));border:1px solid color-mix(in oklab,var(--ng-doc-blockquote-border-color, var(--ng-doc-hue-neutral)) var(--ng-doc-mix-border),var(--ng-doc-background));overflow:hidden;--ng-doc-code-margin: var(--ng-doc-base-gutter) 0}:host[data-ng-doc-has-icon]{grid-template-columns:20px minmax(0,1fr)}:host[data-ng-doc-type=note]{--ng-doc-blockquote-background: var(--ng-doc-info);--ng-doc-blockquote-border-color: var(--ng-doc-info);--ng-doc-icon-color: var(--ng-doc-info)}:host[data-ng-doc-type=warning]{--ng-doc-blockquote-background: var(--ng-doc-warning);--ng-doc-blockquote-border-color: var(--ng-doc-warning);--ng-doc-icon-color: var(--ng-doc-warning)}:host[data-ng-doc-type=alert]{--ng-doc-blockquote-background: var(--ng-doc-alert);--ng-doc-blockquote-border-color: var(--ng-doc-alert);--ng-doc-icon-color: var(--ng-doc-alert)}:host[data-ng-doc-type=success]{--ng-doc-blockquote-background: var(--ng-doc-success);--ng-doc-blockquote-border-color: var(--ng-doc-success);--ng-doc-icon-color: var(--ng-doc-success)}:host .ng-doc-blockquote-icon{display:flex;padding-top:3px}:host .ng-doc-blockquote-icon ng-doc-icon{width:18px;height:18px}:host .ng-doc-blockquote-icon ::ng-deep svg{width:100%;height:100%}:host .ng-doc-blockquote{min-width:0;text-decoration:none}:host .ng-doc-blockquote-title{display:block;font-weight:600;color:color-mix(in oklab,var(--ng-doc-blockquote-border-color, var(--ng-doc-hue-neutral)) var(--ng-doc-mix-strong),var(--ng-doc-heading-color))}:host ::ng-deep code.ng-doc-code-with-link a{color:color-mix(in oklab,var(--ng-doc-link-color) var(--ng-doc-mix-syntax, 80%),var(--ng-doc-heading-color))}:host ::ng-deep p{margin:0}\n"] }]
|
|
47
|
+
}], propDecorators: { type: [{ type: i0.Input, args: [{ isSignal: true, alias: "type", required: false }] }], icon: [{ type: i0.Input, args: [{ isSignal: true, alias: "icon", required: false }] }], label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }] } });
|
|
23
48
|
|
|
24
49
|
/**
|
|
25
50
|
* Generated bundle index. Do not edit.
|