mn-angular-lib 1.0.147 → 1.0.148

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,9 +1,10 @@
1
1
  {
2
2
  "name": "mn-angular-lib",
3
- "version": "1.0.147",
3
+ "version": "1.0.148",
4
4
  "peerDependencies": {
5
5
  "@angular/common": "^21.1.3",
6
6
  "@angular/core": "^21.1.3",
7
+ "@lucide/angular": "^1.18.0",
7
8
  "quill": "^2.0.3"
8
9
  },
9
10
  "peerDependenciesMeta": {
@@ -2912,6 +2912,18 @@ declare const mnDropdownTriggerVariants: tailwind_variants.TVReturnType<{
2912
2912
  }, undefined, "inline-flex items-center justify-center gap-x-1.5 text-base-content/80 cursor-pointer", unknown, unknown, undefined>>;
2913
2913
  type MnDropdownTriggerVariants = VariantProps<typeof mnDropdownTriggerVariants>;
2914
2914
 
2915
+ /**
2916
+ * The leading icon of a command — either a `TemplateRef` (full control over the icon
2917
+ * set: an `<mn-icon>`, an emoji, a bespoke `<svg>`) or lucide icon *data*, i.e. a
2918
+ * lucide icon's static `.icon` (e.g. `LucidePencil.icon`), which the component renders
2919
+ * itself at the right size for its slot.
2920
+ *
2921
+ * The data form exists so an action can be declared in plain TypeScript — a shared
2922
+ * action factory, a config array, a service — without the host component having to
2923
+ * carry an `<ng-template>` stub and a `@ViewChild` for every glyph. Same convention as
2924
+ * {@link MnCollectionDataSource.emptyIcon}.
2925
+ */
2926
+ type MnActionIcon = TemplateRef<unknown> | LucideIconData;
2915
2927
  /** Theme colour tokens an action item can be tinted with, mirroring mn-button's palette. */
2916
2928
  type MnDropdownActionColor = 'primary' | 'secondary' | 'danger' | 'warning' | 'success' | 'accent' | 'gray';
2917
2929
  /**
@@ -2928,10 +2940,11 @@ type MnDropdownAction = {
2928
2940
  */
2929
2941
  labelKey?: string;
2930
2942
  /**
2931
- * Optional leading icon, supplied as a template so the consumer keeps full control
2932
- * over which icon set is used (a lucide `<svg>`, an `<mn-icon>`, an emoji…).
2943
+ * Optional leading icon: a template, so the consumer keeps full control over which
2944
+ * icon set is used (an `<mn-icon>`, an emoji…), or lucide icon data such as
2945
+ * `LucidePencil.icon` for a template-free declaration. See {@link MnActionIcon}.
2933
2946
  */
2934
- icon?: TemplateRef<unknown>;
2947
+ icon?: MnActionIcon;
2935
2948
  /** Invoked when the item is chosen. The menu closes immediately afterwards. */
2936
2949
  run: () => void;
2937
2950
  /** When true the item is shown dimmed and cannot be chosen. */
@@ -3091,6 +3104,14 @@ declare class MnDropdown implements OnInit {
3091
3104
  private portal;
3092
3105
  /** The label shown for an action, preferring a resolved translation key. */
3093
3106
  actionLabel(action: MnDropdownAction): string;
3107
+ /**
3108
+ * Whether an icon was supplied as a `TemplateRef` rather than lucide icon data, which
3109
+ * decides how the template renders it. Kept as a method (not a pipe) so the narrowing
3110
+ * is available inline in the item loop.
3111
+ * @param value The icon to test.
3112
+ * @returns True when the icon is a template the caller owns.
3113
+ */
3114
+ isTemplateRef(value: unknown): value is TemplateRef<unknown>;
3094
3115
  /**
3095
3116
  * Foreground class for an item: an explicit {@link MnDropdownAction.color}, else the
3096
3117
  * destructive red for a {@link MnDropdownAction.danger} item, else the default text.
@@ -4245,6 +4266,17 @@ type MnColumnFilter = {
4245
4266
  * skeleton at 75% width is used (matching the previous default).
4246
4267
  */
4247
4268
  type ColumnSkeleton = Partial<MnSkeletonProps> | TemplateRef<unknown>;
4269
+ /**
4270
+ * A presentation value that is either fixed for the whole column or derived per row.
4271
+ *
4272
+ * The function form is what lets one action cover a state that flips — an
4273
+ * activate/deactivate toggle, a pin/unpin — instead of declaring two actions and hiding
4274
+ * one of them per row. It is only for *presentation*: visibility stays with `hidden` and
4275
+ * interactivity with `disabled`, both of which are always predicates.
4276
+ *
4277
+ * Resolved on every change detection, so the accessor must be cheap and side-effect free.
4278
+ */
4279
+ type MnRowValue<T, V> = V | ((row: T) => V);
4248
4280
  /**
4249
4281
  * A per-row command rendered in an actions column (see {@link ColumnBase.actions}).
4250
4282
  * Unlike a cell it carries no display value — choosing it invokes {@link run} with the
@@ -4254,11 +4286,16 @@ type ColumnSkeleton = Partial<MnSkeletonProps> | TemplateRef<unknown>;
4254
4286
  */
4255
4287
  type MnTableRowAction<T> = {
4256
4288
  /** Visible label. Falls back to `labelKey`'s resolved text when omitted. */
4257
- label?: string;
4289
+ label?: MnRowValue<T, string>;
4258
4290
  /** Translation key for the label, resolved via MnLanguageService and kept updated on locale change. */
4259
- labelKey?: string;
4260
- /** Optional leading icon, supplied as a template (a lucide `<svg>`, an `<mn-icon>`, …). */
4261
- icon?: TemplateRef<unknown>;
4291
+ labelKey?: MnRowValue<T, string>;
4292
+ /**
4293
+ * Optional leading icon: a template (an `<mn-icon>`, a bespoke `<svg>`, …), or lucide
4294
+ * icon data such as `LucidePencil.icon`, which the table renders itself. The data form
4295
+ * lets an action be declared without an `<ng-template>` stub and a `@ViewChild` per
4296
+ * glyph, which is what makes shared action factories practical.
4297
+ */
4298
+ icon?: MnRowValue<T, MnActionIcon>;
4262
4299
  /** Invoked with the row when the action is chosen. */
4263
4300
  run: (row: T) => void;
4264
4301
  /**
@@ -4275,7 +4312,7 @@ type MnTableRowAction<T> = {
4275
4312
  * `'danger'` when {@link danger} is set), matching the built-in look. Whatever colour
4276
4313
  * an action shows inline is carried into the collapsed bottom-sheet item too.
4277
4314
  */
4278
- color?: MnDropdownActionColor;
4315
+ color?: MnRowValue<T, MnDropdownActionColor>;
4279
4316
  /** Renders the action in a destructive style (e.g. "Delete"). Shorthand for
4280
4317
  * `color: 'danger'`. */
4281
4318
  danger?: boolean;
@@ -4680,16 +4717,24 @@ declare class MnTable<T = object> extends MnSelectableCollectionBase<T, TableDat
4680
4717
  * path at all, per row.
4681
4718
  */
4682
4719
  shouldCollapseActions(column: ColumnDefinition<T>, row: T): boolean;
4720
+ /**
4721
+ * Resolves a {@link MnRowValue}: either the fixed value, or the accessor applied to
4722
+ * the row. Every per-row presentation field goes through here so the fixed and derived
4723
+ * forms can never drift apart.
4724
+ */
4725
+ private resolveRowValue;
4683
4726
  /** The resolved label for an inline action button (translation key wins once resolved). */
4684
- rowActionLabel(action: MnTableRowAction<T>): string;
4727
+ rowActionLabel(action: MnTableRowAction<T>, row: T): string;
4728
+ /** The resolved leading icon for an action on a given row, if it has one. */
4729
+ rowActionIcon(action: MnTableRowAction<T>, row: T): MnActionIcon | undefined;
4685
4730
  /** Whether an inline action button should render its icon. */
4686
- showActionIcon(column: ColumnDefinition<T>, action: MnTableRowAction<T>): boolean;
4731
+ showActionIcon(column: ColumnDefinition<T>, action: MnTableRowAction<T>, row: T): boolean;
4687
4732
  /**
4688
4733
  * Whether an inline action button should render its text label. In `'icon'` mode the
4689
4734
  * label is hidden — unless the action has no icon, in which case it is shown anyway so
4690
4735
  * the button is never blank.
4691
4736
  */
4692
- showActionLabel(column: ColumnDefinition<T>, action: MnTableRowAction<T>): boolean;
4737
+ showActionLabel(column: ColumnDefinition<T>, action: MnTableRowAction<T>, row: T): boolean;
4693
4738
  /** Whether an action is disabled for the given row. */
4694
4739
  isRowActionDisabled(action: MnTableRowAction<T>, row: T): boolean;
4695
4740
  /**
@@ -4697,7 +4742,7 @@ declare class MnTable<T = object> extends MnSelectableCollectionBase<T, TableDat
4697
4742
  * collapsed ⋯-menu item so the two never diverge: an explicit `color`, else `'danger'`
4698
4743
  * for a destructive action, else the default `'secondary'`.
4699
4744
  */
4700
- rowActionColor(action: MnTableRowAction<T>): MnDropdownActionColor;
4745
+ rowActionColor(action: MnTableRowAction<T>, row: T): MnDropdownActionColor;
4701
4746
  /** Invokes an action for a row. */
4702
4747
  runRowAction(action: MnTableRowAction<T>, row: T): void;
4703
4748
  /** A stable, unique element id for a row's actions dropdown (aria wiring). */
@@ -8449,4 +8494,4 @@ type MnPreviewMessage = {
8449
8494
  declare function enableMnPreviewMode(configService: MnConfigService, langService: MnLanguageService, allowedOrigins?: string[]): void;
8450
8495
 
8451
8496
  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_DROPDOWN_CONFIG, MN_HAPTICS, MN_ICON_MAP, MN_INPUT_FIELD_CONFIG, MN_INSTANCE_ID, MN_LIB_DUAL_HORIZONTAL_IMAGE, MN_MODAL_ACTION_ICONS, MN_MULTI_SELECT_CONFIG, MN_SECTION_PATH, MN_SELECT_CONFIG, MN_TEXTAREA_CONFIG, MODAL_ACTION_ICON_SIZE, MODAL_ACTION_ICON_SIZE_SM, MnAlertOutletComponent, MnAlertService, MnAlertStore, MnBadge, MnBottomSheet, MnBreadcrumbs, MnButton, MnCheckbox, MnCollectionBase, MnCollectionPagination, MnCollectionState, MnConfigService, MnConfirmationBodyComponent, MnCustomBodyHostComponent, MnDateSelectorBar, MnDatetime, MnDropdown, MnDualHorizontalImage, MnFileInput, MnFormBodyComponent, MnGrid, MnHiddenBelowDirective, MnHttpService, MnIcon, MnIconAttributes, MnInformationCard, MnInputField, MnInstanceDirective, MnLanguageService, MnList, MnModalRef, MnModalService, MnModalShellComponent, MnMultiSelect, MnRichTextEditor, 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, defaultFilterPredicate, defaultIconForStyle, defaultTextAdapter, emptyFilterValue, enableMnPreviewMode, isFilterValueActive, isTranslatable, matchesColumnFilter, mnAlertVariants, mnBadgeVariants, mnBreadcrumbsVariants, mnButtonVariants, mnCheckboxVariants, mnCheckboxWrapperVariants, mnDatetimeVariants, mnDropdownTriggerVariants, mnFileInputVariants, mnIconVariants, mnInformationCardVariants, mnInputFieldVariants, mnMultiSelectVariants, mnSelectVariants, mnSkeletonVariants, mnTextareaVariants, numberAdapter, pickAdapter, provideMnAlerts, provideMnCalendarConfig, provideMnComponentConfig, provideMnConfig, provideMnLanguage, resolveCalendarConfig, resolveFilterableValue };
8452
- export type { AnimationOptions, ApiError, BaseModalConfig, CalendarButton, CalendarConfig, CalendarDateFormatter, CalendarEvent, CalendarEventData, CancellationActionConfig, CheckboxFieldConfig, ColorFieldConfig, ColorPreset, ColumnBase, ColumnDay, ColumnDefinition, ColumnFilterOption, ColumnFilterState, ColumnFilterType, ColumnFilterValue, ColumnSkeleton, ConfirmationActionConfig, ConfirmationModalConfig, CrudConfig, CurrentTimeCalendarEvent, CursorPaginationStrategy, CustomFieldConfig, CustomModalConfig, DateFieldConfig, DateSelectorBarLayout, DatetimeFieldConfig, DayTile, 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, MnBreadcrumbItem, MnBreadcrumbsData, MnBreadcrumbsVariants, MnButtonTypes, MnButtonVariants, MnCheckboxErrorMessageData, MnCheckboxErrorMessagesData, MnCheckboxProps, MnCheckboxUIConfig, MnCheckboxVariants, MnCheckboxWrapperVariants, MnCollectionDataSource, MnCollectionLabels, MnColumnFilter, MnConfigFile, MnConfigSettings, MnConfigValue, MnDatetimeErrorMessageData, MnDatetimeErrorMessagesData, MnDatetimeMode, MnDatetimeProps, MnDatetimeUIConfig, MnDatetimeVariants, MnDomAttrs, MnDropdownAction, MnDropdownActionColor, MnDropdownProps, MnDropdownTriggerVariants, MnDropdownUIConfig, MnDualHorizontalImageConfig, MnDualHorizontalImageTypes, MnErrorMessageData, MnErrorMessageFn, MnErrorMessagesData, MnFileDisplayItem, MnFileInputDisplayMode, MnFileInputErrorMessageData, MnFileInputErrorMessagesData, MnFileInputProps, MnFileInputUIConfig, MnFileInputVariants, MnHapticStyle, MnHapticsHandler, MnIconTypes, MnIconVariants, MnImageType, MnInformationCardBaseData, MnInformationCardData, MnInformationCardVariants, MnInputAdapter, MnInputBaseProps, MnInputDateTimeProps, MnInputFieldProps, MnInputFieldUIConfig, MnInputProps, MnInputType, MnInputVariants, MnLanguageConfig, MnMultiSelectErrorMessageData, MnMultiSelectErrorMessagesData, MnMultiSelectOption, MnMultiSelectProps, MnMultiSelectUIConfig, MnMultiSelectVariants, MnPageSlot, MnPreviewMessage, MnQueryParams, MnRichTextEditorControl, MnRichTextEditorLabels, MnRichTextEditorToolbar, MnSelectErrorMessageData, MnSelectErrorMessagesData, MnSelectOption, MnSelectProps, MnSelectUIConfig, MnSelectVariants, MnSelectableCollectionDataSource, MnShowInput, MnSkeletonProps, MnSkeletonShape, MnSkeletonVariantProps, MnTabDataSource, MnTabItem, MnTableFilterLabels, MnTableRowAction, 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 };
8497
+ export type { AnimationOptions, ApiError, BaseModalConfig, CalendarButton, CalendarConfig, CalendarDateFormatter, CalendarEvent, CalendarEventData, CancellationActionConfig, CheckboxFieldConfig, ColorFieldConfig, ColorPreset, ColumnBase, ColumnDay, ColumnDefinition, ColumnFilterOption, ColumnFilterState, ColumnFilterType, ColumnFilterValue, ColumnSkeleton, ConfirmationActionConfig, ConfirmationModalConfig, CrudConfig, CurrentTimeCalendarEvent, CursorPaginationStrategy, CustomFieldConfig, CustomModalConfig, DateFieldConfig, DateSelectorBarLayout, DatetimeFieldConfig, DayTile, FailureResult, FieldDataSource, FieldRequiredCondition, FieldValidator, FieldVisibilityCondition, FileFieldConfig, FormFieldConfig, FormFieldGroup, FormModalConfig, FormRow, FormRowField, FormValidator, GridDataSource, GridLayout, GridSkeleton, HourRow, ListAppearance, ListDataSource, ListLabels, ListSkeleton, MnActionIcon, MnAlert, MnAlertConfig, MnAlertId, MnAlertKind, MnAlertTemplateContext, MnAlertVariants, MnBadgeTypes, MnBadgeVariants, MnBreadcrumbItem, MnBreadcrumbsData, MnBreadcrumbsVariants, MnButtonTypes, MnButtonVariants, MnCheckboxErrorMessageData, MnCheckboxErrorMessagesData, MnCheckboxProps, MnCheckboxUIConfig, MnCheckboxVariants, MnCheckboxWrapperVariants, MnCollectionDataSource, MnCollectionLabels, MnColumnFilter, MnConfigFile, MnConfigSettings, MnConfigValue, MnDatetimeErrorMessageData, MnDatetimeErrorMessagesData, MnDatetimeMode, MnDatetimeProps, MnDatetimeUIConfig, MnDatetimeVariants, MnDomAttrs, MnDropdownAction, MnDropdownActionColor, MnDropdownProps, MnDropdownTriggerVariants, MnDropdownUIConfig, MnDualHorizontalImageConfig, MnDualHorizontalImageTypes, MnErrorMessageData, MnErrorMessageFn, MnErrorMessagesData, MnFileDisplayItem, MnFileInputDisplayMode, MnFileInputErrorMessageData, MnFileInputErrorMessagesData, MnFileInputProps, MnFileInputUIConfig, MnFileInputVariants, MnHapticStyle, MnHapticsHandler, MnIconTypes, MnIconVariants, MnImageType, MnInformationCardBaseData, MnInformationCardData, MnInformationCardVariants, MnInputAdapter, MnInputBaseProps, MnInputDateTimeProps, MnInputFieldProps, MnInputFieldUIConfig, MnInputProps, MnInputType, MnInputVariants, MnLanguageConfig, MnMultiSelectErrorMessageData, MnMultiSelectErrorMessagesData, MnMultiSelectOption, MnMultiSelectProps, MnMultiSelectUIConfig, MnMultiSelectVariants, MnPageSlot, MnPreviewMessage, MnQueryParams, MnRichTextEditorControl, MnRichTextEditorLabels, MnRichTextEditorToolbar, MnRowValue, MnSelectErrorMessageData, MnSelectErrorMessagesData, MnSelectOption, MnSelectProps, MnSelectUIConfig, MnSelectVariants, MnSelectableCollectionDataSource, MnShowInput, MnSkeletonProps, MnSkeletonShape, MnSkeletonVariantProps, MnTabDataSource, MnTabItem, MnTableFilterLabels, MnTableRowAction, 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 };