chrv-components 1.12.222 → 1.12.224

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.
Binary file
@@ -4133,6 +4133,12 @@ class ChrPopoverDirective {
4133
4133
  return mayBeTemplate;
4134
4134
  }, /* @ts-ignore */
4135
4135
  ...(ngDevMode ? [{ debugName: "targetElementId" }] : /* istanbul ignore next */ []));
4136
+ this.isNativePopoverTrigger = computed(() => {
4137
+ const host = this.hostElement();
4138
+ return (host instanceof HTMLButtonElement ||
4139
+ (host instanceof HTMLInputElement && host.type === 'button'));
4140
+ }, /* @ts-ignore */
4141
+ ...(ngDevMode ? [{ debugName: "isNativePopoverTrigger" }] : /* istanbul ignore next */ []));
4136
4142
  this.updateLastKnownMousePosition = (event) => {
4137
4143
  this.lastKnownMousePosition$.next({
4138
4144
  x: event.clientX,
@@ -4198,6 +4204,8 @@ class ChrPopoverDirective {
4198
4204
  return this.isInsideRect(x, y, rect);
4199
4205
  };
4200
4206
  effect(() => {
4207
+ if (!this.isNativePopoverTrigger())
4208
+ return;
4201
4209
  const open = this.isOpen();
4202
4210
  if (open)
4203
4211
  this.showPopover();
@@ -4235,9 +4243,7 @@ class ChrPopoverDirective {
4235
4243
  this.renderer.addClass(this.targetElement(), 'card');
4236
4244
  this.renderer.addClass(this.targetElement(), 'glass');
4237
4245
  this.renderer.setStyle(this.targetElement(), 'border', 'none');
4238
- const isNativePopoverTrigger = host instanceof HTMLButtonElement ||
4239
- (host instanceof HTMLInputElement && host.type === 'button');
4240
- if (!this.chrPopoverOnHover() && !isNativePopoverTrigger) {
4246
+ if (!this.chrPopoverOnHover() && !this.isNativePopoverTrigger()) {
4241
4247
  this.renderer.listen(this.hostElement(), 'click', () => {
4242
4248
  if (this.isOpen()) {
4243
4249
  this.isOpen.set(false);
@@ -4311,6 +4317,7 @@ class ChrInputComponent {
4311
4317
  // public valueChanges = output<any>();
4312
4318
  /* CODE */
4313
4319
  constructor() {
4320
+ this.destroyRef = inject(DestroyRef);
4314
4321
  /**
4315
4322
  * Label of the input
4316
4323
  */
@@ -4483,7 +4490,7 @@ class ChrInputComponent {
4483
4490
  // The Behavior Subject always has an initial value. Which means that subscribing to it will make it look like the input has a new value (initially null).
4484
4491
  // Which is false, because we're only instanciating the object. This is why we need to skip the first value. Otherwise the form will receive a random null when this
4485
4492
  // observable is subscribed to and set the value to said null.
4486
- skip(1), debounceTime$1(this.debounceTime()))
4493
+ takeUntilDestroyed(this.destroyRef), skip(1), debounceTime$1(this.debounceTime()))
4487
4494
  .subscribe((res) => {
4488
4495
  this.debouncedInput.emit(res);
4489
4496
  // If the value is an empty string, set the value to null to trigger validation and prevent an inconsitent value to be set (ex: for number type input)
@@ -4504,15 +4511,17 @@ class ChrInputComponent {
4504
4511
  this.isFocused.set(true);
4505
4512
  });
4506
4513
  this.ngControl()
4507
- ?.control?.events.pipe(filter((e) => e instanceof TouchedChangeEvent), map((e) => e.touched),
4514
+ ?.control?.events.pipe(takeUntilDestroyed(this.destroyRef), filter((e) => e instanceof TouchedChangeEvent), map((e) => e.touched),
4508
4515
  // Start with will inject a starting value, it MUST be used after eventual transformation (here Event -> boolean)
4509
4516
  // and contain the type of the final data
4510
4517
  startWith(this.ngControl()?.control?.touched ?? false))
4511
4518
  .subscribe((e) => this.isTouched.set(e));
4512
4519
  this.ngControl()
4513
- ?.control?.events.pipe(filter((e) => e instanceof StatusChangeEvent), map((e) => e.status === 'DISABLED'), startWith(this.ngControl()?.control?.disabled ?? false))
4520
+ ?.control?.events.pipe(takeUntilDestroyed(this.destroyRef), filter((e) => e instanceof StatusChangeEvent), map((e) => e.status === 'DISABLED'), startWith(this.ngControl()?.control?.disabled ?? false))
4514
4521
  .subscribe((e) => this.isDisabled.set(e));
4515
- this.ngControl()?.statusChanges?.subscribe((data) => {
4522
+ this.ngControl()
4523
+ ?.statusChanges?.pipe(takeUntilDestroyed(this.destroyRef))
4524
+ .subscribe((data) => {
4516
4525
  this.ensureState(data);
4517
4526
  });
4518
4527
  this.displayValue.subscribe((v) => {