Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/primefaces/primeng
Browse files Browse the repository at this point in the history
  • Loading branch information
mehmetcetin01140 committed Jul 4, 2024
2 parents 38d37f8 + eb35c2f commit d7d545a
Show file tree
Hide file tree
Showing 6 changed files with 51 additions and 35 deletions.
15 changes: 9 additions & 6 deletions src/app/components/inputnumber/inputnumber.ts
Original file line number Diff line number Diff line change
Expand Up @@ -597,6 +597,7 @@ export class InputNumber implements OnInit, AfterContentInit, OnChanges, Control
const decimalChar = this.getDecimalChar();
return new RegExp(`[${decimalChar}]`, 'g');
}

getDecimalChar(): string {
const formatter = new Intl.NumberFormat(this.locale, { ...this.getOptions(), useGrouping: false });
return formatter
Expand Down Expand Up @@ -648,6 +649,10 @@ export class InputNumber implements OnInit, AfterContentInit, OnChanges, Control
return new RegExp(`${this.escapeRegExp(this.suffixChar || '')}`, 'g');
}

get isBlurUpdateOnMode() {
return this.ngControl?.control?.updateOn === 'blur';
}

formatValue(value: any) {
if (value != null) {
if (value === '-') {
Expand Down Expand Up @@ -1281,7 +1286,7 @@ export class InputNumber implements OnInit, AfterContentInit, OnChanges, Control
if (this.isValueChanged(currentValue, newValue)) {
(this.input as ElementRef).nativeElement.value = this.formatValue(newValue);
this.input?.nativeElement.setAttribute('aria-valuenow', newValue);
this.updateModel(event, newValue);
!this.isBlurUpdateOnMode && this.updateModel(event, newValue);
this.onInput.emit({ originalEvent: event, value: newValue, formattedValue: currentValue });
}
}
Expand Down Expand Up @@ -1446,16 +1451,14 @@ export class InputNumber implements OnInit, AfterContentInit, OnChanges, Control
}

updateModel(event: Event, value: any) {
const isBlurUpdateOnMode = this.ngControl?.control?.updateOn === 'blur';

if (this.value !== value) {
this.value = value;

if (!(isBlurUpdateOnMode && this.focused)) {
if (!(this.isBlurUpdateOnMode && this.focused)) {
this.onModelChange(value);
} else if (this.isBlurUpdateOnMode) {
this.onModelChange(value);
}
} else if (isBlurUpdateOnMode) {
this.onModelChange(value);
}
this.onModelTouched();
}
Expand Down
21 changes: 10 additions & 11 deletions src/app/components/multiselect/multiselect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,14 @@ export class MultiSelectItem {
<div #token *ngFor="let item of chipSelectedItems(); let i = index" class="p-multiselect-token">
<span class="p-multiselect-token-label">{{ getLabelByValue(item) }}</span>
<ng-container *ngIf="!disabled">
<TimesCircleIcon *ngIf="!removeTokenIconTemplate" [styleClass]="'p-multiselect-token-icon'" (click)="removeOption(item, event)" [attr.data-pc-section]="'clearicon'" [attr.aria-hidden]="true" />
<TimesCircleIcon
*ngIf="!removeTokenIconTemplate"
[ngClass]="{ 'p-disabled': isOptionDisabled(item) }"
[styleClass]="'p-multiselect-token-icon'"
(click)="removeOption(item, event)"
[attr.data-pc-section]="'clearicon'"
[attr.aria-hidden]="true"
/>
<span *ngIf="removeTokenIconTemplate" class="p-multiselect-token-icon" (click)="removeOption(item, event)" [attr.data-pc-section]="'clearicon'" [attr.aria-hidden]="true">
<ng-container *ngTemplateOutlet="removeTokenIconTemplate"></ng-container>
</span>
Expand Down Expand Up @@ -1182,15 +1189,7 @@ export class MultiSelect implements OnInit, AfterViewInit, AfterContentInit, Aft
return ObjectUtils.isNotEmpty(this.maxSelectedLabels) && this.modelValue() && this.modelValue().length > this.maxSelectedLabels ? this.modelValue().slice(0, this.maxSelectedLabels) : this.modelValue();
});

constructor(
public el: ElementRef,
public renderer: Renderer2,
public cd: ChangeDetectorRef,
public zone: NgZone,
public filterService: FilterService,
public config: PrimeNGConfig,
public overlayService: OverlayService
) {
constructor(public el: ElementRef, public renderer: Renderer2, public cd: ChangeDetectorRef, public zone: NgZone, public filterService: FilterService, public config: PrimeNGConfig, public overlayService: OverlayService) {
effect(() => {
const modelValue = this.modelValue();

Expand Down Expand Up @@ -1379,7 +1378,7 @@ export class MultiSelect implements OnInit, AfterViewInit, AfterContentInit, Aft
isFocus && DomHandler.focus(this.focusInputViewChild?.nativeElement);

this.onChange.emit({
originalEvent: event,
originalEvent: { ...event, selected: !event.selected },
value: value,
itemValue: option
});
Expand Down
5 changes: 5 additions & 0 deletions src/app/components/splitter/splitter.css
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
}

.p-splitter-panel {
overflow: hidden;
flex-grow: 1;
}

Expand Down Expand Up @@ -62,4 +63,8 @@
width: 24px;
height: 100%;
}

.p-splitter-resizing .p-splitter-panel {
pointer-events: none;
}
}
6 changes: 4 additions & 2 deletions src/app/components/splitter/splitter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -394,11 +394,13 @@ export class Splitter {
}

validateResize(newPrevPanelSize: number, newNextPanelSize: number) {
if (this.minSizes.length >= 1 && this.minSizes[0] && this.minSizes[0] > newPrevPanelSize) {
const prevPanelIndex = this.prevPanelIndex;
if (this.minSizes.length > prevPanelIndex && this.minSizes[prevPanelIndex] && this.minSizes[prevPanelIndex] > newPrevPanelSize) {
return false;
}

if (this.minSizes.length > 1 && this.minSizes[1] && this.minSizes[1] > newNextPanelSize) {
const nextPanelIndex = this.prevPanelIndex + 1;
if (this.minSizes.length > nextPanelIndex && this.minSizes[nextPanelIndex] && this.minSizes[nextPanelIndex] > newNextPanelSize) {
return false;
}

Expand Down
9 changes: 5 additions & 4 deletions src/app/components/table/table.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1849,7 +1849,7 @@ export class Table implements OnInit, AfterViewInit, AfterContentInit, Blockable
}
}

selectRange(event: MouseEvent | KeyboardEvent, rowIndex: number) {
selectRange(event: MouseEvent | KeyboardEvent, rowIndex: number, isMetaKeySelection? : boolean | undefined) {
let rangeStart, rangeEnd;

if (<number>this.anchorRowIndex > rowIndex) {
Expand All @@ -1871,7 +1871,7 @@ export class Table implements OnInit, AfterViewInit, AfterContentInit, Blockable
let rangeRowsData = [];
for (let i = <number>rangeStart; i <= <number>rangeEnd; i++) {
let rangeRowData = this.filteredValue ? this.filteredValue[i] : this.value[i];
if (!this.isSelected(rangeRowData)) {
if (!this.isSelected(rangeRowData) && !isMetaKeySelection) {
if (!this.isRowSelectable(rangeRowData, rowIndex)) {
continue;
}
Expand Down Expand Up @@ -2988,7 +2988,8 @@ export class Table implements OnInit, AfterViewInit, AfterContentInit, Blockable
this.responsiveStyleElement = this.renderer.createElement('style');
this.responsiveStyleElement.type = 'text/css';
this.renderer.appendChild(this.document.head, this.responsiveStyleElement);

DomHandler.setAttribute(this.responsiveStyleElement, 'nonce', this.config?.csp()?.nonce);

let innerHTML = `
@media screen and (max-width: ${this.breakpoint}) {
#${this.id}-table > .p-datatable-thead > tr > th,
Expand Down Expand Up @@ -3632,7 +3633,7 @@ export class SelectableRow implements OnInit, OnDestroy {
if (event.code === 'KeyA' && (event.metaKey || event.ctrlKey) && this.dt.selectionMode === 'multiple') {
const data = this.dt.dataToRender(this.dt.processedData);
this.dt.selection = [...data];
this.dt.selectRange(event, data.length - 1);
this.dt.selectRange(event, data.length - 1, true);

event.preventDefault();
}
Expand Down
30 changes: 18 additions & 12 deletions src/app/components/tooltip/tooltip.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,8 @@ export class Tooltip implements AfterViewInit, OnDestroy {

resizeListener: any;

interactionInProgress = false;

constructor(
@Inject(PLATFORM_ID) private platformId: any,
public el: ElementRef,
Expand Down Expand Up @@ -339,24 +341,28 @@ export class Tooltip implements AfterViewInit, OnDestroy {
}

activate() {
this.active = true;
this.clearHideTimeout();
if (!this.interactionInProgress) {
this.active = true;
this.clearHideTimeout();

if (this.getOption('showDelay'))
this.showTimeout = setTimeout(() => {
this.show();
}, this.getOption('showDelay'));
else this.show();
if (this.getOption('showDelay'))
this.showTimeout = setTimeout(() => {
this.show();
}, this.getOption('showDelay'));
else this.show();

if (this.getOption('life')) {
let duration = this.getOption('showDelay') ? this.getOption('life') + this.getOption('showDelay') : this.getOption('life');
this.hideTimeout = setTimeout(() => {
this.hide();
}, duration);
if (this.getOption('life')) {
let duration = this.getOption('showDelay') ? this.getOption('life') + this.getOption('showDelay') : this.getOption('life');
this.hideTimeout = setTimeout(() => {
this.hide();
}, duration);
}
}
this.interactionInProgress = true;
}

deactivate() {
this.interactionInProgress = false;
this.active = false;
this.clearShowTimeout();

Expand Down

0 comments on commit d7d545a

Please sign in to comment.