novo-elements 7.4.1-next.1 → 7.5.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.
@@ -35114,7 +35114,7 @@ class NovoChipInput {
35114
35114
  focus(options) {
35115
35115
  this._inputElement.focus(options);
35116
35116
  }
35117
- /** Focuses the input. */
35117
+ /** Clears the input. */
35118
35118
  clearValue() {
35119
35119
  this._inputElement.value = '';
35120
35120
  this.ngControl?.control.setValue('');
@@ -37185,6 +37185,8 @@ class DataTableState {
37185
37185
  this.isForceRefresh = false;
37186
37186
  this.updates = new EventEmitter();
37187
37187
  this.retainSelected = false;
37188
+ this.savedSearchName = undefined;
37189
+ this.displayedColumns = undefined;
37188
37190
  }
37189
37191
  get userFiltered() {
37190
37192
  return !!(this.filter || this.sort || this.globalSearch || this.outsideFilter || this.where);
@@ -37196,27 +37198,7 @@ class DataTableState {
37196
37198
  return Array.from(this.selectedRows.values());
37197
37199
  }
37198
37200
  reset(fireUpdate = true, persistUserFilters) {
37199
- if (!persistUserFilters) {
37200
- this.sort = undefined;
37201
- this.globalSearch = undefined;
37202
- this.filter = undefined;
37203
- this.where = undefined;
37204
- }
37205
- this.page = 0;
37206
- if (!this.retainSelected) {
37207
- this.selectedRows.clear();
37208
- this.resetSource.next();
37209
- }
37210
- this.onSortFilterChange();
37211
- this.retainSelected = false;
37212
- if (fireUpdate) {
37213
- this.updates.emit({
37214
- sort: this.sort,
37215
- filter: this.filter,
37216
- globalSearch: this.globalSearch,
37217
- where: this.where,
37218
- });
37219
- }
37201
+ this.setState({}, fireUpdate, persistUserFilters);
37220
37202
  }
37221
37203
  clearSort(fireUpdate = true) {
37222
37204
  this.sort = undefined;
@@ -37298,6 +37280,7 @@ class DataTableState {
37298
37280
  filter: this.filter,
37299
37281
  globalSearch: this.globalSearch,
37300
37282
  where: this.where,
37283
+ savedSearchName: this.savedSearchName,
37301
37284
  });
37302
37285
  }
37303
37286
  setInitialSortFilter(preferences) {
@@ -37309,23 +37292,58 @@ class DataTableState {
37309
37292
  this.sort = preferences.sort;
37310
37293
  }
37311
37294
  if (preferences.filter) {
37312
- const filters = Helpers.convertToArray(preferences.filter);
37313
- filters.forEach((filter) => {
37314
- filter.value =
37315
- filter.selectedOption && filter.type
37316
- ? NovoDataTableFilterUtils.constructFilter(filter.selectedOption, filter.type)
37317
- : filter.value;
37318
- });
37319
- this.filter = filters;
37295
+ this.filter = this.transformFilters(preferences.filter);
37320
37296
  }
37321
37297
  if (preferences.globalSearch) {
37322
37298
  this.globalSearch = preferences.globalSearch;
37323
37299
  }
37300
+ if (preferences.savedSearchName) {
37301
+ this.savedSearchName = preferences.savedSearchName;
37302
+ }
37303
+ }
37304
+ }
37305
+ setState(preferences, fireUpdate = true, persistUserFilters = false) {
37306
+ if (!persistUserFilters) {
37307
+ this.where = preferences.where;
37308
+ this.sort = preferences.sort;
37309
+ this.filter = preferences.filter ? this.transformFilters(preferences.filter) : undefined;
37310
+ this.globalSearch = preferences.globalSearch;
37311
+ this.savedSearchName = preferences.savedSearchName;
37312
+ if (preferences.displayedColumns?.length) {
37313
+ this.displayedColumns = preferences.displayedColumns;
37314
+ }
37315
+ }
37316
+ this.page = 0;
37317
+ if (!this.retainSelected) {
37318
+ this.selectedRows.clear();
37319
+ this.resetSource.next();
37320
+ }
37321
+ this.onSortFilterChange();
37322
+ this.retainSelected = false;
37323
+ if (fireUpdate) {
37324
+ this.updates.emit({
37325
+ sort: this.sort,
37326
+ filter: this.filter,
37327
+ globalSearch: this.globalSearch,
37328
+ where: this.where,
37329
+ savedSearchName: this.savedSearchName,
37330
+ displayedColumns: this.displayedColumns,
37331
+ });
37324
37332
  }
37325
37333
  }
37326
37334
  checkRetainment(caller, allMatchingSelected = false) {
37327
37335
  this.retainSelected = this.selectionOptions?.some((option) => option.label === caller) || this.retainSelected || allMatchingSelected;
37328
37336
  }
37337
+ transformFilters(filters) {
37338
+ const filterArray = Helpers.convertToArray(filters);
37339
+ filterArray.forEach((filter) => {
37340
+ filter.value =
37341
+ filter.selectedOption && filter.type
37342
+ ? NovoDataTableFilterUtils.constructFilter(filter.selectedOption, filter.type)
37343
+ : filter.value;
37344
+ });
37345
+ return filterArray;
37346
+ }
37329
37347
  }
