@coolon/angular-ui-powerups 13.7.19 → 13.7.21

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.
@@ -3080,15 +3080,20 @@ class ListPropertyColumnModel extends ColumnModel {
3080
3080
  constructor(id, property, defaults) {
3081
3081
  super(id, defaults);
3082
3082
  this.property = property;
3083
- this._format = (value) => value?.map(v => v?.toString()).join(", ");
3083
+ this._defaultSearchTextFormat = value => {
3084
+ const intermediate = (this._userFormat ?? Functions.identity)(value);
3085
+ return Array.isArray(intermediate) ?
3086
+ intermediate.map(v => v?.toString()).join(", ") :
3087
+ intermediate?.toString();
3088
+ };
3084
3089
  this.cellRenderer(DefaultCellRendererComponent);
3085
3090
  }
3086
3091
  cellRenderer(componentType) {
3087
- this.configureColumnTextSearch(EnableCellTextSearch.getFormatter(componentType, () => ColumnTextSearchFormatter.forFormatter(value => this._format(value))), row => row[this.property]);
3092
+ this.configureColumnTextSearch(EnableCellTextSearch.getFormatter(componentType, () => ColumnTextSearchFormatter.forFormatter(this._defaultSearchTextFormat)), row => row[this.property]);
3088
3093
  this.configureCellRenderer(new ComponentCellRendererPortalRef(componentType, (component, rowData) => {
3089
- let rowElement = rowData.row[this.property];
3094
+ const rowValue = rowData.row[this.property];
3090
3095
  // @ts-ignore Started complaining in ts 4.5.. but I think my logic is correct...
3091
- component.value = this._format(rowElement);
3096
+ component.value = (this._userFormat) ? this._userFormat(rowValue) : rowValue;
3092
3097
  }));
3093
3098
  return this;
3094
3099
  }
@@ -3109,7 +3114,7 @@ class ListPropertyColumnModel extends ColumnModel {
3109
3114
  }
3110
3115
  format(formatter) {
3111
3116
  assert$1.isFunction(formatter);
3112
- this._format = formatter;
3117
+ this._userFormat = formatter;
3113
3118
  return this;
3114
3119
  }
3115
3120
  selectRowOnClick(selectRowOnClick) {
@@ -3121,11 +3126,13 @@ class PropertyColumnModel extends ColumnModel {
3121
3126
  constructor(id, property, defaults) {
3122
3127
  super(id, defaults);
3123
3128
  this.property = property;
3124
- this._format = (value) => value?.toString();
3129
+ this._defaultSearchTextFormatter = (value) => {
3130
+ return (this._userFormat ?? Functions.identity)(value)?.toString();
3131
+ };
3125
3132
  this.cellRenderer(DefaultCellRendererComponent);
3126
3133
  }
3127
3134
  cellRenderer(componentType, onComponentInitOrOptions) {
3128
- this.configureColumnTextSearch(EnableCellTextSearch.getFormatter(componentType, () => ColumnTextSearchFormatter.forFormatter(value => this._format(value))), row => row[this.property]);
3135
+ this.configureColumnTextSearch(EnableCellTextSearch.getFormatter(componentType, () => ColumnTextSearchFormatter.forFormatter(this._defaultSearchTextFormatter)), row => row[this.property]);
3129
3136
  this.configureCellRenderer(new ComponentCellRendererPortalRef(componentType, (component, rowData, firstTime) => {
3130
3137
  if (firstTime) {
3131
3138
  if (isFunction$1(onComponentInitOrOptions)) {
@@ -3137,7 +3144,8 @@ class PropertyColumnModel extends ColumnModel {
3137
3144
  }
3138
3145
  }
3139
3146
  }
3140
- component.value = this._format(rowData.row[this.property]);
3147
+ const rowValue = rowData.row[this.property];
3148
+ component.value = this._userFormat ? this._userFormat(rowValue) : rowValue;
3141
3149
  }));
3142
3150
  return this;
3143
3151
  }
@@ -3194,7 +3202,7 @@ class PropertyColumnModel extends ColumnModel {
3194
3202
  }
3195
3203
  format(formatter) {
3196
3204
  assert$1.isFunction(formatter);
3197
- this._format = formatter;
3205
+ this._userFormat = formatter;
3198
3206
  return this;
3199
3207
  }
3200
3208
  selectRowOnClick(selectOnRowClick) {
@@ -3237,6 +3245,7 @@ class SelectionColumnModel extends ColumnModel {
3237
3245
  }
3238
3246
  }
3239
3247
 
3248
+ // TODO: Merge MarsUi FilterRegistry into this.
3240
3249
  class AbstractTableFilterModel extends GarbageCollector {
3241
3250
  }
3242
3251
  TrackExternal.useDelegate(AbstractTableFilterModel, options => {
@@ -3282,7 +3291,8 @@ class AbstractTableModel extends GarbageCollector {
3282
3291
  }, {
3283
3292
  dependsOn: [this.filterModel.rowFilter$, this.columns]
3284
3293
  })
3285
- .replaceAll(this.rowsBeingEdited$);
3294
+ .replaceAll(this.rowsBeingEdited$)
3295
+ .identifiedWith(this._rawDataSource.identityOf);
3286
3296
  this._visibleRows$.setDelegate(this._filteredRows$);
3287
3297
  this.firstEditableColumn$ = chain(this.columns).select(c => c.hasEditorPortal()).first();
3288
3298
  this.firstVisibleColumn$ = chain(this._columnList).first();
@@ -10185,9 +10195,9 @@ function installMechanics(parameterDef, prototype, propertyKey, tagPrefix) {
10185
10195
  }
10186
10196
  });
10187
10197
  }
10188
- function RouteId(type, options) {
10198
+ function RouteId(formatter, options) {
10189
10199
  return (prototype, propertyKey) => {
10190
- const parameterDef = new ParameterDefinition.RouteId(propertyKey.toString(), options, type);
10200
+ const parameterDef = new ParameterDefinition.RouteId(propertyKey.toString(), options, formatter);
10191
10201
  installMechanics(parameterDef, prototype, propertyKey, '@RouteId');
10192
10202
  };
10193
10203
  }