@acorex/cdk 20.2.0-next.7 → 20.2.0-next.9

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/common/index.d.ts CHANGED
@@ -492,7 +492,7 @@ declare abstract class AXAutocompleteParentComponent<T> extends MXValueComponent
492
492
  }
493
493
 
494
494
  type AXDataSourceOperator = {
495
- type: 'equal' | 'isNull' | 'isEmpty' | 'lt' | 'lte' | 'gt' | 'gte' | 'startsWith' | 'endsWith' | 'contains';
495
+ type: 'equal' | 'isNull' | 'isEmpty' | 'lt' | 'lte' | 'gt' | 'gte' | 'startsWith' | 'endsWith' | 'contains' | 'in';
496
496
  negative?: boolean;
497
497
  };
498
498
  type AXFilterLogic = 'and' | 'or';
@@ -575,10 +575,10 @@ declare class AXDataSource<T = unknown> {
575
575
  }): void;
576
576
  find(key: unknown): T | Promise<T>;
577
577
  }
578
- declare function convertArrayToDataSource<T>(items: T[], options?: {
578
+ declare function convertArrayToDataSource<T = unknown>(items: T[], options?: {
579
579
  key: string;
580
580
  pageSize: number;
581
- }): AXDataSource;
581
+ }): AXDataSource<T>;
582
582
 
583
583
  interface AXDataListQuery {
584
584
  take?: number;
@@ -803,53 +803,168 @@ declare class MXInputBaseValueComponent<T = string> extends MXValueComponent<T>
803
803
  static ɵprov: i0.ɵɵInjectableDeclaration<MXInputBaseValueComponent<any>>;
804
804
  }
805
805
 
806
+ /**
807
+ * Service that manages selection state and caching for selection components
808
+ */
806
809
  declare class MXSelectionBridgeService {
810
+ /** Array of currently selected items */
807
811
  selectedItems: unknown[];
808
- cacheList: {
809
- [key: string | number]: unknown;
810
- };
812
+ /** Cache for normalized items keyed by their unique identifier */
813
+ cacheList: Record<string | number, unknown>;
811
814
  static ɵfac: i0.ɵɵFactoryDeclaration<MXSelectionBridgeService, never>;
812
815
  static ɵprov: i0.ɵɵInjectableDeclaration<MXSelectionBridgeService>;
813
816
  }
817
+ /**
818
+ * Injection token for the selection bridge service
819
+ */
814
820
  declare const AX_SELECTION_DATA_TOKEN: InjectionToken<MXSelectionBridgeService>;
