@ng-doc/app 22.0.0 → 22.2.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/LICENSE +21 -0
- package/fesm2022/ng-doc-app-classes-content-controller.mjs +22 -4
- package/fesm2022/ng-doc-app-classes-content-controller.mjs.map +1 -1
- package/fesm2022/ng-doc-app-classes-default-search-engine.mjs +36 -12
- package/fesm2022/ng-doc-app-classes-default-search-engine.mjs.map +1 -1
- package/fesm2022/ng-doc-app-classes-root-page.mjs.map +1 -1
- package/fesm2022/ng-doc-app-components-api-list.mjs +7 -5
- package/fesm2022/ng-doc-app-components-api-list.mjs.map +1 -1
- package/fesm2022/ng-doc-app-components-breadcrumb.mjs +5 -3
- package/fesm2022/ng-doc-app-components-breadcrumb.mjs.map +1 -1
- package/fesm2022/ng-doc-app-components-code.mjs +6 -4
- package/fesm2022/ng-doc-app-components-code.mjs.map +1 -1
- package/fesm2022/ng-doc-app-components-command-palette.mjs +35 -27
- package/fesm2022/ng-doc-app-components-command-palette.mjs.map +1 -1
- package/fesm2022/ng-doc-app-components-copy-button.mjs +6 -4
- package/fesm2022/ng-doc-app-components-copy-button.mjs.map +1 -1
- package/fesm2022/ng-doc-app-components-demo-displayer.mjs +19 -4
- package/fesm2022/ng-doc-app-components-demo-displayer.mjs.map +1 -1
- package/fesm2022/ng-doc-app-components-demo-frame.mjs +279 -0
- package/fesm2022/ng-doc-app-components-demo-frame.mjs.map +1 -0
- package/fesm2022/ng-doc-app-components-demo-pane.mjs +2 -2
- package/fesm2022/ng-doc-app-components-demo-pane.mjs.map +1 -1
- package/fesm2022/ng-doc-app-components-demo.mjs +97 -14
- package/fesm2022/ng-doc-app-components-demo.mjs.map +1 -1
- package/fesm2022/ng-doc-app-components-fullscreen-button.mjs +5 -3
- package/fesm2022/ng-doc-app-components-fullscreen-button.mjs.map +1 -1
- package/fesm2022/ng-doc-app-components-fullscreen-toggle.mjs +4 -2
- package/fesm2022/ng-doc-app-components-fullscreen-toggle.mjs.map +1 -1
- package/fesm2022/ng-doc-app-components-heading-anchor.mjs +5 -3
- package/fesm2022/ng-doc-app-components-heading-anchor.mjs.map +1 -1
- package/fesm2022/ng-doc-app-components-image-viewer.mjs +5 -3
- package/fesm2022/ng-doc-app-components-image-viewer.mjs.map +1 -1
- package/fesm2022/ng-doc-app-components-navbar.mjs +4 -2
- package/fesm2022/ng-doc-app-components-navbar.mjs.map +1 -1
- package/fesm2022/ng-doc-app-components-page-navigation.mjs +5 -3
- package/fesm2022/ng-doc-app-components-page-navigation.mjs.map +1 -1
- package/fesm2022/ng-doc-app-components-page-wrapper.mjs +2 -2
- package/fesm2022/ng-doc-app-components-page-wrapper.mjs.map +1 -1
- package/fesm2022/ng-doc-app-components-page.mjs +83 -16
- package/fesm2022/ng-doc-app-components-page.mjs.map +1 -1
- package/fesm2022/ng-doc-app-components-playground.mjs +838 -141
- package/fesm2022/ng-doc-app-components-playground.mjs.map +1 -1
- package/fesm2022/ng-doc-app-components-root.mjs +51 -4
- package/fesm2022/ng-doc-app-components-root.mjs.map +1 -1
- package/fesm2022/ng-doc-app-components-search-result.mjs +8 -6
- package/fesm2022/ng-doc-app-components-search-result.mjs.map +1 -1
- package/fesm2022/ng-doc-app-components-search.mjs +7 -5
- package/fesm2022/ng-doc-app-components-search.mjs.map +1 -1
- package/fesm2022/ng-doc-app-components-sidebar.mjs +4 -3
- package/fesm2022/ng-doc-app-components-sidebar.mjs.map +1 -1
- package/fesm2022/ng-doc-app-components-tabs.mjs +21 -3
- package/fesm2022/ng-doc-app-components-tabs.mjs.map +1 -1
- package/fesm2022/ng-doc-app-components-theme-toggle.mjs +7 -5
- package/fesm2022/ng-doc-app-components-theme-toggle.mjs.map +1 -1
- package/fesm2022/ng-doc-app-components-toc.mjs +4 -2
- package/fesm2022/ng-doc-app-components-toc.mjs.map +1 -1
- package/fesm2022/ng-doc-app-components.mjs +1 -0
- package/fesm2022/ng-doc-app-components.mjs.map +1 -1
- package/fesm2022/ng-doc-app-constants.mjs +11 -1
- package/fesm2022/ng-doc-app-constants.mjs.map +1 -1
- package/fesm2022/ng-doc-app-demo-app.mjs +779 -0
- package/fesm2022/ng-doc-app-demo-app.mjs.map +1 -0
- package/fesm2022/ng-doc-app-helpers.mjs +147 -7
- package/fesm2022/ng-doc-app-helpers.mjs.map +1 -1
- package/fesm2022/ng-doc-app-processors-processors.mjs +30 -9
- package/fesm2022/ng-doc-app-processors-processors.mjs.map +1 -1
- package/fesm2022/ng-doc-app-providers-ng-doc-app.mjs +29 -18
- package/fesm2022/ng-doc-app-providers-ng-doc-app.mjs.map +1 -1
- package/fesm2022/ng-doc-app-providers-texts.mjs +53 -0
- package/fesm2022/ng-doc-app-providers-texts.mjs.map +1 -0
- package/fesm2022/ng-doc-app-providers-title.mjs +129 -0
- package/fesm2022/ng-doc-app-providers-title.mjs.map +1 -0
- package/fesm2022/ng-doc-app-providers.mjs +2 -0
- package/fesm2022/ng-doc-app-providers.mjs.map +1 -1
- package/fesm2022/ng-doc-app-services-content-scroll-intent.mjs +27 -2
- package/fesm2022/ng-doc-app-services-content-scroll-intent.mjs.map +1 -1
- package/fesm2022/ng-doc-app-services-highlighter.mjs +23 -16
- package/fesm2022/ng-doc-app-services-highlighter.mjs.map +1 -1
- package/fesm2022/ng-doc-app-services-route-preloader.mjs +34 -10
- package/fesm2022/ng-doc-app-services-route-preloader.mjs.map +1 -1
- package/fesm2022/ng-doc-app-services-shortcuts.mjs +38 -4
- package/fesm2022/ng-doc-app-services-shortcuts.mjs.map +1 -1
- package/fesm2022/ng-doc-app-texts-ar.mjs +238 -0
- package/fesm2022/ng-doc-app-texts-ar.mjs.map +1 -0
- package/fesm2022/ng-doc-app-texts-de.mjs +205 -0
- package/fesm2022/ng-doc-app-texts-de.mjs.map +1 -0
- package/fesm2022/ng-doc-app-texts-es.mjs +205 -0
- package/fesm2022/ng-doc-app-texts-es.mjs.map +1 -0
- package/fesm2022/ng-doc-app-texts-fr.mjs +205 -0
- package/fesm2022/ng-doc-app-texts-fr.mjs.map +1 -0
- package/fesm2022/ng-doc-app-texts-hi.mjs +219 -0
- package/fesm2022/ng-doc-app-texts-hi.mjs.map +1 -0
- package/fesm2022/ng-doc-app-texts-ja.mjs +205 -0
- package/fesm2022/ng-doc-app-texts-ja.mjs.map +1 -0
- package/fesm2022/ng-doc-app-texts-ko.mjs +205 -0
- package/fesm2022/ng-doc-app-texts-ko.mjs.map +1 -0
- package/fesm2022/ng-doc-app-texts-pt-br.mjs +205 -0
- package/fesm2022/ng-doc-app-texts-pt-br.mjs.map +1 -0
- package/fesm2022/ng-doc-app-texts-ru.mjs +231 -0
- package/fesm2022/ng-doc-app-texts-ru.mjs.map +1 -0
- package/fesm2022/ng-doc-app-texts-uk.mjs +231 -0
- package/fesm2022/ng-doc-app-texts-uk.mjs.map +1 -0
- package/fesm2022/ng-doc-app-texts-zh.mjs +205 -0
- package/fesm2022/ng-doc-app-texts-zh.mjs.map +1 -0
- package/fesm2022/ng-doc-app-tokens.mjs +214 -1
- package/fesm2022/ng-doc-app-tokens.mjs.map +1 -1
- package/fesm2022/ng-doc-app-type-controls-json-control.mjs +90 -0
- package/fesm2022/ng-doc-app-type-controls-json-control.mjs.map +1 -0
- package/fesm2022/ng-doc-app-type-controls-list-control.mjs +792 -0
- package/fesm2022/ng-doc-app-type-controls-list-control.mjs.map +1 -0
- package/fesm2022/ng-doc-app-type-controls-type-alias-control.mjs +45 -8
- package/fesm2022/ng-doc-app-type-controls-type-alias-control.mjs.map +1 -1
- package/fesm2022/ng-doc-app-type-controls.mjs +2 -0
- package/fesm2022/ng-doc-app-type-controls.mjs.map +1 -1
- package/package.json +73 -4
- package/styles/global.css +4 -0
- package/styles/main.css +4 -0
- package/styles/themes/dark.css +10 -0
- package/types/ng-doc-app-classes-default-search-engine.d.ts +11 -0
- package/types/ng-doc-app-classes-root-page.d.ts +13 -0
- package/types/ng-doc-app-components-api-list.d.ts +3 -1
- package/types/ng-doc-app-components-breadcrumb.d.ts +2 -1
- package/types/ng-doc-app-components-code.d.ts +2 -0
- package/types/ng-doc-app-components-command-palette.d.ts +3 -1
- package/types/ng-doc-app-components-copy-button.d.ts +3 -1
- package/types/ng-doc-app-components-demo-displayer.d.ts +13 -1
- package/types/ng-doc-app-components-demo-frame.d.ts +107 -0
- package/types/ng-doc-app-components-demo.d.ts +47 -10
- package/types/ng-doc-app-components-fullscreen-button.d.ts +2 -0
- package/types/ng-doc-app-components-fullscreen-toggle.d.ts +2 -0
- package/types/ng-doc-app-components-heading-anchor.d.ts +2 -0
- package/types/ng-doc-app-components-image-viewer.d.ts +2 -0
- package/types/ng-doc-app-components-navbar.d.ts +2 -0
- package/types/ng-doc-app-components-page-navigation.d.ts +2 -1
- package/types/ng-doc-app-components-page.d.ts +10 -1
- package/types/ng-doc-app-components-playground.d.ts +260 -42
- package/types/ng-doc-app-components-root.d.ts +18 -0
- package/types/ng-doc-app-components-search-result.d.ts +2 -0
- package/types/ng-doc-app-components-search.d.ts +2 -0
- package/types/ng-doc-app-components-sidebar.d.ts +2 -1
- package/types/ng-doc-app-components-tabs.d.ts +13 -3
- package/types/ng-doc-app-components-theme-toggle.d.ts +4 -1
- package/types/ng-doc-app-components-toc.d.ts +2 -1
- package/types/ng-doc-app-components.d.ts +1 -0
- package/types/ng-doc-app-constants.d.ts +11 -1
- package/types/ng-doc-app-demo-app.d.ts +297 -0
- package/types/ng-doc-app-helpers.d.ts +75 -4
- package/types/ng-doc-app-interfaces.d.ts +635 -6
- package/types/ng-doc-app-processors-processors.d.ts +5 -0
- package/types/ng-doc-app-providers-ng-doc-app.d.ts +7 -1
- package/types/ng-doc-app-providers-texts.d.ts +28 -0
- package/types/ng-doc-app-providers-title.d.ts +59 -0
- package/types/ng-doc-app-providers.d.ts +2 -0
- package/types/ng-doc-app-services-content-scroll-intent.d.ts +11 -1
- package/types/ng-doc-app-services-highlighter.d.ts +15 -6
- package/types/ng-doc-app-services-route-preloader.d.ts +13 -1
- package/types/ng-doc-app-services-shortcuts.d.ts +16 -0
- package/types/ng-doc-app-texts-ar.d.ts +13 -0
- package/types/ng-doc-app-texts-de.d.ts +12 -0
- package/types/ng-doc-app-texts-es.d.ts +12 -0
- package/types/ng-doc-app-texts-fr.d.ts +12 -0
- package/types/ng-doc-app-texts-hi.d.ts +12 -0
- package/types/ng-doc-app-texts-ja.d.ts +12 -0
- package/types/ng-doc-app-texts-ko.d.ts +12 -0
- package/types/ng-doc-app-texts-pt-br.d.ts +12 -0
- package/types/ng-doc-app-texts-ru.d.ts +12 -0
- package/types/ng-doc-app-texts-uk.d.ts +12 -0
- package/types/ng-doc-app-texts-zh.d.ts +12 -0
- package/types/ng-doc-app-tokens.d.ts +21 -2
- package/types/ng-doc-app-type-controls-json-control.d.ts +38 -0
- package/types/ng-doc-app-type-controls-list-control.d.ts +313 -0
- package/types/ng-doc-app-type-controls-type-alias-control.d.ts +28 -5
- package/types/ng-doc-app-type-controls.d.ts +2 -0
|
@@ -0,0 +1,313 @@
|
|
|
1
|
+
import * as _angular_core from '@angular/core';
|
|
2
|
+
import { Signal } from '@angular/core';
|
|
3
|
+
import { NgDocResolvedPlaygroundOption } from '@ng-doc/app/helpers';
|
|
4
|
+
import { NgDocTypeControl, NgDocPlaygroundTexts } from '@ng-doc/app/interfaces';
|
|
5
|
+
import { NgDocPlaygroundOption } from '@ng-doc/core/interfaces';
|
|
6
|
+
import { DIControl } from 'di-controls';
|
|
7
|
+
|
|
8
|
+
/** A value that an item of an array control can be. */
|
|
9
|
+
type NgDocListControlItem = string | number | boolean;
|
|
10
|
+
/** A row of the dropdown of an array control. */
|
|
11
|
+
interface NgDocListControlRow<T> {
|
|
12
|
+
/** `add` for the row that adds the typed text, `item` for a suggestion or a value of a union. */
|
|
13
|
+
kind: 'add' | 'item';
|
|
14
|
+
/** The value that the row adds. */
|
|
15
|
+
value: T;
|
|
16
|
+
/** The text of the value. */
|
|
17
|
+
label: string;
|
|
18
|
+
/** Whether the array holds the value: a picked value of a union. */
|
|
19
|
+
selected: boolean;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* The base of the playground controls of array inputs: a chip combobox. The items are chips, in
|
|
23
|
+
* one field with a text field after them. Enter adds the typed value, Backspace in the empty field
|
|
24
|
+
* removes the last chip, and the × of a chip removes it. A chip is dragged to another place, or
|
|
25
|
+
* moved with Alt+Left and Alt+Right while it is focused, and the arrow keys move between chips.
|
|
26
|
+
* While the reader types, a dropdown lists the matching suggestions; the arrow keys move its
|
|
27
|
+
* highlight, and Enter or a click picks a row. Escape closes it.
|
|
28
|
+
*
|
|
29
|
+
* Subclasses decide what an item is: typed text (`parseItem`) for the arrays of strings and
|
|
30
|
+
* numbers, which suggest the input's default items and the items removed while the control is
|
|
31
|
+
* shown, or the values of a union, which the dropdown lists (`NgDocTypeAliasListControlComponent`).
|
|
32
|
+
*
|
|
33
|
+
* The control never changes an array it received: every edit reports a new array of plain values,
|
|
34
|
+
* so the value can be compared with the default and sent to an isolated demo as it is. An
|
|
35
|
+
* `undefined` or `null` value has no items and shows as such; the first added item makes it an
|
|
36
|
+
* array, and removing the last item leaves an empty array. Reset returns to the input's default,
|
|
37
|
+
* which is how an optional input gets back to `undefined`.
|
|
38
|
+
*/
|
|
39
|
+
declare abstract class NgDocListControl<T extends NgDocListControlItem> extends DIControl<T[] | undefined> implements NgDocTypeControl<T[] | undefined> {
|
|
40
|
+
/** Default value of the input; Reset returns to it. */
|
|
41
|
+
readonly default: _angular_core.InputSignal<T[] | undefined>;
|
|
42
|
+
/**
|
|
43
|
+
* Whether typed text becomes an item (`parseItem`). Without it, the dropdown lists the values the
|
|
44
|
+
* items can have, and a value is in the array at most once.
|
|
45
|
+
*/
|
|
46
|
+
protected abstract readonly freeText: boolean;
|
|
47
|
+
protected readonly texts: NgDocPlaygroundTexts;
|
|
48
|
+
/** The prefix of the IDs of the parts of the control. */
|
|
49
|
+
protected readonly id: string;
|
|
50
|
+
/** The items of the value; none when the value is not an array. */
|
|
51
|
+
protected readonly items: Signal<readonly T[]>;
|
|
52
|
+
/** The items as the chips show them: in the order of a drag in progress. */
|
|
53
|
+
protected readonly shownItems: Signal<readonly T[]>;
|
|
54
|
+
/**
|
|
55
|
+
* The text shown instead of the items when the value is not an array (`undefined` or `null`), or
|
|
56
|
+
* is an empty array (`[]`), so that the two can be told apart. These are code, not words.
|
|
57
|
+
*/
|
|
58
|
+
protected readonly literal: Signal<string>;
|
|
59
|
+
/** Whether Reset is shown: the value differs from the default. */
|
|
60
|
+
protected readonly canReset: Signal<boolean>;
|
|
61
|
+
/** The text of the text field. */
|
|
62
|
+
protected readonly text: _angular_core.WritableSignal<string>;
|
|
63
|
+
/** Whether the reader asked for the dropdown, by typing, clicking or an arrow key. */
|
|
64
|
+
protected readonly expanded: _angular_core.WritableSignal<boolean>;
|
|
65
|
+
/** The position of the highlighted row of the dropdown, or `-1`. */
|
|
66
|
+
protected readonly highlighted: _angular_core.WritableSignal<number>;
|
|
67
|
+
/** The position of the item edited in place, or `null`. */
|
|
68
|
+
protected readonly editing: _angular_core.WritableSignal<number | null>;
|
|
69
|
+
/** The text of the field that edits an item in place. */
|
|
70
|
+
protected readonly editText: _angular_core.WritableSignal<string>;
|
|
71
|
+
/** The position of the chip in the tab order; the others are reached with the arrow keys. */
|
|
72
|
+
protected readonly tabStop: _angular_core.WritableSignal<number>;
|
|
73
|
+
/** The position of the chip being dragged, or `null`. */
|
|
74
|
+
protected readonly dragIndex: _angular_core.WritableSignal<number | null>;
|
|
75
|
+
/** What the live region announces: the new position of a moved item. */
|
|
76
|
+
protected readonly announcement: _angular_core.WritableSignal<string>;
|
|
77
|
+
/** The width of the dropdown: the width of the field. */
|
|
78
|
+
protected readonly panelWidth: _angular_core.WritableSignal<number>;
|
|
79
|
+
/** Whether the text field holds text that is not an item, such as a word in a `number[]`. */
|
|
80
|
+
protected readonly invalid: Signal<boolean>;
|
|
81
|
+
/** Whether the field that edits an item holds text that is not an item. */
|
|
82
|
+
protected readonly editInvalid: Signal<boolean>;
|
|
83
|
+
/**
|
|
84
|
+
* The rows of the dropdown: the values of `candidates()` whose text contains the typed text (the
|
|
85
|
+
* one equal to it first), and, when the typed text is an item that no row adds, a row that adds
|
|
86
|
+
* it, first.
|
|
87
|
+
*/
|
|
88
|
+
protected readonly rows: Signal<Array<NgDocListControlRow<T>>>;
|
|
89
|
+
/**
|
|
90
|
+
* Whether the dropdown is open: the reader asked for it and it has rows, or, for a union, says
|
|
91
|
+
* that no value matches the typed text.
|
|
92
|
+
*/
|
|
93
|
+
protected readonly panelOpen: Signal<boolean>;
|
|
94
|
+
/** The items removed while the control is shown, which the arrays of strings and numbers suggest. */
|
|
95
|
+
private readonly removed;
|
|
96
|
+
private readonly injector;
|
|
97
|
+
private readonly dropdown;
|
|
98
|
+
private readonly fieldBox;
|
|
99
|
+
/** The items in the order of a drag in progress, or `null`. */
|
|
100
|
+
private readonly dragOrder;
|
|
101
|
+
private drag;
|
|
102
|
+
/** The last array the control reported, which the form writes back. */
|
|
103
|
+
private reported;
|
|
104
|
+
protected constructor();
|
|
105
|
+
/**
|
|
106
|
+
* Reads typed text as an item.
|
|
107
|
+
* @param text - The text.
|
|
108
|
+
* @returns The item, or `undefined` when the text is not one.
|
|
109
|
+
*/
|
|
110
|
+
protected abstract parseItem(text: string): T | undefined;
|
|
111
|
+
/**
|
|
112
|
+
* The values that the dropdown can list, before the typed text filters them: for an array of
|
|
113
|
+
* strings or numbers, the items of the default and the removed items that the array doesn't
|
|
114
|
+
* hold. Plain arrays may hold an item twice, so typed text that is an item is added again, but
|
|
115
|
+
* the suggestions never repeat an item.
|
|
116
|
+
*/
|
|
117
|
+
protected candidates(): readonly T[];
|
|
118
|
+
/**
|
|
119
|
+
* The text of an item.
|
|
120
|
+
* @param item - The item.
|
|
121
|
+
*/
|
|
122
|
+
protected labelOf(item: T): string;
|
|
123
|
+
/**
|
|
124
|
+
* The text of a chip: the item's text, or `""` for an empty string.
|
|
125
|
+
* @param item - The item.
|
|
126
|
+
*/
|
|
127
|
+
protected chipText(item: T): string;
|
|
128
|
+
/**
|
|
129
|
+
* Reads the text field as the reader types.
|
|
130
|
+
* @param text - The text of the field.
|
|
131
|
+
*/
|
|
132
|
+
protected type(text: string): void;
|
|
133
|
+
/**
|
|
134
|
+
* Handles the keys of the text field.
|
|
135
|
+
* @param event - The key event.
|
|
136
|
+
* @param field - The text field.
|
|
137
|
+
*/
|
|
138
|
+
protected fieldKeydown(event: KeyboardEvent, field: HTMLInputElement): void;
|
|
139
|
+
/**
|
|
140
|
+
* Opens the dropdown when the reader clicks the field, and focuses the text field when the click
|
|
141
|
+
* is not on a chip or a button.
|
|
142
|
+
* @param event - The click.
|
|
143
|
+
* @param field - The text field.
|
|
144
|
+
*/
|
|
145
|
+
protected fieldClick(event: MouseEvent, field: HTMLInputElement): void;
|
|
146
|
+
/**
|
|
147
|
+
* Picks a row of the dropdown: adds its value, or removes a picked value of a union.
|
|
148
|
+
* @param row - The row.
|
|
149
|
+
*/
|
|
150
|
+
protected pick(row: NgDocListControlRow<T>): void;
|
|
151
|
+
/**
|
|
152
|
+
* Handles the keys of a focused chip.
|
|
153
|
+
* @param event - The key event.
|
|
154
|
+
* @param index - The position of the chip.
|
|
155
|
+
*/
|
|
156
|
+
protected chipKeydown(event: KeyboardEvent, index: number): void;
|
|
157
|
+
/**
|
|
158
|
+
* Removes an item. The focus goes to the chip that takes its place, the previous chip, or the
|
|
159
|
+
* text field when the field had it, or no chip is left.
|
|
160
|
+
* @param index - The position of the item.
|
|
161
|
+
* @param focus - Whether the focus moves; a pick in the dropdown keeps it in the text field.
|
|
162
|
+
*/
|
|
163
|
+
protected remove(index: number, focus?: boolean): void;
|
|
164
|
+
/**
|
|
165
|
+
* Edits an item in place: its chip becomes a text field.
|
|
166
|
+
* @param index - The position of the item.
|
|
167
|
+
*/
|
|
168
|
+
protected startEdit(index: number): void;
|
|
169
|
+
/**
|
|
170
|
+
* Handles the keys of the field that edits an item: Enter keeps the text, Escape the item.
|
|
171
|
+
* @param event - The key event.
|
|
172
|
+
*/
|
|
173
|
+
protected editKeydown(event: KeyboardEvent): void;
|
|
174
|
+
/** Ends an edit when its field loses the focus: with the text when it is an item. */
|
|
175
|
+
protected editBlur(): void;
|
|
176
|
+
/**
|
|
177
|
+
* Starts to follow a pointer that went down on a chip.
|
|
178
|
+
* @param event - The pointer event.
|
|
179
|
+
* @param index - The position of the chip.
|
|
180
|
+
*/
|
|
181
|
+
protected chipPointerDown(event: PointerEvent, index: number): void;
|
|
182
|
+
/**
|
|
183
|
+
* Drags the chip once the pointer has moved far enough, and moves it in front of or behind the
|
|
184
|
+
* chip under the pointer once the pointer passes that chip's middle.
|
|
185
|
+
* @param event - The pointer event.
|
|
186
|
+
*/
|
|
187
|
+
protected chipPointerMove(event: PointerEvent): void;
|
|
188
|
+
/**
|
|
189
|
+
* Drops a dragged chip: the items take the order of the drag.
|
|
190
|
+
* @param event - The pointer event.
|
|
191
|
+
*/
|
|
192
|
+
protected chipPointerUp(event: PointerEvent): void;
|
|
193
|
+
/** Stops following the pointer; a drag in progress leaves the items as they were. */
|
|
194
|
+
protected cancelDrag(): void;
|
|
195
|
+
/**
|
|
196
|
+
* Closes the dropdown and marks the control as touched when the focus leaves the control.
|
|
197
|
+
* @param event - The focus event.
|
|
198
|
+
*/
|
|
199
|
+
protected leave(event: FocusEvent): void;
|
|
200
|
+
/** Sets the value back to the default of the input. */
|
|
201
|
+
protected reset(): void;
|
|
202
|
+
/**
|
|
203
|
+
* The ID of a row of the dropdown, which the text field names as its active descendant.
|
|
204
|
+
* @param index - The position of the row.
|
|
205
|
+
*/
|
|
206
|
+
protected rowId(index: number): string;
|
|
207
|
+
/**
|
|
208
|
+
* Adds an item at the end.
|
|
209
|
+
* @param value - The item.
|
|
210
|
+
*/
|
|
211
|
+
private add;
|
|
212
|
+
/** Adds the highlighted row, or the typed text when it is an item. */
|
|
213
|
+
private enter;
|
|
214
|
+
/**
|
|
215
|
+
* Moves the highlight of the dropdown, and opens it.
|
|
216
|
+
* @param step - `1` for the next row, `-1` for the previous one.
|
|
217
|
+
*/
|
|
218
|
+
private moveHighlight;
|
|
219
|
+
/**
|
|
220
|
+
* Moves an item one place, with the focus.
|
|
221
|
+
* @param index - The position of the item.
|
|
222
|
+
* @param offset - `-1` toward the start, `1` toward the end.
|
|
223
|
+
*/
|
|
224
|
+
private move;
|
|
225
|
+
/**
|
|
226
|
+
* Sets the edited item from the text of its field.
|
|
227
|
+
* @returns Whether the text is an item.
|
|
228
|
+
*/
|
|
229
|
+
private commitEdit;
|
|
230
|
+
/**
|
|
231
|
+
* The position a dragged chip moves to: the position of the chip under the pointer, once the
|
|
232
|
+
* pointer has passed its middle in the direction of the move.
|
|
233
|
+
* @param event - The pointer event.
|
|
234
|
+
* @param from - The position of the dragged chip.
|
|
235
|
+
*/
|
|
236
|
+
private dropTarget;
|
|
237
|
+
/**
|
|
238
|
+
* Reports a new value.
|
|
239
|
+
* @param value - The value.
|
|
240
|
+
*/
|
|
241
|
+
private report;
|
|
242
|
+
/**
|
|
243
|
+
* Announces the new position of a moved item.
|
|
244
|
+
* @param order - The items after the move.
|
|
245
|
+
* @param index - The new position of the item.
|
|
246
|
+
*/
|
|
247
|
+
private announceMove;
|
|
248
|
+
/**
|
|
249
|
+
* Focuses a chip once the chips have rendered: they are tracked by position, so the focused
|
|
250
|
+
* element may show another item, or be gone.
|
|
251
|
+
* @param index - The position of the chip.
|
|
252
|
+
*/
|
|
253
|
+
private focusChip;
|
|
254
|
+
/** Focuses the text field once the chips have rendered. */
|
|
255
|
+
private focusField;
|
|
256
|
+
private fieldElement;
|
|
257
|
+
private isFocused;
|
|
258
|
+
/** Whether the chips flow from right to left, which turns the arrow keys round. */
|
|
259
|
+
private isRtl;
|
|
260
|
+
private host;
|
|
261
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<NgDocListControl<any>, never>;
|
|
262
|
+
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<NgDocListControl<any>, never, never, { "default": { "alias": "default"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
263
|
+
}
|
|
264
|
+
/**
|
|
265
|
+
* The playground control of `string[]` inputs: a chip combobox (`NgDocListControl`). Typed text is
|
|
266
|
+
* an item as it is, and a double click, Enter or F2 edits a chip in place.
|
|
267
|
+
*/
|
|
268
|
+
declare class NgDocStringListControlComponent extends NgDocListControl<string> {
|
|
269
|
+
protected readonly freeText = true;
|
|
270
|
+
constructor();
|
|
271
|
+
protected parseItem(text: string): string;
|
|
272
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<NgDocStringListControlComponent, never>;
|
|
273
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<NgDocStringListControlComponent, "ng-doc-string-list-control", never, {}, {}, never, never, true, never>;
|
|
274
|
+
}
|
|
275
|
+
/**
|
|
276
|
+
* The playground control of `number[]` inputs: a chip combobox (`NgDocListControl`) whose items are
|
|
277
|
+
* numbers. Text that is not a number marks the field as invalid and adds nothing; a chip edited to
|
|
278
|
+
* such text keeps its number.
|
|
279
|
+
*/
|
|
280
|
+
declare class NgDocNumberListControlComponent extends NgDocListControl<number> {
|
|
281
|
+
protected readonly freeText = true;
|
|
282
|
+
constructor();
|
|
283
|
+
protected parseItem(text: string): number | undefined;
|
|
284
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<NgDocNumberListControlComponent, never>;
|
|
285
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<NgDocNumberListControlComponent, "ng-doc-number-list-control", never, {}, {}, never, never, true, never>;
|
|
286
|
+
}
|
|
287
|
+
/**
|
|
288
|
+
* The playground control of arrays of a union of literals, such as `NgDocSize[]` or
|
|
289
|
+
* `('a' | 'b')[]`: a chip combobox (`NgDocListControl`) whose dropdown lists every value of the
|
|
290
|
+
* union, with the same texts as the control of the union (`NgDocTypeAliasControlComponent`).
|
|
291
|
+
* Picking a value adds it, and picking a value that the array holds, which is marked, removes it.
|
|
292
|
+
* The typed text filters the values; it is never an item itself.
|
|
293
|
+
*/
|
|
294
|
+
declare class NgDocTypeAliasListControlComponent extends NgDocListControl<NgDocListControlItem> {
|
|
295
|
+
/**
|
|
296
|
+
* The values of the items: the members of the union as written in code, plain values when
|
|
297
|
+
* `isManual` is set, or the names and values of enum members.
|
|
298
|
+
*/
|
|
299
|
+
readonly options: _angular_core.InputSignal<(string | NgDocPlaygroundOption)[] | undefined>;
|
|
300
|
+
/** Whether `options` are values the user listed in the playground config. */
|
|
301
|
+
readonly isManual: _angular_core.InputSignal<boolean | undefined>;
|
|
302
|
+
protected readonly freeText = false;
|
|
303
|
+
/** The values of the union that an item can be; `undefined`, `null` and repeats are left out. */
|
|
304
|
+
protected readonly values: Signal<NgDocResolvedPlaygroundOption[]>;
|
|
305
|
+
constructor();
|
|
306
|
+
protected candidates(): readonly NgDocListControlItem[];
|
|
307
|
+
protected labelOf(item: NgDocListControlItem): string;
|
|
308
|
+
protected parseItem(): undefined;
|
|
309
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<NgDocTypeAliasListControlComponent, never>;
|
|
310
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<NgDocTypeAliasListControlComponent, "ng-doc-type-alias-list-control", never, { "options": { "alias": "options"; "required": false; "isSignal": true; }; "isManual": { "alias": "isManual"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
export { NgDocListControl, NgDocNumberListControlComponent, NgDocStringListControlComponent, NgDocTypeAliasListControlComponent };
|
|
@@ -1,20 +1,43 @@
|
|
|
1
1
|
import * as _angular_core from '@angular/core';
|
|
2
|
-
import {
|
|
2
|
+
import { Signal } from '@angular/core';
|
|
3
|
+
import { NgDocResolvedPlaygroundOption } from '@ng-doc/app/helpers';
|
|
4
|
+
import { NgDocTypeControl, NgDocPlaygroundTexts } from '@ng-doc/app/interfaces';
|
|
5
|
+
import { NgDocPlaygroundOption } from '@ng-doc/core/interfaces';
|
|
3
6
|
import { DIControl } from 'di-controls';
|
|
4
7
|
|
|
5
8
|
/**
|
|
6
|
-
* The playground control of union type aliases: a select that shows the value
|
|
7
|
-
* the default. The inspector shows the value type under
|
|
9
|
+
* The playground control of union type aliases and enums: a select that shows the value (or the
|
|
10
|
+
* name of an enum member) and whether it is the default. The inspector shows the value type under
|
|
11
|
+
* the input's name.
|
|
8
12
|
*/
|
|
9
13
|
declare class NgDocTypeAliasControlComponent<T> extends DIControl<T> implements NgDocTypeControl<T> {
|
|
14
|
+
protected readonly texts: NgDocPlaygroundTexts;
|
|
10
15
|
/** Default value of the input; clearing the selection returns to it. */
|
|
11
16
|
readonly default: _angular_core.InputSignal<T | undefined>;
|
|
12
|
-
/**
|
|
13
|
-
|
|
17
|
+
/**
|
|
18
|
+
* Values the input accepts: literal source text, plain values when `isManual` is set, or the
|
|
19
|
+
* names and values of enum members.
|
|
20
|
+
*/
|
|
21
|
+
readonly options: _angular_core.InputSignal<(string | NgDocPlaygroundOption)[] | undefined>;
|
|
14
22
|
/** Whether `options` are values the user listed in the playground config. */
|
|
15
23
|
readonly isManual: _angular_core.InputSignal<boolean | undefined>;
|
|
24
|
+
/**
|
|
25
|
+
* The options of the select. `undefined` and `null` get no option: clearing the selection
|
|
26
|
+
* returns to the default value instead.
|
|
27
|
+
*/
|
|
28
|
+
protected readonly items: Signal<NgDocResolvedPlaygroundOption[]>;
|
|
16
29
|
constructor();
|
|
17
30
|
typeOf(value: unknown): string;
|
|
31
|
+
/**
|
|
32
|
+
* The text of a value: the name of its option, such as the name of an enum member.
|
|
33
|
+
* @param value - A value of the input.
|
|
34
|
+
*/
|
|
35
|
+
labelOf(value: unknown): string;
|
|
36
|
+
/**
|
|
37
|
+
* Whether the reset button is shown: a value other than the default is selected.
|
|
38
|
+
* @param value - The selected value.
|
|
39
|
+
*/
|
|
40
|
+
protected canReset(value: T | null): boolean;
|
|
18
41
|
changeModel(value: T | null): void;
|
|
19
42
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<NgDocTypeAliasControlComponent<any>, never>;
|
|
20
43
|
static ɵcmp: _angular_core.ɵɵComponentDeclaration<NgDocTypeAliasControlComponent<any>, "ng-doc-type-alias-control", never, { "default": { "alias": "default"; "required": false; "isSignal": true; }; "options": { "alias": "options"; "required": false; "isSignal": true; }; "isManual": { "alias": "isManual"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
export * from '@ng-doc/app/type-controls/boolean-control';
|
|
2
|
+
export * from '@ng-doc/app/type-controls/json-control';
|
|
3
|
+
export * from '@ng-doc/app/type-controls/list-control';
|
|
2
4
|
export * from '@ng-doc/app/type-controls/number-control';
|
|
3
5
|
export * from '@ng-doc/app/type-controls/string-control';
|
|
4
6
|
export * from '@ng-doc/app/type-controls/type-alias-control';
|