chrv-components 1.11.52 → 1.11.54

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
@@ -1279,7 +1279,7 @@ class ChrBaseInputComponent {
1279
1279
  if (this.type() === 'number' && value !== null)
1280
1280
  value = Number(value);
1281
1281
  this.onChange(value);
1282
- this.value.set(value);
1282
+ this.writeValue(value);
1283
1283
  });
1284
1284
  };
1285
1285
  this.configureTouchBehavior = () => {
@@ -1725,7 +1725,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImpor
1725
1725
 
1726
1726
  class ChrTagSelectComponent extends ChrBaseInputComponent {
1727
1727
  constructor() {
1728
- const ngControl = inject(NgControl, { optional: true });
1729
1728
  super();
1730
1729
  this.predicate = true;
1731
1730
  this.autocomplete = viewChild.required('auto');
@@ -1819,6 +1818,7 @@ class ChrTagSelectComponent extends ChrBaseInputComponent {
1819
1818
  value[value.indexOf(entry)] = res;
1820
1819
  return [...(value ?? [])];
1821
1820
  });
1821
+ this.onValueChange(this.value());
1822
1822
  };
1823
1823
  this.registerFilters = () => {
1824
1824
  this.filteredModelOptions = this.values.pipe(startWith(''), combineLatestWith(this.data$), map((value) => this._filterModel(this.textInputValue() || -1)), map((values) => {
@@ -1894,8 +1894,8 @@ class ChrTagSelectComponent extends ChrBaseInputComponent {
1894
1894
  };
1895
1895
  this.addSubject.subscribe((entry) => {
1896
1896
  if (!this.value()?.find((v) => v == entry)) {
1897
- this.value.set([...(this.value() ?? []), entry]);
1898
- //this.onValueChange(this.value());
1897
+ const updated = [...(this.value() || []), entry];
1898
+ this.onValueChange(updated.length > 0 ? updated : null);
1899
1899
  }
1900
1900
  });
1901
1901
  this.editSubject.subscribe((entry) => {
@@ -1904,7 +1904,7 @@ class ChrTagSelectComponent extends ChrBaseInputComponent {
1904
1904
  value[index] = entry;
1905
1905
  return [...(value ?? [])];
1906
1906
  });
1907
- //return this.onValueChange(this.value());
1907
+ return this.onValueChange(this.value());
1908
1908
  });
1909
1909
  effect(() => {
1910
1910
  this.data$.next(this.data() || []);
@@ -1915,14 +1915,12 @@ class ChrTagSelectComponent extends ChrBaseInputComponent {
1915
1915
  //console.log(this.value);
1916
1916
  this.registerFilters();
1917
1917
  }
1918
- writeValue(obj) {
1919
- super.writeValue(obj);
1920
- }
1921
1918
  remove(value) {
1919
+ const updated = this.value()?.filter((v) => v != value);
1922
1920
  if (this.value() !== null)
1923
- this.value.set(this.value()?.filter((v) => v != value));
1924
- if (this.value()?.length === 0)
1925
- this.value.set(null);
1921
+ this.onValueChange(updated);
1922
+ if (updated.length === 0)
1923
+ this.onValueChange(null);
1926
1924
  this.removeCallback()?.(value);
1927
1925
  }
1928
1926
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: ChrTagSelectComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
@@ -3247,7 +3245,11 @@ class ChrDataTable {
3247
3245
  */
3248
3246
  this.actions = input();
3249
3247
  this.contextMenuItems = (entry) => {
3250
- const entries = this.actions()?.map((action) => ({
3248
+ const entries = this.actions()
3249
+ ?.filter((action) => action.disabledCallback
3250
+ ? !action.disabledCallback(entry)
3251
+ : !action.disabled || false)
3252
+ ?.map((action) => ({
3251
3253
  label: action.display,
3252
3254
  icon: action.icon,
3253
3255
  action: () => action.callback(entry),
@@ -3485,7 +3487,11 @@ class ChrTableComponent {
3485
3487
  this.textColor = input('secondary-contrast');
3486
3488
  this._page = 1;
3487
3489
  this.contextMenuItems = (entry) => {
3488
- const entries = this.actions()?.map((action) => ({
3490
+ const entries = this.actions()
3491
+ ?.filter((action) => action.disabledCallback
3492
+ ? !action.disabledCallback(entry)
3493
+ : !action.disabled || false)
3494
+ .map((action) => ({
3489
3495
  label: action.display,
3490
3496
  icon: action.icon,
3491
3497
  action: () => action.callback(entry),