@nexterajs/ui 0.0.1 → 0.1.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 +279 -34
- package/fesm2022/nexterajs-ui-charts.mjs +1096 -0
- package/fesm2022/nexterajs-ui-charts.mjs.map +1 -0
- package/fesm2022/nexterajs-ui-core.mjs +835 -11
- package/fesm2022/nexterajs-ui-core.mjs.map +1 -1
- package/fesm2022/nexterajs-ui-display.mjs +1142 -0
- package/fesm2022/nexterajs-ui-display.mjs.map +1 -0
- package/fesm2022/nexterajs-ui-dropdowns.mjs +621 -69
- package/fesm2022/nexterajs-ui-dropdowns.mjs.map +1 -1
- package/fesm2022/nexterajs-ui-file-uploader.mjs +576 -11
- package/fesm2022/nexterajs-ui-file-uploader.mjs.map +1 -1
- package/fesm2022/nexterajs-ui-forms.mjs +2702 -452
- package/fesm2022/nexterajs-ui-forms.mjs.map +1 -1
- package/fesm2022/nexterajs-ui-grid.mjs +2350 -336
- package/fesm2022/nexterajs-ui-grid.mjs.map +1 -1
- package/fesm2022/nexterajs-ui-intl.mjs +117 -15
- package/fesm2022/nexterajs-ui-intl.mjs.map +1 -1
- package/fesm2022/nexterajs-ui-navigation.mjs +1054 -0
- package/fesm2022/nexterajs-ui-navigation.mjs.map +1 -0
- package/fesm2022/nexterajs-ui-notify.mjs +353 -0
- package/fesm2022/nexterajs-ui-notify.mjs.map +1 -0
- package/fesm2022/nexterajs-ui-overlay.mjs +1671 -0
- package/fesm2022/nexterajs-ui-overlay.mjs.map +1 -0
- package/fesm2022/nexterajs-ui-pivot.mjs +191 -136
- package/fesm2022/nexterajs-ui-pivot.mjs.map +1 -1
- package/fesm2022/nexterajs-ui-shell.mjs +542 -0
- package/fesm2022/nexterajs-ui-shell.mjs.map +1 -0
- package/fesm2022/nexterajs-ui-styling.mjs +568 -3
- package/fesm2022/nexterajs-ui-styling.mjs.map +1 -1
- package/fesm2022/nexterajs-ui-tree-view.mjs +150 -18
- package/fesm2022/nexterajs-ui-tree-view.mjs.map +1 -1
- package/fesm2022/nexterajs-ui-validation.mjs +283 -97
- package/fesm2022/nexterajs-ui-validation.mjs.map +1 -1
- package/fesm2022/nexterajs-ui.mjs +6 -0
- package/fesm2022/nexterajs-ui.mjs.map +1 -1
- package/package.json +37 -2
- package/styles/_dropdown.scss +150 -1
- package/styles/_editor.scss +75 -21
- package/styles/_icons.scss +92 -0
- package/styles/_mixins.scss +104 -1
- package/styles/_scrollbar.scss +134 -0
- package/styles/_status.scss +21 -0
- package/styles/_toast.scss +243 -0
- package/styles/_tokens.scss +467 -2
- package/styles/_widget.scss +14 -3
- package/styles/index.scss +10 -4
- package/types/nexterajs-ui-charts.d.ts +446 -0
- package/types/nexterajs-ui-core.d.ts +515 -30
- package/types/nexterajs-ui-display.d.ts +720 -0
- package/types/nexterajs-ui-dropdowns.d.ts +318 -57
- package/types/nexterajs-ui-file-uploader.d.ts +240 -8
- package/types/nexterajs-ui-forms.d.ts +772 -43
- package/types/nexterajs-ui-grid.d.ts +878 -135
- package/types/nexterajs-ui-intl.d.ts +39 -4
- package/types/nexterajs-ui-navigation.d.ts +531 -0
- package/types/nexterajs-ui-notify.d.ts +149 -0
- package/types/nexterajs-ui-overlay.d.ts +703 -0
- package/types/nexterajs-ui-pivot.d.ts +91 -70
- package/types/nexterajs-ui-shell.d.ts +294 -0
- package/types/nexterajs-ui-styling.d.ts +163 -3
- package/types/nexterajs-ui-tree-view.d.ts +56 -4
- package/types/nexterajs-ui-validation.d.ts +110 -22
- package/types/nexterajs-ui.d.ts +6 -0
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import * as _angular_core from '@angular/core';
|
|
2
|
-
import { NxeValidationResult } from '@nexterajs/ui/core';
|
|
2
|
+
import { NxeMessageService, NxeValidatedEvent, NxeBrokenRule, NxeValidationResult } from '@nexterajs/ui/core';
|
|
3
3
|
import { ValidatorFn } from '@angular/forms';
|
|
4
4
|
|
|
5
5
|
/** DevExtreme validation rule type (the codebase uses `required`, `compare`, and `range`). */
|
|
6
6
|
type NxeValidationRuleType = 'required' | 'compare' | 'custom' | 'pattern' | 'email' | 'range';
|
|
7
7
|
/**
|
|
8
|
-
* The message shown when a rule fails and the caller gave none.
|
|
8
|
+
* The English message shown when a rule fails and the caller gave none. The components resolve it
|
|
9
|
+
* through `NxeMessageService` (`validation.rule.*`), which starts as these same strings and
|
|
10
|
+
* follows the active language; this table stays for code that reads it directly.
|
|
9
11
|
*
|
|
10
12
|
* These are DevExtreme's own defaults, verbatim from its `validation-*` message keys. Without
|
|
11
13
|
* them a rule with no `message` blocks its group and displays nothing at all, because every
|
|
@@ -15,8 +17,35 @@ declare const NXE_DEFAULT_VALIDATION_MESSAGES: Readonly<Record<NxeValidationRule
|
|
|
15
17
|
/** Payload passed to a `custom` rule's `validationCallback` (mirrors DevExtreme). */
|
|
16
18
|
interface NxeCustomRuleData {
|
|
17
19
|
value: unknown;
|
|
18
|
-
rule
|
|
20
|
+
/** Absent when the rule came from `[validationRules]` rather than a projected element. */
|
|
21
|
+
rule?: NxeValidationRuleComponent;
|
|
19
22
|
}
|
|
23
|
+
/**
|
|
24
|
+
* A rule as plain data.
|
|
25
|
+
*
|
|
26
|
+
* The projected `<nxe-validation-rule>` and the `[validationRules]` array are two ways of saying
|
|
27
|
+
* the same thing, so they evaluate through one function rather than two implementations that
|
|
28
|
+
* could drift.
|
|
29
|
+
*/
|
|
30
|
+
interface NxeRuleSpec {
|
|
31
|
+
type: NxeValidationRuleType;
|
|
32
|
+
message?: string;
|
|
33
|
+
comparisonTarget?: () => unknown;
|
|
34
|
+
comparisonType?: '==' | '===' | '!=' | '!==' | '>' | '<' | '>=' | '<=';
|
|
35
|
+
validationCallback?: (data: NxeCustomRuleData) => boolean;
|
|
36
|
+
pattern?: string | RegExp;
|
|
37
|
+
min?: number;
|
|
38
|
+
max?: number;
|
|
39
|
+
}
|
|
40
|
+
/** DevExtreme RequiredRule semantics: null/undefined/''/false are "not specified". */
|
|
41
|
+
declare function nxeIsEmptyValue(value: unknown): boolean;
|
|
42
|
+
/**
|
|
43
|
+
* The message for a rule with none of its own: the active language's when a message service is
|
|
44
|
+
* given, English otherwise.
|
|
45
|
+
*/
|
|
46
|
+
declare function nxeDefaultMessage(type: NxeValidationRuleType, messages?: NxeMessageService): string;
|
|
47
|
+
/** Whether `value` satisfies `spec`. The single evaluator behind both rule forms. */
|
|
48
|
+
declare function nxeEvaluateRule(spec: NxeRuleSpec, value: unknown, rule?: NxeValidationRuleComponent): boolean;
|
|
20
49
|
/**
|
|
21
50
|
* `nxe-validation-rule` — drop-in for DevExtreme `dxi-validation-rule`.
|
|
22
51
|
*
|
|
@@ -25,31 +54,29 @@ interface NxeCustomRuleData {
|
|
|
25
54
|
* `type` input covers 100% of usage.
|
|
26
55
|
*/
|
|
27
56
|
declare class NxeValidationRuleComponent {
|
|
57
|
+
private readonly messages;
|
|
28
58
|
readonly type: _angular_core.InputSignal<NxeValidationRuleType>;
|
|
29
59
|
readonly message: _angular_core.InputSignal<string>;
|
|
30
60
|
/** `compare` rule: returns the value to compare against. Mirrors `comparisonTarget`. */
|
|
31
|
-
readonly comparisonTarget: _angular_core.InputSignal<() => unknown>;
|
|
61
|
+
readonly comparisonTarget: _angular_core.InputSignal<(() => unknown) | undefined>;
|
|
32
62
|
/** `compare` rule comparison operator (default `==`). */
|
|
33
63
|
readonly comparisonType: _angular_core.InputSignal<"==" | "===" | "!=" | "!==" | ">" | "<" | ">=" | "<=">;
|
|
34
64
|
/** `custom` rule: returns true when valid. Mirrors `validationCallback`. */
|
|
35
|
-
readonly validationCallback: _angular_core.InputSignal<(data: NxeCustomRuleData) => boolean>;
|
|
65
|
+
readonly validationCallback: _angular_core.InputSignal<((data: NxeCustomRuleData) => boolean) | undefined>;
|
|
36
66
|
/** `pattern` rule. */
|
|
37
|
-
readonly pattern: _angular_core.InputSignal<string | RegExp>;
|
|
67
|
+
readonly pattern: _angular_core.InputSignal<string | RegExp | undefined>;
|
|
38
68
|
/** `range` rule bounds (DevExtreme RangeRule: empty values pass, bounds are inclusive). */
|
|
39
|
-
readonly min: _angular_core.InputSignal<number>;
|
|
40
|
-
readonly max: _angular_core.InputSignal<number>;
|
|
69
|
+
readonly min: _angular_core.InputSignal<number | undefined>;
|
|
70
|
+
readonly max: _angular_core.InputSignal<number | undefined>;
|
|
41
71
|
/**
|
|
42
72
|
* The message to show when this rule fails: the caller's, or DevExtreme's default for the
|
|
43
73
|
* rule type. Whitespace counts as absent — a message of spaces is still an empty bubble.
|
|
44
74
|
*/
|
|
45
75
|
readonly resolvedMessage: _angular_core.Signal<string>;
|
|
76
|
+
/** This rule as plain data, so both rule forms evaluate through one function. */
|
|
77
|
+
toSpec(): NxeRuleSpec;
|
|
46
78
|
/** Whether `value` satisfies this rule. */
|
|
47
79
|
evaluate(value: unknown): boolean;
|
|
48
|
-
/** DevExtreme RequiredRule semantics: null/undefined/''/false are "not specified". */
|
|
49
|
-
private isEmpty;
|
|
50
|
-
private compare;
|
|
51
|
-
private inRange;
|
|
52
|
-
private matchesPattern;
|
|
53
80
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<NxeValidationRuleComponent, never>;
|
|
54
81
|
static ɵcmp: _angular_core.ɵɵComponentDeclaration<NxeValidationRuleComponent, "nxe-validation-rule", never, { "type": { "alias": "type"; "required": false; "isSignal": true; }; "message": { "alias": "message"; "required": false; "isSignal": true; }; "comparisonTarget": { "alias": "comparisonTarget"; "required": false; "isSignal": true; }; "comparisonType": { "alias": "comparisonType"; "required": false; "isSignal": true; }; "validationCallback": { "alias": "validationCallback"; "required": false; "isSignal": true; }; "pattern": { "alias": "pattern"; "required": false; "isSignal": true; }; "min": { "alias": "min"; "required": false; "isSignal": true; }; "max": { "alias": "max"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
55
82
|
}
|
|
@@ -58,28 +85,61 @@ declare class NxeValidationRuleComponent {
|
|
|
58
85
|
* `nxe-validator` — drop-in for DevExtreme `dx-validator`.
|
|
59
86
|
*
|
|
60
87
|
* Placed inside an editor (`<nxe-text-box><nxe-validator><nxe-validation-rule .../></nxe-validator></nxe-text-box>`),
|
|
61
|
-
* it adapts the editor via {@link NXE_VALIDATION_TARGET}, collects its
|
|
62
|
-
*
|
|
63
|
-
*
|
|
64
|
-
* `validate()` is invoked by
|
|
88
|
+
* it adapts the editor via {@link NXE_VALIDATION_TARGET}, collects its rules, and registers into
|
|
89
|
+
* the {@link NxeValidationGroupRegistry} under the editor's `validationGroup`.
|
|
90
|
+
*
|
|
91
|
+
* Validation is on demand, as in DevExtreme — `validate()` is invoked by
|
|
92
|
+
* `nxe-button[validationGroup]` or directly. With one exception, which is also dx's: once a
|
|
93
|
+
* validator HAS been validated, it re-validates as the value changes, so a field that has gone
|
|
94
|
+
* red clears itself as the user fixes it rather than staying red until the next submit.
|
|
65
95
|
*/
|
|
66
96
|
declare class NxeValidatorComponent {
|
|
67
97
|
private readonly target;
|
|
68
98
|
private readonly registry;
|
|
99
|
+
private readonly messages;
|
|
100
|
+
private readonly groupScope;
|
|
69
101
|
readonly rules: _angular_core.Signal<readonly NxeValidationRuleComponent[]>;
|
|
102
|
+
/**
|
|
103
|
+
* dx `validationRules` — rules as data instead of projected children. Both forms combine;
|
|
104
|
+
* projected children come first, matching declaration order.
|
|
105
|
+
*/
|
|
106
|
+
readonly validationRules: _angular_core.InputSignal<readonly NxeRuleSpec[] | undefined>;
|
|
70
107
|
/** Explicit group; otherwise inherited from the wrapped editor's `validationGroup`. */
|
|
71
|
-
readonly validationGroupInput: _angular_core.InputSignal<string>;
|
|
108
|
+
readonly validationGroupInput: _angular_core.InputSignal<string | undefined>;
|
|
109
|
+
/** dx `onValidated`, fired on every validation, valid or not. */
|
|
110
|
+
readonly onValidated: _angular_core.OutputEmitterRef<NxeValidatedEvent>;
|
|
72
111
|
private readonly group;
|
|
73
112
|
/** Last validation outcome (false once a rule has failed, until re-validated). */
|
|
74
113
|
readonly isValid: _angular_core.WritableSignal<boolean>;
|
|
114
|
+
/** Every rule broken by the last validation, in declaration order. */
|
|
115
|
+
readonly brokenRules: _angular_core.WritableSignal<readonly NxeBrokenRule[]>;
|
|
116
|
+
/** Whether `validate()` has ever run — the gate on live re-validation. */
|
|
117
|
+
private readonly validated;
|
|
75
118
|
/** DevExtreme parity: existing code calls `validator.instance.validate()` via `@ViewChild`. */
|
|
76
119
|
get instance(): NxeValidatorComponent;
|
|
77
120
|
private readonly member;
|
|
121
|
+
/** Projected children plus `[validationRules]`, as one evaluable list. */
|
|
122
|
+
private readonly allRules;
|
|
78
123
|
constructor();
|
|
79
|
-
/**
|
|
124
|
+
/** Re-word the broken rules after a language switch, without validating again or emitting. */
|
|
125
|
+
private refreshMessages;
|
|
126
|
+
/**
|
|
127
|
+
* Run every rule against the editor's current value.
|
|
128
|
+
*
|
|
129
|
+
* dx reports ALL broken rules, not just the first — a `brokenRules` array with at most one
|
|
130
|
+
* entry cannot tell a caller whether a field failed once or three times. The editor's bubble
|
|
131
|
+
* still shows the first message, which is what dx renders.
|
|
132
|
+
*/
|
|
80
133
|
validate(): NxeValidationResult;
|
|
134
|
+
/**
|
|
135
|
+
* Clear the error state without validating (dx `reset()`).
|
|
136
|
+
*
|
|
137
|
+
* Also clears `validated`, so the field goes back to staying quiet until it is validated
|
|
138
|
+
* again — otherwise a reset field would light up on the next keystroke.
|
|
139
|
+
*/
|
|
140
|
+
reset(): void;
|
|
81
141
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<NxeValidatorComponent, never>;
|
|
82
|
-
static ɵcmp: _angular_core.ɵɵComponentDeclaration<NxeValidatorComponent, "nxe-validator", never, { "validationGroupInput": { "alias": "validationGroup"; "required": false; "isSignal": true; }; }, {}, ["rules"], ["*"], true, never>;
|
|
142
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<NxeValidatorComponent, "nxe-validator", never, { "validationRules": { "alias": "validationRules"; "required": false; "isSignal": true; }; "validationGroupInput": { "alias": "validationGroup"; "required": false; "isSignal": true; }; }, { "onValidated": "onValidated"; }, ["rules"], ["*"], true, never>;
|
|
83
143
|
}
|
|
84
144
|
|
|
85
145
|
declare class NxeValidators {
|
|
@@ -98,5 +158,33 @@ declare class NxeValidators {
|
|
|
98
158
|
static mustMatch(controlPath: string, matchingControlPath: string): ValidatorFn;
|
|
99
159
|
}
|
|
100
160
|
|
|
101
|
-
|
|
102
|
-
|
|
161
|
+
/**
|
|
162
|
+
* `nxe-validation-group` — drop-in for DevExtreme `dx-validation-group`.
|
|
163
|
+
*
|
|
164
|
+
* DevExtreme lets a group be addressed two ways. Either a string name is repeated on the
|
|
165
|
+
* validator and on the button, or both are wrapped in a group element and the relationship is
|
|
166
|
+
* structural. Only the string form existed here, which meant a form could not be validated as a
|
|
167
|
+
* unit without inventing a name for it and keeping that name in two places.
|
|
168
|
+
*
|
|
169
|
+
* The key is generated, not derived from anything the application controls, so two groups on one
|
|
170
|
+
* page cannot collide and a group can never accidentally share a name with a string group. An
|
|
171
|
+
* explicit `validationGroup` on a descendant still wins, as in dx — the structural form is a
|
|
172
|
+
* default, not an override.
|
|
173
|
+
*/
|
|
174
|
+
declare class NxeValidationGroupComponent {
|
|
175
|
+
private readonly registry;
|
|
176
|
+
private readonly scope;
|
|
177
|
+
/** The generated key descendants register under. Exposed for a caller that needs to name it. */
|
|
178
|
+
get groupKey(): string;
|
|
179
|
+
/** DevExtreme parity: `group.instance.validate()` / `.reset()`. */
|
|
180
|
+
get instance(): NxeValidationGroupComponent;
|
|
181
|
+
/** Validate every validator inside this group. */
|
|
182
|
+
validate(): NxeValidationResult;
|
|
183
|
+
/** Clear every validator inside this group without validating (dx `reset()`). */
|
|
184
|
+
reset(): void;
|
|
185
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<NxeValidationGroupComponent, never>;
|
|
186
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<NxeValidationGroupComponent, "nxe-validation-group", never, {}, {}, never, ["*"], true, never>;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
export { NXE_DEFAULT_VALIDATION_MESSAGES, NxeValidationGroupComponent, NxeValidationRuleComponent, NxeValidatorComponent, NxeValidators, nxeDefaultMessage, nxeEvaluateRule, nxeIsEmptyValue };
|
|
190
|
+
export type { NxeCustomRuleData, NxeRuleSpec, NxeValidationRuleType };
|
package/types/nexterajs-ui.d.ts
CHANGED
|
@@ -1,12 +1,18 @@
|
|
|
1
1
|
export * from '@nexterajs/ui/animations';
|
|
2
|
+
export * from '@nexterajs/ui/charts';
|
|
2
3
|
export * from '@nexterajs/ui/core';
|
|
4
|
+
export * from '@nexterajs/ui/display';
|
|
3
5
|
export * from '@nexterajs/ui/dropdowns';
|
|
4
6
|
export * from '@nexterajs/ui/excel';
|
|
5
7
|
export * from '@nexterajs/ui/file-uploader';
|
|
6
8
|
export * from '@nexterajs/ui/forms';
|
|
7
9
|
export * from '@nexterajs/ui/grid';
|
|
8
10
|
export * from '@nexterajs/ui/intl';
|
|
11
|
+
export * from '@nexterajs/ui/navigation';
|
|
12
|
+
export * from '@nexterajs/ui/notify';
|
|
13
|
+
export * from '@nexterajs/ui/overlay';
|
|
9
14
|
export * from '@nexterajs/ui/pivot';
|
|
15
|
+
export * from '@nexterajs/ui/shell';
|
|
10
16
|
export * from '@nexterajs/ui/styling';
|
|
11
17
|
export * from '@nexterajs/ui/tree-view';
|
|
12
18
|
export * from '@nexterajs/ui/validation';
|