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

Fixed #15045 -SpeedDial | Add item template #15165

Merged
merged 23 commits into from
Mar 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
0b7d9ca
Fix api-generator
lukasmatta Feb 8, 2024
23b7166
Merge branch 'master' into fix/14770-api-generator
lukasmatta Feb 28, 2024
0a1b651
Rename build-apidoc to ts, regenerate docs
lukasmatta Feb 28, 2024
3a06858
Fixed #15122 - Dropdown | Missing ariaLabel when in editable = true
mehmetcetin01140 Mar 26, 2024
6223333
Fixed #15084 - Listbox | Missing aria-label
mehmetcetin01140 Mar 26, 2024
7efe9d9
Update calendar.ts
rordenerena Mar 26, 2024
c6f18e3
Fixed #15045 -SpeedDial | Add item template
mehmetcetin01140 Mar 26, 2024
ec9f560
Merge pull request #15163 from primefaces/issue-15084
cetincakiroglu Mar 26, 2024
54b7dcf
Merge pull request #15164 from rordenerena/fix-calendar-range-showed-…
cetincakiroglu Mar 26, 2024
3414de1
Merge pull request #15162 from primefaces/issue-15122
cetincakiroglu Mar 26, 2024
c7d81ef
Merge branch 'master' into fix/14770-api-generator
lukasmatta Mar 27, 2024
eb731fa
fix typo
lukasmatta Mar 27, 2024
52c76ba
Regenerate docs
lukasmatta Mar 27, 2024
9527493
Revert "Fixed #15158 - TreeTable | Update selection logic and fix par…
cetincakiroglu Mar 27, 2024
4bfea95
Merge pull request #15177 from primefaces/revert-15159-issue-15158
cetincakiroglu Mar 27, 2024
b146837
Fixed #15178 - Use ObjectUtils for comparison
cetincakiroglu Mar 27, 2024
eed5029
Merge pull request #15179 from primefaces/issue-15178
cetincakiroglu Mar 27, 2024
3d7db6f
Merge pull request #14771 from lukasmatta/fix/14770-api-generator
cetincakiroglu Mar 28, 2024
aff4aa7
Update explanation
cetincakiroglu Mar 28, 2024
184a321
Merge branch 'master' of https://github.com/primefaces/primeng
cetincakiroglu Mar 28, 2024
2d0fbe8
update table | filtermenudoc
mehmetcetin01140 Mar 28, 2024
eacf3a2
Fixed #15045 -SpeedDial | Add item template
mehmetcetin01140 Mar 26, 2024
144aca6
Merge branch 'issue-15045' of https://github.com/primefaces/primeng i…
mehmetcetin01140 Mar 29, 2024
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
26 changes: 14 additions & 12 deletions api-generator/build-apidoc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,11 @@ async function main() {
return text.replace(/{/g, '{').replace(/}/g, '}');
};

const getDeprecatedText = (signature) => {
const deprecatedTag = signature?.comment?.getTag('@deprecated');
return deprecatedTag ? parseText(deprecatedTag.content[0].text) : undefined;
};

const modules = project.groups.find((g) => g.title === 'Modules');

if (isProcessable(modules)) {
Expand Down Expand Up @@ -89,13 +94,10 @@ async function main() {
readonly: prop.flags.isReadonly,
type: prop.getSignature && prop.getSignature.type ? prop.getSignature.type.toString() : prop.type ? prop.type.toString() : null,
default: prop.type && prop.type.name === 'boolean' && !prop.defaultValue ? 'false' : prop.defaultValue ? prop.defaultValue.replace(/^'|'$/g, '') : undefined,
description: prop.getSignature && prop.getSignature.comment ? prop.getSignature.comment.summary.map((s) => s.text || '').join(' ') : prop.comment && prop.comment.summary.map((s) => s.text || '').join(' '),
deprecated:
prop.getSignature && prop.getSignature.comment && prop.getSignature.comment.getTag('@deprecated')
? parseText(prop.getSignature.comment.getTag('@deprecated').content[0].text)
: prop.comment && prop.comment.getTag('@deprecated')
? parseText(prop.comment.getTag('@deprecated').content[0].text)
: undefined
description: ((prop.getSignature?.comment?.summary || prop.setSignature?.comment?.summary) || prop.comment?.summary)?.map((s) => s.text || '').join(' '),
deprecated: getDeprecatedText(prop.getSignature)
|| getDeprecatedText(prop.setSignature)
|| getDeprecatedText(prop)
});
});
doc[name]['components'][componentName]['props'] = props;
Expand All @@ -113,7 +115,7 @@ async function main() {
name: emitter.name,
parameters: [{ name: extractParameter(emitter) && extractParameter(emitter).includes('Event') ? 'event' : 'value', type: extractParameter(emitter) }],
description: emitter.comment && emitter.comment.summary.map((s) => s.text || '').join(' '),
deprecated: emitter.comment && emitter.comment.getTag('@deprecated') ? parseText(emitter.comment.getTag('@deprecated').content[0].text) : undefined
deprecated: getDeprecatedText(emitter)
});
});

