@firestitch/chip 18.0.2 → 18.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/app/components/chip/chip.component.d.ts +21 -24
- package/app/components/chip-action/chip-action.component.d.ts +11 -0
- package/app/components/chips/chips.component.d.ts +7 -9
- package/app/fs-chip.module.d.ts +6 -4
- package/esm2022/app/components/chip/chip.component.mjs +83 -113
- package/esm2022/app/components/chip-action/chip-action.component.mjs +28 -0
- package/esm2022/app/components/chips/chips.component.mjs +59 -54
- package/esm2022/app/fs-chip.module.mjs +14 -7
- package/fesm2022/firestitch-chip.mjs +254 -255
- package/fesm2022/firestitch-chip.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -1,229 +1,52 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import { EventEmitter, Component, ChangeDetectionStrategy, HostBinding, Input, Output, HostListener, forwardRef, ContentChildren, NgModule } from '@angular/core';
|
|
3
|
-
import * as i1 from '@angular/common';
|
|
1
|
+
import * as i2 from '@angular/common';
|
|
4
2
|
import { CommonModule } from '@angular/common';
|
|
5
|
-
import * as
|
|
3
|
+
import * as i0 from '@angular/core';
|
|
4
|
+
import { EventEmitter, Component, ChangeDetectionStrategy, Input, Output, forwardRef, ViewChild, ContentChildren, TemplateRef, Optional, NgModule } from '@angular/core';
|
|
5
|
+
import * as i2$1 from '@angular/cdk/drag-drop';
|
|
6
|
+
import { moveItemInArray, CdkDropList, DragDropModule } from '@angular/cdk/drag-drop';
|
|
7
|
+
import * as i3 from '@angular/material/icon';
|
|
6
8
|
import { MatIconModule } from '@angular/material/icon';
|
|
7
9
|
import { FsLabelModule } from '@firestitch/label';
|
|
8
|
-
import { NG_VALUE_ACCESSOR } from '@angular/forms';
|
|
9
10
|
import { Subject } from 'rxjs';
|
|
11
|
+
import { NG_VALUE_ACCESSOR } from '@angular/forms';
|
|
10
12
|
import { takeUntil } from 'rxjs/operators';
|
|
11
13
|
|
|
12
|
-
class
|
|
13
|
-
_cdRef;
|
|
14
|
-
fsChip = true;
|
|
15
|
-
_outlined = false;
|
|
16
|
-
selectable = false;
|
|
17
|
-
removable = true;
|
|
18
|
-
actionable = true;
|
|
19
|
-
styleBackgroundColor = '';
|
|
20
|
-
styleColor = '';
|
|
21
|
-
styleBorderColor = '';
|
|
22
|
-
classSmall = false;
|
|
23
|
-
classTiny = false;
|
|
24
|
-
classMicro = false;
|
|
25
|
-
value;
|
|
26
|
-
maxWidth;
|
|
27
|
-
actions = [];
|
|
14
|
+
class FsChipActionComponent {
|
|
28
15
|
icon;
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
_color = '';
|
|
36
|
-
constructor(_cdRef) {
|
|
37
|
-
this._cdRef = _cdRef;
|
|
38
|
-
}
|
|
39
|
-
set setSize(value) {
|
|
40
|
-
this.classSmall = value === 'small';
|
|
41
|
-
this.classTiny = value === 'tiny';
|
|
42
|
-
this.classMicro = value === 'micro';
|
|
43
|
-
}
|
|
44
|
-
click() {
|
|
45
|
-
if (this.selectable) {
|
|
46
|
-
this.selected = !this.selected;
|
|
47
|
-
this.selectedToggled.emit({ value: this.value, selected: this.selected });
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
set backgroundColor(value) {
|
|
51
|
-
this._backgroundColor = value;
|
|
52
|
-
this._updateStyles();
|
|
53
|
-
}
|
|
54
|
-
set borderColor(value) {
|
|
55
|
-
this.styleBorderColor = value;
|
|
56
|
-
this._updateStyles();
|
|
57
|
-
}
|
|
58
|
-
set color(value) {
|
|
59
|
-
this._color = value;
|
|
60
|
-
this._updateStyles();
|
|
61
|
-
}
|
|
62
|
-
get destroy$() {
|
|
63
|
-
return this._destroy$.asObservable();
|
|
64
|
-
}
|
|
65
|
-
set outlined(value) {
|
|
66
|
-
this._outlined = value;
|
|
67
|
-
this._updateStyles();
|
|
68
|
-
}
|
|
69
|
-
select() {
|
|
70
|
-
this.selected = true;
|
|
71
|
-
this._cdRef.markForCheck();
|
|
72
|
-
}
|
|
73
|
-
unselect() {
|
|
74
|
-
this.selected = false;
|
|
75
|
-
this._cdRef.markForCheck();
|
|
76
|
-
}
|
|
77
|
-
ngOnChanges() {
|
|
78
|
-
this.actions = this.actions
|
|
79
|
-
.filter((action) => action.type !== 'remove');
|
|
80
|
-
if (this.removed.observed && this.removable) {
|
|
81
|
-
this.actions.push({
|
|
82
|
-
icon: 'remove_circle_outline',
|
|
83
|
-
click: (event) => this.remove(event),
|
|
84
|
-
type: 'remove',
|
|
85
|
-
});
|
|
86
|
-
}
|
|
87
|
-
this.actionable = this.actions.length !== 0;
|
|
88
|
-
}
|
|
89
|
-
actionClick(action, event) {
|
|
90
|
-
if (action.click) {
|
|
91
|
-
action.click(event);
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
ngOnDestroy() {
|
|
95
|
-
this._destroy$.next(null);
|
|
96
|
-
this._destroy$.complete();
|
|
97
|
-
}
|
|
98
|
-
remove(event) {
|
|
99
|
-
event.stopImmediatePropagation();
|
|
100
|
-
event.stopPropagation();
|
|
101
|
-
this.removed.next(event);
|
|
102
|
-
}
|
|
103
|
-
_isContrastYIQBlack(hexcolor) {
|
|
104
|
-
if (!hexcolor) {
|
|
105
|
-
return true;
|
|
106
|
-
}
|
|
107
|
-
hexcolor = hexcolor.replace('#', '');
|
|
108
|
-
const r = parseInt(hexcolor.substr(0, 2), 16);
|
|
109
|
-
const g = parseInt(hexcolor.substr(2, 2), 16);
|
|
110
|
-
const b = parseInt(hexcolor.substr(4, 2), 16);
|
|
111
|
-
const yiq = ((r * 299) + (g * 587) + (b * 114)) / 1000;
|
|
112
|
-
return yiq >= 200;
|
|
113
|
-
}
|
|
114
|
-
_updateStyles() {
|
|
115
|
-
this.styleBackgroundColor = this._backgroundColor;
|
|
116
|
-
if (this._color) {
|
|
117
|
-
this.styleColor = this._color;
|
|
118
|
-
}
|
|
119
|
-
else if (!this._outlined) {
|
|
120
|
-
this.styleColor = this._isContrastYIQBlack(this.styleBackgroundColor) ? '#474747' : '#fff';
|
|
121
|
-
}
|
|
122
|
-
if (this._outlined) {
|
|
123
|
-
this.styleBackgroundColor = '';
|
|
124
|
-
if (this._color) {
|
|
125
|
-
this.styleBorderColor = this._color;
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
this._cdRef.markForCheck();
|
|
129
|
-
}
|
|
130
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: FsChipComponent, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
131
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.7", type: FsChipComponent, selector: "fs-chip", inputs: { selectable: "selectable", removable: "removable", actionable: "actionable", value: "value", maxWidth: "maxWidth", actions: "actions", icon: "icon", image: "image", selected: "selected", setSize: ["size", "setSize"], backgroundColor: "backgroundColor", borderColor: "borderColor", color: "color", outlined: "outlined" }, outputs: { selectedToggled: "selectedToggled", removed: "removed" }, host: { listeners: { "click": "click()" }, properties: { "class.fs-chip": "this.fsChip", "class.outlined": "this._outlined", "class.selectable": "this.selectable", "class.removable": "this.removable", "class.actionable": "this.actionable", "style.backgroundColor": "this.styleBackgroundColor", "style.color": "this.styleColor", "style.borderColor": "this.styleBorderColor", "class.size-small": "this.classSmall", "class.size-tiny": "this.classTiny", "class.size-micro": "this.classMicro", "class.iconed": "this.icon", "class.imaged": "this.image", "class.selected": "this.selected" } }, usesOnChanges: true, ngImport: i0, template: "<ng-container *ngIf=\"image\">\n <img [src]=\"image\" class=\"image\" alt=\"\">\n</ng-container>\n<ng-container *ngIf=\"icon\">\n <mat-icon class=\"icon\">{{icon}}</mat-icon>\n</ng-container>\n<div \n class=\"fs-chip-content\"\n [ngStyle]=\"{ 'max-width': maxWidth }\">\n <ng-content></ng-content>\n</div>\n<ng-container *ngIf=\"selected\">\n <div class=\"selected-check\">\n <mat-icon [style.color]=\"styleColor\">check</mat-icon>\n </div>\n</ng-container>\n@for (action of actions; track action.icon) {\n @if(action.link) {\n <a [href]=\"action.link\" [target]=\"action.linkTarget || '_self'\">\n <ng-container *ngTemplateOutlet=\"actionTemplate\"></ng-container>\n </a>\n } @else {\n <ng-container *ngTemplateOutlet=\"actionTemplate\"></ng-container>\n }\n\n <ng-template #actionTemplate>\n <mat-icon \n [style.color]=\"styleColor\" \n class=\"action\"\n (click)=\"actionClick(action, $event)\">\n {{action.icon}}\n </mat-icon>\n </ng-template>\n}", styles: [":host{-webkit-user-select:none;user-select:none;transition:box-shadow .28s cubic-bezier(.4,0,.2,1);display:inline-flex;padding:0 12px;border-radius:16px;align-items:center;cursor:default;height:30px;background-color:#e0e0e0;overflow:hidden}:host.imaged{overflow:visible;padding-left:0;vertical-align:middle}:host.imaged.outlined .image{margin-left:-2px}:host.iconed:not(.imaged){padding-left:5px}:host.actionable,:host.selected{padding-right:3px}:host.selectable{cursor:pointer}:host.outlined{background-color:transparent;border:1px solid #e0e0e0;box-sizing:border-box}:host .icon{margin-right:5px}:host mat-icon{font-size:25px}:host .image{height:30px;width:30px;border-radius:50%;object-fit:cover;margin-left:-1px;margin-right:8px}:host .fs-chip-content{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}:host .selected-check{margin:0 5px;display:flex}:host .action{display:flex;margin-left:5px;cursor:pointer}:host.size-micro{padding:0 5px;height:16px;line-height:normal}:host.size-micro .fs-chip-content{font-size:65%}:host.size-micro .image{height:100%;width:16px;margin-right:2px}:host.size-micro .action{margin-left:1px}:host.size-micro .selected-check{margin:0 1px 0 0}:host.size-micro.imaged{padding-left:0}:host.size-micro.actionable,:host.size-micro.selected{padding-right:0}:host.size-micro mat-icon{width:12px;height:12px;font-size:11px}:host.size-tiny{padding:0 6px;height:18px;line-height:normal}:host.size-tiny .fs-chip-content{font-size:75%}:host.size-tiny .image{height:18px;width:18px;margin-right:3px}:host.size-tiny.iconed:not(.imaged){padding-left:3px}:host.size-tiny .action{margin-left:2px;margin-right:2px}:host.size-tiny .selected-check{margin:0 1px 0 0}:host.size-tiny.imaged{padding-left:0}:host.size-tiny.actionable,:host.size-tiny.selected{padding-right:0}:host.size-tiny mat-icon{height:13px;width:13px;font-size:13px}:host.size-small{padding:0 8px;font-size:85%;height:25px;line-height:normal}:host.size-small .image{height:25px;width:25px;margin-right:5px}:host.size-small.iconed:not(.imaged){padding-left:4px}:host.size-small.imaged{padding-left:0}:host.size-small .action{margin-right:2px}:host.size-small .selected-check{margin:0 2px 0 0}:host.size-small .selected-check mat-icon{transform:scale(.7)}:host.size-small.actionable,:host.size-small.selected{padding-right:0}:host.size-small mat-icon{height:22px;width:22px;font-size:22px}\n"], dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: i1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "component", type: i2.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
16
|
+
link;
|
|
17
|
+
linkTarget;
|
|
18
|
+
color;
|
|
19
|
+
actionClick = new EventEmitter();
|
|
20
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: FsChipActionComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
21
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.7", type: FsChipActionComponent, selector: "fs-chip-action", inputs: { icon: "icon", link: "link", linkTarget: "linkTarget", color: "color" }, outputs: { actionClick: "actionClick" }, ngImport: i0, template: "@if (link) {\n <a\n [href]=\"link\"\n [target]=\"linkTarget || '_self'\">\n <ng-container *ngTemplateOutlet=\"actionTemplate\"></ng-container>\n </a>\n} @else {\n <ng-container *ngTemplateOutlet=\"actionTemplate\"></ng-container>\n}\n<ng-template #actionTemplate>\n <mat-icon\n cdkHighlight\n [style.color]=\"color\"\n class=\"action\"\n (click)=\"actionClick.emit($event)\">\n {{ icon }}\n </mat-icon>\n</ng-template>", styles: [""], dependencies: [{ kind: "directive", type: i2.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: i3.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
132
22
|
}
|
|
133
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type:
|
|
23
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: FsChipActionComponent, decorators: [{
|
|
134
24
|
type: Component,
|
|
135
|
-
args: [{ selector: 'fs-chip', changeDetection: ChangeDetectionStrategy.OnPush, template: "
|
|
136
|
-
}],
|
|
137
|
-
type: HostBinding,
|
|
138
|
-
args: ['class.fs-chip']
|
|
139
|
-
}], _outlined: [{
|
|
140
|
-
type: HostBinding,
|
|
141
|
-
args: ['class.outlined']
|
|
142
|
-
}], selectable: [{
|
|
143
|
-
type: Input
|
|
144
|
-
}, {
|
|
145
|
-
type: HostBinding,
|
|
146
|
-
args: ['class.selectable']
|
|
147
|
-
}], removable: [{
|
|
25
|
+
args: [{ selector: 'fs-chip-action', changeDetection: ChangeDetectionStrategy.OnPush, template: "@if (link) {\n <a\n [href]=\"link\"\n [target]=\"linkTarget || '_self'\">\n <ng-container *ngTemplateOutlet=\"actionTemplate\"></ng-container>\n </a>\n} @else {\n <ng-container *ngTemplateOutlet=\"actionTemplate\"></ng-container>\n}\n<ng-template #actionTemplate>\n <mat-icon\n cdkHighlight\n [style.color]=\"color\"\n class=\"action\"\n (click)=\"actionClick.emit($event)\">\n {{ icon }}\n </mat-icon>\n</ng-template>" }]
|
|
26
|
+
}], propDecorators: { icon: [{
|
|
148
27
|
type: Input
|
|
149
|
-
}, {
|
|
150
|
-
type: HostBinding,
|
|
151
|
-
args: ['class.removable']
|
|
152
|
-
}], actionable: [{
|
|
28
|
+
}], link: [{
|
|
153
29
|
type: Input
|
|
154
|
-
}, {
|
|
155
|
-
type: HostBinding,
|
|
156
|
-
args: ['class.actionable']
|
|
157
|
-
}], styleBackgroundColor: [{
|
|
158
|
-
type: HostBinding,
|
|
159
|
-
args: ['style.backgroundColor']
|
|
160
|
-
}], styleColor: [{
|
|
161
|
-
type: HostBinding,
|
|
162
|
-
args: ['style.color']
|
|
163
|
-
}], styleBorderColor: [{
|
|
164
|
-
type: HostBinding,
|
|
165
|
-
args: ['style.borderColor']
|
|
166
|
-
}], classSmall: [{
|
|
167
|
-
type: HostBinding,
|
|
168
|
-
args: ['class.size-small']
|
|
169
|
-
}], classTiny: [{
|
|
170
|
-
type: HostBinding,
|
|
171
|
-
args: ['class.size-tiny']
|
|
172
|
-
}], classMicro: [{
|
|
173
|
-
type: HostBinding,
|
|
174
|
-
args: ['class.size-micro']
|
|
175
|
-
}], value: [{
|
|
176
|
-
type: Input
|
|
177
|
-
}], maxWidth: [{
|
|
178
|
-
type: Input
|
|
179
|
-
}], actions: [{
|
|
180
|
-
type: Input
|
|
181
|
-
}], icon: [{
|
|
182
|
-
type: Input
|
|
183
|
-
}, {
|
|
184
|
-
type: HostBinding,
|
|
185
|
-
args: ['class.iconed']
|
|
186
|
-
}], image: [{
|
|
187
|
-
type: Input
|
|
188
|
-
}, {
|
|
189
|
-
type: HostBinding,
|
|
190
|
-
args: ['class.imaged']
|
|
191
|
-
}], selected: [{
|
|
192
|
-
type: Input
|
|
193
|
-
}, {
|
|
194
|
-
type: HostBinding,
|
|
195
|
-
args: ['class.selected']
|
|
196
|
-
}], selectedToggled: [{
|
|
197
|
-
type: Output
|
|
198
|
-
}], removed: [{
|
|
199
|
-
type: Output
|
|
200
|
-
}], setSize: [{
|
|
201
|
-
type: Input,
|
|
202
|
-
args: ['size']
|
|
203
|
-
}], click: [{
|
|
204
|
-
type: HostListener,
|
|
205
|
-
args: ['click']
|
|
206
|
-
}], backgroundColor: [{
|
|
207
|
-
type: Input
|
|
208
|
-
}], borderColor: [{
|
|
30
|
+
}], linkTarget: [{
|
|
209
31
|
type: Input
|
|
210
32
|
}], color: [{
|
|
211
33
|
type: Input
|
|
212
|
-
}],
|
|
213
|
-
type:
|
|
34
|
+
}], actionClick: [{
|
|
35
|
+
type: Output
|
|
214
36
|
}] } });
|
|
215
37
|
|
|
216
38
|
class FsChipsComponent {
|
|
217
39
|
_cdRef;
|
|
218
40
|
_iterable;
|
|
219
|
-
|
|
220
|
-
classHasChips = false;
|
|
41
|
+
dropList;
|
|
221
42
|
chips;
|
|
222
43
|
compare;
|
|
223
44
|
multiple = true;
|
|
45
|
+
sortable = false;
|
|
224
46
|
onChange;
|
|
225
47
|
onTouch;
|
|
226
48
|
_value = [];
|
|
49
|
+
_selectable = false;
|
|
227
50
|
_destroy$ = new Subject();
|
|
228
51
|
_chipDiffer;
|
|
229
52
|
constructor(_cdRef, _iterable) {
|
|
@@ -231,12 +54,13 @@ class FsChipsComponent {
|
|
|
231
54
|
this._iterable = _iterable;
|
|
232
55
|
this._chipDiffer = this._iterable.find([]).create();
|
|
233
56
|
}
|
|
234
|
-
|
|
235
|
-
|
|
57
|
+
drop(event) {
|
|
58
|
+
moveItemInArray(this._value, event.previousIndex, event.currentIndex);
|
|
59
|
+
this.onChange(this._value);
|
|
236
60
|
}
|
|
237
61
|
ngAfterContentInit() {
|
|
238
|
-
this.
|
|
239
|
-
this.
|
|
62
|
+
this._subscribeToSelectionChange();
|
|
63
|
+
this._subscribeChanges();
|
|
240
64
|
}
|
|
241
65
|
set value(value) {
|
|
242
66
|
if (this._value !== value) {
|
|
@@ -267,50 +91,48 @@ class FsChipsComponent {
|
|
|
267
91
|
_subscribeToSelectionChange() {
|
|
268
92
|
const changed = this._chipDiffer.diff(this.chips);
|
|
269
93
|
changed?.forEachAddedItem((change) => {
|
|
94
|
+
this._selectable = this.chips.some((chip) => chip.selectable);
|
|
270
95
|
change.item.selectedToggled
|
|
271
96
|
.pipe(takeUntil(change.item.destroy$), takeUntil(this._destroy$))
|
|
272
97
|
.subscribe(({ selected, value }) => {
|
|
273
|
-
if (
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
}
|
|
277
|
-
|
|
278
|
-
this.value.
|
|
279
|
-
|
|
280
|
-
|
|
98
|
+
if (this.multiple) {
|
|
99
|
+
if (selected) {
|
|
100
|
+
this.value.push(value);
|
|
101
|
+
}
|
|
102
|
+
else {
|
|
103
|
+
const valueIndex = this.value.findIndex((item) => {
|
|
104
|
+
return this._compareFn(item, value);
|
|
105
|
+
});
|
|
106
|
+
if (valueIndex > -1) {
|
|
107
|
+
this.value.splice(valueIndex, 1);
|
|
108
|
+
}
|
|
281
109
|
}
|
|
282
110
|
}
|
|
283
111
|
else {
|
|
284
|
-
this.
|
|
285
|
-
|
|
286
|
-
|
|
112
|
+
this.chips
|
|
113
|
+
.forEach((chip) => {
|
|
114
|
+
if (!this._compareFn(chip.value, value)) {
|
|
115
|
+
chip.unselect();
|
|
116
|
+
}
|
|
117
|
+
});
|
|
118
|
+
this.value = selected ? value : null;
|
|
287
119
|
}
|
|
120
|
+
this.onChange(this._value);
|
|
121
|
+
this.onTouch(this._value);
|
|
288
122
|
});
|
|
289
123
|
});
|
|
290
124
|
}
|
|
291
|
-
/**
|
|
292
|
-
* Update ngModel value when selection changed
|
|
293
|
-
*/
|
|
294
|
-
_subscribeToSelectionChanges() {
|
|
295
|
-
this._subscribeToSelectionChange();
|
|
296
|
-
this.chips.changes
|
|
297
|
-
.pipe(takeUntil(this._destroy$))
|
|
298
|
-
.subscribe(() => {
|
|
299
|
-
this._subscribeToSelectionChange();
|
|
300
|
-
});
|
|
301
|
-
}
|
|
302
125
|
/**
|
|
303
126
|
* Update selection if item was added or removed
|
|
304
127
|
*/
|
|
305
|
-
|
|
128
|
+
_subscribeChanges() {
|
|
306
129
|
this.chips.changes
|
|
307
130
|
.pipe(takeUntil(this._destroy$))
|
|
308
131
|
.subscribe(() => {
|
|
309
|
-
this.
|
|
132
|
+
this._subscribeToSelectionChange();
|
|
310
133
|
this._cdRef.markForCheck();
|
|
311
134
|
this._updateChips();
|
|
312
135
|
});
|
|
313
|
-
this.classHasChips = this.chips.length !== 0;
|
|
314
136
|
this._cdRef.markForCheck();
|
|
315
137
|
}
|
|
316
138
|
_compareFn(o1, o2) {
|
|
@@ -320,29 +142,31 @@ class FsChipsComponent {
|
|
|
320
142
|
return o1 === o2;
|
|
321
143
|
}
|
|
322
144
|
_updateChips() {
|
|
323
|
-
if (this.multiple &&
|
|
324
|
-
this.
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
145
|
+
if (this.multiple && this._selectable) {
|
|
146
|
+
if (Array.isArray(this.value)) {
|
|
147
|
+
this.chips.forEach((chip) => {
|
|
148
|
+
const selected = this.value
|
|
149
|
+
.some((item) => {
|
|
150
|
+
return this._compareFn(item, chip.value);
|
|
151
|
+
});
|
|
152
|
+
if (selected) {
|
|
153
|
+
chip.select();
|
|
154
|
+
}
|
|
155
|
+
else {
|
|
156
|
+
chip.unselect();
|
|
157
|
+
}
|
|
328
158
|
});
|
|
329
|
-
|
|
330
|
-
chip.select();
|
|
331
|
-
}
|
|
332
|
-
else {
|
|
333
|
-
chip.unselect();
|
|
334
|
-
}
|
|
335
|
-
});
|
|
159
|
+
}
|
|
336
160
|
}
|
|
337
161
|
}
|
|
338
162
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: FsChipsComponent, deps: [{ token: i0.ChangeDetectorRef }, { token: i0.IterableDiffers }], target: i0.ɵɵFactoryTarget.Component });
|
|
339
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "
|
|
163
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.7", type: FsChipsComponent, selector: "fs-chips", inputs: { compare: "compare", multiple: "multiple", sortable: "sortable" }, providers: [
|
|
340
164
|
{
|
|
341
165
|
provide: NG_VALUE_ACCESSOR,
|
|
342
166
|
useExisting: forwardRef(() => FsChipsComponent),
|
|
343
167
|
multi: true,
|
|
344
168
|
},
|
|
345
|
-
], queries: [{ propertyName: "chips", predicate: FsChipComponent }], ngImport: i0, template: "<ng-
|
|
169
|
+
], queries: [{ propertyName: "chips", predicate: FsChipComponent }], viewQueries: [{ propertyName: "dropList", first: true, predicate: CdkDropList, descendants: true, static: true }], ngImport: i0, template: "@if (sortable) {\n <div\n class=\"fs-chips chips-sortable\"\n cdkDropList\n [cdkDropListLockAxis]=\"'y'\"\n (cdkDropListDropped)=\"drop($event)\">\n @for (chip of chips; track chip) {\n <div\n class=\"chip-container\"\n cdkDrag\n [cdkDragPreviewClass]=\"'fs-chip-drag-preview'\">\n <a\n class=\"chip-handle\"\n mat-icon-button\n cdkDragHandle>\n <mat-icon>\n drag_indicator\n </mat-icon>\n </a>\n <ng-component [ngTemplateOutlet]=\"chip.templateRef\"></ng-component>\n </div>\n }\n </div>\n} @else {\n <div class=\"fs-chips\">\n @for (chip of chips; track chip) {\n <div class=\"chip-container\">\n <ng-component [ngTemplateOutlet]=\"chip.templateRef\"></ng-component>\n </div>\n }\n </div>\n}", styles: [".fs-chips{display:flex}.fs-chips:not(.chips-sortable){gap:5px}.fs-chips.chips-sortable{flex-direction:column}.fs-chips.chips-sortable .chip-container{display:flex;align-items:center}.fs-chips.chips-sortable .chip-container+.chip-container{border-top:7px solid transparent}.fs-chips.chips-sortable .chip-container .chip-handle{color:inherit;display:flex;align-items:center}.fs-chips.chips-sortable ::ng-deep .cdk-drag-placeholder{opacity:.3}.fs-chips .fs-chip-container{display:flex}::ng-deep .fs-chip-drag-preview{display:flex;overflow:visible}::ng-deep .fs-chip-drag-preview .chip-handle{color:inherit;display:flex;align-items:center}::ng-deep .fs-chip-drag-preview.chip-container .fs-chip{box-shadow:3px 3px 3px #c4c4c4}\n"], dependencies: [{ kind: "directive", type: i2.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: i2$1.CdkDropList, selector: "[cdkDropList], cdk-drop-list", inputs: ["cdkDropListConnectedTo", "cdkDropListData", "cdkDropListOrientation", "id", "cdkDropListLockAxis", "cdkDropListDisabled", "cdkDropListSortingDisabled", "cdkDropListEnterPredicate", "cdkDropListSortPredicate", "cdkDropListAutoScrollDisabled", "cdkDropListAutoScrollStep", "cdkDropListElementContainer"], outputs: ["cdkDropListDropped", "cdkDropListEntered", "cdkDropListExited", "cdkDropListSorted"], exportAs: ["cdkDropList"] }, { kind: "directive", type: i2$1.CdkDrag, selector: "[cdkDrag]", inputs: ["cdkDragData", "cdkDragLockAxis", "cdkDragRootElement", "cdkDragBoundary", "cdkDragStartDelay", "cdkDragFreeDragPosition", "cdkDragDisabled", "cdkDragConstrainPosition", "cdkDragPreviewClass", "cdkDragPreviewContainer", "cdkDragScale"], outputs: ["cdkDragStarted", "cdkDragReleased", "cdkDragEnded", "cdkDragEntered", "cdkDragExited", "cdkDragDropped", "cdkDragMoved"], exportAs: ["cdkDrag"] }, { kind: "directive", type: i2$1.CdkDragHandle, selector: "[cdkDragHandle]", inputs: ["cdkDragHandleDisabled"] }, { kind: "component", type: i3.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
346
170
|
}
|
|
347
171
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: FsChipsComponent, decorators: [{
|
|
348
172
|
type: Component,
|
|
@@ -352,13 +176,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.7", ngImpor
|
|
|
352
176
|
useExisting: forwardRef(() => FsChipsComponent),
|
|
353
177
|
multi: true,
|
|
354
178
|
},
|
|
355
|
-
], changeDetection: ChangeDetectionStrategy.OnPush, template: "<ng-
|
|
356
|
-
}], ctorParameters: () => [{ type: i0.ChangeDetectorRef }, { type: i0.IterableDiffers }], propDecorators: {
|
|
357
|
-
type:
|
|
358
|
-
args: [
|
|
359
|
-
}], classHasChips: [{
|
|
360
|
-
type: HostBinding,
|
|
361
|
-
args: ['class.has-chips']
|
|
179
|
+
], changeDetection: ChangeDetectionStrategy.OnPush, template: "@if (sortable) {\n <div\n class=\"fs-chips chips-sortable\"\n cdkDropList\n [cdkDropListLockAxis]=\"'y'\"\n (cdkDropListDropped)=\"drop($event)\">\n @for (chip of chips; track chip) {\n <div\n class=\"chip-container\"\n cdkDrag\n [cdkDragPreviewClass]=\"'fs-chip-drag-preview'\">\n <a\n class=\"chip-handle\"\n mat-icon-button\n cdkDragHandle>\n <mat-icon>\n drag_indicator\n </mat-icon>\n </a>\n <ng-component [ngTemplateOutlet]=\"chip.templateRef\"></ng-component>\n </div>\n }\n </div>\n} @else {\n <div class=\"fs-chips\">\n @for (chip of chips; track chip) {\n <div class=\"chip-container\">\n <ng-component [ngTemplateOutlet]=\"chip.templateRef\"></ng-component>\n </div>\n }\n </div>\n}", styles: [".fs-chips{display:flex}.fs-chips:not(.chips-sortable){gap:5px}.fs-chips.chips-sortable{flex-direction:column}.fs-chips.chips-sortable .chip-container{display:flex;align-items:center}.fs-chips.chips-sortable .chip-container+.chip-container{border-top:7px solid transparent}.fs-chips.chips-sortable .chip-container .chip-handle{color:inherit;display:flex;align-items:center}.fs-chips.chips-sortable ::ng-deep .cdk-drag-placeholder{opacity:.3}.fs-chips .fs-chip-container{display:flex}::ng-deep .fs-chip-drag-preview{display:flex;overflow:visible}::ng-deep .fs-chip-drag-preview .chip-handle{color:inherit;display:flex;align-items:center}::ng-deep .fs-chip-drag-preview.chip-container .fs-chip{box-shadow:3px 3px 3px #c4c4c4}\n"] }]
|
|
180
|
+
}], ctorParameters: () => [{ type: i0.ChangeDetectorRef }, { type: i0.IterableDiffers }], propDecorators: { dropList: [{
|
|
181
|
+
type: ViewChild,
|
|
182
|
+
args: [CdkDropList, { static: true }]
|
|
362
183
|
}], chips: [{
|
|
363
184
|
type: ContentChildren,
|
|
364
185
|
args: [FsChipComponent]
|
|
@@ -366,21 +187,197 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.7", ngImpor
|
|
|
366
187
|
type: Input
|
|
367
188
|
}], multiple: [{
|
|
368
189
|
type: Input
|
|
190
|
+
}], sortable: [{
|
|
191
|
+
type: Input
|
|
192
|
+
}] } });
|
|
193
|
+
|
|
194
|
+
class FsChipComponent {
|
|
195
|
+
chips;
|
|
196
|
+
_cdRef;
|
|
197
|
+
templateRef;
|
|
198
|
+
selectable = false;
|
|
199
|
+
removable = true;
|
|
200
|
+
value;
|
|
201
|
+
maxWidth;
|
|
202
|
+
width;
|
|
203
|
+
backgroundColor;
|
|
204
|
+
borderColor;
|
|
205
|
+
color;
|
|
206
|
+
outlined;
|
|
207
|
+
actions = [];
|
|
208
|
+
icon;
|
|
209
|
+
image;
|
|
210
|
+
set setSelected(value) {
|
|
211
|
+
this.classes.selected = value;
|
|
212
|
+
this._selected = value;
|
|
213
|
+
}
|
|
214
|
+
get selected() {
|
|
215
|
+
return this._selected;
|
|
216
|
+
}
|
|
217
|
+
selectedToggled = new EventEmitter();
|
|
218
|
+
removed = new EventEmitter();
|
|
219
|
+
styles = {};
|
|
220
|
+
classes = {};
|
|
221
|
+
_destroy$ = new Subject();
|
|
222
|
+
_selected = false;
|
|
223
|
+
constructor(chips, _cdRef) {
|
|
224
|
+
this.chips = chips;
|
|
225
|
+
this._cdRef = _cdRef;
|
|
226
|
+
}
|
|
227
|
+
set setSize(value) {
|
|
228
|
+
this.classes['size-small'] = value === 'small';
|
|
229
|
+
this.classes['size-tiny'] = value === 'tiny';
|
|
230
|
+
this.classes['size-micro'] = value === 'micro';
|
|
231
|
+
}
|
|
232
|
+
click() {
|
|
233
|
+
if (this.selectable) {
|
|
234
|
+
this.setSelected = !this.selected;
|
|
235
|
+
this.selectedToggled.emit({ value: this.value, selected: this.selected });
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
select() {
|
|
239
|
+
this.setSelected = true;
|
|
240
|
+
this._cdRef.markForCheck();
|
|
241
|
+
}
|
|
242
|
+
unselect() {
|
|
243
|
+
this.setSelected = false;
|
|
244
|
+
this._cdRef.markForCheck();
|
|
245
|
+
}
|
|
246
|
+
get destroy$() {
|
|
247
|
+
return this._destroy$.asObservable();
|
|
248
|
+
}
|
|
249
|
+
ngOnChanges(changes) {
|
|
250
|
+
this.actions = this.actions
|
|
251
|
+
.filter((action) => action.type !== 'remove');
|
|
252
|
+
if (changes.selectable) {
|
|
253
|
+
this.classes.selectable = this.selectable;
|
|
254
|
+
}
|
|
255
|
+
if (changes.removable) {
|
|
256
|
+
this.classes.removable = this.removable;
|
|
257
|
+
}
|
|
258
|
+
if (changes.icon) {
|
|
259
|
+
this.classes.iconed = !!this.icon;
|
|
260
|
+
}
|
|
261
|
+
if (changes.image) {
|
|
262
|
+
this.classes.imaged = !!this.image;
|
|
263
|
+
}
|
|
264
|
+
if (this.removed.observed && this.removable) {
|
|
265
|
+
this.actions.push({
|
|
266
|
+
icon: 'remove_circle_outline',
|
|
267
|
+
click: (event) => this.remove(event),
|
|
268
|
+
type: 'remove',
|
|
269
|
+
});
|
|
270
|
+
}
|
|
271
|
+
this.classes.actionable = this.actions.length !== 0;
|
|
272
|
+
this._updateStyles();
|
|
273
|
+
}
|
|
274
|
+
actionClick(action, event) {
|
|
275
|
+
if (action.click) {
|
|
276
|
+
action.click(event);
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
ngOnDestroy() {
|
|
280
|
+
this._destroy$.next(null);
|
|
281
|
+
this._destroy$.complete();
|
|
282
|
+
}
|
|
283
|
+
remove(event) {
|
|
284
|
+
event.stopImmediatePropagation();
|
|
285
|
+
event.stopPropagation();
|
|
286
|
+
this.removed.next(event);
|
|
287
|
+
}
|
|
288
|
+
_isContrastYIQBlack(hexcolor) {
|
|
289
|
+
if (!hexcolor) {
|
|
290
|
+
return true;
|
|
291
|
+
}
|
|
292
|
+
hexcolor = hexcolor.replace('#', '');
|
|
293
|
+
const r = parseInt(hexcolor.substr(0, 2), 16);
|
|
294
|
+
const g = parseInt(hexcolor.substr(2, 2), 16);
|
|
295
|
+
const b = parseInt(hexcolor.substr(4, 2), 16);
|
|
296
|
+
const yiq = ((r * 299) + (g * 587) + (b * 114)) / 1000;
|
|
297
|
+
return yiq >= 200;
|
|
298
|
+
}
|
|
299
|
+
_updateStyles() {
|
|
300
|
+
this.styles.backgroundColor = this.backgroundColor;
|
|
301
|
+
this.styles.borderColor = this.borderColor;
|
|
302
|
+
this.styles.width = this.width;
|
|
303
|
+
this.classes.outlined = this.outlined;
|
|
304
|
+
if (this.color) {
|
|
305
|
+
this.styles.color = this.color;
|
|
306
|
+
}
|
|
307
|
+
else if (!this.outlined) {
|
|
308
|
+
this.styles.color = this._isContrastYIQBlack(this.backgroundColor) ? '#474747' : '#fff';
|
|
309
|
+
}
|
|
310
|
+
if (this.outlined) {
|
|
311
|
+
this.styles.backgroundColor = '';
|
|
312
|
+
if (this.color) {
|
|
313
|
+
this.styles.borderColor = this.color;
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
this._cdRef.markForCheck();
|
|
317
|
+
}
|
|
318
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: FsChipComponent, deps: [{ token: FsChipsComponent, optional: true }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
319
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.7", type: FsChipComponent, selector: "fs-chip", inputs: { selectable: "selectable", removable: "removable", value: "value", maxWidth: "maxWidth", width: "width", backgroundColor: "backgroundColor", borderColor: "borderColor", color: "color", outlined: "outlined", actions: "actions", icon: "icon", image: "image", setSelected: ["selected", "setSelected"], setSize: ["size", "setSize"] }, outputs: { selectedToggled: "selectedToggled", removed: "removed" }, viewQueries: [{ propertyName: "templateRef", first: true, predicate: TemplateRef, descendants: true, static: true }], usesOnChanges: true, ngImport: i0, template: "<ng-template>\n <div\n class=\"fs-chip\"\n (click)=\"click()\"\n [ngStyle]=\"styles\"\n [ngClass]=\"classes\">\n <ng-container *ngIf=\"image\">\n <img\n [src]=\"image\"\n class=\"image\"\n alt=\"\">\n </ng-container>\n <ng-container *ngIf=\"icon\">\n <mat-icon class=\"icon\">\n {{ icon }}\n </mat-icon>\n </ng-container>\n <div\n class=\"fs-chip-content\"\n [ngStyle]=\"{ 'max-width': maxWidth }\">\n <ng-content></ng-content>\n </div>\n @if (selected) {\n <div class=\"selected-check\">\n <mat-icon [style.color]=\"styles.color\">\n check\n </mat-icon>\n </div>\n }\n @if (actions) {\n <div class=\"actions\">\n @for (action of actions; track action.icon) {\n <fs-chip-action\n [icon]=\"action.icon\"\n [link]=\"action.link\"\n [linkTarget]=\"action.linkTarget\"\n [color]=\"styles.color\"\n (actionClick)=\"actionClick(action, $event)\">\n </fs-chip-action>\n }\n </div>\n }\n </div>\n</ng-template>\n@if (!chips) {\n <ng-container [ngTemplateOutlet]=\"templateRef\"></ng-container>\n}", styles: [".fs-chip{-webkit-user-select:none;user-select:none;transition:box-shadow .28s cubic-bezier(.4,0,.2,1);display:inline-flex;padding:0 12px;border-radius:16px;align-items:center;cursor:default;height:30px;background-color:#e7e7e7;overflow:hidden}.fs-chip.imaged{overflow:visible;padding-left:0;vertical-align:middle}.fs-chip.imaged.outlined .image{margin-left:-2px}.fs-chip.iconed:not(.imaged){padding-left:5px}.fs-chip.actionable,.fs-chip.selected{padding-right:3px}.fs-chip.selectable{cursor:pointer}.fs-chip.outlined{background-color:transparent;border:1px solid #e0e0e0;box-sizing:border-box}.fs-chip .icon{margin-right:5px}.fs-chip mat-icon{font-size:25px}.fs-chip .actions{display:flex;flex-direction:row;margin-left:5px}.fs-chip .image{height:30px;width:30px;border-radius:50%;object-fit:cover;margin-left:-1px;margin-right:8px}.fs-chip .fs-chip-content{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.fs-chip .selected-check{margin:0 5px;display:flex}.fs-chip fs-chip-action{display:flex;cursor:pointer}.fs-chip.size-micro{padding:0 5px;height:16px;line-height:normal}.fs-chip.size-micro .fs-chip-content{font-size:65%}.fs-chip.size-micro .image{height:100%;width:16px;margin-right:2px}.fs-chip.size-micro fs-chip-action{margin-left:1px}.fs-chip.size-micro .selected-check{margin:0 1px 0 0}.fs-chip.size-micro.imaged{padding-left:0}.fs-chip.size-micro.actionable,.fs-chip.size-micro.selected{padding-right:0}.fs-chip.size-micro mat-icon{width:12px;height:12px;font-size:11px}.fs-chip.size-tiny{padding:0 6px;height:18px;line-height:normal}.fs-chip.size-tiny .fs-chip-content{font-size:75%}.fs-chip.size-tiny .image{height:18px;width:18px;margin-right:3px}.fs-chip.size-tiny.iconed:not(.imaged){padding-left:3px}.fs-chip.size-tiny fs-chip-action{margin-left:2px;margin-right:2px}.fs-chip.size-tiny .selected-check{margin:0 1px 0 0}.fs-chip.size-tiny.imaged{padding-left:0}.fs-chip.size-tiny.actionable,.fs-chip.size-tiny.selected{padding-right:0}.fs-chip.size-tiny mat-icon{height:13px;width:13px;font-size:13px}.fs-chip.size-small{padding:0 8px;font-size:85%;height:25px;line-height:normal}.fs-chip.size-small .image{height:25px;width:25px;margin-right:5px}.fs-chip.size-small.iconed:not(.imaged){padding-left:4px}.fs-chip.size-small.imaged{padding-left:0}.fs-chip.size-small fs-chip-action{margin-right:2px}.fs-chip.size-small .selected-check{margin:0 2px 0 0}.fs-chip.size-small .selected-check mat-icon{transform:scale(.7)}.fs-chip.size-small.actionable,.fs-chip.size-small.selected{padding-right:0}.fs-chip.size-small mat-icon{height:22px;width:22px;font-size:22px}\n"], dependencies: [{ kind: "directive", type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: i2.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "component", type: i3.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "component", type: FsChipActionComponent, selector: "fs-chip-action", inputs: ["icon", "link", "linkTarget", "color"], outputs: ["actionClick"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
320
|
+
}
|
|
321
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: FsChipComponent, decorators: [{
|
|
322
|
+
type: Component,
|
|
323
|
+
args: [{ selector: 'fs-chip', changeDetection: ChangeDetectionStrategy.OnPush, template: "<ng-template>\n <div\n class=\"fs-chip\"\n (click)=\"click()\"\n [ngStyle]=\"styles\"\n [ngClass]=\"classes\">\n <ng-container *ngIf=\"image\">\n <img\n [src]=\"image\"\n class=\"image\"\n alt=\"\">\n </ng-container>\n <ng-container *ngIf=\"icon\">\n <mat-icon class=\"icon\">\n {{ icon }}\n </mat-icon>\n </ng-container>\n <div\n class=\"fs-chip-content\"\n [ngStyle]=\"{ 'max-width': maxWidth }\">\n <ng-content></ng-content>\n </div>\n @if (selected) {\n <div class=\"selected-check\">\n <mat-icon [style.color]=\"styles.color\">\n check\n </mat-icon>\n </div>\n }\n @if (actions) {\n <div class=\"actions\">\n @for (action of actions; track action.icon) {\n <fs-chip-action\n [icon]=\"action.icon\"\n [link]=\"action.link\"\n [linkTarget]=\"action.linkTarget\"\n [color]=\"styles.color\"\n (actionClick)=\"actionClick(action, $event)\">\n </fs-chip-action>\n }\n </div>\n }\n </div>\n</ng-template>\n@if (!chips) {\n <ng-container [ngTemplateOutlet]=\"templateRef\"></ng-container>\n}", styles: [".fs-chip{-webkit-user-select:none;user-select:none;transition:box-shadow .28s cubic-bezier(.4,0,.2,1);display:inline-flex;padding:0 12px;border-radius:16px;align-items:center;cursor:default;height:30px;background-color:#e7e7e7;overflow:hidden}.fs-chip.imaged{overflow:visible;padding-left:0;vertical-align:middle}.fs-chip.imaged.outlined .image{margin-left:-2px}.fs-chip.iconed:not(.imaged){padding-left:5px}.fs-chip.actionable,.fs-chip.selected{padding-right:3px}.fs-chip.selectable{cursor:pointer}.fs-chip.outlined{background-color:transparent;border:1px solid #e0e0e0;box-sizing:border-box}.fs-chip .icon{margin-right:5px}.fs-chip mat-icon{font-size:25px}.fs-chip .actions{display:flex;flex-direction:row;margin-left:5px}.fs-chip .image{height:30px;width:30px;border-radius:50%;object-fit:cover;margin-left:-1px;margin-right:8px}.fs-chip .fs-chip-content{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.fs-chip .selected-check{margin:0 5px;display:flex}.fs-chip fs-chip-action{display:flex;cursor:pointer}.fs-chip.size-micro{padding:0 5px;height:16px;line-height:normal}.fs-chip.size-micro .fs-chip-content{font-size:65%}.fs-chip.size-micro .image{height:100%;width:16px;margin-right:2px}.fs-chip.size-micro fs-chip-action{margin-left:1px}.fs-chip.size-micro .selected-check{margin:0 1px 0 0}.fs-chip.size-micro.imaged{padding-left:0}.fs-chip.size-micro.actionable,.fs-chip.size-micro.selected{padding-right:0}.fs-chip.size-micro mat-icon{width:12px;height:12px;font-size:11px}.fs-chip.size-tiny{padding:0 6px;height:18px;line-height:normal}.fs-chip.size-tiny .fs-chip-content{font-size:75%}.fs-chip.size-tiny .image{height:18px;width:18px;margin-right:3px}.fs-chip.size-tiny.iconed:not(.imaged){padding-left:3px}.fs-chip.size-tiny fs-chip-action{margin-left:2px;margin-right:2px}.fs-chip.size-tiny .selected-check{margin:0 1px 0 0}.fs-chip.size-tiny.imaged{padding-left:0}.fs-chip.size-tiny.actionable,.fs-chip.size-tiny.selected{padding-right:0}.fs-chip.size-tiny mat-icon{height:13px;width:13px;font-size:13px}.fs-chip.size-small{padding:0 8px;font-size:85%;height:25px;line-height:normal}.fs-chip.size-small .image{height:25px;width:25px;margin-right:5px}.fs-chip.size-small.iconed:not(.imaged){padding-left:4px}.fs-chip.size-small.imaged{padding-left:0}.fs-chip.size-small fs-chip-action{margin-right:2px}.fs-chip.size-small .selected-check{margin:0 2px 0 0}.fs-chip.size-small .selected-check mat-icon{transform:scale(.7)}.fs-chip.size-small.actionable,.fs-chip.size-small.selected{padding-right:0}.fs-chip.size-small mat-icon{height:22px;width:22px;font-size:22px}\n"] }]
|
|
324
|
+
}], ctorParameters: () => [{ type: FsChipsComponent, decorators: [{
|
|
325
|
+
type: Optional
|
|
326
|
+
}] }, { type: i0.ChangeDetectorRef }], propDecorators: { templateRef: [{
|
|
327
|
+
type: ViewChild,
|
|
328
|
+
args: [TemplateRef, { static: true }]
|
|
329
|
+
}], selectable: [{
|
|
330
|
+
type: Input
|
|
331
|
+
}], removable: [{
|
|
332
|
+
type: Input
|
|
333
|
+
}], value: [{
|
|
334
|
+
type: Input
|
|
335
|
+
}], maxWidth: [{
|
|
336
|
+
type: Input
|
|
337
|
+
}], width: [{
|
|
338
|
+
type: Input
|
|
339
|
+
}], backgroundColor: [{
|
|
340
|
+
type: Input
|
|
341
|
+
}], borderColor: [{
|
|
342
|
+
type: Input
|
|
343
|
+
}], color: [{
|
|
344
|
+
type: Input
|
|
345
|
+
}], outlined: [{
|
|
346
|
+
type: Input
|
|
347
|
+
}], actions: [{
|
|
348
|
+
type: Input
|
|
349
|
+
}], icon: [{
|
|
350
|
+
type: Input
|
|
351
|
+
}], image: [{
|
|
352
|
+
type: Input
|
|
353
|
+
}], setSelected: [{
|
|
354
|
+
type: Input,
|
|
355
|
+
args: ['selected']
|
|
356
|
+
}], selectedToggled: [{
|
|
357
|
+
type: Output
|
|
358
|
+
}], removed: [{
|
|
359
|
+
type: Output
|
|
360
|
+
}], setSize: [{
|
|
361
|
+
type: Input,
|
|
362
|
+
args: ['size']
|
|
369
363
|
}] } });
|
|
370
364
|
|
|
371
365
|
class FsChipModule {
|
|
372
366
|
static forRoot() {
|
|
373
367
|
return {
|
|
374
|
-
ngModule: FsChipModule
|
|
368
|
+
ngModule: FsChipModule,
|
|
375
369
|
};
|
|
376
370
|
}
|
|
377
371
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: FsChipModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
378
372
|
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.2.7", ngImport: i0, type: FsChipModule, declarations: [FsChipsComponent,
|
|
379
|
-
FsChipComponent
|
|
373
|
+
FsChipComponent,
|
|
374
|
+
FsChipActionComponent], imports: [CommonModule,
|
|
375
|
+
DragDropModule,
|
|
380
376
|
MatIconModule,
|
|
381
377
|
FsLabelModule], exports: [FsChipsComponent,
|
|
382
378
|
FsChipComponent] });
|
|
383
379
|
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: FsChipModule, imports: [CommonModule,
|
|
380
|
+
DragDropModule,
|
|
384
381
|
MatIconModule,
|
|
385
382
|
FsLabelModule] });
|
|
386
383
|
}
|
|
@@ -389,8 +386,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.7", ngImpor
|
|
|
389
386
|
args: [{
|
|
390
387
|
imports: [
|
|
391
388
|
CommonModule,
|
|
389
|
+
DragDropModule,
|
|
392
390
|
MatIconModule,
|
|
393
|
-
FsLabelModule
|
|
391
|
+
FsLabelModule,
|
|
394
392
|
],
|
|
395
393
|
exports: [
|
|
396
394
|
FsChipsComponent,
|
|
@@ -399,7 +397,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.7", ngImpor
|
|
|
399
397
|
declarations: [
|
|
400
398
|
FsChipsComponent,
|
|
401
399
|
FsChipComponent,
|
|
402
|
-
|
|
400
|
+
FsChipActionComponent,
|
|
401
|
+
],
|
|
403
402
|
}]
|
|
404
403
|
}] });
|
|
405
404
|
|