815
- declare abstract class MXSelectionValueComponent<T = any> extends MXValueComponent<any> {
816
- private formatService;
817
- private dataService;
818
- disabledCallback: (e: {
819
- item: T;
820
- index: number;
821
- }) => boolean;
821
+ /**
822
+ * Type definition for disabled callback function
823
+ */
824
+ type DisabledCallback<T> = (event: {
825
+ item: T;
826
+ index: number;
827
+ }) => boolean;
828
+ /**
829
+ * Type definition for normalized item object
830
+ */
831
+ interface NormalizedItem {
832
+ [key: string]: unknown;
833
+ isLoading?: boolean;
834
+ }
835
+ /**
836
+ * Abstract base component for selection-based value components
837
+ * Provides common functionality for components that support item selection
838
+ */
839
+ declare abstract class MXSelectionValueComponent<T = unknown> extends MXValueComponent<unknown> {
840
+ private readonly formatService;
841
+ private readonly dataService;
842
+ /** Callback function to determine if an item should be disabled */
843
+ disabledCallback: DisabledCallback<T>;
822
844
  private _valueField;
845
+ /** Field name used to extract the unique value from items */
823
846
  get valueField(): string;
824
- set valueField(v: string);
825
- private _textTemplate;
826
- get textTemplate(): string;
827
- set textTemplate(v: string);
847
+ set valueField(value: string);
828
848
  private _textField;
849
+ /** Field name used to extract the display text from items */
829
850
  get textField(): string;
830
- set textField(v: string);
851
+ set textField(value: string);
852
+ private _textTemplate;
853
+ /** Template string for formatting item display text */
854
+ get textTemplate(): string;
855
+ set textTemplate(value: string);
831
856
  private _disabledField;
857
+ /** Field name used to determine if an item is disabled */
832
858
  get disabledField(): string;
833
- set disabledField(v: string);
859
+ set disabledField(value: string);
834
860
  private _multiple;
861
+ /** Whether multiple items can be selected */
835
862
  get multiple(): boolean;
836
- set multiple(v: boolean);
863
+ set multiple(value: boolean);
864
+ /** Gets the currently selected items */
837
865
  get selectedItems(): unknown[];
838
- internalSetValue(value: unknown): any;
839
- emitOnValueChangedEvent(oldValue?: unknown, newValue?: unknown): void;
866
+ /**
867
+ * Abstract method to retrieve an item by its key
868
+ * @param key The unique identifier of the item
869
+ * @returns The item or a Promise that resolves to the item
870
+ */
840
871
  abstract getItemByKey(key: unknown): unknown | Promise<unknown>;
841
- protected normalizeItemsList(items: unknown[], findBykey?: boolean): unknown[];
872
+ /**
873
+ * Internal method to set and normalize the component value
874
+ * @param value The value to set (can be single item or array)
875
+ * @returns Normalized value based on multiple selection mode
876
+ */
877
+ internalSetValue(value: unknown): unknown;
878
+ /**
879
+ * Override to normalize selected items when value changes
880
+ */
881
+ emitOnValueChangedEvent(oldValue?: unknown, newValue?: unknown): void;
882
+ /**
883
+ * Normalizes a list of items, filtering out null values
884
+ * @param items Array of items to normalize
885
+ * @param findByKey Whether to attempt finding items by key
886
+ * @returns Array of normalized items
887
+ */
888
+ protected normalizeItemsList(items: unknown[], findByKey?: boolean): NormalizedItem[];
889
+ /**
890
+ * Normalizes a single item, handling caching and async loading
891
+ * @param item Item to normalize
892
+ * @param findByKey Whether to attempt finding the item by key
893
+ * @returns Normalized item object
894
+ */
842
895
  private normalizeItem;
896
+ /**
897
+ * Handles the normalization logic for items that need property assignment
898
+ */
899
+ private handleItemNormalization;
900
+ /**
901
+ * Handles async item loading with loading state
902
+ */
903
+ private handleAsyncItem;
904
+ /**
905
+ * Assigns value and text properties to the normalized object
906
+ */
907
+ private assignItemProperties;
908
+ /**
909
+ * Creates a consistent cache key for an item
910
+ */
911
+ private createCacheKey;
912
+ /**
913
+ * Normalizes currently selected items and updates the data service
914
+ */
843
915
  private _normalizeSelectedItems;
916
+ /**
917
+ * Unselects the specified items from the selection
918
+ * @param items Items to unselect
919
+ */
844
920
  unselectItems(...items: T[]): void;
921
+ /**
922
+ * Selects the specified items
923
+ * @param items Items to select
924
+ */
845
925
  selectItems(...items: T[]): void;
926
+ /**
927
+ * Toggles the selection state of the specified items
928
+ * @param items Items to toggle
929
+ */
846
930
  toggleSelect(...items: T[]): void;
931
+ /**
932
+ * Checks if an item is currently selected
933
+ * @param item Item to check
934
+ * @returns True if the item is selected
935
+ */
847
936
  isItemSelected(item: T): boolean;
937
+ /**
938
+ * Checks if an item is disabled
939
+ * @param item Item to check
940
+ * @returns True if the item is disabled
941
+ */
848
942
  isItemDisabled(item: T): boolean;
849
- protected getDisplayText(item: T): any;
850
- protected getValue(item: T): any;
943
+ /**
944
+ * Gets the display text for an item using template or text field
945
+ * @param item Item to get display text for
946
+ * @returns Formatted display text
947
+ */
948
+ protected getDisplayText(item: T): string;
949
+ /**
950
+ * Gets the value of an item
951
+ * @param item Item to get value from
952
+ * @returns Item value
953
+ */
954
+ protected getValue(item: T): unknown;
955
+ /**
956
+ * Clears the selection cache and selected items
957
+ */
851
958
  protected clearSelectionCache(): void;
959
+ /**
960
+ * Clears only the cache while preserving selected items
961
+ */
852
962
  protected softClearSelectionCache(): void;
963
+ /**
964
+ * Asynchronously loads an item by its key and caches the result
965
+ * @param key Key to load item by
966
+ */
967
+ private loadAndCacheItemByKey;
853
968
  static ɵfac: i0.ɵɵFactoryDeclaration<MXSelectionValueComponent<any>, never>;
854
969
  static ɵprov: i0.ɵɵInjectableDeclaration<MXSelectionValueComponent<any>>;
855
970
  }
@@ -929,4 +1044,4 @@ declare class AXHotkeysService {
929
1044
  }
930
1045
 
931
1046
  export { AXAutoFocusDirective, AXAutocompleteParentComponent, AXButtonClickEvent, AXClearableComponent, AXClickEvent, AXClosableComponent, AXCommonModule, AXComponent, AXComponentCloseEvent, AXComponentClosedPromise, AXComponentClosing, AXComponentResult, AXDataSource, AXDomService, AXEvent, AXFocusEvent, AXFocusableComponent, AXHotkeyDirective, AXHotkeysService, AXHtmlEvent, AXInfiniteScrollerDirective, AXInvertedColorDirective, AXItemClickEvent, AXListDataSource, AXNgModelDelayedValueChangedDirective, AXOptionChangedEvent, AXPagedComponent, AXRangeChangedEvent, AXResponsiveDirective, AXRippleDirective, AXSearchableComponent, AXSelectionValueChangedEvent, AXValuableComponent, AXValueChangedEvent, AX_LOCATIONS, AX_PLACEMENT_BOTTOM, AX_PLACEMENT_BOTTOM_END, AX_PLACEMENT_BOTTOM_START, AX_PLACEMENT_END, AX_PLACEMENT_END_BOTTOM, AX_PLACEMENT_END_TOP, AX_PLACEMENT_MAP, AX_PLACEMENT_START, AX_PLACEMENT_START_BOTTOM, AX_PLACEMENT_START_TOP, AX_PLACEMENT_TOP, AX_PLACEMENT_TOP_END, AX_PLACEMENT_TOP_START, AX_SELECTION_DATA_TOKEN, AX_STYLE_COLOR_TYPES, AX_STYLE_LOOK_TYPES, MXBaseComponent, MXButtonBaseComponent, MXColorComponent, MXColorLookComponent, MXInputBaseValueComponent, MXInteractiveComponent, MXLookComponent, MXLookableComponent, MXSelectionBridgeService, MXSelectionValueComponent, MXValueComponent, NXButtonComponent, NXClickEvent, NXColorComponent, NXComponent, NXEvent, NXInteractiveComponent, NXLookComponent, NXNativeEvent, NXValueComponent, TAB_META_KEY, convertArrayToDataSource, convertToPlacement };
932
- export type { AXAnimationEasing, AXComponentState, AXConnectedPosition, AXDataListFetchCallbackResult, AXDataListFetchDataCallback, AXDataListItems, AXDataListQuery, AXDataSourceByKeyCallback, AXDataSourceCallbackResult, AXDataSourceChangedEvent, AXDataSourceConfig, AXDataSourceFilterOption, AXDataSourceItemExpandedEvent, AXDataSourceLoadCallback, AXDataSourceOperator, AXDataSourceQuery, AXDataSourceSortOption, AXDirection, AXExpandToggleIcons, AXFilterLogic, AXFormValidationRule, AXHotKeyAction, AXLocation, AXOrientation, AXPagedComponentInterface, AXPlacement, AXPlacementType, AXRange, AXScrollPosition, AXSelectionMode, AXSizeType, AXSortOrder, AXStyleColorType, AXStyleLookType, AXStyleSizeType, AXSurfaceType, MXComponentOptionChanged, MXComponentOptionChanging, MXComponentSetOption };
1047
+ export type { AXAnimationEasing, AXComponentState, AXConnectedPosition, AXDataListFetchCallbackResult, AXDataListFetchDataCallback, AXDataListItems, AXDataListQuery, AXDataSourceByKeyCallback, AXDataSourceCallbackResult, AXDataSourceChangedEvent, AXDataSourceConfig, AXDataSourceFilterOption, AXDataSourceItemExpandedEvent, AXDataSourceLoadCallback, AXDataSourceOperator, AXDataSourceQuery, AXDataSourceSortOption, AXDirection, AXExpandToggleIcons, AXFilterLogic, AXFormValidationRule, AXHotKeyAction, AXLocation, AXOrientation, AXPagedComponentInterface, AXPlacement, AXPlacementType, AXRange, AXScrollPosition, AXSelectionMode, AXSizeType, AXSortOrder, AXStyleColorType, AXStyleLookType, AXStyleSizeType, AXSurfaceType, DisabledCallback, MXComponentOptionChanged, MXComponentOptionChanging, MXComponentSetOption, NormalizedItem };