Expand Down Expand Up @@ -164,7 +166,7 @@ async function main() {
readonly: child.flags.isReadonly,
type: child.type && child.type.toString(),
description: child.comment && child.comment.summary.map((s) => s.text || '').join(' '),
deprecated: child.comment && child.comment.getTag('@deprecated') ? parseText(child.comment.getTag('@deprecated').content[0].text) : undefined
deprecated: getDeprecatedText(child)
}))
});
});
Expand Down Expand Up @@ -192,7 +194,7 @@ async function main() {
readonly: child.flags.isReadonly,
type: child.type && child.type.toString(),
description: child.comment && child.comment.summary.map((s) => s.text || '').join(' '),
deprecated: child.comment && child.comment.getTag('@deprecated') ? parseText(child.comment.getTag('@deprecated').content[0].text) : undefined
deprecated: getDeprecatedText(child)
}))
});
});
Expand Down Expand Up @@ -243,7 +245,7 @@ async function main() {
};
}),
description: signature.comment && signature.comment.summary.map((s) => s.text || '').join(' '),
deprecated: signature.comment && signature.comment.getTag('@deprecated') ? parseText(signature.comment.getTag('@deprecated').content[0].text) : undefined
deprecated: getDeprecatedText(signature)
});
});
});
Expand All @@ -269,7 +271,7 @@ async function main() {
readonly: child.flags.isReadonly,
type: child.type ? child.type.toString() : extractParameter(int),
description: child.comment && child.comment.summary.map((s) => s.text || '').join(' '),
deprecated: child.comment && child.comment.getTag('@deprecated') ? parseText(child.comment.getTag('@deprecated').content[0].text) : undefined
deprecated: getDeprecatedText(child)
}))
});
});
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -89,4 +89,4 @@
"@docsearch/js": "^3.3.4",
"esbuild": "^0.19.8"
}
}
}
2 changes: 1 addition & 1 deletion src/app/components/api/messageservice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export class MessageService {
}
}
/**
* Insterts new messages.
* Inserts new messages.
* @param {Message[]} messages - Messages to be added.
* @group Method
*/
Expand Down
2 changes: 1 addition & 1 deletion src/app/components/autocomplete/autocomplete.interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ export interface AutoCompleteTemplates {
$implicit: any | any[];
}): TemplateRef<{ $implicit: any | any[] }>;
/**
* Custom selected item template.
* Custom selected item template, only supported in multiple mode.
* @param {Object} context - selected item data.
*/
selectedItem(context: {
Expand Down
2 changes: 1 addition & 1 deletion src/app/components/calendar/calendar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2803,7 +2803,7 @@ export class Calendar implements OnInit, OnDestroy, ControlValueAccessor {
updateUI() {
let propValue = this.value;
if (Array.isArray(propValue)) {
propValue = propValue[0];
propValue = propValue.length === 2 ? propValue[1] : propValue[0];
}

let val = this.defaultDate && this.isValidDate(this.defaultDate) && !this.value ? this.defaultDate : propValue && this.isValidDate(propValue) ? propValue : new Date();
Expand Down
1 change: 1 addition & 0 deletions src/app/components/dropdown/dropdown.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ export class DropdownItem {
[disabled]="disabled"
aria-haspopup="listbox"
[attr.placeholder]="modelValue() === undefined || modelValue() === null ? placeholder() : undefined"
[attr.aria-label]="ariaLabel || (label() === 'p-emptylabel' ? undefined : label())"
(input)="onEditableInput($event)"
(keydown)="onKeyDown($event)"
(focus)="onInputFocus($event)"
Expand Down
5 changes: 5 additions & 0 deletions src/app/components/listbox/listbox.ts
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,11 @@ export class Listbox implements AfterContentInit, OnInit, ControlValueAccessor,
* @group Props
*/
@Input() autoOptionFocus: boolean | undefined = true;
/**
* Defines a string that labels the input for accessibility.
* @group Props
*/
@Input() ariaLabel: string | undefined;
/**
* When enabled, the focused option is selected.
* @group Props
Expand Down
14 changes: 14 additions & 0 deletions src/app/components/speeddial/speeddial.interface.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,24 @@
import { TemplateRef } from '@angular/core';
import { MenuItem } from '../api/menuitem';

/**
* Defines valid templates in SpeedDial.
* @group Templates
*/
export interface SpeedDialTemplates {
/**
* Custom template of item.
*/
item(context: {
/**
* Data of the item.
*/
$implicit: MenuItem[];
/**
* Index of the item.
*/
index: number;
}): TemplateRef<{ $implicit: MenuItem[]; index: number }>;
/**
* Custom template of button.
*/
Expand Down
74 changes: 42 additions & 32 deletions src/app/components/speeddial/speeddial.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,48 +85,53 @@ import { asapScheduler } from 'rxjs';
role="menuitem"
[attr.data-pc-section]="'menuitem'"
>
<a
*ngIf="_visible && isClickableRouterLink(item); else elseBlock"
pRipple
[routerLink]="item.routerLink"
[queryParams]="item.queryParams"
class="p-speeddial-action"
[ngClass]="{ 'p-disabled': item.disabled }"
role="menuitem"
[routerLinkActiveOptions]="item.routerLinkActiveOptions || { exact: false }"
(click)="onItemClick($event, item)"
(keydown.enter)="onItemClick($event, item, i)"
[attr.target]="item.target"
[attr.tabindex]="item.disabled || readonly || !visible ? null : item.tabindex ? item.tabindex : '0'"
[fragment]="item.fragment"
[queryParamsHandling]="item.queryParamsHandling"
[preserveFragment]="item.preserveFragment"
[skipLocationChange]="item.skipLocationChange"
[replaceUrl]="item.replaceUrl"
[state]="item.state"
[attr.aria-label]="item.label"
[attr.data-pc-section]="'action'"
>
<span class="p-speeddial-action-icon" *ngIf="item.icon" [ngClass]="item.icon"></span>
</a>
<ng-template #elseBlock>
<ng-container *ngIf="itemTemplate">
<ng-container *ngTemplateOutlet="itemTemplate; context: { $implicit: item, index: i }"></ng-container>
</ng-container>
<ng-container *ngIf="!itemTemplate">
<a
*ngIf="_visible"
[attr.href]="item.url || null"
*ngIf="_visible && isClickableRouterLink(item); else elseBlock"
pRipple
[routerLink]="item.routerLink"
[queryParams]="item.queryParams"
class="p-speeddial-action"
[ngClass]="{ 'p-disabled': item.disabled }"
role="menuitem"
pRipple
[routerLinkActiveOptions]="item.routerLinkActiveOptions || { exact: false }"
(click)="onItemClick($event, item)"
[ngClass]="{ 'p-disabled': item.disabled }"
(keydown.enter)="onItemClick($event, item, i)"
[attr.target]="item.target"
[attr.data-pc-section]="'action'"
[attr.tabindex]="item.disabled || readonly || !visible ? null : item.tabindex ? item.tabindex : '0'"
[fragment]="item.fragment"
[queryParamsHandling]="item.queryParamsHandling"
[preserveFragment]="item.preserveFragment"
[skipLocationChange]="item.skipLocationChange"
[replaceUrl]="item.replaceUrl"
[state]="item.state"
[attr.aria-label]="item.label"
[attr.tabindex]="item.disabled || (i !== activeIndex && readonly) || !visible ? null : item.tabindex ? item.tabindex : '0'"
[attr.data-pc-section]="'action'"
>
<span class="p-speeddial-action-icon" *ngIf="item.icon" [ngClass]="item.icon"></span>
</a>
</ng-template>
<ng-template #elseBlock>
<a
*ngIf="_visible"
[attr.href]="item.url || null"
class="p-speeddial-action"
role="menuitem"
pRipple
(click)="onItemClick($event, item)"
[ngClass]="{ 'p-disabled': item.disabled }"
(keydown.enter)="onItemClick($event, item, i)"
[attr.target]="item.target"
[attr.data-pc-section]="'action'"
[attr.aria-label]="item.label"
[attr.tabindex]="item.disabled || (i !== activeIndex && readonly) || !visible ? null : item.tabindex ? item.tabindex : '0'"
>
<span class="p-speeddial-action-icon" *ngIf="item.icon" [ngClass]="item.icon"></span>
</a>
</ng-template>
</ng-container>
</li>
</ul>
</div>
Expand Down Expand Up @@ -296,6 +301,8 @@ export class SpeedDial implements AfterViewInit, AfterContentInit, OnDestroy {

buttonTemplate: TemplateRef<any> | undefined;

itemTemplate: TemplateRef<any> | undefined;

isItemClicked: boolean = false;

_visible: boolean = false;
Expand Down Expand Up @@ -338,6 +345,9 @@ export class SpeedDial implements AfterViewInit, AfterContentInit, OnDestroy {
case 'button':
this.buttonTemplate = item.template;
break;
case 'item':
this.itemTemplate = item.template;
break;
}
});
}
Expand Down
40 changes: 7 additions & 33 deletions src/app/components/treetable/treetable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1813,35 +1813,19 @@ export class TreeTable implements AfterContentInit, OnInit, OnDestroy, Blockable
}
}

isSelected(node: TreeTableNode): boolean {
isSelected(node: TreeTableNode) {
if (node && this.selection) {
if (this.dataKey) {
return this.selectionKeys[ObjectUtils.resolveFieldData(node.data, this.dataKey)] !== undefined;
} else {
if (Array.isArray(this.selection)) {
return this.allChildrenOrNodeSelected(node);
} else {
return this.equals(node, this.selection);
}
if (Array.isArray(this.selection)) return this.findIndexInSelection(node) > -1;
else return this.equals(node, this.selection);
}
}

return false;
}

allChildrenOrNodeSelected(node: TreeTableNode): boolean {
if (this.findIndexInSelection(node) == -1 && node.parent) {
if (this.findIndexInSelection(node.parent) !== -1) {
return true;
}
}
if (!node.children) {
return this.selection.some((selectedItem) => this.equals(node, selectedItem));
} else {
return node.children.every((child) => this.isSelected(child)) || this.selection.some((selectedItem) => this.equals(node, selectedItem));
}
}

findIndexInSelection(node: any) {
let index: number = -1;
if (this.selection && this.selection.length) {
Expand All @@ -1865,7 +1849,7 @@ export class TreeTable implements AfterContentInit, OnInit, OnDestroy, Blockable
}

equals(node1: TreeTableNode, node2: TreeTableNode) {
return this.compareSelectionBy === 'equals' ? node1 === node2 : ObjectUtils.equals(node1.data, node2.data, this.dataKey);
return this.compareSelectionBy === 'equals' ? ObjectUtils.equals(node1, node2) : ObjectUtils.equals(node1.data, node2.data, this.dataKey);
}

filter(value: string | string[], field: string, matchMode: string) {
Expand Down Expand Up @@ -2949,13 +2933,13 @@ export class TTContextMenuRow {
<div class="p-hidden-accessible">
<input type="checkbox" [checked]="checked" (focus)="onFocus()" (blur)="onBlur()" tabindex="-1" />
</div>
<div #box [ngClass]="{ 'p-checkbox-box': true, 'p-highlight': checked, 'p-focus': focused, 'p-indeterminate': isPartialSelected(), 'p-disabled': disabled }" role="checkbox" [attr.aria-checked]="checked">
<div #box [ngClass]="{ 'p-checkbox-box': true, 'p-highlight': checked, 'p-focus': focused, 'p-indeterminate': rowNode.node.partialSelected, 'p-disabled': disabled }" role="checkbox" [attr.aria-checked]="checked">
<ng-container *ngIf="!tt.checkboxIconTemplate">
<CheckIcon [styleClass]="'p-checkbox-icon'" *ngIf="checked" />
<MinusIcon [styleClass]="'p-checkbox-icon'" *ngIf="isPartialSelected()" />
<MinusIcon [styleClass]="'p-checkbox-icon'" *ngIf="rowNode.node.partialSelected" />
</ng-container>
<span *ngIf="tt.checkboxIconTemplate">
<ng-template *ngTemplateOutlet="tt.checkboxIconTemplate; context: { $implicit: checked, partialSelected: isPartialSelected() }"></ng-template>
<ng-template *ngTemplateOutlet="tt.checkboxIconTemplate; context: { $implicit: checked, partialSelected: rowNode.node.partialSelected }"></ng-template>
</span>
</div>
</div>
Expand Down Expand Up @@ -2988,16 +2972,6 @@ export class TTCheckbox {
this.checked = this.tt.isSelected(this.rowNode.node);
}

isPartialSelected() {
const node = this.rowNode.node;
if (node['partialSelected']) {
return !this.checked && node['partialSelected'];
}
if (node['partialSelected'] == undefined && node.children && node.children.length > 0) {
return !this.checked && node.children.some((child) => this.tt.isSelected(child));
}
}

onClick(event: Event) {
if (!this.disabled) {
this.tt.toggleNodeWithCheckbox({
Expand Down
Loading
Loading