@masterteam/components 0.0.317 → 0.0.319

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": "@masterteam/components",
3
- "version": "0.0.317",
3
+ "version": "0.0.319",
4
4
  "publishConfig": {
5
5
  "directory": "../../../dist/masterteam/components",
6
6
  "linkDirectory": true,
@@ -9,6 +9,7 @@ import { TablePageEvent } from 'primeng/table';
9
9
  import { EntityData, EntityViewType } from '@masterteam/components/entities';
10
10
  import { ControlValueAccessor } from '@angular/forms';
11
11
  import { Popover } from 'primeng/popover';
12
+ import { ButtonSeverity } from 'primeng/button';
12
13
  import { TieredMenu } from 'primeng/tieredmenu';
13
14
 
14
15
  /**
@@ -860,7 +861,7 @@ declare class TableColumnFilter {
860
861
  }
861
862
 
862
863
  /** Visual variants for menu-item icon chips. */
863
- type ActionMenuTone = 'emerald' | 'sky' | 'indigo' | 'secondary';
864
+ type ActionMenuTone = 'excel' | 'pdf' | 'indigo' | 'secondary';
864
865
  interface TableMenuItem extends MenuItem {
865
866
  /** Transloco key resolved in the template so translations stay reactive. */
866
867
  labelKey?: string;
@@ -893,6 +894,16 @@ declare class TableActionsMenu {
893
894
  protected readonly menu: _angular_core.Signal<TieredMenu | undefined>;
894
895
  /** Tailwind classes for flat tone chips, keyed by `iconTone`. */
895
896
  protected readonly toneClass: Record<ActionMenuTone, string>;
897
+ /** Brand-coloured chips, which Tailwind's palette cannot name. */
898
+ protected readonly toneChipStyle: Partial<Record<ActionMenuTone, Record<string, string>>>;
899
+ /**
900
+ * The same hues for flat mode, as button severities. Rendered as their own
901
+ * buttons the actions were all `secondary` grey, so export, print and
902
+ * group-by looked identical until hovered. The brand tones keep a fitting
903
+ * severity as the fallback and re-point its tokens (`toneButtonStyle`).
904
+ */
905
+ protected readonly toneSeverity: Record<ActionMenuTone, ButtonSeverity>;
906
+ protected readonly toneButtonStyle: Partial<Record<ActionMenuTone, Record<string, string>>>;
896
907
  protected readonly items: _angular_core.Signal<TableMenuItem[]>;
897
908
  /** True while the actions render as individual buttons. */
898
909
  protected readonly isFlat: _angular_core.Signal<boolean>;
@@ -227,6 +227,34 @@ interface FormulaConditionConfig {
227
227
  formulaText?: string;
228
228
  mode?: FormulaConditionMode;
229
229
  }
230
+ /**
231
+ * Narrows a select / multi-select to the options allowed for the value of
232
+ * another field in the same form — a cascading lookup (City → Area).
233
+ *
234
+ * `mt-dynamic-form` applies it on every value change:
235
+ * - the field stays disabled until the parent holds a value, and while the
236
+ * parent's value allows no option;
237
+ * - a parent value with no entry in `allowedValuesByParent` offers nothing,
238
+ * or everything when `allowAllWhenUnmapped` is set;
239
+ * - a multi-select parent offers the union of its values' options;
240
+ * - when the user changes the parent, a value it no longer allows is cleared.
241
+ * A value that was loaded with the record is kept until then, so opening a
242
+ * record never edits it.
243
+ *
244
+ * The parent is read from its control, or from `externalValues` when it has
245
+ * none (hidden in this mode, a read-only preview). A parent that resolves to
246
+ * neither leaves the field locked as unavailable — never unrestricted.
247
+ */
248
+ interface FieldOptionsFilterConfig {
249
+ /** Key of the field whose value decides which options are offered. */
250
+ parentKey: string;
251
+ /** The parent's label for the placeholders, which fall back to its key. */
252
+ parentLabel?: string;
253
+ /** Parent value → the option values (`optionValue`) offered while it is selected. */
254
+ allowedValuesByParent: Record<string, string[]>;
255
+ /** A parent value without an entry offers every option instead of none. */
256
+ allowAllWhenUnmapped?: boolean;
257
+ }
230
258
  type FormulaValidationSeverity = 'error' | 'warning';
231
259
  interface FormulaValidationRuleConfig {
232
260
  id: string | number;
@@ -347,6 +375,7 @@ declare class SelectFieldConfig extends BaseFieldConfig {
347
375
  emptyMessage: string;
348
376
  size: string;
349
377
  hasPlaceholderPrefix: boolean;
378
+ optionsFilter?: FieldOptionsFilterConfig;
350
379
  constructor(config: Omit<BaseFieldConstructorConfig, 'type'> & {
351
380
  options: any[];
352
381
  optionLabel?: string;
@@ -362,6 +391,7 @@ declare class SelectFieldConfig extends BaseFieldConfig {
362
391
  emptyMessage?: string;
363
392
  size?: string;
364
393
  hasPlaceholderPrefix?: boolean;
394
+ optionsFilter?: FieldOptionsFilterConfig;
365
395
  });
366
396
  }
367
397
  declare class RadioButtonFieldConfig extends BaseFieldConfig {
@@ -551,6 +581,7 @@ declare class MultiSelectFieldConfig extends BaseFieldConfig {
551
581
  selectedItemsLabel?: string;
552
582
  showToggleAll?: boolean;
553
583
  resetFilterOnHide?: boolean;
584
+ optionsFilter?: FieldOptionsFilterConfig;
554
585
  constructor(config: Omit<BaseFieldConstructorConfig, 'type'> & {
555
586
  options: any[];
556
587
  optionLabel?: string;
@@ -565,6 +596,7 @@ declare class MultiSelectFieldConfig extends BaseFieldConfig {
565
596
  selectedItemsLabel?: string;
566
597
  showToggleAll?: boolean;
567
598
  resetFilterOnHide?: boolean;
599
+ optionsFilter?: FieldOptionsFilterConfig;
568
600
  });
569
601
  }
570
602
  declare class PickListFieldConfig extends BaseFieldConfig {
@@ -880,6 +912,15 @@ interface FieldState {
880
912
  hidden: boolean;
881
913
  disabled: boolean;
882
914
  }
915
+ /**
916
+ * What a field's {@link FieldOptionsFilterConfig} resolved to right now:
917
+ * the options to offer and, while the field is locked, the placeholder that
918
+ * says why. `mt-dynamic-form` keeps the reference stable until it changes.
919
+ */
920
+ interface FieldOptionsFilterState {
921
+ options: any[];
922
+ placeholder?: string;
923
+ }
883
924
  declare function createCustomValidator(customValidator: (value: any, control?: AbstractControl) => boolean | Promise<boolean>, message?: string): ValidatorFn;
884
925
  declare function wrapValidatorWithMessage(validator: ValidatorFn, errorKey: string, message: string): ValidatorFn;
885
926
 
@@ -1327,4 +1368,4 @@ declare class MTDateFormatPipe implements PipeTransform {
1327
1368
  }
1328
1369
 
1329
1370
  export { BaseFacade, BaseFieldConfig, CheckboxFieldConfig, ColorPickerFieldConfig, CrudStateBase, DEFAULT_MT_DATE_FORMATS, DS_BLUE, DS_CHART_SERIES, DS_CONTROL_HEIGHT, DS_DEFAULT_PRIMARY_COLOR, DS_ERROR, DS_FONT_FAMILY, DS_GRAY, DS_INDIGO, DS_RADIUS, DS_SEMANTIC, DS_SHADOW, DS_SUCCESS, DS_WARNING, DateFieldConfig, EditorFieldConfig, EntityListFieldConfig, IconFieldConfig, LocationFieldConfig, LookupMatrixFieldConfig, LookupModuleCheckListFieldConfig, MTDateFormatPipe, MT_DATE_FORMATS, MT_DESIGN_IDENTITY_CLASS, MultiSelectFieldConfig, NumberFieldConfig, PickListFieldConfig, READABLE_DARK_INK, REQUEST_CONTEXT, RadioButtonFieldConfig, RadioCardsFieldConfig, ScheduleItemSelectorFieldConfig, SchedulePredecessorFieldConfig, SchemaConnectionFieldConfig, SelectFieldConfig, SliderFieldConfig, SpacerFieldConfig, TextFieldConfig, TextareaFieldConfig, ToggleFieldConfig, UploadFileFieldConfig, UserSearchFieldConfig, ValidatorConfig, WCAG_AA_NORMAL_TEXT, applyDesignIdentityClass, changeBackgroundColor, changePrimaryColor, changeTextColor, clockTimeToSeconds, coerceCheckboxValue, contrastRatio, createCustomValidator, createEntityAdapter, dsChartSeries, dsIdentityConfigs, endLoading, formatClockTime, generateTailwindPalette, getContrastColor, getLightColor, getMTDesignIdentity, handleApiRequest, isInvalid, newFieldId, parseClockTime, provideMTComponents, provideMTConfirmation, provideMTDateFormats, provideMTMessages, readableTextOn, relativeLuminance, setLoadingError, setMTDesignIdentity, startLoading, toAngularDateFormat, toClockTimeParts, wrapValidatorWithMessage };
1330
- export type { ApiRequestConfig, BaseFieldConstructorConfig, ClockTimeParts, CrudCreateConfig, CrudDeleteConfig, CrudLoadConfig, CrudUpdateConfig, DSColorScale, DynamicFieldConfig, DynamicFormConfig, EntityAdapter, EntityListFieldRuntimeContext, FieldRelationAction, FieldRelationConfig, FieldState, FieldType, FormulaConditionConfig, FormulaConditionMode, FormulaRuntimeMessage, FormulaRuntimeMessageCode, FormulaValidationRuleConfig, FormulaValidationSeverity, LayoutConfig, LoadingStateShape, LookupCheckListPropertyConfig, LookupMatrixCellConfig, LookupModuleCheckListFieldRuntimeContext, LookupOptionItemConfig, MTDateFormatType, MTDateFormats, MTDesignIdentity, MTThemeOptions, PaletteShade, QueryResult, RequestContextConfig, Response, ResponsiveColSpan, ScheduleItemSelectorFieldRuntimeContext, SchedulePredecessorFieldRuntimeContext, SchemaConnectionFieldRuntimeContext, SectionConfig, ValidatorType };
1371
+ export type { ApiRequestConfig, BaseFieldConstructorConfig, ClockTimeParts, CrudCreateConfig, CrudDeleteConfig, CrudLoadConfig, CrudUpdateConfig, DSColorScale, DynamicFieldConfig, DynamicFormConfig, EntityAdapter, EntityListFieldRuntimeContext, FieldOptionsFilterConfig, FieldOptionsFilterState, FieldRelationAction, FieldRelationConfig, FieldState, FieldType, FormulaConditionConfig, FormulaConditionMode, FormulaRuntimeMessage, FormulaRuntimeMessageCode, FormulaValidationRuleConfig, FormulaValidationSeverity, LayoutConfig, LoadingStateShape, LookupCheckListPropertyConfig, LookupMatrixCellConfig, LookupModuleCheckListFieldRuntimeContext, LookupOptionItemConfig, MTDateFormatType, MTDateFormats, MTDesignIdentity, MTThemeOptions, PaletteShade, QueryResult, RequestContextConfig, Response, ResponsiveColSpan, ScheduleItemSelectorFieldRuntimeContext, SchedulePredecessorFieldRuntimeContext, SchemaConnectionFieldRuntimeContext, SectionConfig, ValidatorType };