37330
37348
  DataTableState.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: DataTableState, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
37331
37349
  DataTableState.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: DataTableState });
@@ -40795,6 +40813,7 @@ class NovoDataTable {
40795
40813
  filter: event.filter,
40796
40814
  globalSearch: event.globalSearch,
40797
40815
  where: event.where,
40816
+ savedSearchName: event.savedSearchName,
40798
40817
  });
40799
40818
  this.performInteractions('change');
40800
40819
  }
@@ -40927,17 +40946,19 @@ class NovoDataTable {
40927
40946
  }
40928
40947
  modifyCellHeaderMultiSelectFilterOptions(column, newOptions) {
40929
40948
  const header = this.cellHeaders.find((cellHeader) => cellHeader.id === column);
40930
- if (header && header.config && header.config.filterConfig && header.config.filterConfig.options) {
40931
- const filterOptions = header.config.filterConfig.options;
40932
- const optionsToKeep = filterOptions.filter((opt) => header.isSelected(opt, header.multiSelectedOptions) &&
40933
- !newOptions.find((newOpt) => opt.value && newOpt.value && newOpt.value === opt.value));
40934
- header.config.filterConfig.options = [...optionsToKeep, ...newOptions];
40935
- }
40936
- else {
40937
- header.config.filterConfig.options = newOptions;
40949
+ if (header) {
40950
+ if (header.config && header.config.filterConfig && header.config.filterConfig.options) {
40951
+ const filterOptions = header.config.filterConfig.options;
40952
+ const optionsToKeep = filterOptions.filter((opt) => header.isSelected(opt, header.multiSelectedOptions) &&
40953
+ !newOptions.find((newOpt) => opt.value && newOpt.value && newOpt.value === opt.value));
40954
+ header.config.filterConfig.options = [...optionsToKeep, ...newOptions];
40955
+ }
40956
+ else {
40957
+ header.config.filterConfig.options = newOptions;
40958
+ }
40959
+ header.setupFilterOptions();
40960
+ header.changeDetectorRef.markForCheck();
40938
40961
  }
40939
- header.setupFilterOptions();
40940
- header.changeDetectorRef.markForCheck();
40941
40962
  }
40942
40963
  ngOnDestroy() {
40943
40964
  this.outsideFilterSubscription?.unsubscribe();
@@ -57115,7 +57136,6 @@ class NovoDefaultStringConditionDef extends AbstractConditionFieldDef {
57115
57136
  super(...arguments);
57116
57137
  this.separatorKeysCodes = [ENTER, COMMA];
57117
57138
  this.defaultOperator = 'includeAny';
57118
- this.model = '';
57119
57139
  }
57120
57140
  getValue(formGroup) {
57121
57141
  return formGroup.value?.value || [];
@@ -57155,15 +57175,14 @@ NovoDefaultStringConditionDef.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "1
57155
57175
  <novo-option value="excludeAny">{{ labels.exclude }}</novo-option>
57156
57176
  </novo-select>
57157
57177
  </novo-field>
57158
- <novo-field *novoConditionInputDef="let formGroup">
57159
- <novo-chip-list #chipList aria-label="filter value">
57178
+ <novo-field *novoConditionInputDef="let formGroup" [formGroup]="formGroup">
57179
+ <novo-chip-list #chipList aria-label="filter value" formControlName="value">
57160
57180
  <novo-chip *ngFor="let chip of formGroup.value?.value || []" [value]="chip" (removed)="remove(chip, formGroup)">
57161
57181
  {{ chip }}
57162
57182
  <novo-icon novoChipRemove>close</novo-icon>
57163
57183
  </novo-chip>
57164
57184
  <input
57165
57185
  novoChipInput
57166
- [(ngModel)]="model"
57167
57186
  [placeholder]="labels.typeToAddChips"
57168
57187
  autocomplete="off"
57169
57188
  (novoChipInputTokenEnd)="add($event, formGroup)"
@@ -57172,7 +57191,7 @@ NovoDefaultStringConditionDef.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "1
57172
57191
  <novo-autocomplete></novo-autocomplete>
57173
57192
  </novo-field>
57174
57193
  </ng-container>
57175
- `, isInline: true, components: [{ type: NovoFieldElement, selector: "novo-field", inputs: ["layout", "appearance", "width"], outputs: ["valueChanges", "stateChanges"] }, { type: NovoSelectElement, selector: "novo-select", inputs: ["disabled", "required", "tabIndex", "id", "name", "options", "placeholder", "readonly", "headerConfig", "position", "overlayWidth", "overlayHeight", "displayWith", "compareWith", "value", "multiple"], outputs: ["onSelect", "selectionChange", "valueChange", "openedChange", "opened", "closed"] }, { type: NovoOption, selector: "novo-option", inputs: ["selected", "keepOpen", "novoInert", "value", "disabled"], exportAs: ["novoOption"] }, { type: NovoChipList, selector: "novo-chip-list", inputs: ["errorStateMatcher", "multiple", "stacked", "compareWith", "value", "required", "placeholder", "disabled", "aria-orientation", "selectable", "tabIndex"], outputs: ["change", "valueChange"], exportAs: ["novoChipList"] }, { type: NovoChipElement, selector: "novo-chip, [novo-chip]", inputs: ["color", "tabIndex", "size", "type", "selected", "value", "selectable", "disabled", "removable"], outputs: ["selectionChange", "destroyed", "removed"] }, { type: NovoIconComponent, selector: "novo-icon", inputs: ["raised", "theme", "shape", "color", "size", "smaller", "larger", "alt", "name"] }, { type: NovoAutocompleteElement, selector: "novo-autocomplete", inputs: ["tabIndex", "triggerOn", "displayWith", "aria-label", "multiple", "disabled"], outputs: ["optionSelected", "optionActivated"], exportAs: ["novoAutocomplete"] }], directives: [{ type: NovoConditionFieldDef, selector: "[novoConditionFieldDef]" }, { type: NovoConditionOperatorsDef, selector: "[novoConditionOperatorsDef]" }, { type: i5.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { type: i5.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { type: i5.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i5.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { type: NovoConditionInputDef, selector: "[novoConditionInputDef]" }, { type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: NovoChipRemove, selector: "[novoChipRemove]" }, { type: NovoChipInput, selector: "input[novoChipInput]", inputs: ["novoChipInputAddOnBlur", "novoChipInputSeparatorKeyCodes", "placeholder", "id", "disabled"], outputs: ["novoChipInputTokenEnd"], exportAs: ["novoChipInput", "novoChipInputFor"] }, { type: i5.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { type: i5.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }], changeDetection: i0.ChangeDetectionStrategy.Default, encapsulation: i0.ViewEncapsulation.None });
57194
+ `, isInline: true, components: [{ type: NovoFieldElement, selector: "novo-field", inputs: ["layout", "appearance", "width"], outputs: ["valueChanges", "stateChanges"] }, { type: NovoSelectElement, selector: "novo-select", inputs: ["disabled", "required", "tabIndex", "id", "name", "options", "placeholder", "readonly", "headerConfig", "position", "overlayWidth", "overlayHeight", "displayWith", "compareWith", "value", "multiple"], outputs: ["onSelect", "selectionChange", "valueChange", "openedChange", "opened", "closed"] }, { type: NovoOption, selector: "novo-option", inputs: ["selected", "keepOpen", "novoInert", "value", "disabled"], exportAs: ["novoOption"] }, { type: NovoChipList, selector: "novo-chip-list", inputs: ["errorStateMatcher", "multiple", "stacked", "compareWith", "value", "required", "placeholder", "disabled", "aria-orientation", "selectable", "tabIndex"], outputs: ["change", "valueChange"], exportAs: ["novoChipList"] }, { type: NovoChipElement, selector: "novo-chip, [novo-chip]", inputs: ["color", "tabIndex", "size", "type", "selected", "value", "selectable", "disabled", "removable"], outputs: ["selectionChange", "destroyed", "removed"] }, { type: NovoIconComponent, selector: "novo-icon", inputs: ["raised", "theme", "shape", "color", "size", "smaller", "larger", "alt", "name"] }, { type: NovoAutocompleteElement, selector: "novo-autocomplete", inputs: ["tabIndex", "triggerOn", "displayWith", "aria-label", "multiple", "disabled"], outputs: ["optionSelected", "optionActivated"], exportAs: ["novoAutocomplete"] }], directives: [{ type: NovoConditionFieldDef, selector: "[novoConditionFieldDef]" }, { type: NovoConditionOperatorsDef, selector: "[novoConditionOperatorsDef]" }, { type: i5.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { type: i5.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { type: i5.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i5.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { type: NovoConditionInputDef, selector: "[novoConditionInputDef]" }, { type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: NovoChipRemove, selector: "[novoChipRemove]" }, { type: NovoChipInput, selector: "input[novoChipInput]", inputs: ["novoChipInputAddOnBlur", "novoChipInputSeparatorKeyCodes", "placeholder", "id", "disabled"], outputs: ["novoChipInputTokenEnd"], exportAs: ["novoChipInput", "novoChipInputFor"] }], changeDetection: i0.ChangeDetectionStrategy.Default, encapsulation: i0.ViewEncapsulation.None });
57176
57195
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: NovoDefaultStringConditionDef, decorators: [{
57177
57196
  type: Component,
57178
57197
  args: [{
@@ -57187,15 +57206,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImpo
57187
57206
  <novo-option value="excludeAny">{{ labels.exclude }}</novo-option>
57188
57207
  </novo-select>
57189
57208
  </novo-field>
57190
- <novo-field *novoConditionInputDef="let formGroup">
57191
- <novo-chip-list #chipList aria-label="filter value">
57209
+ <novo-field *novoConditionInputDef="let formGroup" [formGroup]="formGroup">
57210
+ <novo-chip-list #chipList aria-label="filter value" formControlName="value">
57192
57211
  <novo-chip *ngFor="let chip of formGroup.value?.value || []" [value]="chip" (removed)="remove(chip, formGroup)">
57193
57212
  {{ chip }}
57194
57213
  <novo-icon novoChipRemove>close</novo-icon>
57195
57214
  </novo-chip>
57196
57215
  <input
57197
57216
  novoChipInput
57198
- [(ngModel)]="model"
57199
57217
  [placeholder]="labels.typeToAddChips"
57200
57218
  autocomplete="off"
57201
57219
  (novoChipInputTokenEnd)="add($event, formGroup)"
@@ -57270,7 +57288,7 @@ class ConditionGroupComponent {
57270
57288
  return this.formBuilder.group({
57271
57289
  field: [field, Validators.required],
57272
57290
  operator: [operator, Validators.required],
57273
- value: [value, Validators.required],
57291
+ value: [value],
57274
57292
  });
57275
57293
  }
57276
57294
  cantRemoveRow(isFirst) {
@@ -57376,7 +57394,7 @@ class CriteriaBuilderComponent {
57376
57394
  return this.formBuilder.group({
57377
57395
  field: [field, Validators.required],
57378
57396
  operator: [operator, Validators.required],
57379
- value: [value, Validators.required],
57397
+ value: [value],
57380
57398
  });
57381
57399
  }
57382
57400
  removeConditionGroupAt(index) {