Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/dev compatibility for monitoring #2692

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ export class DatalistComponent extends GenericFormComponent implements OnInit, O
@Input() filters = {}; // help

@Input() default;
@Input() nullDefault;

@Input() dataPath: string; // pour atteindre la liste si elle n'est pas à la racine de la réponse de l'api.
// si on a 'data/liste' on mettra dataPath='data'
Expand Down Expand Up @@ -75,7 +76,15 @@ export class DatalistComponent extends GenericFormComponent implements OnInit, O

getFilteredValues() {
let values = this.values || [];

// if(this.nullDefault){
// values.push()
// }
if (this.nullDefault && !this.required) {
let obj = {};
obj[this.keyValue] = null;
obj[this.keyLabel] = '-- Aucun --';
values.unshift(obj);
}
values = values
// filter search
.filter(
Expand Down Expand Up @@ -138,8 +147,8 @@ export class DatalistComponent extends GenericFormComponent implements OnInit, O
this.filteredValues.length === 1 &&
!(this.parentFormControl.value && this.parentFormControl.value.length)
) {
const val = this.values[0][this.keyValue];
this.parentFormControl.patchValue(this.multiple ? [val] : val);
const val = this.nullDefault ? null : this.values[0][this.keyValue];
this.parentFormControl.patchValue(this.multiple && !this.nullDefault ? [val] : val);
}

// valeur par défaut (depuis input value)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,16 @@
[idMenu]="formDefComp['id_menu']"
[idList]="formDefComp['id_list']"
[codeList]="formDefComp['code_list']"
></pnx-observers>
[multiSelect]="formDefComp['multi_select']"
>
</pnx-observers>

<pnx-observers-text
*ngSwitchCase="'observers-text'"
[label]="formDefComp['attribut_label']"
[parentFormControl]="form.get(formDefComp['attribut_name'])"
>
</pnx-observers-text>

<pnx-date
*ngSwitchCase="'date'"
Expand Down Expand Up @@ -364,6 +373,7 @@
[definition]="formDefComp['definition']"
[filters]="formDefComp['filters']"
[default]="formDefComp['default']"
[nullDefault]="formDefComp['nullDefault']"
></pnx-datalist>

<small class="form-text text-muted">{{ formDefComp['help'] }}</small>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export class ObserversComponent extends GenericFormComponent {
ngOnInit() {
super.ngOnInit();
this.bindValue = this.bindAllItem ? null : this.bindValue;
this.multiSelect = this.multiSelect || true;
this.multiSelect = this.multiSelect == undefined ? true : this.multiSelect;
// uniformise as IdList the id of list
// retrocompat: keep idMenu
if (this.idList) {
Expand Down
Loading