@nexterajs/ui 0.0.1
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 +202 -0
- package/NOTICE +16 -0
- package/README.md +64 -0
- package/fesm2022/nexterajs-ui-animations.mjs +184 -0
- package/fesm2022/nexterajs-ui-animations.mjs.map +1 -0
- package/fesm2022/nexterajs-ui-core.mjs +326 -0
- package/fesm2022/nexterajs-ui-core.mjs.map +1 -0
- package/fesm2022/nexterajs-ui-dropdowns.mjs +953 -0
- package/fesm2022/nexterajs-ui-dropdowns.mjs.map +1 -0
- package/fesm2022/nexterajs-ui-excel.mjs +779 -0
- package/fesm2022/nexterajs-ui-excel.mjs.map +1 -0
- package/fesm2022/nexterajs-ui-file-uploader.mjs +125 -0
- package/fesm2022/nexterajs-ui-file-uploader.mjs.map +1 -0
- package/fesm2022/nexterajs-ui-forms.mjs +1113 -0
- package/fesm2022/nexterajs-ui-forms.mjs.map +1 -0
- package/fesm2022/nexterajs-ui-grid.mjs +4145 -0
- package/fesm2022/nexterajs-ui-grid.mjs.map +1 -0
- package/fesm2022/nexterajs-ui-intl.mjs +377 -0
- package/fesm2022/nexterajs-ui-intl.mjs.map +1 -0
- package/fesm2022/nexterajs-ui-pivot.mjs +4739 -0
- package/fesm2022/nexterajs-ui-pivot.mjs.map +1 -0
- package/fesm2022/nexterajs-ui-styling.mjs +59 -0
- package/fesm2022/nexterajs-ui-styling.mjs.map +1 -0
- package/fesm2022/nexterajs-ui-tree-view.mjs +202 -0
- package/fesm2022/nexterajs-ui-tree-view.mjs.map +1 -0
- package/fesm2022/nexterajs-ui-validation.mjs +269 -0
- package/fesm2022/nexterajs-ui-validation.mjs.map +1 -0
- package/fesm2022/nexterajs-ui.mjs +23 -0
- package/fesm2022/nexterajs-ui.mjs.map +1 -0
- package/package.json +100 -0
- package/styles/_button-directives.scss +39 -0
- package/styles/_dropdown.scss +113 -0
- package/styles/_editor.scss +146 -0
- package/styles/_mixins.scss +2 -0
- package/styles/_tokens.scss +77 -0
- package/styles/_widget.scss +58 -0
- package/styles/index.scss +83 -0
- package/types/nexterajs-ui-animations.d.ts +22 -0
- package/types/nexterajs-ui-core.d.ts +328 -0
- package/types/nexterajs-ui-dropdowns.d.ts +334 -0
- package/types/nexterajs-ui-excel.d.ts +159 -0
- package/types/nexterajs-ui-file-uploader.d.ts +47 -0
- package/types/nexterajs-ui-forms.d.ts +296 -0
- package/types/nexterajs-ui-grid.d.ts +1485 -0
- package/types/nexterajs-ui-intl.d.ts +125 -0
- package/types/nexterajs-ui-pivot.d.ts +1470 -0
- package/types/nexterajs-ui-styling.d.ts +40 -0
- package/types/nexterajs-ui-tree-view.d.ts +69 -0
- package/types/nexterajs-ui-validation.d.ts +102 -0
- package/types/nexterajs-ui.d.ts +12 -0
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import { DateTime } from 'luxon';
|
|
2
|
+
import { InjectionToken } from '@angular/core';
|
|
3
|
+
|
|
4
|
+
interface NxeParsedNumberFormat {
|
|
5
|
+
prefix: string;
|
|
6
|
+
suffix: string;
|
|
7
|
+
useGrouping: boolean;
|
|
8
|
+
/**
|
|
9
|
+
* Digits per group, read from the pattern: `#,##0` is 3, `#,#0` is 2. Optional because
|
|
10
|
+
* callers construct this shape by hand as well as through {@link parseNumberFormat};
|
|
11
|
+
* omitted means dx's usual 3.
|
|
12
|
+
*/
|
|
13
|
+
groupSize?: number;
|
|
14
|
+
minInt: number;
|
|
15
|
+
minFrac: number;
|
|
16
|
+
maxFrac: number;
|
|
17
|
+
}
|
|
18
|
+
/** Parse an LDML pattern into a {@link NxeParsedNumberFormat}, or `null` for raw (no format). */
|
|
19
|
+
declare function parseNumberFormat(pattern: string | undefined | null): NxeParsedNumberFormat | null;
|
|
20
|
+
/** Round half-away-from-zero to `frac` fraction digits (DevExtreme rounding), fp-safe. */
|
|
21
|
+
declare function roundHalfAwayFromZero(value: number, frac: number): number;
|
|
22
|
+
/** Format a number with the parsed pattern. `null`/`NaN` → `''`. */
|
|
23
|
+
/**
|
|
24
|
+
* The characters that separate groups and the fraction.
|
|
25
|
+
*
|
|
26
|
+
* The LDML pattern always writes `,` for grouping and `.` for the decimal point — that is the
|
|
27
|
+
* pattern language, not the output. Which characters actually get rendered is a locale decision,
|
|
28
|
+
* and it is the one that split this file: one consuming app needs `1,234.50`, another needs
|
|
29
|
+
* `1.250.000,50`, and hardcoding either forces the other to fork.
|
|
30
|
+
*/
|
|
31
|
+
interface NxeNumberSeparators {
|
|
32
|
+
readonly group: string;
|
|
33
|
+
readonly decimal: string;
|
|
34
|
+
}
|
|
35
|
+
/** DevExtreme's default, and this library's. */
|
|
36
|
+
declare const NXE_EN_US_SEPARATORS: NxeNumberSeparators;
|
|
37
|
+
/** Indonesian house style, used by several of the consuming applications. */
|
|
38
|
+
declare const NXE_ID_SEPARATORS: NxeNumberSeparators;
|
|
39
|
+
declare function formatNumber(value: number | null | undefined, fmt: NxeParsedNumberFormat | null, separators?: NxeNumberSeparators): string;
|
|
40
|
+
/** Parse a (possibly formatted) string into a number; strips grouping/literals. Empty → `null`. */
|
|
41
|
+
declare function parseNumber(text: string | null | undefined, separators?: NxeNumberSeparators): number | null;
|
|
42
|
+
|
|
43
|
+
/** The app-wide serialization format (matches DevExtreme `dateSerializationFormat`). */
|
|
44
|
+
declare const NXE_DATE_SERIALIZATION_FORMAT = "yyyy-MM-dd'T'HH:mm:ss";
|
|
45
|
+
/** DevExtreme global default `displayFormat` (`dxDateBox.defaultOptions`). */
|
|
46
|
+
declare const NXE_DEFAULT_DISPLAY_FORMAT = "dd-MMM-yyyy";
|
|
47
|
+
/** Default `displayFormat` for `type="datetime"`. */
|
|
48
|
+
declare const NXE_DEFAULT_DATETIME_DISPLAY_FORMAT = "dd-MMM-yyyy HH:mm";
|
|
49
|
+
/** Default `displayFormat` for `type="time"`. */
|
|
50
|
+
declare const NXE_DEFAULT_TIME_DISPLAY_FORMAT = "HH:mm";
|
|
51
|
+
/** Parse a bound value (wall-clock ISO string, full ISO, Date, or DateTime) into a Luxon DateTime. */
|
|
52
|
+
declare function parseDateValue(value: unknown): DateTime | null;
|
|
53
|
+
/** Serialize a DateTime back to the `"yyyy-MM-ddTHH:mm:ss"` string the rest of the app expects. */
|
|
54
|
+
declare function serializeDate(dt: DateTime): string;
|
|
55
|
+
/**
|
|
56
|
+
* Whether a value carries a real time of day.
|
|
57
|
+
*
|
|
58
|
+
* This is the one place that states what `00:00:00` MEANS in the app's serialization format: not
|
|
59
|
+
* "midnight", but "no time was chosen". Every date-only editor in the app writes exactly midnight,
|
|
60
|
+
* so the calendar's all-day-vs-timed split, the grid's display format and anything else that has to
|
|
61
|
+
* tell the two apart all read it from here and cannot drift.
|
|
62
|
+
*/
|
|
63
|
+
declare function hasTimeOfDay(value: unknown): boolean;
|
|
64
|
+
/**
|
|
65
|
+
* Whether a start/end pair describes a whole-day range.
|
|
66
|
+
*
|
|
67
|
+
* Deliberately "every end that is PRESENT is midnight", not "start is midnight AND end is midnight".
|
|
68
|
+
* Half-filled pairs are a supported shape — the calendar endpoint folds `start ?? end` and treats a
|
|
69
|
+
* row carrying only one of the two as a single-day event — and a rule that demanded both would call
|
|
70
|
+
* such a row timed on the strength of the end that is not there.
|
|
71
|
+
*
|
|
72
|
+
* A pair with neither end is all-day by this reading. Degenerate, and unreachable in practice: a row
|
|
73
|
+
* with no dates at all cannot overlap a window, so the endpoint never returns one.
|
|
74
|
+
*/
|
|
75
|
+
declare function isAllDayRange(start: unknown, end: unknown): boolean;
|
|
76
|
+
/** Format a DateTime for display per `displayFormat` (DevExtreme tokens map 1:1 to Luxon). */
|
|
77
|
+
declare function formatDisplay(dt: DateTime | null, displayFormat: string): string;
|
|
78
|
+
/**
|
|
79
|
+
* Parse user-typed text, trying in order: the display format; a lenient variant of it; for a format
|
|
80
|
+
* carrying time tokens, its date-only head (keeping `base`'s time); then ISO.
|
|
81
|
+
*
|
|
82
|
+
* `base` is what stops a datetime field from being destructive. Without it, typing just the date
|
|
83
|
+
* into a `dd-MMM-yyyy HH:mm` box either resets the time to midnight or — because the strict pass
|
|
84
|
+
* rejects the text outright — nulls the whole field. Callers editing an existing value should pass
|
|
85
|
+
* it; the parameter is optional so the date-only call sites need no change.
|
|
86
|
+
*/
|
|
87
|
+
declare function parseDisplay(text: string, displayFormat: string, base?: DateTime | null): DateTime | null;
|
|
88
|
+
/** Calendar zoom level (DevExtreme `dxCalendar.zoomLevel`). */
|
|
89
|
+
type NxeCalendarZoom = 'month' | 'year' | 'decade' | 'century';
|
|
90
|
+
interface NxePeriodCell {
|
|
91
|
+
/** First day of the period (month / year / decade). */
|
|
92
|
+
anchor: DateTime;
|
|
93
|
+
label: string;
|
|
94
|
+
/** Belongs to the adjacent decade/century (rendered dimmed, DevExtreme `other-view`). */
|
|
95
|
+
other: boolean;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Build the 4×3 period grid for a zoomed-out calendar view (mirrors DevExtreme):
|
|
99
|
+
* `year` → Jan..Dec, `decade` → decadeStart−1..decadeStart+10, `century` → 12 decades
|
|
100
|
+
* from centuryStart−10, labelled `"2020 - 2029"`.
|
|
101
|
+
*/
|
|
102
|
+
declare function buildPeriodCells(zoom: Exclude<NxeCalendarZoom, 'month'>, view: DateTime): NxePeriodCell[];
|
|
103
|
+
/** Build the 6×7 day grid (Sunday-first) for the calendar popup of `viewMonth`. */
|
|
104
|
+
declare function buildCalendarWeeks(viewMonth: DateTime): DateTime[][];
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* The grouping and decimal characters every number editor renders with.
|
|
108
|
+
*
|
|
109
|
+
* DevExtreme solves this with a global `DevExpress.localization.locale()`; the Angular equivalent
|
|
110
|
+
* is a provider, so an application states it once at bootstrap:
|
|
111
|
+
*
|
|
112
|
+
* ```ts
|
|
113
|
+
* providers: [{ provide: NXE_NUMBER_SEPARATORS, useValue: NXE_ID_SEPARATORS }]
|
|
114
|
+
* ```
|
|
115
|
+
*
|
|
116
|
+
* This exists because the alternative already happened: with the separators hardcoded, an
|
|
117
|
+
* application that needed `1.250.000,50` instead of `1,234.50` forked the format engine to get
|
|
118
|
+
* them, and that single file is why its copy of the library could not be merged back.
|
|
119
|
+
*
|
|
120
|
+
* Defaults to en-US, which is DevExtreme's default and what the pattern language itself writes.
|
|
121
|
+
*/
|
|
122
|
+
declare const NXE_NUMBER_SEPARATORS: InjectionToken<NxeNumberSeparators>;
|
|
123
|
+
|
|
124
|
+
export { NXE_DATE_SERIALIZATION_FORMAT, NXE_DEFAULT_DATETIME_DISPLAY_FORMAT, NXE_DEFAULT_DISPLAY_FORMAT, NXE_DEFAULT_TIME_DISPLAY_FORMAT, NXE_EN_US_SEPARATORS, NXE_ID_SEPARATORS, NXE_NUMBER_SEPARATORS, buildCalendarWeeks, buildPeriodCells, formatDisplay, formatNumber, hasTimeOfDay, isAllDayRange, parseDateValue, parseDisplay, parseNumber, parseNumberFormat, roundHalfAwayFromZero, serializeDate };
|
|
125
|
+
export type { NxeCalendarZoom, NxeNumberSeparators, NxeParsedNumberFormat, NxePeriodCell };
|