@firestitch/chip 12.0.0 → 13.0.0
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 +52 -51
- package/app/components/chips/chips.component.d.ts +36 -36
- package/app/fs-chip.module.d.ts +13 -13
- package/app/services/chips.service.d.ts +17 -17
- package/esm2020/app/components/chip/chip.component.mjs +221 -0
- package/esm2020/app/components/chips/chips.component.mjs +132 -0
- package/{esm2015/app/fs-chip.module.js → esm2020/app/fs-chip.module.mjs} +44 -44
- package/{esm2015/app/services/chips.service.js → esm2020/app/services/chips.service.mjs} +47 -47
- package/{esm2015/firestitch-chip.js → esm2020/firestitch-chip.mjs} +4 -4
- package/{esm2015/public_api.js → esm2020/public_api.mjs} +6 -6
- package/fesm2015/firestitch-chip.mjs +442 -0
- package/fesm2015/firestitch-chip.mjs.map +1 -0
- package/{fesm2015/firestitch-chip.js → fesm2020/firestitch-chip.mjs} +415 -420
- package/fesm2020/firestitch-chip.mjs.map +1 -0
- package/firestitch-chip.d.ts +5 -5
- package/package.json +23 -10
- package/public_api.d.ts +3 -3
- package/styles.scss +0 -190
- package/bundles/firestitch-chip.umd.js +0 -531
- package/bundles/firestitch-chip.umd.js.map +0 -1
- package/esm2015/app/components/chip/chip.component.js +0 -222
- package/esm2015/app/components/chips/chips.component.js +0 -136
- package/fesm2015/firestitch-chip.js.map +0 -1
|
@@ -10,436 +10,431 @@ import { Subject } from 'rxjs';
|
|
|
10
10
|
import { takeUntil, debounceTime } from 'rxjs/operators';
|
|
11
11
|
import { find } from 'lodash-es';
|
|
12
12
|
|
|
13
|
-
class FsChipsService {
|
|
14
|
-
constructor() {
|
|
15
|
-
this.chips = [];
|
|
16
|
-
this._chipItemsChanged$ = new Subject();
|
|
17
|
-
this._selectionChanged$ = new Subject();
|
|
18
|
-
this._destroy$ = new Subject();
|
|
19
|
-
}
|
|
20
|
-
get selectionChanged$() {
|
|
21
|
-
return this._selectionChanged$.
|
|
22
|
-
pipe(takeUntil(this._destroy$));
|
|
23
|
-
}
|
|
24
|
-
get chipItemsChanged$() {
|
|
25
|
-
return this._chipItemsChanged$
|
|
26
|
-
.pipe(takeUntil(this._destroy$), debounceTime(50));
|
|
27
|
-
}
|
|
28
|
-
ngOnDestroy() {
|
|
29
|
-
this._destroy$.next();
|
|
30
|
-
this._destroy$.complete();
|
|
31
|
-
}
|
|
32
|
-
selectionChanged(selected, value) {
|
|
33
|
-
this._selectionChanged$.next({
|
|
34
|
-
selected: selected,
|
|
35
|
-
value: value,
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
register(chip) {
|
|
39
|
-
this.chips.push(chip);
|
|
40
|
-
this._chipItemsChanged$.next();
|
|
41
|
-
}
|
|
42
|
-
destroy(chip) {
|
|
43
|
-
const index = this.chips.indexOf(chip);
|
|
44
|
-
if (index > -1) {
|
|
45
|
-
this.chips.splice(index, 1);
|
|
46
|
-
this._chipItemsChanged$.next();
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
FsChipsService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
51
|
-
FsChipsService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
52
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
53
|
-
type: Injectable
|
|
13
|
+
class FsChipsService {
|
|
14
|
+
constructor() {
|
|
15
|
+
this.chips = [];
|
|
16
|
+
this._chipItemsChanged$ = new Subject();
|
|
17
|
+
this._selectionChanged$ = new Subject();
|
|
18
|
+
this._destroy$ = new Subject();
|
|
19
|
+
}
|
|
20
|
+
get selectionChanged$() {
|
|
21
|
+
return this._selectionChanged$.
|
|
22
|
+
pipe(takeUntil(this._destroy$));
|
|
23
|
+
}
|
|
24
|
+
get chipItemsChanged$() {
|
|
25
|
+
return this._chipItemsChanged$
|
|
26
|
+
.pipe(takeUntil(this._destroy$), debounceTime(50));
|
|
27
|
+
}
|
|
28
|
+
ngOnDestroy() {
|
|
29
|
+
this._destroy$.next();
|
|
30
|
+
this._destroy$.complete();
|
|
31
|
+
}
|
|
32
|
+
selectionChanged(selected, value) {
|
|
33
|
+
this._selectionChanged$.next({
|
|
34
|
+
selected: selected,
|
|
35
|
+
value: value,
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
register(chip) {
|
|
39
|
+
this.chips.push(chip);
|
|
40
|
+
this._chipItemsChanged$.next();
|
|
41
|
+
}
|
|
42
|
+
destroy(chip) {
|
|
43
|
+
const index = this.chips.indexOf(chip);
|
|
44
|
+
if (index > -1) {
|
|
45
|
+
this.chips.splice(index, 1);
|
|
46
|
+
this._chipItemsChanged$.next();
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
FsChipsService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsChipsService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
51
|
+
FsChipsService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsChipsService });
|
|
52
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsChipsService, decorators: [{
|
|
53
|
+
type: Injectable
|
|
54
54
|
}], ctorParameters: function () { return []; } });
|
|
55
55
|
|
|
56
|
-
class FsChipsComponent {
|
|
57
|
-
constructor(_cdRef, _chipsService) {
|
|
58
|
-
this._cdRef = _cdRef;
|
|
59
|
-
this._chipsService = _chipsService;
|
|
60
|
-
this.classFsChips = true;
|
|
61
|
-
this.classHasChips = false;
|
|
62
|
-
this.multiple = true;
|
|
63
|
-
this.
|
|
64
|
-
this.
|
|
65
|
-
this.
|
|
66
|
-
this.
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
this._value
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
registerOnTouched(fn) {
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
this.
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
this.
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
}], compare: [{
|
|
179
|
-
type: Input
|
|
180
|
-
}], multiple: [{
|
|
181
|
-
type: Input
|
|
56
|
+
class FsChipsComponent {
|
|
57
|
+
constructor(_cdRef, _chipsService) {
|
|
58
|
+
this._cdRef = _cdRef;
|
|
59
|
+
this._chipsService = _chipsService;
|
|
60
|
+
this.classFsChips = true;
|
|
61
|
+
this.classHasChips = false;
|
|
62
|
+
this.multiple = true;
|
|
63
|
+
this._value = [];
|
|
64
|
+
this._destroy$ = new Subject();
|
|
65
|
+
this._subscribeToItemsChange();
|
|
66
|
+
this._subscribeToSelectionChange();
|
|
67
|
+
}
|
|
68
|
+
get chips() {
|
|
69
|
+
return this._chipsService.chips;
|
|
70
|
+
}
|
|
71
|
+
set value(value) {
|
|
72
|
+
if (this._value !== value) {
|
|
73
|
+
this._value = value;
|
|
74
|
+
this.onChange(this._value);
|
|
75
|
+
this.onTouch(this._value);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
get value() {
|
|
79
|
+
return this._value;
|
|
80
|
+
}
|
|
81
|
+
ngOnDestroy() {
|
|
82
|
+
this._destroy$.next();
|
|
83
|
+
this._destroy$.complete();
|
|
84
|
+
}
|
|
85
|
+
writeValue(value) {
|
|
86
|
+
if (value !== this.value) {
|
|
87
|
+
this._value = value;
|
|
88
|
+
}
|
|
89
|
+
this._updateChips();
|
|
90
|
+
}
|
|
91
|
+
registerOnChange(fn) {
|
|
92
|
+
this.onChange = fn;
|
|
93
|
+
}
|
|
94
|
+
registerOnTouched(fn) {
|
|
95
|
+
this.onTouch = fn;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Update ngModel value when selection changed
|
|
99
|
+
*/
|
|
100
|
+
_subscribeToSelectionChange() {
|
|
101
|
+
this._chipsService.selectionChanged$
|
|
102
|
+
.pipe(takeUntil(this._destroy$))
|
|
103
|
+
.subscribe(({ selected, value }) => {
|
|
104
|
+
if (!selected) {
|
|
105
|
+
const valueIndex = this.value.findIndex((item) => {
|
|
106
|
+
return this._compareFn(item, value);
|
|
107
|
+
});
|
|
108
|
+
if (valueIndex > -1) {
|
|
109
|
+
this.value.splice(valueIndex, 1);
|
|
110
|
+
this.onChange(this._value);
|
|
111
|
+
this.onTouch(this._value);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
else {
|
|
115
|
+
this.value.push(value);
|
|
116
|
+
this.onChange(this._value);
|
|
117
|
+
this.onTouch(this._value);
|
|
118
|
+
}
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Update selection if item was added or removed
|
|
123
|
+
*/
|
|
124
|
+
_subscribeToItemsChange() {
|
|
125
|
+
this._chipsService.chipItemsChanged$
|
|
126
|
+
.pipe(takeUntil(this._destroy$))
|
|
127
|
+
.subscribe(() => {
|
|
128
|
+
this.classHasChips = !!this._chipsService.chips.length;
|
|
129
|
+
this._updateChips();
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
_compareFn(o1, o2) {
|
|
133
|
+
if (this.compare) {
|
|
134
|
+
return this.compare(o1, o2);
|
|
135
|
+
}
|
|
136
|
+
return o1 === o2;
|
|
137
|
+
}
|
|
138
|
+
_updateChips() {
|
|
139
|
+
if (this.multiple && Array.isArray(this.value) && this.chips) {
|
|
140
|
+
this.chips.forEach((chip) => {
|
|
141
|
+
chip.selected = find(this.value, (o) => {
|
|
142
|
+
return this._compareFn(o, chip.value);
|
|
143
|
+
}) !== undefined;
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
this._cdRef.markForCheck();
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
FsChipsComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsChipsComponent, deps: [{ token: i0.ChangeDetectorRef }, { token: FsChipsService }], target: i0.ɵɵFactoryTarget.Component });
|
|
150
|
+
FsChipsComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.4.0", type: FsChipsComponent, selector: "fs-chips", inputs: { compare: "compare", multiple: "multiple" }, host: { properties: { "class.fs-chips": "this.classFsChips", "class.has-chips": "this.classHasChips" } }, providers: [
|
|
151
|
+
{
|
|
152
|
+
provide: NG_VALUE_ACCESSOR,
|
|
153
|
+
useExisting: forwardRef(() => FsChipsComponent),
|
|
154
|
+
multi: true,
|
|
155
|
+
},
|
|
156
|
+
FsChipsService,
|
|
157
|
+
], ngImport: i0, template: "<ng-content></ng-content>\n", styles: [":host{display:flex;flex-wrap:wrap}:host.has-chips{margin-top:-5px}:host ::ng-deep .fs-chip{margin-right:5px;margin-top:5px}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
158
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsChipsComponent, decorators: [{
|
|
159
|
+
type: Component,
|
|
160
|
+
args: [{ selector: 'fs-chips', providers: [
|
|
161
|
+
{
|
|
162
|
+
provide: NG_VALUE_ACCESSOR,
|
|
163
|
+
useExisting: forwardRef(() => FsChipsComponent),
|
|
164
|
+
multi: true,
|
|
165
|
+
},
|
|
166
|
+
FsChipsService,
|
|
167
|
+
], changeDetection: ChangeDetectionStrategy.OnPush, template: "<ng-content></ng-content>\n", styles: [":host{display:flex;flex-wrap:wrap}:host.has-chips{margin-top:-5px}:host ::ng-deep .fs-chip{margin-right:5px;margin-top:5px}\n"] }]
|
|
168
|
+
}], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }, { type: FsChipsService }]; }, propDecorators: { classFsChips: [{
|
|
169
|
+
type: HostBinding,
|
|
170
|
+
args: ['class.fs-chips']
|
|
171
|
+
}], classHasChips: [{
|
|
172
|
+
type: HostBinding,
|
|
173
|
+
args: ['class.has-chips']
|
|
174
|
+
}], compare: [{
|
|
175
|
+
type: Input
|
|
176
|
+
}], multiple: [{
|
|
177
|
+
type: Input
|
|
182
178
|
}] } });
|
|
183
179
|
|
|
184
|
-
class FsChipComponent {
|
|
185
|
-
constructor(_cdRef, _chips) {
|
|
186
|
-
this._cdRef = _cdRef;
|
|
187
|
-
this._chips = _chips;
|
|
188
|
-
this.fsChip = true;
|
|
189
|
-
this._outlined = false;
|
|
190
|
-
this._selectable = false;
|
|
191
|
-
this._image = false;
|
|
192
|
-
this._selected = false;
|
|
193
|
-
this._removable = false;
|
|
194
|
-
this.styleBackgroundColor = '';
|
|
195
|
-
this.styleColor = '';
|
|
196
|
-
this.styleBorderColor = '';
|
|
197
|
-
this.classSmall = false;
|
|
198
|
-
this.classTiny = false;
|
|
199
|
-
this.classMicro = false;
|
|
200
|
-
this.
|
|
201
|
-
this.
|
|
202
|
-
this
|
|
203
|
-
this
|
|
204
|
-
this.
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
this.
|
|
209
|
-
this.
|
|
210
|
-
this.
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
this.
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
this.
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
this.
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
this.
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
this.
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
this.
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
this.
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
this.
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
this.$destroy.
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
const
|
|
299
|
-
const
|
|
300
|
-
const
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
this.
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
this.
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
}
|
|
321
|
-
FsChipComponent.ɵ
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
type: HostBinding,
|
|
335
|
-
args: ['class.
|
|
336
|
-
}],
|
|
337
|
-
type: HostBinding,
|
|
338
|
-
args: ['class.
|
|
339
|
-
}],
|
|
340
|
-
type: HostBinding,
|
|
341
|
-
args: ['class.
|
|
342
|
-
}],
|
|
343
|
-
type: HostBinding,
|
|
344
|
-
args: ['class.
|
|
345
|
-
}],
|
|
346
|
-
type: HostBinding,
|
|
347
|
-
args: ['
|
|
348
|
-
}],
|
|
349
|
-
type: HostBinding,
|
|
350
|
-
args: ['
|
|
351
|
-
}],
|
|
352
|
-
type: HostBinding,
|
|
353
|
-
args: ['style.
|
|
354
|
-
}],
|
|
355
|
-
type: HostBinding,
|
|
356
|
-
args: ['
|
|
357
|
-
}],
|
|
358
|
-
type: HostBinding,
|
|
359
|
-
args: ['
|
|
360
|
-
}],
|
|
361
|
-
type: HostBinding,
|
|
362
|
-
args: ['class.
|
|
363
|
-
}],
|
|
364
|
-
type:
|
|
365
|
-
args: ['
|
|
366
|
-
}],
|
|
367
|
-
type:
|
|
368
|
-
args: ['
|
|
369
|
-
}],
|
|
370
|
-
type: Input
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
type: Output
|
|
180
|
+
class FsChipComponent {
|
|
181
|
+
constructor(_cdRef, _chips) {
|
|
182
|
+
this._cdRef = _cdRef;
|
|
183
|
+
this._chips = _chips;
|
|
184
|
+
this.fsChip = true;
|
|
185
|
+
this._outlined = false;
|
|
186
|
+
this._selectable = false;
|
|
187
|
+
this._image = false;
|
|
188
|
+
this._selected = false;
|
|
189
|
+
this._removable = false;
|
|
190
|
+
this.styleBackgroundColor = '';
|
|
191
|
+
this.styleColor = '';
|
|
192
|
+
this.styleBorderColor = '';
|
|
193
|
+
this.classSmall = false;
|
|
194
|
+
this.classTiny = false;
|
|
195
|
+
this.classMicro = false;
|
|
196
|
+
this.selectedToggled = new EventEmitter();
|
|
197
|
+
this.removed = new EventEmitter();
|
|
198
|
+
this.$destroy = new Subject();
|
|
199
|
+
this._backgroundColor = '';
|
|
200
|
+
this._color = '';
|
|
201
|
+
}
|
|
202
|
+
set setSize(value) {
|
|
203
|
+
this._size = value;
|
|
204
|
+
this.classSmall = value === 'small';
|
|
205
|
+
this.classTiny = value === 'tiny';
|
|
206
|
+
this.classMicro = value === 'micro';
|
|
207
|
+
}
|
|
208
|
+
;
|
|
209
|
+
click() {
|
|
210
|
+
if (this.selectable) {
|
|
211
|
+
this.selected = !this.selected;
|
|
212
|
+
this.selectedToggled.emit({ value: this.value, selected: this.selected });
|
|
213
|
+
if (this._chips) {
|
|
214
|
+
this._chips.selectionChanged(this.selected, this.value);
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
set backgroundColor(value) {
|
|
219
|
+
this._backgroundColor = value;
|
|
220
|
+
this.updateStyles();
|
|
221
|
+
}
|
|
222
|
+
;
|
|
223
|
+
set borderColor(value) {
|
|
224
|
+
this.styleBorderColor = value;
|
|
225
|
+
this.updateStyles();
|
|
226
|
+
}
|
|
227
|
+
set color(value) {
|
|
228
|
+
this._color = value;
|
|
229
|
+
this.updateStyles();
|
|
230
|
+
}
|
|
231
|
+
get color() {
|
|
232
|
+
return this._color;
|
|
233
|
+
}
|
|
234
|
+
set outlined(value) {
|
|
235
|
+
this._outlined = value;
|
|
236
|
+
this.updateStyles();
|
|
237
|
+
}
|
|
238
|
+
;
|
|
239
|
+
get outlined() {
|
|
240
|
+
return this._outlined;
|
|
241
|
+
}
|
|
242
|
+
set removable(value) {
|
|
243
|
+
this._removable = value;
|
|
244
|
+
this._cdRef.markForCheck();
|
|
245
|
+
}
|
|
246
|
+
;
|
|
247
|
+
get removable() {
|
|
248
|
+
return this._removable;
|
|
249
|
+
}
|
|
250
|
+
set selectable(value) {
|
|
251
|
+
this._selectable = value;
|
|
252
|
+
}
|
|
253
|
+
;
|
|
254
|
+
get selectable() {
|
|
255
|
+
return this._selectable;
|
|
256
|
+
}
|
|
257
|
+
set selected(value) {
|
|
258
|
+
this._selected = value;
|
|
259
|
+
this._cdRef.markForCheck();
|
|
260
|
+
}
|
|
261
|
+
;
|
|
262
|
+
get selected() {
|
|
263
|
+
return this._selected;
|
|
264
|
+
}
|
|
265
|
+
set image(value) {
|
|
266
|
+
this._image = value;
|
|
267
|
+
this._cdRef.markForCheck();
|
|
268
|
+
}
|
|
269
|
+
;
|
|
270
|
+
get image() {
|
|
271
|
+
return this._image;
|
|
272
|
+
}
|
|
273
|
+
ngOnInit() {
|
|
274
|
+
if (this._chips) {
|
|
275
|
+
this._chips.register(this);
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
ngOnDestroy() {
|
|
279
|
+
if (this._chips) {
|
|
280
|
+
this._chips.destroy(this);
|
|
281
|
+
}
|
|
282
|
+
this.$destroy.next();
|
|
283
|
+
this.$destroy.complete();
|
|
284
|
+
}
|
|
285
|
+
remove(event) {
|
|
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.styleBackgroundColor = this._backgroundColor;
|
|
301
|
+
if (this._color) {
|
|
302
|
+
this.styleColor = this._color;
|
|
303
|
+
}
|
|
304
|
+
else if (!this._outlined) {
|
|
305
|
+
this.styleColor = this.isContrastYIQBlack(this.styleBackgroundColor) ? '#474747' : '#fff';
|
|
306
|
+
}
|
|
307
|
+
if (this._outlined) {
|
|
308
|
+
this.styleBackgroundColor = '';
|
|
309
|
+
if (this._color) {
|
|
310
|
+
this.styleBorderColor = this._color;
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
this._cdRef.markForCheck();
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
FsChipComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsChipComponent, deps: [{ token: i0.ChangeDetectorRef }, { token: FsChipsService, optional: true }], target: i0.ɵɵFactoryTarget.Component });
|
|
317
|
+
FsChipComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.4.0", type: FsChipComponent, selector: "fs-chip", inputs: { setSize: ["size", "setSize"], value: "value", icon: "icon", backgroundColor: "backgroundColor", borderColor: "borderColor", color: "color", outlined: "outlined", removable: "removable", selectable: "selectable", selected: "selected", image: "image" }, outputs: { selectedToggled: "selectedToggled", removed: "removed" }, host: { listeners: { "click": "click()" }, properties: { "class.fs-chip": "this.fsChip", "class.outlined": "this._outlined", "class.selectable": "this._selectable", "class.imaged": "this._image", "class.selected": "this._selected", "class.removable": "this._removable", "style.backgroundColor": "this.styleBackgroundColor", "style.color": "this.styleColor", "style.borderColor": "this.styleBorderColor", "class.small": "this.classSmall", "class.tiny": "this.classTiny", "class.micro": "this.classMicro", "class.iconed": "this.icon" } }, ngImport: i0, template: "<img *ngIf=\"image\" [src]=\"image\" class=\"image\" alt=\"\">\n<ng-container *ngIf=\"icon\">\n <mat-icon class=\"icon\">{{icon}}</mat-icon>\n</ng-container>\n<div class=\"fs-chip-content\">\n <ng-content></ng-content>\n</div>\n<div class=\"selected-check\" *ngIf=\"selected\">\n <mat-icon [style.color]=\"styleColor\">check</mat-icon>\n</div>\n<a *ngIf=\"removable\" class=\"remove\" (click)=\"remove($event)\">\n <mat-icon [style.color]=\"styleColor\">cancel</mat-icon>\n</a>\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}:host.imaged.outlined .image{margin-left:-2px}:host.iconed:not(.imaged){padding-left:5px}:host.removable,: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 .image{height:30px;width:30px;border-radius:50%;object-fit:cover;margin-left:-1px;margin-right:8px}:host .fs-chip-content{max-width:250px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}:host .selected-check{margin:0 5px;display:flex}:host .remove{display:flex;margin-left:5px;cursor:pointer}:host.small{padding:0 8px;font-size:85%;height:25px;line-height:normal}:host.small .image{height:25px;width:25px;margin-right:5px}:host.small.iconed:not(.imaged){padding-left:4px}:host.small.imaged{padding-left:0}:host.small .remove{margin-left:3px}:host.small .selected-check{margin:0 2px 0 0}:host.small .selected-check mat-icon{transform:scale(.7)}:host.small.removable,:host.small.selected{padding-right:0}:host.small mat-icon{height:23px;width:23px;font-size:23px}:host.tiny{padding:0 6px;height:18px;line-height:normal}:host.tiny .fs-chip-content{font-size:75%}:host.tiny .image{height:18px;width:18px;margin-right:3px}:host.tiny.iconed:not(.imaged){padding-left:3px}:host.tiny .remove{margin-left:2px}:host.tiny .selected-check{margin:0 1px 0 0}:host.tiny.imaged{padding-left:0}:host.tiny.removable,:host.tiny.selected{padding-right:0}:host.tiny mat-icon{height:15px;width:15px;font-size:15px}:host.micro{padding:0 5px;height:16px;line-height:normal}:host.micro .fs-chip-content{font-size:65%}:host.micro .image{height:100%;width:16px;margin-right:2px}:host.micro .remove{margin-left:1px}:host.micro .selected-check{margin:0 1px 0 0}:host.micro.imaged{padding-left:0}:host.micro.removable,:host.micro.selected{padding-right:0}:host.micro mat-icon{width:12px;height:12px;font-size:11px}\n"], components: [{ type: i2.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }], directives: [{ type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
318
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsChipComponent, decorators: [{
|
|
319
|
+
type: Component,
|
|
320
|
+
args: [{ selector: 'fs-chip', changeDetection: ChangeDetectionStrategy.OnPush, template: "<img *ngIf=\"image\" [src]=\"image\" class=\"image\" alt=\"\">\n<ng-container *ngIf=\"icon\">\n <mat-icon class=\"icon\">{{icon}}</mat-icon>\n</ng-container>\n<div class=\"fs-chip-content\">\n <ng-content></ng-content>\n</div>\n<div class=\"selected-check\" *ngIf=\"selected\">\n <mat-icon [style.color]=\"styleColor\">check</mat-icon>\n</div>\n<a *ngIf=\"removable\" class=\"remove\" (click)=\"remove($event)\">\n <mat-icon [style.color]=\"styleColor\">cancel</mat-icon>\n</a>\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}:host.imaged.outlined .image{margin-left:-2px}:host.iconed:not(.imaged){padding-left:5px}:host.removable,: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 .image{height:30px;width:30px;border-radius:50%;object-fit:cover;margin-left:-1px;margin-right:8px}:host .fs-chip-content{max-width:250px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}:host .selected-check{margin:0 5px;display:flex}:host .remove{display:flex;margin-left:5px;cursor:pointer}:host.small{padding:0 8px;font-size:85%;height:25px;line-height:normal}:host.small .image{height:25px;width:25px;margin-right:5px}:host.small.iconed:not(.imaged){padding-left:4px}:host.small.imaged{padding-left:0}:host.small .remove{margin-left:3px}:host.small .selected-check{margin:0 2px 0 0}:host.small .selected-check mat-icon{transform:scale(.7)}:host.small.removable,:host.small.selected{padding-right:0}:host.small mat-icon{height:23px;width:23px;font-size:23px}:host.tiny{padding:0 6px;height:18px;line-height:normal}:host.tiny .fs-chip-content{font-size:75%}:host.tiny .image{height:18px;width:18px;margin-right:3px}:host.tiny.iconed:not(.imaged){padding-left:3px}:host.tiny .remove{margin-left:2px}:host.tiny .selected-check{margin:0 1px 0 0}:host.tiny.imaged{padding-left:0}:host.tiny.removable,:host.tiny.selected{padding-right:0}:host.tiny mat-icon{height:15px;width:15px;font-size:15px}:host.micro{padding:0 5px;height:16px;line-height:normal}:host.micro .fs-chip-content{font-size:65%}:host.micro .image{height:100%;width:16px;margin-right:2px}:host.micro .remove{margin-left:1px}:host.micro .selected-check{margin:0 1px 0 0}:host.micro.imaged{padding-left:0}:host.micro.removable,:host.micro.selected{padding-right:0}:host.micro mat-icon{width:12px;height:12px;font-size:11px}\n"] }]
|
|
321
|
+
}], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }, { type: FsChipsService, decorators: [{
|
|
322
|
+
type: Optional
|
|
323
|
+
}] }]; }, propDecorators: { fsChip: [{
|
|
324
|
+
type: HostBinding,
|
|
325
|
+
args: ['class.fs-chip']
|
|
326
|
+
}], _outlined: [{
|
|
327
|
+
type: HostBinding,
|
|
328
|
+
args: ['class.outlined']
|
|
329
|
+
}], _selectable: [{
|
|
330
|
+
type: HostBinding,
|
|
331
|
+
args: ['class.selectable']
|
|
332
|
+
}], _image: [{
|
|
333
|
+
type: HostBinding,
|
|
334
|
+
args: ['class.imaged']
|
|
335
|
+
}], _selected: [{
|
|
336
|
+
type: HostBinding,
|
|
337
|
+
args: ['class.selected']
|
|
338
|
+
}], _removable: [{
|
|
339
|
+
type: HostBinding,
|
|
340
|
+
args: ['class.removable']
|
|
341
|
+
}], styleBackgroundColor: [{
|
|
342
|
+
type: HostBinding,
|
|
343
|
+
args: ['style.backgroundColor']
|
|
344
|
+
}], styleColor: [{
|
|
345
|
+
type: HostBinding,
|
|
346
|
+
args: ['style.color']
|
|
347
|
+
}], styleBorderColor: [{
|
|
348
|
+
type: HostBinding,
|
|
349
|
+
args: ['style.borderColor']
|
|
350
|
+
}], classSmall: [{
|
|
351
|
+
type: HostBinding,
|
|
352
|
+
args: ['class.small']
|
|
353
|
+
}], classTiny: [{
|
|
354
|
+
type: HostBinding,
|
|
355
|
+
args: ['class.tiny']
|
|
356
|
+
}], classMicro: [{
|
|
357
|
+
type: HostBinding,
|
|
358
|
+
args: ['class.micro']
|
|
359
|
+
}], setSize: [{
|
|
360
|
+
type: Input,
|
|
361
|
+
args: ['size']
|
|
362
|
+
}], click: [{
|
|
363
|
+
type: HostListener,
|
|
364
|
+
args: ['click']
|
|
365
|
+
}], value: [{
|
|
366
|
+
type: Input
|
|
367
|
+
}], icon: [{
|
|
368
|
+
type: Input
|
|
369
|
+
}, {
|
|
370
|
+
type: HostBinding,
|
|
371
|
+
args: ['class.iconed']
|
|
372
|
+
}], backgroundColor: [{
|
|
373
|
+
type: Input
|
|
374
|
+
}], borderColor: [{
|
|
375
|
+
type: Input
|
|
376
|
+
}], color: [{
|
|
377
|
+
type: Input
|
|
378
|
+
}], outlined: [{
|
|
379
|
+
type: Input
|
|
380
|
+
}], removable: [{
|
|
381
|
+
type: Input
|
|
382
|
+
}], selectable: [{
|
|
383
|
+
type: Input
|
|
384
|
+
}], selected: [{
|
|
385
|
+
type: Input
|
|
386
|
+
}], image: [{
|
|
387
|
+
type: Input
|
|
388
|
+
}], selectedToggled: [{
|
|
389
|
+
type: Output
|
|
390
|
+
}], removed: [{
|
|
391
|
+
type: Output
|
|
397
392
|
}] } });
|
|
398
393
|
|
|
399
|
-
class FsChipModule {
|
|
400
|
-
static forRoot() {
|
|
401
|
-
return {
|
|
402
|
-
ngModule: FsChipModule
|
|
403
|
-
};
|
|
404
|
-
}
|
|
405
|
-
}
|
|
406
|
-
FsChipModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
407
|
-
FsChipModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "
|
|
408
|
-
FsChipComponent], imports: [CommonModule,
|
|
409
|
-
MatIconModule,
|
|
410
|
-
FsLabelModule], exports: [FsChipsComponent,
|
|
411
|
-
FsChipComponent] });
|
|
412
|
-
FsChipModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "
|
|
413
|
-
CommonModule,
|
|
414
|
-
MatIconModule,
|
|
415
|
-
FsLabelModule
|
|
416
|
-
]] });
|
|
417
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
418
|
-
type: NgModule,
|
|
419
|
-
args: [{
|
|
420
|
-
imports: [
|
|
421
|
-
CommonModule,
|
|
422
|
-
MatIconModule,
|
|
423
|
-
FsLabelModule
|
|
424
|
-
],
|
|
425
|
-
exports: [
|
|
426
|
-
FsChipsComponent,
|
|
427
|
-
FsChipComponent,
|
|
428
|
-
],
|
|
429
|
-
declarations: [
|
|
430
|
-
FsChipsComponent,
|
|
431
|
-
FsChipComponent,
|
|
432
|
-
]
|
|
433
|
-
}]
|
|
394
|
+
class FsChipModule {
|
|
395
|
+
static forRoot() {
|
|
396
|
+
return {
|
|
397
|
+
ngModule: FsChipModule
|
|
398
|
+
};
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
FsChipModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsChipModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
402
|
+
FsChipModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsChipModule, declarations: [FsChipsComponent,
|
|
403
|
+
FsChipComponent], imports: [CommonModule,
|
|
404
|
+
MatIconModule,
|
|
405
|
+
FsLabelModule], exports: [FsChipsComponent,
|
|
406
|
+
FsChipComponent] });
|
|
407
|
+
FsChipModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsChipModule, imports: [[
|
|
408
|
+
CommonModule,
|
|
409
|
+
MatIconModule,
|
|
410
|
+
FsLabelModule
|
|
411
|
+
]] });
|
|
412
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsChipModule, decorators: [{
|
|
413
|
+
type: NgModule,
|
|
414
|
+
args: [{
|
|
415
|
+
imports: [
|
|
416
|
+
CommonModule,
|
|
417
|
+
MatIconModule,
|
|
418
|
+
FsLabelModule
|
|
419
|
+
],
|
|
420
|
+
exports: [
|
|
421
|
+
FsChipsComponent,
|
|
422
|
+
FsChipComponent,
|
|
423
|
+
],
|
|
424
|
+
declarations: [
|
|
425
|
+
FsChipsComponent,
|
|
426
|
+
FsChipComponent,
|
|
427
|
+
]
|
|
428
|
+
}]
|
|
434
429
|
}] });
|
|
435
430
|
|
|
436
|
-
/*
|
|
437
|
-
* Public API Surface of fs-menu
|
|
431
|
+
/*
|
|
432
|
+
* Public API Surface of fs-menu
|
|
438
433
|
*/
|
|
439
434
|
|
|
440
|
-
/**
|
|
441
|
-
* Generated bundle index. Do not edit.
|
|
435
|
+
/**
|
|
436
|
+
* Generated bundle index. Do not edit.
|
|
442
437
|
*/
|
|
443
438
|
|
|
444
439
|
export { FsChipComponent, FsChipModule, FsChipsComponent };
|
|
445
|
-
//# sourceMappingURL=firestitch-chip.
|
|
440
|
+
//# sourceMappingURL=firestitch-chip.mjs.map
|