@fuentis/phoenix-ui 0.0.9-alpha.583 → 0.0.9-alpha.585

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.
@@ -2042,9 +2042,13 @@ class TableCaptionComponent {
2042
2042
  const t = f.type ?? 'text';
2043
2043
  // We DO NOT store null for multiselect (we store []),
2044
2044
  // because null is the common cause of "everything selected" / broken filtering.
2045
- const initialValue = t === 'multiselect' ? this.normalizeMultiInitial(f.selected) :
2046
- t === 'checkbox' ? !!f.selected :
2047
- f.selected ?? '';
2045
+ const initialValue = t === 'boolean-multiselect'
2046
+ ? this.normalizeBooleanMultiInitial(f.selected)
2047
+ : t === 'multiselect'
2048
+ ? this.normalizeMultiInitial(f.selected)
2049
+ : t === 'checkbox'
2050
+ ? !!f.selected
2051
+ : f.selected ?? '';
2048
2052
  fg.addControl(f.key, this.fb.control(initialValue));
2049
2053
  }
2050
2054
  this.filtersForm = fg;
@@ -2096,6 +2100,22 @@ class TableCaptionComponent {
2096
2100
  return [];
2097
2101
  return Array.isArray(selected) ? selected : [selected];
2098
2102
  }
2103
+ normalizeBooleanMultiInitial(selected) {
2104
+ if (selected == null)
2105
+ return [];
2106
+ const arr = Array.isArray(selected) ? selected : [selected];
2107
+ return arr
2108
+ .map((x) => {
2109
+ if (typeof x === 'boolean')
2110
+ return x;
2111
+ if (typeof x === 'string')
2112
+ return x === 'true';
2113
+ if (x && typeof x === 'object')
2114
+ return x.key === true || x.key === 'true';
2115
+ return null;
2116
+ })
2117
+ .filter((x) => typeof x === 'boolean');
2118
+ }
2099
2119
  /**
2100
2120
  * Emit only meaningful values:
2101
2121
  * - text: '' removed
@@ -2112,6 +2132,12 @@ class TableCaptionComponent {
2112
2132
  continue;
2113
2133
  const t = f.type ?? 'text';
2114
2134
  const v = raw[key];
2135
+ if (t === 'boolean-multiselect') {
2136
+ const arr = this.normalizeBooleanMultiInitial(v);
2137
+ if (arr.length)
2138
+ out[key] = arr; // boolean[]
2139
+ continue;
2140
+ }
2115
2141
  if (t === 'multiselect') {
2116
2142
  const arr = Array.isArray(v) ? v.filter((x) => x != null && x !== '') : [];
2117
2143
  if (arr.length)
@@ -2150,15 +2176,23 @@ class TableCaptionComponent {
2150
2176
  }
2151
2177
  // ensure multiselect never becomes null
2152
2178
  for (const f of cfg) {
2153
- if (f.type === 'multiselect') {
2179
+ const t = f.type ?? 'text';
2180
+ if (t === 'boolean-multiselect') {
2181
+ patch[f.key] = this.normalizeBooleanMultiInitial(patch[f.key]);
2182
+ continue;
2183
+ }
2184
+ if (t === 'multiselect') {
2154
2185
  const val = patch[f.key];
2155
2186
  if (val == null)
2156
2187
  patch[f.key] = [];
2157
2188
  else if (!Array.isArray(val))
2158
2189
  patch[f.key] = [val];
2190
+ continue;
2159
2191
  }
2160
- if (f.type === 'checkbox')
2192
+ if (t === 'checkbox') {
2161
2193
  patch[f.key] = !!patch[f.key];
2194
+ continue;
2195
+ }
2162
2196
  }
2163
2197
  this.filtersForm.patchValue(patch, { emitEvent: false });
2164
2198
  }
@@ -5088,7 +5122,7 @@ class MetaPasswordFeildComponent extends BaseMetaField {
5088
5122
  [feedback]="false"
5089
5123
  (input)="onChanged(getInputValue($event))"
5090
5124
  class="ng-invalid ng-dirty"
5091
- [autocomplete]="'new-password'"
5125
+ [autocomplete]="'one-time-code'"
5092
5126
  ></p-password>
5093
5127
 
5094
5128
  @if (!control?.hidden) {
@@ -5119,7 +5153,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImpo
5119
5153
  [feedback]="false"
5120
5154
  (input)="onChanged(getInputValue($event))"
5121
5155
  class="ng-invalid ng-dirty"
5122
- [autocomplete]="'new-password'"
5156
+ [autocomplete]="'one-time-code'"
5123
5157
  ></p-password>
5124
5158
 
5125
5159
  @if (!control?.hidden) {
@@ -6400,6 +6434,7 @@ class MetaTextInputComponent extends BaseMetaField {
6400
6434
  type="text"
6401
6435
  pInputText
6402
6436
  class="w-full"
6437
+ [autocomplete]="'one-time-code'"
6403
6438
  />
6404
6439
  <phoenix-inline-field-error
6405
6440
  *ngIf="!control?.hidden"
@@ -6432,6 +6467,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImpo
6432
6467
  type="text"
6433
6468
  pInputText
6434
6469
  class="w-full"
6470
+ [autocomplete]="'one-time-code'"
6435
6471
  />
6436
6472
  <phoenix-inline-field-error
6437
6473
  *ngIf="!control?.hidden"