Skip to content

Commit

Permalink
Merge pull request #30 from squidit/bugfix/SQ-55130
Browse files Browse the repository at this point in the history
bugfix/SQ-55130 - Não permitir remoção no sq-select-multi-tags com readonly e disabled
  • Loading branch information
danielpcs committed Nov 10, 2023
2 parents f52c2af + 67d1ad6 commit 2c7dbed
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,14 @@
<span *ngIf="!value?.length || !showInside">{{ placeholder }}</span>
<div class="input-fake-content-text" *ngIf="showInside && value?.length">
<span class="tag" *ngFor="let opt of value; let i = index" (click)="removeItem(opt, $event)">
{{ opt?.label }} <i class="fas fa-times"></i>
{{ opt?.label }} <i *ngIf="!readonly" class="fas fa-times"></i>
</span>
</div>
<span *ngIf="value?.length" class="badge">{{ value!.length }}</span>
<i *ngIf="!loading" class="icon-down fas fa-chevron-down"></i>
<i *ngIf="!loading && !readonly" class="icon-down fas fa-chevron-down"></i>
</div>
<div
*ngIf="!loading && !disabled && !isMaxTags && renderOptionsList"
*ngIf="!loading && !disabled && !readonly && !isMaxTags && renderOptionsList"
id="sq-select-multi-tags-scroll"
class="input-window scrollbar"
[ngClass]="{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -333,16 +333,18 @@ export class SqSelectMultiTagsComponent implements OnChanges {
*/
removeItem(item: OptionMulti, event: any) {
event?.stopPropagation()
if (item.children?.length) {
item.children.forEach((child) => {
this.value = this.value?.filter((value) => value.value !== child.value)
})
if(!this.readonly && !this.disabled) {
if (item.children?.length) {
item.children.forEach((child) => {
this.value = this.value?.filter((value) => value.value !== child.value)
})
}
this.value = this.value?.filter((value) => value.value !== item.value)

this.valueChange.emit(this.value)
this.removeTag.emit(item)
this.validate()
}
this.value = this.value?.filter((value) => value.value !== item.value)

this.valueChange.emit(this.value)
this.removeTag.emit(item)
this.validate()
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@squidit/ngx-css",
"version": "1.1.58",
"version": "1.1.59",
"peerDependencies": {
"@angular/common": ">=15.0.0",
"@angular/core": ">=15.0.0",
Expand Down

0 comments on commit 2c7dbed

Please sign in to comment.