@ngneers/controls 0.0.1-next.1 → 0.0.1-next.2
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/fesm2022/ngneers-controls-api-ng.mjs +11 -18
- package/fesm2022/ngneers-controls-api-ng.mjs.map +1 -1
- package/fesm2022/ngneers-controls-badge.mjs +160 -0
- package/fesm2022/ngneers-controls-badge.mjs.map +1 -0
- package/fesm2022/ngneers-controls-base.mjs +85 -8
- package/fesm2022/ngneers-controls-base.mjs.map +1 -1
- package/fesm2022/{ngneers-controls-calendar-time-CJT5AFlA.mjs → ngneers-controls-calendar-time-paM6WVpV.mjs} +2 -2
- package/fesm2022/{ngneers-controls-calendar-time-CJT5AFlA.mjs.map → ngneers-controls-calendar-time-paM6WVpV.mjs.map} +1 -1
- package/fesm2022/ngneers-controls-calendar.mjs +13 -6
- package/fesm2022/ngneers-controls-calendar.mjs.map +1 -1
- package/fesm2022/ngneers-controls-checkbox.mjs +3 -3
- package/fesm2022/ngneers-controls-checkbox.mjs.map +1 -1
- package/fesm2022/ngneers-controls-color-picker.mjs +336 -0
- package/fesm2022/ngneers-controls-color-picker.mjs.map +1 -0
- package/fesm2022/ngneers-controls-default-icons.mjs +5 -0
- package/fesm2022/ngneers-controls-default-icons.mjs.map +1 -1
- package/fesm2022/ngneers-controls-directives.mjs +64 -7
- package/fesm2022/ngneers-controls-directives.mjs.map +1 -1
- package/fesm2022/ngneers-controls-edit-inplace.mjs +15 -5
- package/fesm2022/ngneers-controls-edit-inplace.mjs.map +1 -1
- package/fesm2022/ngneers-controls-errors.mjs +203 -148
- package/fesm2022/ngneers-controls-errors.mjs.map +1 -1
- package/fesm2022/ngneers-controls-filter.mjs +2 -2
- package/fesm2022/ngneers-controls-filter.mjs.map +1 -1
- package/fesm2022/ngneers-controls-hint.mjs +18 -1
- package/fesm2022/ngneers-controls-hint.mjs.map +1 -1
- package/fesm2022/ngneers-controls-i18n-translations-de.mjs +14 -0
- package/fesm2022/ngneers-controls-i18n-translations-de.mjs.map +1 -1
- package/fesm2022/ngneers-controls-i18n-translations-en.mjs +16 -0
- package/fesm2022/ngneers-controls-i18n-translations-en.mjs.map +1 -1
- package/fesm2022/ngneers-controls-icon.mjs +23 -6
- package/fesm2022/ngneers-controls-icon.mjs.map +1 -1
- package/fesm2022/ngneers-controls-input-field.mjs +18 -2
- package/fesm2022/ngneers-controls-input-field.mjs.map +1 -1
- package/fesm2022/ngneers-controls-input.mjs +49 -9
- package/fesm2022/ngneers-controls-input.mjs.map +1 -1
- package/fesm2022/ngneers-controls-list-box.mjs +2 -2
- package/fesm2022/ngneers-controls-list-box.mjs.map +1 -1
- package/fesm2022/ngneers-controls-mask-input.mjs +4 -1
- package/fesm2022/ngneers-controls-mask-input.mjs.map +1 -1
- package/fesm2022/ngneers-controls-number-input.mjs +4 -4
- package/fesm2022/ngneers-controls-number-input.mjs.map +1 -1
- package/fesm2022/ngneers-controls-otp.mjs +16 -4
- package/fesm2022/ngneers-controls-otp.mjs.map +1 -1
- package/fesm2022/ngneers-controls-paginator.mjs +36 -9
- package/fesm2022/ngneers-controls-paginator.mjs.map +1 -1
- package/fesm2022/ngneers-controls-radio.mjs +4 -4
- package/fesm2022/ngneers-controls-radio.mjs.map +1 -1
- package/fesm2022/ngneers-controls-rating.mjs +180 -0
- package/fesm2022/ngneers-controls-rating.mjs.map +1 -0
- package/fesm2022/ngneers-controls-scroll-shadow.mjs +33 -7
- package/fesm2022/ngneers-controls-scroll-shadow.mjs.map +1 -1
- package/fesm2022/ngneers-controls-scroller.mjs +4 -2
- package/fesm2022/ngneers-controls-scroller.mjs.map +1 -1
- package/fesm2022/ngneers-controls-select-button.mjs +2 -1
- package/fesm2022/ngneers-controls-select-button.mjs.map +1 -1
- package/fesm2022/ngneers-controls-select.mjs +24 -4
- package/fesm2022/ngneers-controls-select.mjs.map +1 -1
- package/fesm2022/ngneers-controls-slider.mjs +3 -3
- package/fesm2022/ngneers-controls-slider.mjs.map +1 -1
- package/fesm2022/ngneers-controls-stepper.mjs +142 -0
- package/fesm2022/ngneers-controls-stepper.mjs.map +1 -0
- package/fesm2022/ngneers-controls-switch.mjs +3 -3
- package/fesm2022/ngneers-controls-switch.mjs.map +1 -1
- package/fesm2022/ngneers-controls-table.mjs +282 -15
- package/fesm2022/ngneers-controls-table.mjs.map +1 -1
- package/fesm2022/ngneers-controls-tabs.mjs +2 -2
- package/fesm2022/ngneers-controls-tabs.mjs.map +1 -1
- package/fesm2022/ngneers-controls-toggle-button.mjs +3 -3
- package/fesm2022/ngneers-controls-toggle-button.mjs.map +1 -1
- package/fesm2022/ngneers-controls-tooltip.mjs +16 -28
- package/fesm2022/ngneers-controls-tooltip.mjs.map +1 -1
- package/fesm2022/ngneers-controls-tree.mjs +2 -2
- package/fesm2022/ngneers-controls-tree.mjs.map +1 -1
- package/fesm2022/ngneers-controls-utils.mjs +138 -1
- package/fesm2022/ngneers-controls-utils.mjs.map +1 -1
- package/package.json +18 -2
- package/types/ngneers-controls-api-ng.d.ts +12 -9
- package/types/ngneers-controls-badge.d.ts +67 -0
- package/types/ngneers-controls-base.d.ts +61 -4
- package/types/ngneers-controls-breadcrumb.d.ts +14 -0
- package/types/ngneers-controls-calendar.d.ts +21 -6
- package/types/ngneers-controls-chip.d.ts +14 -0
- package/types/ngneers-controls-color-picker.d.ts +119 -0
- package/types/ngneers-controls-dialog.d.ts +14 -0
- package/types/ngneers-controls-directives.d.ts +31 -2
- package/types/ngneers-controls-drawer.d.ts +14 -0
- package/types/ngneers-controls-edit-inplace.d.ts +20 -0
- package/types/ngneers-controls-errors.d.ts +105 -16
- package/types/ngneers-controls-filter.d.ts +27 -13
- package/types/ngneers-controls-hint.d.ts +8 -1
- package/types/ngneers-controls-i18n-translations-de.d.ts +14 -0
- package/types/ngneers-controls-i18n-translations-en.d.ts +14 -0
- package/types/ngneers-controls-i18n.d.ts +14 -0
- package/types/ngneers-controls-icon.d.ts +2 -2
- package/types/ngneers-controls-input-field.d.ts +25 -2
- package/types/ngneers-controls-input.d.ts +35 -3
- package/types/ngneers-controls-list-box.d.ts +14 -0
- package/types/ngneers-controls-mask-input.d.ts +14 -0
- package/types/ngneers-controls-otp.d.ts +19 -0
- package/types/ngneers-controls-paginator.d.ts +31 -3
- package/types/ngneers-controls-rating.d.ts +69 -0
- package/types/ngneers-controls-scroll-shadow.d.ts +11 -2
- package/types/ngneers-controls-scroller.d.ts +3 -1
- package/types/ngneers-controls-select.d.ts +27 -3
- package/types/ngneers-controls-snackbar.d.ts +14 -0
- package/types/ngneers-controls-splitter.d.ts +14 -0
- package/types/ngneers-controls-state.d.ts +2 -2
- package/types/ngneers-controls-stepper.d.ts +68 -0
- package/types/ngneers-controls-table.d.ts +273 -169
- package/types/ngneers-controls-toast.d.ts +14 -0
- package/types/ngneers-controls-tooltip.d.ts +0 -1
- package/types/ngneers-controls-tree.d.ts +14 -0
- package/types/ngneers-controls-upload.d.ts +14 -0
- package/types/ngneers-controls-utils.d.ts +27 -2
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { input, booleanAttribute, model, contentChild, Component, contentChildren, viewChildren, computed, effect } from '@angular/core';
|
|
3
|
+
import { NgnBase, provideSelf, NgnPt } from '@ngneers/controls/base';
|
|
4
|
+
import { NgnDefer } from '@ngneers/controls/defer';
|
|
5
|
+
import { NgnIcon } from '@ngneers/controls/icon';
|
|
6
|
+
import { NgnRovingItem, NgnRovingGroup } from '@ngneers/controls/roving-focus';
|
|
7
|
+
import { stepperControlTemplate } from '@ngneers/controls-themes/templates/stepper';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* A single step within an `ngn-stepper`. Declares the step's header metadata and
|
|
11
|
+
* projects its content via `<ng-template #content>`.
|
|
12
|
+
* @category control
|
|
13
|
+
*/
|
|
14
|
+
class NgnStep extends NgnBase {
|
|
15
|
+
theme = null;
|
|
16
|
+
/** The step's header label. */
|
|
17
|
+
label = input('', /* @ts-ignore */
|
|
18
|
+
...(ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []));
|
|
19
|
+
/** Custom marker icon; when unset the 1-based step number is shown. */
|
|
20
|
+
iconStep = input(/* @ts-ignore */
|
|
21
|
+
...(ngDevMode ? [undefined, { debugName: "iconStep" }] : /* istanbul ignore next */ []));
|
|
22
|
+
/** Marks the step optional (shown as a hint; skippable in linear mode). @default false */
|
|
23
|
+
optional = input(false, { ...(ngDevMode ? { debugName: "optional" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
24
|
+
/** Disables navigation to this step. @default false */
|
|
25
|
+
disabled = input(false, { ...(ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
26
|
+
/** Renders the step's marker in an error state. @default false */
|
|
27
|
+
error = input(false, { ...(ngDevMode ? { debugName: "error" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
28
|
+
/**
|
|
29
|
+
* Whether the step is complete. The app sets this; in linear mode it gates
|
|
30
|
+
* forward navigation past this step. @default false
|
|
31
|
+
*/
|
|
32
|
+
completed = model(false, /* @ts-ignore */
|
|
33
|
+
...(ngDevMode ? [{ debugName: "completed" }] : /* istanbul ignore next */ []));
|
|
34
|
+
content = contentChild('content', /* @ts-ignore */
|
|
35
|
+
...(ngDevMode ? [{ debugName: "content" }] : /* istanbul ignore next */ []));
|
|
36
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: NgnStep, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
37
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "22.0.5", type: NgnStep, isStandalone: true, selector: "ngn-step", inputs: { label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, iconStep: { classPropertyName: "iconStep", publicName: "iconStep", isSignal: true, isRequired: false, transformFunction: null }, optional: { classPropertyName: "optional", publicName: "optional", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, error: { classPropertyName: "error", publicName: "error", isSignal: true, isRequired: false, transformFunction: null }, completed: { classPropertyName: "completed", publicName: "completed", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { completed: "completedChange" }, providers: [provideSelf(NgnStep)], queries: [{ propertyName: "content", first: true, predicate: ["content"], descendants: true, isSignal: true }], usesInheritance: true, ngImport: i0, template: '', isInline: true });
|
|
38
|
+
}
|
|
39
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: NgnStep, decorators: [{
|
|
40
|
+
type: Component,
|
|
41
|
+
args: [{
|
|
42
|
+
selector: 'ngn-step',
|
|
43
|
+
template: '',
|
|
44
|
+
providers: [provideSelf(NgnStep)],
|
|
45
|
+
}]
|
|
46
|
+
}], propDecorators: { label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], iconStep: [{ type: i0.Input, args: [{ isSignal: true, alias: "iconStep", required: false }] }], optional: [{ type: i0.Input, args: [{ isSignal: true, alias: "optional", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], error: [{ type: i0.Input, args: [{ isSignal: true, alias: "error", required: false }] }], completed: [{ type: i0.Input, args: [{ isSignal: true, alias: "completed", required: false }] }, { type: i0.Output, args: ["completedChange"] }], content: [{ type: i0.ContentChild, args: ['content', { isSignal: true }] }] } });
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* @category control
|
|
50
|
+
*/
|
|
51
|
+
class NgnStepper extends NgnBase {
|
|
52
|
+
theme = this.injectThemeTemplate(stepperControlTemplate, 'root');
|
|
53
|
+
steps = contentChildren(NgnStep, /* @ts-ignore */
|
|
54
|
+
...(ngDevMode ? [{ debugName: "steps" }] : /* istanbul ignore next */ []));
|
|
55
|
+
/** The header buttons' roving items, in step order (one per step; connectors are plain spans). */
|
|
56
|
+
_rovingItems = viewChildren(NgnRovingItem, /* @ts-ignore */
|
|
57
|
+
...(ngDevMode ? [{ debugName: "_rovingItems" }] : /* istanbul ignore next */ []));
|
|
58
|
+
/** The active step index (zero-based). @default 0 */
|
|
59
|
+
active = model(0, /* @ts-ignore */
|
|
60
|
+
...(ngDevMode ? [{ debugName: "active" }] : /* istanbul ignore next */ []));
|
|
61
|
+
/** Gate forward navigation on prior steps being `completed`. @default false */
|
|
62
|
+
linear = input(false, { ...(ngDevMode ? { debugName: "linear" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
63
|
+
/** Lazily render step content (forwarded to `ngn-defer`). @default true */
|
|
64
|
+
lazy = input(true, { ...(ngDevMode ? { debugName: "lazy" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
65
|
+
/** Keep opened step content in the DOM to preserve state (forwarded to `ngn-defer`). @default true */
|
|
66
|
+
cache = input(true, { ...(ngDevMode ? { debugName: "cache" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
67
|
+
/**
|
|
68
|
+
* Index of the first step that is not yet completed (the furthest reachable in linear mode).
|
|
69
|
+
* Optional steps are exempt — an incomplete optional step never blocks forward progress.
|
|
70
|
+
*/
|
|
71
|
+
_firstIncomplete = computed(() => {
|
|
72
|
+
const steps = this.steps();
|
|
73
|
+
const idx = steps.findIndex(s => !s.completed() && !s.optional());
|
|
74
|
+
return idx === -1 ? steps.length - 1 : idx;
|
|
75
|
+
}, /* @ts-ignore */
|
|
76
|
+
...(ngDevMode ? [{ debugName: "_firstIncomplete" }] : /* istanbul ignore next */ []));
|
|
77
|
+
constructor() {
|
|
78
|
+
super();
|
|
79
|
+
// Clamp active into range when steps change.
|
|
80
|
+
effect(() => {
|
|
81
|
+
const n = this.steps().length;
|
|
82
|
+
if (n === 0) {
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
const a = this.active();
|
|
86
|
+
if (a > n - 1) {
|
|
87
|
+
this.active.set(n - 1);
|
|
88
|
+
}
|
|
89
|
+
else if (a < 0) {
|
|
90
|
+
this.active.set(0);
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
// Keep each header's roving item in sync with its step's NATIVE `disabled` input (not
|
|
94
|
+
// `canGoTo()` gating) — a merely gated step stays arrow-focusable, only a truly disabled
|
|
95
|
+
// step is skipped by keyboard navigation. Mirrors NgnButtonGroup's roving-disabled sync.
|
|
96
|
+
effect(() => {
|
|
97
|
+
const items = this._rovingItems();
|
|
98
|
+
const steps = this.steps();
|
|
99
|
+
items.forEach((item, i) => item.disabled.set(!!steps[i]?.disabled()));
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
/** Whether navigation to `index` is currently permitted. */
|
|
103
|
+
canGoTo(index) {
|
|
104
|
+
const steps = this.steps();
|
|
105
|
+
const step = steps[index];
|
|
106
|
+
if (!step || step.disabled()) {
|
|
107
|
+
return false;
|
|
108
|
+
}
|
|
109
|
+
if (!this.linear()) {
|
|
110
|
+
return true;
|
|
111
|
+
}
|
|
112
|
+
// Linear: can go backward freely, or forward up to the first incomplete step.
|
|
113
|
+
return index <= Math.max(this.active(), this._firstIncomplete());
|
|
114
|
+
}
|
|
115
|
+
goTo(index) {
|
|
116
|
+
if (this.canGoTo(index)) {
|
|
117
|
+
this.active.set(index);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
next() {
|
|
121
|
+
this.goTo(this.active() + 1);
|
|
122
|
+
}
|
|
123
|
+
previous() {
|
|
124
|
+
this.goTo(this.active() - 1);
|
|
125
|
+
}
|
|
126
|
+
onHeaderActivate(index) {
|
|
127
|
+
this.goTo(index);
|
|
128
|
+
}
|
|
129
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: NgnStepper, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
130
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.5", type: NgnStepper, isStandalone: true, selector: "ngn-stepper", inputs: { active: { classPropertyName: "active", publicName: "active", isSignal: true, isRequired: false, transformFunction: null }, linear: { classPropertyName: "linear", publicName: "linear", isSignal: true, isRequired: false, transformFunction: null }, lazy: { classPropertyName: "lazy", publicName: "lazy", isSignal: true, isRequired: false, transformFunction: null }, cache: { classPropertyName: "cache", publicName: "cache", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { active: "activeChange" }, providers: [provideSelf(NgnStepper)], queries: [{ propertyName: "steps", predicate: NgnStep, isSignal: true }], viewQueries: [{ propertyName: "_rovingItems", predicate: NgnRovingItem, descendants: true, isSignal: true }], usesInheritance: true, ngImport: i0, template: "<div ngnRovingGroup [ptInt]=\"this\" [ptClass]=\"'header'\" role=\"tablist\">\n @for (step of steps(); track $index; let i = $index; let last = $last) {\n <button\n type=\"button\"\n ngnRovingItem\n role=\"tab\"\n [attr.aria-selected]=\"i === active()\"\n [attr.aria-disabled]=\"!canGoTo(i) ? 'true' : null\"\n [disabled]=\"step.disabled()\"\n [ptInt]=\"this\"\n [ptClass]=\"{\n step: true,\n active: i === active(),\n completed: !!step.completed(),\n error: !!step.error(),\n disabled: step.disabled() || !canGoTo(i),\n }\"\n (click)=\"onHeaderActivate(i)\"\n >\n <span [ptInt]=\"this\" [ptClass]=\"'marker'\">\n @if (step.iconStep(); as icon) {\n <ngn-icon [ptInt]=\"this\" [ptClass]=\"'marker-icon'\" [icon]=\"icon\" />\n } @else if (step.completed() && i !== active()) {\n <ngn-icon [ptInt]=\"this\" [ptClass]=\"'marker-icon'\" [defaultIcon]=\"'stepper-completed'\" />\n } @else {\n <span [ptInt]=\"this\" [ptClass]=\"'marker-index'\">{{ i + 1 }}</span>\n }\n </span>\n <span [ptInt]=\"this\" [ptClass]=\"'label'\">\n {{ step.label() }}\n @if (step.optional()) {\n <span [ptInt]=\"this\" [ptClass]=\"'optional'\">(optional)</span>\n }\n </span>\n </button>\n @if (!last) {\n <span [ptInt]=\"this\" [ptClass]=\"'connector'\"></span>\n }\n }\n</div>\n\n@for (step of steps(); track $index; let i = $index) {\n <div\n role=\"tabpanel\"\n [ptInt]=\"this\"\n [ptClass]=\"{ content: i === active() }\"\n [hidden]=\"i !== active()\"\n >\n <ngn-defer\n [lazyContent]=\"step.content()\"\n [open]=\"i === active()\"\n [lazy]=\"lazy()\"\n [cache]=\"cache()\"\n />\n </div>\n}\n", dependencies: [{ kind: "directive", type: NgnPt, selector: "[ptInt]", inputs: ["ptInt", "ptClass", "ptDep"] }, { kind: "component", type: NgnDefer, selector: "ngn-defer", inputs: ["lazyContent", "lazyContentContext", "open", "lazy", "cache", "hiddenOnClosed"] }, { kind: "component", type: NgnIcon, selector: "ngn-icon", inputs: ["defaultIcon", "icon"] }, { kind: "directive", type: NgnRovingGroup, selector: "[ngnRovingGroup]", inputs: ["orientation", "rovingMode", "rovingWrap"], outputs: ["activeItemChange"], exportAs: ["ngnRovingGroup"] }, { kind: "directive", type: NgnRovingItem, selector: "[ngnRovingItem]", inputs: ["ngnRovingItem"], exportAs: ["ngnRovingItem"] }] });
|
|
131
|
+
}
|
|
132
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: NgnStepper, decorators: [{
|
|
133
|
+
type: Component,
|
|
134
|
+
args: [{ selector: 'ngn-stepper', imports: [NgnPt, NgnDefer, NgnIcon, NgnRovingGroup, NgnRovingItem], providers: [provideSelf(NgnStepper)], template: "<div ngnRovingGroup [ptInt]=\"this\" [ptClass]=\"'header'\" role=\"tablist\">\n @for (step of steps(); track $index; let i = $index; let last = $last) {\n <button\n type=\"button\"\n ngnRovingItem\n role=\"tab\"\n [attr.aria-selected]=\"i === active()\"\n [attr.aria-disabled]=\"!canGoTo(i) ? 'true' : null\"\n [disabled]=\"step.disabled()\"\n [ptInt]=\"this\"\n [ptClass]=\"{\n step: true,\n active: i === active(),\n completed: !!step.completed(),\n error: !!step.error(),\n disabled: step.disabled() || !canGoTo(i),\n }\"\n (click)=\"onHeaderActivate(i)\"\n >\n <span [ptInt]=\"this\" [ptClass]=\"'marker'\">\n @if (step.iconStep(); as icon) {\n <ngn-icon [ptInt]=\"this\" [ptClass]=\"'marker-icon'\" [icon]=\"icon\" />\n } @else if (step.completed() && i !== active()) {\n <ngn-icon [ptInt]=\"this\" [ptClass]=\"'marker-icon'\" [defaultIcon]=\"'stepper-completed'\" />\n } @else {\n <span [ptInt]=\"this\" [ptClass]=\"'marker-index'\">{{ i + 1 }}</span>\n }\n </span>\n <span [ptInt]=\"this\" [ptClass]=\"'label'\">\n {{ step.label() }}\n @if (step.optional()) {\n <span [ptInt]=\"this\" [ptClass]=\"'optional'\">(optional)</span>\n }\n </span>\n </button>\n @if (!last) {\n <span [ptInt]=\"this\" [ptClass]=\"'connector'\"></span>\n }\n }\n</div>\n\n@for (step of steps(); track $index; let i = $index) {\n <div\n role=\"tabpanel\"\n [ptInt]=\"this\"\n [ptClass]=\"{ content: i === active() }\"\n [hidden]=\"i !== active()\"\n >\n <ngn-defer\n [lazyContent]=\"step.content()\"\n [open]=\"i === active()\"\n [lazy]=\"lazy()\"\n [cache]=\"cache()\"\n />\n </div>\n}\n" }]
|
|
135
|
+
}], ctorParameters: () => [], propDecorators: { steps: [{ type: i0.ContentChildren, args: [i0.forwardRef(() => NgnStep), { isSignal: true }] }], _rovingItems: [{ type: i0.ViewChildren, args: [i0.forwardRef(() => NgnRovingItem), { isSignal: true }] }], active: [{ type: i0.Input, args: [{ isSignal: true, alias: "active", required: false }] }, { type: i0.Output, args: ["activeChange"] }], linear: [{ type: i0.Input, args: [{ isSignal: true, alias: "linear", required: false }] }], lazy: [{ type: i0.Input, args: [{ isSignal: true, alias: "lazy", required: false }] }], cache: [{ type: i0.Input, args: [{ isSignal: true, alias: "cache", required: false }] }] } });
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* Generated bundle index. Do not edit.
|
|
139
|
+
*/
|
|
140
|
+
|
|
141
|
+
export { NgnStep, NgnStepper };
|
|
142
|
+
//# sourceMappingURL=ngneers-controls-stepper.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ngneers-controls-stepper.mjs","sources":["../../src/stepper/step.ts","../../src/stepper/stepper.ts","../../src/stepper/stepper.html","../../src/stepper/ngneers-controls-stepper.ts"],"sourcesContent":["import {\n booleanAttribute,\n Component,\n contentChild,\n input,\n model,\n TemplateRef,\n} from '@angular/core';\nimport { NgnBase, provideSelf } from '@ngneers/controls/base';\n\nimport type { IconType } from '@ngneers/controls-custom-types';\n\n/**\n * A single step within an `ngn-stepper`. Declares the step's header metadata and\n * projects its content via `<ng-template #content>`.\n * @category control\n */\n@Component({\n selector: 'ngn-step',\n template: '',\n providers: [provideSelf(NgnStep)],\n})\nexport class NgnStep extends NgnBase<'stepper'> {\n protected readonly theme = null;\n\n /** The step's header label. */\n public readonly label = input<string>('');\n /** Custom marker icon; when unset the 1-based step number is shown. */\n public readonly iconStep = input<IconType>();\n /** Marks the step optional (shown as a hint; skippable in linear mode). @default false */\n public readonly optional = input(false, { transform: booleanAttribute });\n /** Disables navigation to this step. @default false */\n public readonly disabled = input(false, { transform: booleanAttribute });\n /** Renders the step's marker in an error state. @default false */\n public readonly error = input(false, { transform: booleanAttribute });\n /**\n * Whether the step is complete. The app sets this; in linear mode it gates\n * forward navigation past this step. @default false\n */\n public readonly completed = model(false);\n\n public readonly content = contentChild<TemplateRef<unknown>>('content');\n}\n","import {\n booleanAttribute,\n Component,\n computed,\n contentChildren,\n effect,\n input,\n model,\n viewChildren,\n} from '@angular/core';\nimport { NgnBase, NgnPt, provideSelf } from '@ngneers/controls/base';\nimport { NgnDefer } from '@ngneers/controls/defer';\nimport { NgnIcon } from '@ngneers/controls/icon';\nimport { NgnRovingGroup, NgnRovingItem } from '@ngneers/controls/roving-focus';\nimport { stepperControlTemplate } from '@ngneers/controls-themes/templates/stepper';\n\nimport { NgnStep } from './step';\n\n/**\n * @category control\n */\n@Component({\n selector: 'ngn-stepper',\n templateUrl: './stepper.html',\n imports: [NgnPt, NgnDefer, NgnIcon, NgnRovingGroup, NgnRovingItem],\n providers: [provideSelf(NgnStepper)],\n})\nexport class NgnStepper extends NgnBase<'stepper'> {\n protected readonly theme = this.injectThemeTemplate(stepperControlTemplate, 'root');\n\n protected readonly steps = contentChildren(NgnStep);\n\n /** The header buttons' roving items, in step order (one per step; connectors are plain spans). */\n private readonly _rovingItems = viewChildren(NgnRovingItem);\n\n /** The active step index (zero-based). @default 0 */\n public readonly active = model<number>(0);\n /** Gate forward navigation on prior steps being `completed`. @default false */\n public readonly linear = input(false, { transform: booleanAttribute });\n /** Lazily render step content (forwarded to `ngn-defer`). @default true */\n public readonly lazy = input(true, { transform: booleanAttribute });\n /** Keep opened step content in the DOM to preserve state (forwarded to `ngn-defer`). @default true */\n public readonly cache = input(true, { transform: booleanAttribute });\n\n /**\n * Index of the first step that is not yet completed (the furthest reachable in linear mode).\n * Optional steps are exempt — an incomplete optional step never blocks forward progress.\n */\n private readonly _firstIncomplete = computed(() => {\n const steps = this.steps();\n const idx = steps.findIndex(s => !s.completed() && !s.optional());\n return idx === -1 ? steps.length - 1 : idx;\n });\n\n constructor() {\n super();\n // Clamp active into range when steps change.\n effect(() => {\n const n = this.steps().length;\n if (n === 0) {\n return;\n }\n const a = this.active();\n if (a > n - 1) {\n this.active.set(n - 1);\n } else if (a < 0) {\n this.active.set(0);\n }\n });\n\n // Keep each header's roving item in sync with its step's NATIVE `disabled` input (not\n // `canGoTo()` gating) — a merely gated step stays arrow-focusable, only a truly disabled\n // step is skipped by keyboard navigation. Mirrors NgnButtonGroup's roving-disabled sync.\n effect(() => {\n const items = this._rovingItems();\n const steps = this.steps();\n items.forEach((item, i) => item.disabled.set(!!steps[i]?.disabled()));\n });\n }\n\n /** Whether navigation to `index` is currently permitted. */\n public canGoTo(index: number): boolean {\n const steps = this.steps();\n const step = steps[index];\n if (!step || step.disabled()) {\n return false;\n }\n if (!this.linear()) {\n return true;\n }\n // Linear: can go backward freely, or forward up to the first incomplete step.\n return index <= Math.max(this.active(), this._firstIncomplete());\n }\n\n public goTo(index: number): void {\n if (this.canGoTo(index)) {\n this.active.set(index);\n }\n }\n\n public next(): void {\n this.goTo(this.active() + 1);\n }\n\n public previous(): void {\n this.goTo(this.active() - 1);\n }\n\n protected onHeaderActivate(index: number): void {\n this.goTo(index);\n }\n}\n","<div ngnRovingGroup [ptInt]=\"this\" [ptClass]=\"'header'\" role=\"tablist\">\n @for (step of steps(); track $index; let i = $index; let last = $last) {\n <button\n type=\"button\"\n ngnRovingItem\n role=\"tab\"\n [attr.aria-selected]=\"i === active()\"\n [attr.aria-disabled]=\"!canGoTo(i) ? 'true' : null\"\n [disabled]=\"step.disabled()\"\n [ptInt]=\"this\"\n [ptClass]=\"{\n step: true,\n active: i === active(),\n completed: !!step.completed(),\n error: !!step.error(),\n disabled: step.disabled() || !canGoTo(i),\n }\"\n (click)=\"onHeaderActivate(i)\"\n >\n <span [ptInt]=\"this\" [ptClass]=\"'marker'\">\n @if (step.iconStep(); as icon) {\n <ngn-icon [ptInt]=\"this\" [ptClass]=\"'marker-icon'\" [icon]=\"icon\" />\n } @else if (step.completed() && i !== active()) {\n <ngn-icon [ptInt]=\"this\" [ptClass]=\"'marker-icon'\" [defaultIcon]=\"'stepper-completed'\" />\n } @else {\n <span [ptInt]=\"this\" [ptClass]=\"'marker-index'\">{{ i + 1 }}</span>\n }\n </span>\n <span [ptInt]=\"this\" [ptClass]=\"'label'\">\n {{ step.label() }}\n @if (step.optional()) {\n <span [ptInt]=\"this\" [ptClass]=\"'optional'\">(optional)</span>\n }\n </span>\n </button>\n @if (!last) {\n <span [ptInt]=\"this\" [ptClass]=\"'connector'\"></span>\n }\n }\n</div>\n\n@for (step of steps(); track $index; let i = $index) {\n <div\n role=\"tabpanel\"\n [ptInt]=\"this\"\n [ptClass]=\"{ content: i === active() }\"\n [hidden]=\"i !== active()\"\n >\n <ngn-defer\n [lazyContent]=\"step.content()\"\n [open]=\"i === active()\"\n [lazy]=\"lazy()\"\n [cache]=\"c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,EAAA,QAAA,EAAA,KAAA,EAAA,CAAA,EAAA,CAAA,EAAA,IAAA,EAAA,CAAA,EAAA,IAAA,EAAA,EAAA,CAAA,KAAA,EAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,IAAA,EAAA,KAAA,EAAA,MAAA,EAAA,QAAA,EAAA,KAAA,EAAA,CAAA,EAAA,CAAA,EAAA,KAAA,EAAA,CAAA,EAAA,IAAA,EAAA,EAAA,CAAA,KAAA,EAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,IAAA,EAAA,KAAA,EAAA,OAAA,EAAA,QAAA,EAAA,KAAA,EAAA,CAAA,EAAA,CAAA,EAAA,EAAA,CAAA;;AEjC5D;;AAEG;;;;"}
|
|
@@ -9,7 +9,7 @@ import { switchControlTemplate } from '@ngneers/controls-themes/templates/switch
|
|
|
9
9
|
class NgnSwitch extends ValueControlBase {
|
|
10
10
|
theme = this.injectThemeTemplate(switchControlTemplate, {
|
|
11
11
|
root: true,
|
|
12
|
-
invalid: () => this.
|
|
12
|
+
invalid: () => this.invalidState(),
|
|
13
13
|
});
|
|
14
14
|
changed(event) {
|
|
15
15
|
const target = event.target;
|
|
@@ -24,11 +24,11 @@ class NgnSwitch extends ValueControlBase {
|
|
|
24
24
|
super();
|
|
25
25
|
}
|
|
26
26
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: NgnSwitch, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
27
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "22.0.5", type: NgnSwitch, isStandalone: true, selector: "ngn-switch", providers: [provideSelf(NgnSwitch)], usesInheritance: true, ngImport: i0, template: "<div [ptInt]=\"this\" [ptClass]=\"{ track: true, 'track-checked': !!value() }\">\n <div [ptInt]=\"this\" [ptClass]=\"'thumb'\"></div>\n</div>\n<input\n type=\"checkbox\"\n [checked]=\"value()\"\n (change)=\"changed($event)\"\n (click)=\"onClick($event)\"\n [ptInt]=\"this\"\n [ptClass]=\"'input'\"\n [attr.disabled]=\"disabled() ? '' : undefined\"\n [ariaReadOnly]=\"readonly() ? '' : undefined\"\n [ariaInvalid]=\"
|
|
27
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "22.0.5", type: NgnSwitch, isStandalone: true, selector: "ngn-switch", providers: [provideSelf(NgnSwitch)], usesInheritance: true, ngImport: i0, template: "<div [ptInt]=\"this\" [ptClass]=\"{ track: true, 'track-checked': !!value() }\">\n <div [ptInt]=\"this\" [ptClass]=\"'thumb'\"></div>\n</div>\n<input\n type=\"checkbox\"\n [checked]=\"value()\"\n (change)=\"changed($event)\"\n (click)=\"onClick($event)\"\n [ptInt]=\"this\"\n [ptClass]=\"'input'\"\n [attr.disabled]=\"disabled() ? '' : undefined\"\n [ariaReadOnly]=\"readonly() ? '' : undefined\"\n [ariaInvalid]=\"invalidState() ? 'true' : undefined\"\n [attr.aria-label]=\"label()\"\n [ariaLabelledByElements]=\"labelledBy()\"\n [id]=\"inputId()\"\n (blur)=\"markTouched()\"\n/>\n", dependencies: [{ kind: "directive", type: NgnPt, selector: "[ptInt]", inputs: ["ptInt", "ptClass", "ptDep"] }] });
|
|
28
28
|
}
|
|
29
29
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: NgnSwitch, decorators: [{
|
|
30
30
|
type: Component,
|
|
31
|
-
args: [{ selector: 'ngn-switch', imports: [NgnPt], providers: [provideSelf(NgnSwitch)], template: "<div [ptInt]=\"this\" [ptClass]=\"{ track: true, 'track-checked': !!value() }\">\n <div [ptInt]=\"this\" [ptClass]=\"'thumb'\"></div>\n</div>\n<input\n type=\"checkbox\"\n [checked]=\"value()\"\n (change)=\"changed($event)\"\n (click)=\"onClick($event)\"\n [ptInt]=\"this\"\n [ptClass]=\"'input'\"\n [attr.disabled]=\"disabled() ? '' : undefined\"\n [ariaReadOnly]=\"readonly() ? '' : undefined\"\n [ariaInvalid]=\"
|
|
31
|
+
args: [{ selector: 'ngn-switch', imports: [NgnPt], providers: [provideSelf(NgnSwitch)], template: "<div [ptInt]=\"this\" [ptClass]=\"{ track: true, 'track-checked': !!value() }\">\n <div [ptInt]=\"this\" [ptClass]=\"'thumb'\"></div>\n</div>\n<input\n type=\"checkbox\"\n [checked]=\"value()\"\n (change)=\"changed($event)\"\n (click)=\"onClick($event)\"\n [ptInt]=\"this\"\n [ptClass]=\"'input'\"\n [attr.disabled]=\"disabled() ? '' : undefined\"\n [ariaReadOnly]=\"readonly() ? '' : undefined\"\n [ariaInvalid]=\"invalidState() ? 'true' : undefined\"\n [attr.aria-label]=\"label()\"\n [ariaLabelledByElements]=\"labelledBy()\"\n [id]=\"inputId()\"\n (blur)=\"markTouched()\"\n/>\n" }]
|
|
32
32
|
}], ctorParameters: () => [] });
|
|
33
33
|
|
|
34
34
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ngneers-controls-switch.mjs","sources":["../../src/switch/switch.ts","../../src/switch/switch.html","../../src/switch/ngneers-controls-switch.ts"],"sourcesContent":["import { Component } from '@angular/core';\nimport { NgnPt, provideSelf, ValueControlBase } from '@ngneers/controls/base';\nimport { switchControlTemplate } from '@ngneers/controls-themes/templates/switch';\n\n/**\n * @category control\n */\n@Component({\n selector: 'ngn-switch',\n templateUrl: './switch.html',\n imports: [NgnPt],\n providers: [provideSelf(NgnSwitch)],\n})\nexport class NgnSwitch extends ValueControlBase<'switch', boolean> {\n protected readonly theme = this.injectThemeTemplate(switchControlTemplate, {\n root: true,\n invalid: () => this.
|
|
1
|
+
{"version":3,"file":"ngneers-controls-switch.mjs","sources":["../../src/switch/switch.ts","../../src/switch/switch.html","../../src/switch/ngneers-controls-switch.ts"],"sourcesContent":["import { Component } from '@angular/core';\nimport { NgnPt, provideSelf, ValueControlBase } from '@ngneers/controls/base';\nimport { switchControlTemplate } from '@ngneers/controls-themes/templates/switch';\n\n/**\n * @category control\n */\n@Component({\n selector: 'ngn-switch',\n templateUrl: './switch.html',\n imports: [NgnPt],\n providers: [provideSelf(NgnSwitch)],\n})\nexport class NgnSwitch extends ValueControlBase<'switch', boolean> {\n protected readonly theme = this.injectThemeTemplate(switchControlTemplate, {\n root: true,\n invalid: () => this.invalidState(),\n });\n\n protected changed(event: Event) {\n const target = event.target as HTMLInputElement;\n this.value.set(target.checked);\n }\n\n protected onClick(event: Event) {\n if (this.readonly() || this.disabled()) {\n event.preventDefault();\n }\n }\n\n constructor() {\n super();\n }\n}\n","<div [ptInt]=\"this\" [ptClass]=\"{ track: true, 'track-checked': !!value() }\">\n <div [ptInt]=\"this\" [ptClass]=\"'thumb'\"></div>\n</div>\n<input\n type=\"checkbox\"\n [checked]=\"value()\"\n (change)=\"changed($event)\"\n (click)=\"onClick($event)\"\n [ptInt]=\"this\"\n [ptClass]=\"'input'\"\n [attr.disabled]=\"disabled() ? '' : undefined\"\n [ariaReadOnly]=\"readonly() ? '' : undefined\"\n [ariaInvalid]=\"invalidState() ? 'true' : undefined\"\n [attr.aria-label]=\"label()\"\n [ariaLabelledByElements]=\"labelledBy()\"\n [id]=\"inputId()\"\n (blur)=\"markTouched()\"\n/>\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;AAIA;;AAEG;AAOG,MAAO,SAAU,SAAQ,gBAAmC,CAAA;AAC7C,IAAA,KAAK,GAAG,IAAI,CAAC,mBAAmB,CAAC,qBAAqB,EAAE;AACzE,QAAA,IAAI,EAAE,IAAI;AACV,QAAA,OAAO,EAAE,MAAM,IAAI,CAAC,YAAY,EAAE;AACnC,KAAA,CAAC;AAEQ,IAAA,OAAO,CAAC,KAAY,EAAA;AAC5B,QAAA,MAAM,MAAM,GAAG,KAAK,CAAC,MAA0B;QAC/C,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC;IAChC;AAEU,IAAA,OAAO,CAAC,KAAY,EAA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