@meshmakers/octo-ui 3.3.600 → 3.3.620

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.
@@ -2710,7 +2710,14 @@ class AttributeSelectorDialogComponent {
2710
2710
  searchIcon = searchIcon;
2711
2711
  arrowUpIcon = arrowUpIcon;
2712
2712
  arrowDownIcon = arrowDownIcon;
2713
- data;
2713
+ _data;
2714
+ get data() { return this._data; }
2715
+ set data(value) {
2716
+ this._data = value;
2717
+ if (value) {
2718
+ this.initializeFromData(value);
2719
+ }
2720
+ }
2714
2721
  dialogTitle = 'Select Attributes';
2715
2722
  rtCkTypeId;
2716
2723
  singleSelect = false;
@@ -2744,29 +2751,28 @@ class AttributeSelectorDialogComponent {
2744
2751
  lastClickedItem = null;
2745
2752
  doubleClickDelay = 300; // milliseconds
2746
2753
  ngOnInit() {
2747
- if (this.data) {
2748
- this.rtCkTypeId = this.data.rtCkTypeId;
2749
- this.dialogTitle = this.data.dialogTitle || 'Select Attributes';
2750
- this.singleSelect = this.data.singleSelect ?? false;
2751
- this.includeNavigationProperties = this.data.includeNavigationProperties ?? true;
2752
- this.maxDepth = this.data.maxDepth ?? null;
2753
- this.additionalAttributes = this.data.additionalAttributes ?? [];
2754
- this.hideNavigationControls = this.data.hideNavigationControls ?? false;
2755
- this.attributePathsSet = this.data.attributePaths ? new Set(this.data.attributePaths) : null;
2756
- if (this.data.selectedAttributes && this.data.selectedAttributes.length > 0) {
2757
- if (this.singleSelect) {
2758
- this.selectedSingleKey = [this.data.selectedAttributes[0]];
2759
- }
2760
- else {
2761
- // Pre-populate selected attributes if provided
2762
- this.loadInitialSelectedAttributes(this.data.selectedAttributes);
2763
- }
2764
- }
2765
- }
2766
- // Set up search debouncing
2754
+ // Set up search debouncing (always, regardless of data timing)
2767
2755
  this.searchSubject.pipe(debounceTime(300), distinctUntilChanged()).subscribe(searchText => {
2768
2756
  this.loadAvailableAttributes(searchText);
2769
2757
  });
2758
+ }
2759
+ initializeFromData(data) {
2760
+ this.rtCkTypeId = data.rtCkTypeId;
2761
+ this.dialogTitle = data.dialogTitle || 'Select Attributes';
2762
+ this.singleSelect = data.singleSelect ?? false;
2763
+ this.includeNavigationProperties = data.includeNavigationProperties ?? true;
2764
+ this.maxDepth = data.maxDepth ?? null;
2765
+ this.additionalAttributes = data.additionalAttributes ?? [];
2766
+ this.hideNavigationControls = data.hideNavigationControls ?? false;
2767
+ this.attributePathsSet = data.attributePaths ? new Set(data.attributePaths) : null;
2768
+ if (data.selectedAttributes && data.selectedAttributes.length > 0) {
2769
+ if (this.singleSelect) {
2770
+ this.selectedSingleKey = [data.selectedAttributes[0]];
2771
+ }
2772
+ else {
2773
+ this.loadInitialSelectedAttributes(data.selectedAttributes);
2774
+ }
2775
+ }
2770
2776
  // Load initial attributes
2771
2777
  this.loadAvailableAttributes();
2772
2778
  }
@@ -2797,7 +2803,7 @@ class AttributeSelectorDialogComponent {
2797
2803
  }
2798
2804
  loadInitialSelectedAttributes(attributePaths) {
2799
2805
  // Load all attributes to get the details for selected ones
2800
- this.attributeService.getAvailableAttributes(this.rtCkTypeId).subscribe(result => {
2806
+ this.attributeService.getAvailableAttributes(this.rtCkTypeId, undefined, undefined, undefined, undefined, undefined, this.includeNavigationProperties, this.maxDepth ?? undefined).subscribe(result => {
2801
2807
  // Create a map for quick lookup, including additional virtual attributes
2802
2808
  const attributeMap = new Map(result.items.map(item => [item.attributePath, item]));
2803
2809
  for (const attr of this.additionalAttributes) {
@@ -2808,11 +2814,14 @@ class AttributeSelectorDialogComponent {
2808
2814
  .map(path => attributeMap.get(path))
2809
2815
  .filter((item) => item !== undefined);
2810
2816
  this.updateSelectedGrid();
2811
- // Filter out selected from available
2817
+ // Filter out selected from available, and apply attributePathsSet restriction
2812
2818
  const selectedPaths = new Set(this.selectedAttributes.map(a => a.attributePath));
2819
+ const filteredItems = this.attributePathsSet
2820
+ ? result.items.filter(item => this.attributePathsSet.has(item.attributePath))
2821
+ : result.items;
2813
2822
  this.availableAttributes = [
2814
2823
  ...this.additionalAttributes.filter(attr => !selectedPaths.has(attr.attributePath)),
2815
- ...result.items.filter(item => !selectedPaths.has(item.attributePath))
2824
+ ...filteredItems.filter(item => !selectedPaths.has(item.attributePath))
2816
2825
  ];
2817
2826
  this.updateAvailableGrid();
2818
2827
  });