Skip to content

Commit

Permalink
fix(user-display): handle null string in isNotEmptyString (#3136) (#…
Browse files Browse the repository at this point in the history
…3148)

Co-authored-by: Flavien Normand <[email protected]>
  • Loading branch information
GuillaumeNury and Supamiu authored Oct 21, 2024
1 parent 1f7fe2d commit da52a33
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
3 changes: 3 additions & 0 deletions packages/ng/option/selector/all/select-all.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ export class LuOptionSelectAllComponent<T> extends ALuOptionOperator<T> implemen
public intl = getIntl(LU_OPTION_SELECT_ALL_TRANSLATIONS);

selectAll() {
if (!this.options) {
return;
}
this.onSelectValue.next([...this.options]);
}
deselectAll() {
Expand Down
3 changes: 3 additions & 0 deletions packages/ng/option/selector/all/tree-select-all.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ export class LuTreeOptionSelectAllComponent<T> extends ALuTreeOptionOperator<T>
public intl = getIntl(LU_OPTION_SELECT_ALL_TRANSLATIONS);

selectAll() {
if (!this.flatOptions) {
return;
}
this.onSelectValue.next([...this.flatOptions]);
}
deselectAll() {
Expand Down
9 changes: 7 additions & 2 deletions packages/ng/user/display/user-display.pipe.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ function getFirstCharacter([firstCharacter]: string): string {
}

function isNotEmptyString(value: string): boolean {
return value.length > 0;
return value?.length > 0;
}

export interface LuUserDisplayInput {
Expand Down Expand Up @@ -51,7 +51,12 @@ export function luUsersDisplay(users: LuUserDisplayInput[], options: LuUserDispl

export type LuUserDisplaySingleOptions = LuDisplayFormat | { format: LuDisplayFormat };

export type LuUserDisplayMultipleOptions = { format: LuDisplayFormat; separator: string } | { format: LuDisplayFormat; formatter: Intl.ListFormat };
export type LuUserDisplayMultipleOptions =
| { format: LuDisplayFormat; separator: string }
| {
format: LuDisplayFormat;
formatter: Intl.ListFormat;
};

/**
* Displays a user name according to specified format. Supported formats: f for first name,
Expand Down

0 comments on commit da52a33

Please sign in to comment.