mn-angular-lib 1.0.89 → 1.0.91

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mn-angular-lib",
3
- "version": "1.0.89",
3
+ "version": "1.0.91",
4
4
  "peerDependencies": {
5
5
  "@angular/common": "^21.1.3",
6
6
  "@angular/core": "^21.1.3"
@@ -1,5 +1,5 @@
1
1
  import * as i0 from '@angular/core';
2
- import { InjectionToken, Provider, TemplateRef, OnInit, OnChanges, EventEmitter, ElementRef, PipeTransform, OnDestroy, DoCheck, ChangeDetectorRef, Type, ComponentRef, AfterViewInit, QueryList, ViewContainerRef, SimpleChanges, Signal } from '@angular/core';
2
+ import { InjectionToken, Provider, TemplateRef, OnInit, EventEmitter, OnChanges, ElementRef, PipeTransform, OnDestroy, DoCheck, ChangeDetectorRef, Type, ComponentRef, AfterViewInit, QueryList, ViewContainerRef, SimpleChanges, Signal } from '@angular/core';
3
3
  export { TemplateRef, Type } from '@angular/core';
4
4
  import * as tailwind_variants from 'tailwind-variants';
5
5
  import { VariantProps } from 'tailwind-variants';
@@ -1410,6 +1410,390 @@ declare class MnTextarea implements OnInit {
1410
1410
  static ɵcmp: i0.ɵɵComponentDeclaration<MnTextarea, "mn-lib-textarea", never, { "props": { "alias": "props"; "required": true; }; }, {}, never, never, true, never>;
1411
1411
  }
1412
1412
 
1413
+ /**
1414
+ * Tailwind-variants definition for the MnFileInput component.
1415
+ *
1416
+ * Mirrors the styling vocabulary of {@link mnInputFieldVariants} (size,
1417
+ * borderRadius, shadow, fullWidth, disabled) so a file input visually matches the
1418
+ * rest of the input family, and adds a `dropzone` toggle for the large dashed
1419
+ * drop area used by the default display mode.
1420
+ */
1421
+ declare const mnFileInputVariants: tailwind_variants.TVReturnType<{
1422
+ /** Inner padding scale of the clickable control. */
1423
+ size: {
1424
+ sm: string;
1425
+ md: string;
1426
+ lg: string;
1427
+ };
1428
+ /** Corner rounding of the control. */
1429
+ borderRadius: {
1430
+ none: string;
1431
+ xs: string;
1432
+ sm: string;
1433
+ md: string;
1434
+ lg: string;
1435
+ xl: string;
1436
+ two_xl: string;
1437
+ three_xl: string;
1438
+ four_xl: string;
1439
+ };
1440
+ /** Drop shadow toggle. */
1441
+ shadow: {
1442
+ true: string;
1443
+ };
1444
+ /** Stretch the control to the full width of its container. */
1445
+ fullWidth: {
1446
+ true: string;
1447
+ };
1448
+ /** Renders the control as a large dashed dropzone with a hover accent. */
1449
+ dropzone: {
1450
+ true: string;
1451
+ };
1452
+ /** Dimmed, non-interactive appearance. */
1453
+ disabled: {
1454
+ true: string;
1455
+ };
1456
+ }, undefined, "bg-base-100 border-1 border-base-300 text-base-content text-sm outline-none transition-colors duration-300 ease-in-out", {
1457
+ /** Inner padding scale of the clickable control. */
1458
+ size: {
1459
+ sm: string;
1460
+ md: string;
1461
+ lg: string;
1462
+ };
1463
+ /** Corner rounding of the control. */
1464
+ borderRadius: {
1465
+ none: string;
1466
+ xs: string;
1467
+ sm: string;
1468
+ md: string;
1469
+ lg: string;
1470
+ xl: string;
1471
+ two_xl: string;
1472
+ three_xl: string;
1473
+ four_xl: string;
1474
+ };
1475
+ /** Drop shadow toggle. */
1476
+ shadow: {
1477
+ true: string;
1478
+ };
1479
+ /** Stretch the control to the full width of its container. */
1480
+ fullWidth: {
1481
+ true: string;
1482
+ };
1483
+ /** Renders the control as a large dashed dropzone with a hover accent. */
1484
+ dropzone: {
1485
+ true: string;
1486
+ };
1487
+ /** Dimmed, non-interactive appearance. */
1488
+ disabled: {
1489
+ true: string;
1490
+ };
1491
+ }, undefined, tailwind_variants.TVReturnType<{
1492
+ /** Inner padding scale of the clickable control. */
1493
+ size: {
1494
+ sm: string;
1495
+ md: string;
1496
+ lg: string;
1497
+ };
1498
+ /** Corner rounding of the control. */
1499
+ borderRadius: {
1500
+ none: string;
1501
+ xs: string;
1502
+ sm: string;
1503
+ md: string;
1504
+ lg: string;
1505
+ xl: string;
1506
+ two_xl: string;
1507
+ three_xl: string;
1508
+ four_xl: string;
1509
+ };
1510
+ /** Drop shadow toggle. */
1511
+ shadow: {
1512
+ true: string;
1513
+ };
1514
+ /** Stretch the control to the full width of its container. */
1515
+ fullWidth: {
1516
+ true: string;
1517
+ };
1518
+ /** Renders the control as a large dashed dropzone with a hover accent. */
1519
+ dropzone: {
1520
+ true: string;
1521
+ };
1522
+ /** Dimmed, non-interactive appearance. */
1523
+ disabled: {
1524
+ true: string;
1525
+ };
1526
+ }, undefined, "bg-base-100 border-1 border-base-300 text-base-content text-sm outline-none transition-colors duration-300 ease-in-out", unknown, unknown, undefined>>;
1527
+ /** Variant prop types derived from {@link mnFileInputVariants}. */
1528
+ type MnFileInputVariants = VariantProps<typeof mnFileInputVariants>;
1529
+
1530
+ /** A single error message definition: a static string or a function of the error args. */
1531
+ type MnFileInputErrorMessageData = string | MnErrorMessageFn;
1532
+ /**
1533
+ * Map of error keys to error message definitions.
1534
+ * Keys correspond to the component's selection errors (`accept`, `maxSize`,
1535
+ * `maxFiles`) or the attached control's validator keys (e.g. `required`).
1536
+ */
1537
+ type MnFileInputErrorMessagesData = Partial<Record<string, MnFileInputErrorMessageData>>;
1538
+ /**
1539
+ * Controls how the selected file(s) are presented.
1540
+ * - `dropzone` — large dashed drop area with icon + hint, previews/rows below (default).
1541
+ * - `thumbnail` — grid of image tiles (file icon for non-images), with an add tile.
1542
+ * - `list` — compact rows of file icon + name + size + remove.
1543
+ * - `compact` — inline styled button + current filename + remove.
1544
+ */
1545
+ type MnFileInputDisplayMode = 'dropzone' | 'thumbnail' | 'list' | 'compact';
1546
+ /**
1547
+ * Configuration properties for the {@link MnFileInput} component.
1548
+ * Passed as a single required `props` object, mirroring the other input components.
1549
+ */
1550
+ type MnFileInputProps = {
1551
+ /** Unique identifier for the input element (required for accessibility). */
1552
+ id: string;
1553
+ /** Name attribute for the underlying file input. */
1554
+ name?: string;
1555
+ /** Label text shown above the control (overrides config when provided). */
1556
+ label?: string;
1557
+ /** Hint shown inside the empty dropzone (overrides config when provided). */
1558
+ dropzoneHint?: string;
1559
+ /** Label for the "choose/replace file" affordance (overrides config when provided). */
1560
+ replaceLabel?: string;
1561
+ /** Accessible label for the per-file remove button (overrides config when provided). */
1562
+ removeLabel?: string;
1563
+ /**
1564
+ * Accepted file types, forwarded to the native `accept` attribute and
1565
+ * re-validated on selection (e.g. `image/*`, `.pdf,.docx`). When unset, all
1566
+ * file types are allowed.
1567
+ */
1568
+ accept?: string;
1569
+ /** Allow selecting more than one file. Changes the value shape to `File[]`. */
1570
+ multiple?: boolean;
1571
+ /** Maximum number of files retained (only meaningful when `multiple` is true). */
1572
+ maxFiles?: number;
1573
+ /** Maximum size per file in bytes; larger files are rejected. */
1574
+ maxSize?: number;
1575
+ /** How the selection is rendered. Defaults to `dropzone`. */
1576
+ displayMode?: MnFileInputDisplayMode;
1577
+ /**
1578
+ * URL of an already-saved image to preview when no new file is selected
1579
+ * (single mode). Cleared when the user removes it; surfaced via `cleared`.
1580
+ */
1581
+ currentUrl?: string | null;
1582
+ /** URLs of already-saved images to preview when nothing is selected (multiple mode). */
1583
+ currentUrls?: string[] | null;
1584
+ /** Disables the control. */
1585
+ disabled?: boolean;
1586
+ /** Size variant of the control (default: `md`). */
1587
+ size?: MnFileInputVariants['size'];
1588
+ /** Border radius variant (default: `lg`). */
1589
+ borderRadius?: MnFileInputVariants['borderRadius'];
1590
+ /** Shadow variant for the control. */
1591
+ shadow?: MnFileInputVariants['shadow'];
1592
+ /** Whether the control should take the full width of its container. */
1593
+ fullWidth?: MnFileInputVariants['fullWidth'];
1594
+ /** Custom error messages mapped by error key (overrides config and built-ins). */
1595
+ errorMessages?: MnFileInputErrorMessagesData;
1596
+ /** Fallback message when no specific message is found for an error. */
1597
+ defaultErrorMessage?: string;
1598
+ /** Priority order for displaying control errors when several exist. */
1599
+ errorPriority?: string[];
1600
+ /** Whether to use the built-in default error messages (default: true). */
1601
+ useBuiltInErrorMessages?: boolean;
1602
+ /** Display every control error instead of just the first/priority one (default: false). */
1603
+ showAllErrors?: boolean;
1604
+ };
1605
+ /**
1606
+ * UI strings resolved from {@link MnConfigService} for the file input.
1607
+ * These can only be set via configuration (or the matching `props` overrides).
1608
+ */
1609
+ type MnFileInputUIConfig = {
1610
+ /** Label text displayed above the control. */
1611
+ label?: string;
1612
+ /** ARIA label for screen readers (falls back to label). */
1613
+ ariaLabel?: string;
1614
+ /** Hint shown inside the empty dropzone. */
1615
+ dropzoneHint?: string;
1616
+ /** Label for the "choose/replace file" affordance. */
1617
+ replaceLabel?: string;
1618
+ /** Accessible label for the per-file remove button. */
1619
+ removeLabel?: string;
1620
+ /** Error messages resolved from config (override built-ins, overridden by props). */
1621
+ errorMessages?: Record<string, string>;
1622
+ };
1623
+
1624
+ /** A single renderable entry in the file input (a newly-selected file or an existing image). */
1625
+ type MnFileDisplayItem = {
1626
+ /** File name (new files) or a derived name (existing images). */
1627
+ name: string;
1628
+ /** Whether the entry should render as an image preview. */
1629
+ isImage: boolean;
1630
+ /** Object-URL (new image files) or saved URL (existing images), else null. */
1631
+ previewUrl: string | null;
1632
+ /** Human-readable size for new files, else null. */
1633
+ sizeLabel: string | null;
1634
+ /** Index used by the remove action. */
1635
+ index: number;
1636
+ /** True for an already-saved image passed via `currentUrl(s)`. */
1637
+ existing: boolean;
1638
+ };
1639
+ /**
1640
+ * MnFileInput Component
1641
+ *
1642
+ * A generic, accessible file input that implements Angular's ControlValueAccessor.
1643
+ * It styles selection to match the rest of the input family, shows image previews
1644
+ * (and a file icon + name for non-images), supports single or multiple selection,
1645
+ * several display layouts, and client-side `accept` / `maxSize` / `maxFiles` limits.
1646
+ *
1647
+ * The form control value is the plain selection: `File | null` (single) or
1648
+ * `File[]` (multiple). An optional `currentUrl`/`currentUrls` renders an
1649
+ * already-saved image; removing it leaves the value untouched and emits `cleared`.
1650
+ *
1651
+ * @example
1652
+ * ```html
1653
+ * <mn-lib-file-input
1654
+ * formControlName="image"
1655
+ * [props]="{ id: 'image', label: 'Cover', accept: 'image/*', displayMode: 'dropzone' }"
1656
+ * (cleared)="onRemoveExisting()">
1657
+ * </mn-lib-file-input>
1658
+ * ```
1659
+ */
1660
+ declare class MnFileInput implements OnInit {
1661
+ ngControl: NgControl | null;
1662
+ /** Configuration properties for the file input. */
1663
+ props: MnFileInputProps;
1664
+ /** Emits whenever the selected file(s) change (in addition to the form control). */
1665
+ filesChange: EventEmitter<File | File[] | null>;
1666
+ /** Emits when the user removes an already-saved image (`currentUrl(s)`). */
1667
+ cleared: EventEmitter<void>;
1668
+ /** Resolved UI configuration for the file input. */
1669
+ protected uiConfig: MnFileInputUIConfig;
1670
+ /** Currently selected files (always an array internally). */
1671
+ protected readonly files: i0.WritableSignal<File[]>;
1672
+ /** Transient message for a rejected selection (accept/maxSize/maxFiles). */
1673
+ protected readonly internalError: i0.WritableSignal<string | null>;
1674
+ private readonly configService;
1675
+ private readonly sectionPath;
1676
+ private readonly explicitInstanceId;
1677
+ private readonly lang;
1678
+ private readonly destroyRef;
1679
+ /** Object-URL previews aligned to {@link files}; null for non-image entries. */
1680
+ private readonly previewUrls;
1681
+ /** True once the user removed the single existing image. */
1682
+ private readonly currentCleared;
1683
+ /** Indices of removed existing images (multiple mode). */
1684
+ private readonly removedExisting;
1685
+ /** Renderable entries: existing images (when nothing newer hides them) then new files. */
1686
+ readonly displayItems: i0.Signal<MnFileDisplayItem[]>;
1687
+ /** Disabled state pushed by the forms API. */
1688
+ private formDisabled;
1689
+ /**
1690
+ * Built-in default error messages in English.
1691
+ * Used when `useBuiltInErrorMessages` is true (default); overridable per-field.
1692
+ */
1693
+ private readonly builtInErrorMessages;
1694
+ /** Registers this component as the ControlValueAccessor for the injected control. */
1695
+ constructor();
1696
+ /** The effective display mode. */
1697
+ get displayMode(): MnFileInputDisplayMode;
1698
+ /** Whether the control is disabled (via props or the forms API). */
1699
+ get isDisabled(): boolean;
1700
+ /** Native `accept` attribute value, or null for no restriction when unset. */
1701
+ get acceptAttr(): string | null;
1702
+ /** Resolved id for the file input element. */
1703
+ get resolvedId(): string;
1704
+ /** Resolved name attribute for the file input element. */
1705
+ get resolvedName(): string | null;
1706
+ /** Tailwind-variant classes for the clickable control. */
1707
+ get controlClasses(): string;
1708
+ /** The attached form control, if any. */
1709
+ get control(): _angular_forms.AbstractControl<any, any, any> | null;
1710
+ /** Whether to show control validation errors. */
1711
+ get showError(): boolean;
1712
+ /** All control error messages (used when `showAllErrors` is true). */
1713
+ get errorMessages(): string[];
1714
+ /** Single control error message (priority-aware). */
1715
+ get errorMessage(): string | null;
1716
+ ngOnInit(): void;
1717
+ /**
1718
+ * Writes a value from the form into the control.
1719
+ * @param val A `File`, an array of `File`, or null/undefined.
1720
+ */
1721
+ writeValue(val: unknown): void;
1722
+ /**
1723
+ * Registers the form's change callback.
1724
+ * @param fn Callback invoked with the new value.
1725
+ */
1726
+ registerOnChange(fn: (val: unknown) => void): void;
1727
+ /**
1728
+ * Registers the form's touched callback.
1729
+ * @param fn Callback invoked when the control is touched.
1730
+ */
1731
+ registerOnTouched(fn: () => void): void;
1732
+ /**
1733
+ * Sets the disabled state of the control.
1734
+ * @param isDisabled Whether the control should be disabled.
1735
+ */
1736
+ setDisabledState(isDisabled: boolean): void;
1737
+ /**
1738
+ * Handles a file-picker change: validates the incoming files against the
1739
+ * configured limits and updates the selection.
1740
+ * @param event The native change event from the hidden file input.
1741
+ */
1742
+ onFileSelected(event: Event): void;
1743
+ /**
1744
+ * Removes a newly-selected file by index.
1745
+ * @param index Index into the current selection.
1746
+ */
1747
+ removeFile(index: number): void;
1748
+ /**
1749
+ * Removes an already-saved image and notifies the consumer via `cleared`.
1750
+ * @param index Index of the existing image (0 in single mode).
1751
+ */
1752
+ removeExisting(index: number): void;
1753
+ /** Whether the attached control carries a `required` validator. */
1754
+ protected isRequired(): boolean;
1755
+ /** Stable track key for a display item across renders. */
1756
+ protected itemKey(item: MnFileDisplayItem): string;
1757
+ /** Whether a file should render as an image. */
1758
+ protected isImage(file: File): boolean;
1759
+ /** Callback to notify Angular forms of value changes. */
1760
+ private onChange;
1761
+ /** Callback to notify Angular forms when the control is touched. */
1762
+ private onTouched;
1763
+ /** Resolves UI strings from config, layering built-in defaults and prop overrides. */
1764
+ private resolveConfig;
1765
+ /**
1766
+ * Validates and merges newly-picked files into the current selection.
1767
+ * @param incoming The files chosen by the user.
1768
+ */
1769
+ private addFiles;
1770
+ /** Replaces the internal selection and rebuilds image previews. */
1771
+ private setFiles;
1772
+ /** Emits the current value to the form and any listeners. */
1773
+ private emit;
1774
+ /** Revokes any outstanding object-URL previews to avoid leaks. */
1775
+ private revokeAll;
1776
+ /** Builds a display item for an already-saved image. */
1777
+ private existingItem;
1778
+ /** Picks which control error key to display. */
1779
+ private pickErrorKey;
1780
+ /** Resolves a control error key to a message, interpolating its args. */
1781
+ private resolveControlError;
1782
+ /**
1783
+ * Resolves a message for an error key using the same precedence as the other
1784
+ * inputs: custom props > config > built-in > fallback > default.
1785
+ */
1786
+ private resolveMessage;
1787
+ /** Checks a file against the configured `accept` filter (extensions and MIME globs). */
1788
+ private matchesAccept;
1789
+ /** Formats a byte count as a human-readable size. */
1790
+ private humanFileSize;
1791
+ /** Derives a display name from a URL (last path segment). */
1792
+ private fileNameFromUrl;
1793
+ static ɵfac: i0.ɵɵFactoryDeclaration<MnFileInput, never>;
1794
+ static ɵcmp: i0.ɵɵComponentDeclaration<MnFileInput, "mn-lib-file-input", never, { "props": { "alias": "props"; "required": true; }; }, { "filesChange": "filesChange"; "cleared": "cleared"; }, never, never, true, never>;
1795
+ }
1796
+
1413
1797
  declare const mnCheckboxVariants: tailwind_variants.TVReturnType<{
1414
1798
  size: {
1415
1799
  xs: string;
@@ -2461,7 +2845,7 @@ declare abstract class MnCollectionBase<T, DS extends MnCollectionDataSource<T>>
2461
2845
  /**
2462
2846
  * Measured pixel height of one full page, applied as a persistent `min-height` floor
2463
2847
  * while paginated so a short page (the last page, or after a row is removed/filtered)
2464
- * can't collapse the body and jump the layout below it. Blank space fills the remainder
2848
+ * can't collapse the body and jump the layout below it. Blank space fills the remaindernpm
2465
2849
  * at the bottom. Captured once a full page is actually on screen; `0` means unmeasured.
2466
2850
  * Distinct from the transient {@link lockedMinHeight} reload lock — both combine in
2467
2851
  * {@link bodyMinHeight} via `Math.max`.
@@ -2674,6 +3058,20 @@ type TableDataSource<T> = MnSelectableCollectionDataSource<T> & {
2674
3058
  toolbarLeftTemplate?: TemplateRef<unknown>;
2675
3059
  /** Template rendered on the right side of the toolbar (after the search field). */
2676
3060
  toolbarRightTemplate?: TemplateRef<unknown>;
3061
+ /**
3062
+ * Label for the toggle button that opens the stacked filter panel on small
3063
+ * screens (below 640px). Defaults to "Filters".
3064
+ */
3065
+ filtersLabel?: string;
3066
+ /** Translation key for {@link filtersLabel}. Resolved via MnLanguageService. */
3067
+ filtersLabelKey?: string;
3068
+ /**
3069
+ * Label for the action that resets every column filter in the small-screen
3070
+ * panel. Defaults to "Clear all".
3071
+ */
3072
+ clearFiltersLabel?: string;
3073
+ /** Translation key for {@link clearFiltersLabel}. Resolved via MnLanguageService. */
3074
+ clearFiltersLabelKey?: string;
2677
3075
  };
2678
3076
  /** @deprecated Use {@link MnCollectionLabels}. */
2679
3077
  type TableLabels = MnCollectionLabels;
@@ -2686,6 +3084,16 @@ declare class MnTable<T = object> extends MnSelectableCollectionBase<T, TableDat
2686
3084
  currentSort: SortState | null;
2687
3085
  /** Per-column filter values keyed by column key. */
2688
3086
  columnFilters: ColumnFilterState;
3087
+ /** Viewport width (px) below which the inline filter row collapses into a panel. */
3088
+ private static readonly FILTER_COLLAPSE_WIDTH;
3089
+ /**
3090
+ * True when the viewport is narrow enough that the per-column filter inputs no
3091
+ * longer fit under their headers; the inline row is then replaced by a toggle
3092
+ * button and a stacked filter panel.
3093
+ */
3094
+ protected filtersCollapsed: boolean;
3095
+ /** Whether the small-screen filter panel is currently expanded. */
3096
+ protected filtersPanelOpen: boolean;
2689
3097
  protected readonly componentName = "MnTable";
2690
3098
  protected get trackedToolbarTemplate(): TemplateRef<unknown> | undefined;
2691
3099
  protected collectionBody?: ElementRef<HTMLElement>;
@@ -2695,6 +3103,24 @@ declare class MnTable<T = object> extends MnSelectableCollectionBase<T, TableDat
2695
3103
  getFilterSelectOptions(column: ColumnDefinition<T>): MnSelectOption<string>[];
2696
3104
  /** Whether any column has filtering enabled. */
2697
3105
  get hasColumnFilters(): boolean;
3106
+ /** Whether at least one column filter is active. */
3107
+ get hasActiveFilters(): boolean;
3108
+ /** Label for the small-screen filters toggle button. */
3109
+ get filtersButtonLabel(): string;
3110
+ /** Label for the "clear all filters" action in the small-screen panel. */
3111
+ get clearFiltersButtonLabel(): string;
3112
+ /** Opens/closes the stacked filter panel shown on small screens. */
3113
+ toggleFiltersPanel(): void;
3114
+ /** Resets every column filter and re-applies filtering. */
3115
+ clearAllFilters(): void;
3116
+ /** True when the viewport is below the filter-collapse breakpoint. */
3117
+ private isFilterViewport;
3118
+ /**
3119
+ * Recomputes whether the inline filter row should collapse into the panel.
3120
+ * Closes the panel when returning to the wide layout so reopened state never
3121
+ * leaks across the breakpoint. Marks for check only when the layout flips.
3122
+ */
3123
+ private updateFilterLayout;
2698
3124
  sort(column: ColumnDefinition<T>): void;
2699
3125
  onRowClick(row: T): void;
2700
3126
  /**
@@ -2718,7 +3144,7 @@ declare class MnTable<T = object> extends MnSelectableCollectionBase<T, TableDat
2718
3144
  * rendered rows update in every pagination mode (used at init and on window resize).
2719
3145
  */
2720
3146
  private applyResponsivePageSize;
2721
- /** Re-evaluate the responsive page size when the viewport crosses the breakpoint. */
3147
+ /** Re-evaluate responsive page size and filter layout when the viewport changes. */
2722
3148
  protected onWindowResize(): void;
2723
3149
  /** Tracks the desktop page size when the user picks one (selector only shows at >= md). */
2724
3150
  onPageSizeChange(newSize: number): void;
@@ -3292,6 +3718,24 @@ type FileFieldConfig<TModel = unknown> = {
3292
3718
  maxSize?: number;
3293
3719
  /** Maximum number of files (when multiple is true) */
3294
3720
  maxFiles?: number;
3721
+ /** How the selection is displayed (default: 'dropzone') */
3722
+ displayMode?: 'dropzone' | 'thumbnail' | 'list' | 'compact';
3723
+ /** Hint shown inside the empty dropzone */
3724
+ dropzoneHint?: string;
3725
+ /** Label for the "choose/replace file" affordance */
3726
+ replaceLabel?: string;
3727
+ /** Accessible label for the per-file remove button */
3728
+ removeLabel?: string;
3729
+ /** URL of an already-saved image to preview when no new file is selected (single mode) */
3730
+ currentUrl?: string | null;
3731
+ /** URLs of already-saved images to preview when nothing is selected (multiple mode) */
3732
+ currentUrls?: string[] | null;
3733
+ /**
3734
+ * Called when the user removes an already-saved image (`currentUrl`/`currentUrls`).
3735
+ * The form value stays null; use this to record the removal intent (e.g. to send
3736
+ * a "clear image" instruction to the API on submit).
3737
+ */
3738
+ onClear?: () => void;
3295
3739
  validators?: ValidatorFn[];
3296
3740
  asyncValidators?: AsyncValidatorFn[];
3297
3741
  readOnly?: boolean;
@@ -3905,6 +4349,13 @@ type FormFieldView<TModel> = FormFieldConfig<TModel> & {
3905
4349
  unit?: string;
3906
4350
  accept?: string;
3907
4351
  multiple?: boolean;
4352
+ displayMode?: 'dropzone' | 'thumbnail' | 'list' | 'compact';
4353
+ dropzoneHint?: string;
4354
+ replaceLabel?: string;
4355
+ removeLabel?: string;
4356
+ currentUrl?: string | null;
4357
+ currentUrls?: string[] | null;
4358
+ onClear?: () => void;
3908
4359
  maxSize: number;
3909
4360
  maxFiles?: number;
3910
4361
  component: Type<unknown>;
@@ -4013,13 +4464,13 @@ declare class MnFormBodyComponent<TModel = unknown, TResult = TModel> implements
4013
4464
  private reloadDependentDataSources;
4014
4465
  getGridColumns(row: FormRow<TModel>): string;
4015
4466
  getGridSpan(rowField: FormRowField<TModel>): string;
4016
- /** Store selected files keyed by field key */
4017
- fileSelections: Record<string, File[]>;
4018
- onFileChange(field: FormFieldConfig<TModel>, event: Event): void;
4019
- removeFile(key: string, index: number): void;
4020
- getSelectedFiles(key: string): File[];
4021
- formatFileSize(bytes: number): string;
4022
- getFileError(field: FormFieldConfig<TModel>): string;
4467
+ /**
4468
+ * Invokes a FILE field's `onClear` callback when its existing image is removed.
4469
+ * FILE fields render {@link MnFileInput}, which owns selection/validation and
4470
+ * writes the value (`File | File[] | null`) straight to the form control.
4471
+ * @param field The field whose existing image was cleared.
4472
+ */
4473
+ onFileCleared(field: FormFieldConfig<TModel>): void;
4023
4474
  submit(): Promise<void>;
4024
4475
  static ɵfac: i0.ɵɵFactoryDeclaration<MnFormBodyComponent<any, any>, never>;
4025
4476
  static ɵcmp: i0.ɵɵComponentDeclaration<MnFormBodyComponent<any, any>, "mn-form-body", never, { "config": { "alias": "config"; "required": false; }; "modalRef": { "alias": "modalRef"; "required": false; }; "hideFooter": { "alias": "hideFooter"; "required": false; }; "hideCustomBody": { "alias": "hideCustomBody"; "required": false; }; }, { "formStatusChange": "formStatusChange"; }, never, never, true, never>;
@@ -5607,5 +6058,5 @@ type MnPreviewMessage = {
5607
6058
  */
5608
6059
  declare function enableMnPreviewMode(configService: MnConfigService, langService: MnLanguageService, allowedOrigins?: string[]): void;
5609
6060
 
5610
- export { API_BASE_URL, ActionStyle, BackdropMode, BaseModalBuilder, CALENDAR_CONFIG, CALENDAR_DATE_FORMATTER, CalendarDayComponent, CalendarEventComponent, CalendarEventDefaultComponent, CalendarEventLayoutService, CalendarMonthComponent, CalendarUtility, CalendarView, CalendarViewComponent, CalendarWeekComponent, CloseMode, ColumnSortType, ConfirmationModalBuilder, ConfirmationTone, CrudService, CustomModalBuilder, DEFAULT_CALENDAR_CONFIG, DEFAULT_MN_ALERT_CONFIG, DefaultCalendarDateFormatter, FieldAppearance, FieldKind, FormLayoutMode, FormModalBuilder, KeyboardMode, MN_ALERT_CONFIG, MN_CALENDAR_COMPONENT_NAME, MN_CALENDAR_CONFIG, MN_CHECKBOX_CONFIG, MN_DATETIME_CONFIG, MN_ICON_MAP, MN_INPUT_FIELD_CONFIG, MN_INSTANCE_ID, MN_LIB_DUAL_HORIZONTAL_IMAGE, MN_MULTI_SELECT_CONFIG, MN_SECTION_PATH, MN_SELECT_CONFIG, MN_TEXTAREA_CONFIG, MnAlertOutletComponent, MnAlertService, MnAlertStore, MnBadge, MnButton, MnCheckbox, MnCollectionBase, MnCollectionPagination, MnConfigService, MnConfirmationBodyComponent, MnCustomBodyHostComponent, MnDatetime, MnDualHorizontalImage, MnFormBodyComponent, MnGrid, MnHiddenBelowDirective, MnHttpService, MnIcon, MnIconAttributes, MnInformationCard, MnInputField, MnInstanceDirective, MnLanguageService, MnList, MnModalRef, MnModalService, MnModalShellComponent, MnMultiSelect, MnSectionDirective, MnSelect, MnSelectableCollectionBase, MnShowAboveDirective, MnShowBelowDirective, MnSkeleton, MnTabComponent, MnTable, MnTextarea, MnTranslatePipe, MnWizardBodyComponent, ModalBuilder, ModalCloseReason, ModalIntent, ModalKind, ModalSize, NavigationDirection, OptionState, SelectionMode, StepBuilder, StepState, SubmitMode, UpcomingEventRowComponent, UpcomingEventsComponent, ValidationCode, ValidationStatus, WizardFlowMode, WizardModalBuilder, dateTimeAdapter, defaultTextAdapter, enableMnPreviewMode, isTranslatable, mnAlertVariants, mnBadgeVariants, mnButtonVariants, mnCheckboxVariants, mnCheckboxWrapperVariants, mnDatetimeVariants, mnIconVariants, mnInformationCardVariants, mnInputFieldVariants, mnMultiSelectVariants, mnSelectVariants, mnSkeletonVariants, mnTextareaVariants, numberAdapter, pickAdapter, provideMnAlerts, provideMnCalendarConfig, provideMnComponentConfig, provideMnConfig, provideMnLanguage, resolveCalendarConfig };
5611
- export type { AnimationOptions, ApiError, BaseModalConfig, CalendarButton, CalendarConfig, CalendarDateFormatter, CalendarEvent, CalendarEventData, CancellationActionConfig, CheckboxFieldConfig, ColorFieldConfig, ColorPreset, ColumnDay, ColumnDefinition, ColumnFilterOption, ColumnFilterState, ColumnFilterType, ColumnSkeleton, ConfirmationActionConfig, ConfirmationModalConfig, CrudConfig, CurrentTimeCalendarEvent, CursorPaginationStrategy, CustomFieldConfig, CustomModalConfig, DateFieldConfig, DatetimeFieldConfig, FailureResult, FieldDataSource, FieldRequiredCondition, FieldValidator, FieldVisibilityCondition, FileFieldConfig, FormFieldConfig, FormFieldGroup, FormModalConfig, FormRow, FormRowField, FormValidator, GridDataSource, GridLayout, GridSkeleton, HourRow, ListAppearance, ListDataSource, ListLabels, ListSkeleton, MnAlert, MnAlertConfig, MnAlertId, MnAlertKind, MnAlertTemplateContext, MnAlertVariants, MnBadgeTypes, MnBadgeVariants, MnButtonTypes, MnButtonVariants, MnCheckboxErrorMessageData, MnCheckboxErrorMessagesData, MnCheckboxProps, MnCheckboxUIConfig, MnCheckboxVariants, MnCheckboxWrapperVariants, MnCollectionDataSource, MnCollectionLabels, MnConfigFile, MnConfigSettings, MnConfigValue, MnDatetimeErrorMessageData, MnDatetimeErrorMessagesData, MnDatetimeMode, MnDatetimeProps, MnDatetimeUIConfig, MnDatetimeVariants, MnDomAttrs, MnDualHorizontalImageConfig, MnDualHorizontalImageTypes, MnErrorMessageData, MnErrorMessageFn, MnErrorMessagesData, MnIconTypes, MnIconVariants, MnImageType, MnInformationCardBaseData, MnInformationCardData, MnInformationCardVariants, MnInputAdapter, MnInputBaseProps, MnInputDateTimeProps, MnInputFieldProps, MnInputFieldUIConfig, MnInputProps, MnInputType, MnInputVariants, MnLanguageConfig, MnMultiSelectErrorMessageData, MnMultiSelectErrorMessagesData, MnMultiSelectOption, MnMultiSelectProps, MnMultiSelectUIConfig, MnMultiSelectVariants, MnPreviewMessage, MnQueryParams, MnSelectErrorMessageData, MnSelectErrorMessagesData, MnSelectOption, MnSelectProps, MnSelectUIConfig, MnSelectVariants, MnSelectableCollectionDataSource, MnShowInput, MnSkeletonProps, MnSkeletonShape, MnSkeletonVariantProps, MnTabDataSource, MnTabItem, MnTextareaErrorMessageData, MnTextareaErrorMessagesData, MnTextareaProps, MnTextareaUIConfig, MnTextareaVariants, MnTranslatable, MnTranslationMap, MnTranslations, MnValidationErrorArgs, ModalCancelHandler, ModalCloseEvent, ModalConfig, ModalFooterAction, ModalI18nLabels, ModalInputMap, ModalPollingConfig, ModalRef, ModalResultHandler, ModalStepId, MonthItem, MultiSelectFieldConfig, MultiSelectTableFieldConfig, NumberFieldConfig, OffsetPaginationStrategy, PaginationMode, PaginationStrategy, PasswordFieldConfig, Primitive, QueryParams, QueryValue, RatingFieldConfig, Result, ResultMeta, SelectFieldConfig, SelectOption, SingleSelectTableFieldConfig, SliderFieldConfig, SortState, StepBodyConfig, StepGuard, StepValidator, SuccessResult, TableAppearance, TableDataSource, TableLabels, TextFieldConfig, TextareaFieldConfig, ValidationResult, WizardBeforeCompleteValidator, WizardModalConfig, WizardResult, WizardStepChangeEvent, WizardStepChangeHandler, WizardStepConfig };
6061
+ export { API_BASE_URL, ActionStyle, BackdropMode, BaseModalBuilder, CALENDAR_CONFIG, CALENDAR_DATE_FORMATTER, CalendarDayComponent, CalendarEventComponent, CalendarEventDefaultComponent, CalendarEventLayoutService, CalendarMonthComponent, CalendarUtility, CalendarView, CalendarViewComponent, CalendarWeekComponent, CloseMode, ColumnSortType, ConfirmationModalBuilder, ConfirmationTone, CrudService, CustomModalBuilder, DEFAULT_CALENDAR_CONFIG, DEFAULT_MN_ALERT_CONFIG, DefaultCalendarDateFormatter, FieldAppearance, FieldKind, FormLayoutMode, FormModalBuilder, KeyboardMode, MN_ALERT_CONFIG, MN_CALENDAR_COMPONENT_NAME, MN_CALENDAR_CONFIG, MN_CHECKBOX_CONFIG, MN_DATETIME_CONFIG, MN_ICON_MAP, MN_INPUT_FIELD_CONFIG, MN_INSTANCE_ID, MN_LIB_DUAL_HORIZONTAL_IMAGE, MN_MULTI_SELECT_CONFIG, MN_SECTION_PATH, MN_SELECT_CONFIG, MN_TEXTAREA_CONFIG, MnAlertOutletComponent, MnAlertService, MnAlertStore, MnBadge, MnButton, MnCheckbox, MnCollectionBase, MnCollectionPagination, MnConfigService, MnConfirmationBodyComponent, MnCustomBodyHostComponent, MnDatetime, MnDualHorizontalImage, MnFileInput, MnFormBodyComponent, MnGrid, MnHiddenBelowDirective, MnHttpService, MnIcon, MnIconAttributes, MnInformationCard, MnInputField, MnInstanceDirective, MnLanguageService, MnList, MnModalRef, MnModalService, MnModalShellComponent, MnMultiSelect, MnSectionDirective, MnSelect, MnSelectableCollectionBase, MnShowAboveDirective, MnShowBelowDirective, MnSkeleton, MnTabComponent, MnTable, MnTextarea, MnTranslatePipe, MnWizardBodyComponent, ModalBuilder, ModalCloseReason, ModalIntent, ModalKind, ModalSize, NavigationDirection, OptionState, SelectionMode, StepBuilder, StepState, SubmitMode, UpcomingEventRowComponent, UpcomingEventsComponent, ValidationCode, ValidationStatus, WizardFlowMode, WizardModalBuilder, dateTimeAdapter, defaultTextAdapter, enableMnPreviewMode, isTranslatable, mnAlertVariants, mnBadgeVariants, mnButtonVariants, mnCheckboxVariants, mnCheckboxWrapperVariants, mnDatetimeVariants, mnFileInputVariants, mnIconVariants, mnInformationCardVariants, mnInputFieldVariants, mnMultiSelectVariants, mnSelectVariants, mnSkeletonVariants, mnTextareaVariants, numberAdapter, pickAdapter, provideMnAlerts, provideMnCalendarConfig, provideMnComponentConfig, provideMnConfig, provideMnLanguage, resolveCalendarConfig };
6062
+ export type { AnimationOptions, ApiError, BaseModalConfig, CalendarButton, CalendarConfig, CalendarDateFormatter, CalendarEvent, CalendarEventData, CancellationActionConfig, CheckboxFieldConfig, ColorFieldConfig, ColorPreset, ColumnDay, ColumnDefinition, ColumnFilterOption, ColumnFilterState, ColumnFilterType, ColumnSkeleton, ConfirmationActionConfig, ConfirmationModalConfig, CrudConfig, CurrentTimeCalendarEvent, CursorPaginationStrategy, CustomFieldConfig, CustomModalConfig, DateFieldConfig, DatetimeFieldConfig, FailureResult, FieldDataSource, FieldRequiredCondition, FieldValidator, FieldVisibilityCondition, FileFieldConfig, FormFieldConfig, FormFieldGroup, FormModalConfig, FormRow, FormRowField, FormValidator, GridDataSource, GridLayout, GridSkeleton, HourRow, ListAppearance, ListDataSource, ListLabels, ListSkeleton, MnAlert, MnAlertConfig, MnAlertId, MnAlertKind, MnAlertTemplateContext, MnAlertVariants, MnBadgeTypes, MnBadgeVariants, MnButtonTypes, MnButtonVariants, MnCheckboxErrorMessageData, MnCheckboxErrorMessagesData, MnCheckboxProps, MnCheckboxUIConfig, MnCheckboxVariants, MnCheckboxWrapperVariants, MnCollectionDataSource, MnCollectionLabels, MnConfigFile, MnConfigSettings, MnConfigValue, MnDatetimeErrorMessageData, MnDatetimeErrorMessagesData, MnDatetimeMode, MnDatetimeProps, MnDatetimeUIConfig, MnDatetimeVariants, MnDomAttrs, MnDualHorizontalImageConfig, MnDualHorizontalImageTypes, MnErrorMessageData, MnErrorMessageFn, MnErrorMessagesData, MnFileDisplayItem, MnFileInputDisplayMode, MnFileInputErrorMessageData, MnFileInputErrorMessagesData, MnFileInputProps, MnFileInputUIConfig, MnFileInputVariants, MnIconTypes, MnIconVariants, MnImageType, MnInformationCardBaseData, MnInformationCardData, MnInformationCardVariants, MnInputAdapter, MnInputBaseProps, MnInputDateTimeProps, MnInputFieldProps, MnInputFieldUIConfig, MnInputProps, MnInputType, MnInputVariants, MnLanguageConfig, MnMultiSelectErrorMessageData, MnMultiSelectErrorMessagesData, MnMultiSelectOption, MnMultiSelectProps, MnMultiSelectUIConfig, MnMultiSelectVariants, MnPreviewMessage, MnQueryParams, MnSelectErrorMessageData, MnSelectErrorMessagesData, MnSelectOption, MnSelectProps, MnSelectUIConfig, MnSelectVariants, MnSelectableCollectionDataSource, MnShowInput, MnSkeletonProps, MnSkeletonShape, MnSkeletonVariantProps, MnTabDataSource, MnTabItem, MnTextareaErrorMessageData, MnTextareaErrorMessagesData, MnTextareaProps, MnTextareaUIConfig, MnTextareaVariants, MnTranslatable, MnTranslationMap, MnTranslations, MnValidationErrorArgs, ModalCancelHandler, ModalCloseEvent, ModalConfig, ModalFooterAction, ModalI18nLabels, ModalInputMap, ModalPollingConfig, ModalRef, ModalResultHandler, ModalStepId, MonthItem, MultiSelectFieldConfig, MultiSelectTableFieldConfig, NumberFieldConfig, OffsetPaginationStrategy, PaginationMode, PaginationStrategy, PasswordFieldConfig, Primitive, QueryParams, QueryValue, RatingFieldConfig, Result, ResultMeta, SelectFieldConfig, SelectOption, SingleSelectTableFieldConfig, SliderFieldConfig, SortState, StepBodyConfig, StepGuard, StepValidator, SuccessResult, TableAppearance, TableDataSource, TableLabels, TextFieldConfig, TextareaFieldConfig, ValidationResult, WizardBeforeCompleteValidator, WizardModalConfig, WizardResult, WizardStepChangeEvent, WizardStepChangeHandler, WizardStepConfig };