@praxisui/dynamic-fields 6.0.0-beta.0 → 7.0.0-beta.0

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.
@@ -2614,6 +2614,7 @@ class SimpleBaseSelectComponent extends SimpleBaseInputComponent {
2614
2614
  global = inject(GlobalConfigService);
2615
2615
  // Dependency cascade support (Phase 1)
2616
2616
  dependencySub = null;
2617
+ remoteSelectionHydrationSub = null;
2617
2618
  hasLoadedOnce = false;
2618
2619
  /** Options filtered according to the current `searchTerm` */
2619
2620
  filteredOptions = computed(() => {
@@ -3145,18 +3146,24 @@ class SimpleBaseSelectComponent extends SimpleBaseInputComponent {
3145
3146
  if (searchTerm && !this.optionSource()) {
3146
3147
  filter[this.optionLabelKey()] = searchTerm;
3147
3148
  }
3149
+ const includeIds = page === 0 ? this.currentIncludeIds() : undefined;
3148
3150
  this.loading.set(true);
3149
3151
  const request$ = this.optionSource()
3150
3152
  ? this.crudService.filterOptionSourceOptions(this.optionSource().key, filter, { pageNumber: page, pageSize: this.pageSize() }, {
3151
3153
  search: searchTerm || undefined,
3152
3154
  includeIds: this.optionSource().includeIds
3153
- ? this.currentIncludeIds()
3155
+ ? includeIds
3154
3156
  : undefined,
3155
3157
  })
3156
- : this.crudService.filter(filter, {
3157
- pageNumber: page,
3158
- pageSize: this.pageSize(),
3159
- });
3158
+ : includeIds?.length
3159
+ ? this.crudService.filter(filter, {
3160
+ pageNumber: page,
3161
+ pageSize: this.pageSize(),
3162
+ }, { includeIds })
3163
+ : this.crudService.filter(filter, {
3164
+ pageNumber: page,
3165
+ pageSize: this.pageSize(),
3166
+ });
3160
3167
  request$
3161
3168
  .pipe(takeUntilDestroyed(this.destroyRef), take(1))
3162
3169
  .subscribe({
@@ -3240,6 +3247,45 @@ class SimpleBaseSelectComponent extends SimpleBaseInputComponent {
3240
3247
  // Recreate subscriptions when the bound control instance changes
3241
3248
  queueMicrotask(() => this.setupDependencies());
3242
3249
  }, ...(ngDevMode ? [{ debugName: "_depEffect" }] : []));
3250
+ /** Rebind hydration for remote selected values when FormControl changes */
3251
+ _remoteSelectionEffect = effect(() => {
3252
+ const _ctrl = this.formControl();
3253
+ const _path = this.resourcePath();
3254
+ queueMicrotask(() => this.setupRemoteSelectionHydration());
3255
+ }, ...(ngDevMode ? [{ debugName: "_remoteSelectionEffect" }] : []));
3256
+ setupRemoteSelectionHydration() {
3257
+ if (this.remoteSelectionHydrationSub) {
3258
+ try {
3259
+ this.remoteSelectionHydrationSub.unsubscribe();
3260
+ }
3261
+ catch { }
3262
+ this.remoteSelectionHydrationSub = null;
3263
+ }
3264
+ if (!this.resourcePath()) {
3265
+ return;
3266
+ }
3267
+ const control = this.control();
3268
+ this.remoteSelectionHydrationSub = control.valueChanges
3269
+ .pipe(startWith(control.value), takeUntilDestroyed(this.destroyRef))
3270
+ .subscribe(() => {
3271
+ this.ensureCurrentValueLoaded();
3272
+ });
3273
+ }
3274
+ ensureCurrentValueLoaded() {
3275
+ if (!this.resourcePath() || this.loading()) {
3276
+ return;
3277
+ }
3278
+ const selected = this.currentIncludeIds();
3279
+ if (!selected.length) {
3280
+ return;
3281
+ }
3282
+ const hasAllSelectedOptions = selected.every((value) => this.options().some((candidate) => this.areSelectValuesEqual(candidate.value, value)));
3283
+ if (hasAllSelectedOptions) {
3284
+ return;
3285
+ }
3286
+ this.pageIndex.set(0);
3287
+ this.loadOptions(0, this.searchTerm(), this.filterCriteria());
3288
+ }
3243
3289
  /** (Re)configure dependency observers based on metadata and current FormGroup */
3244
3290
  setupDependencies() {
3245
3291
  // Teardown previous subscriptions if any
package/index.d.ts CHANGED
@@ -974,6 +974,7 @@ declare abstract class SimpleBaseSelectComponent<T = any> extends SimpleBaseInpu
974
974
  protected matSelect: MatSelect | null;
975
975
  protected readonly global: GlobalConfigService;
976
976
  private dependencySub;
977
+ private remoteSelectionHydrationSub;
977
978
  private hasLoadedOnce;
978
979
  /** Options filtered according to the current `searchTerm` */
979
980
  readonly filteredOptions: _angular_core.Signal<SelectOption<T>[]>;
@@ -1116,6 +1117,10 @@ declare abstract class SimpleBaseSelectComponent<T = any> extends SimpleBaseInpu
1116
1117
  protected hasLoaded(): boolean;
1117
1118
  /** Setup effect to re-bind dependency observers when FormControl changes */
1118
1119
  private readonly _depEffect;
1120
+ /** Rebind hydration for remote selected values when FormControl changes */
1121
+ private readonly _remoteSelectionEffect;
1122
+ protected setupRemoteSelectionHydration(): void;
1123
+ private ensureCurrentValueLoaded;
1119
1124
  /** (Re)configure dependency observers based on metadata and current FormGroup */
1120
1125
  protected setupDependencies(): void;
1121
1126
  protected extractDependencyValue(raw: any, path?: string): any;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@praxisui/dynamic-fields",
3
- "version": "6.0.0-beta.0",
3
+ "version": "7.0.0-beta.0",
4
4
  "description": "Angular Material-based dynamic form fields for Praxis UI with lazy loading and metadata-driven rendering.",
5
5
  "peerDependencies": {
6
6
  "@angular/common": "^20.1.0",
@@ -10,9 +10,9 @@
10
10
  "@angular/cdk": "^20.1.0",
11
11
  "@angular/router": "^20.1.0",
12
12
  "rxjs": "^7.8.0",
13
- "@praxisui/core": "^6.0.0-beta.0",
14
- "@praxisui/cron-builder": "^6.0.0-beta.0",
15
- "@praxisui/dialog": "^6.0.0-beta.0"
13
+ "@praxisui/core": "^7.0.0-beta.0",
14
+ "@praxisui/cron-builder": "^7.0.0-beta.0",
15
+ "@praxisui/dialog": "^7.0.0-beta.0"
16
16
  },
17
17
  "dependencies": {
18
18
  "tslib": "^2.3.0"