Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
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
4 changes: 4 additions & 0 deletions packages/primeng/src/api/overlayoptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,10 @@ export interface OverlayOptions {
* The motion options for the overlay.
*/
motionOptions?: MotionOptions;
/**
* Indicates whether the overlay should have a max-width based on the target element.
*/
autoMaxWidth?: boolean;
/**
* Indicates whether the overlay should be hidden when the escape key is pressed.
*/
Expand Down
7 changes: 6 additions & 1 deletion packages/primeng/src/multiselect/multiselect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ export class MultiSelectItem extends BaseComponent {
#overlay
[hostAttrSelector]="$attrSelector"
[(visible)]="overlayVisible"
[options]="overlayOptions"
[options]="{ ...overlayOptions, autoMaxWidth: !autoWidth }"
Comment thread
ayush1298 marked this conversation as resolved.
Outdated
[target]="'@parent'"
[appendTo]="$appendTo()"
[unstyled]="unstyled()"
Expand Down Expand Up @@ -740,6 +740,11 @@ export class MultiSelect extends BaseEditableHolder<MultiSelectPassThrough> {
* @group Props
*/
@Input({ transform: booleanAttribute }) autofocusFilter: boolean = false;
/**
* Whether the width of the overlay mirrors the width of the component.
* @group Props
*/
@Input({ transform: booleanAttribute }) autoWidth: boolean = true;
/**
* Defines how the selected items are displayed.
* @group Props
Expand Down
14 changes: 12 additions & 2 deletions packages/primeng/src/multiselect/style/multiselectstyle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,21 @@ const style = /*css*/ `
.p-multiselect.ng-invalid.ng-dirty {
border-color: dt('multiselect.invalid.border.color');
}
p-multiSelect.ng-invalid.ng-dirty .p-multiselect-label.p-placeholder,
p-multi-select.ng-invalid.ng-dirty .p-multiselect-label.p-placeholder,
p-multiselect.ng-invalid.ng-dirty .p-multiselect-label.p-placeholder {
Comment thread
ayush1298 marked this conversation as resolved.
color: dt('multiselect.invalid.placeholder.color');
}

.p-multiselect-option {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}

.p-multiselect-label {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
`;

const inlineStyles = {
Expand Down
8 changes: 7 additions & 1 deletion packages/primeng/src/overlay/overlay.ts
Original file line number Diff line number Diff line change
Expand Up @@ -602,7 +602,13 @@ export class Overlay extends BaseComponent {
alignOverlay() {
if (!this.modal) {
if (this.overlayEl && this.targetEl) {
this.overlayEl.style.minWidth = getOuterWidth(this.targetEl) + 'px';
const targetWidth = getOuterWidth(this.targetEl);
this.overlayEl.style.minWidth = targetWidth + 'px';

if (this.overlayOptions.autoMaxWidth) {
this.overlayEl.style.maxWidth = targetWidth + 'px';
Comment thread
ayush1298 marked this conversation as resolved.
}

if (this.$appendTo() === 'self') {
relativePosition(this.overlayEl, this.targetEl);
} else {
Expand Down
7 changes: 6 additions & 1 deletion packages/primeng/src/select/select.ts
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ export class SelectItem extends BaseComponent {
#overlay
[hostAttrSelector]="$attrSelector"
[(visible)]="overlayVisible"
[options]="overlayOptions"
[options]="{ ...overlayOptions, autoMaxWidth: !autoWidth }"
Comment thread
ayush1298 marked this conversation as resolved.
Outdated
[target]="'@parent'"
[appendTo]="$appendTo()"
[unstyled]="unstyled()"
Expand Down Expand Up @@ -680,6 +680,11 @@ export class Select extends BaseInput<SelectPassThrough> implements AfterViewIni
* @group Props
*/
@Input({ transform: booleanAttribute }) autofocusFilter: boolean = true;
/**
* Whether the width of the overlay mirrors the width of the component.
* @group Props
*/
@Input({ transform: booleanAttribute }) autoWidth: boolean = true;
/**
* When specified, filter displays with this value.
* @group Props
Expand Down
12 changes: 12 additions & 0 deletions packages/primeng/src/select/style/selectstyle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,18 @@ const style = /*css*/ `
.p-select.ng-invalid.ng-dirty .p-select-label.p-placeholder {
color: dt('select.invalid.placeholder.color');
}

.p-select-option-label {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
Comment thread
ayush1298 marked this conversation as resolved.

.p-select-label {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
`;

const classes = {
Expand Down
Loading