@skyux/lists 5.1.0 → 5.5.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/README.md +6 -4
- package/bundles/skyux-lists-testing.umd.js +16 -16
- package/bundles/skyux-lists.umd.js +127 -88
- package/documentation.json +259 -20
- package/esm2015/index.js +22 -0
- package/esm2015/index.js.map +1 -0
- package/esm2015/{modules → lib/modules}/filter/filter-button.component.js +4 -4
- package/esm2015/lib/modules/filter/filter-button.component.js.map +1 -0
- package/esm2015/lib/modules/filter/filter-inline-item.component.js +18 -0
- package/esm2015/lib/modules/filter/filter-inline-item.component.js.map +1 -0
- package/esm2015/lib/modules/filter/filter-inline.component.js +18 -0
- package/esm2015/lib/modules/filter/filter-inline.component.js.map +1 -0
- package/esm2015/lib/modules/filter/filter-summary-item.component.js +50 -0
- package/esm2015/lib/modules/filter/filter-summary-item.component.js.map +1 -0
- package/esm2015/lib/modules/filter/filter-summary.component.js +20 -0
- package/esm2015/lib/modules/filter/filter-summary.component.js.map +1 -0
- package/esm2015/lib/modules/filter/filter.module.js +61 -0
- package/esm2015/lib/modules/filter/filter.module.js.map +1 -0
- package/esm2015/lib/modules/infinite-scroll/infinite-scroll-dom-adapter.service.js +93 -0
- package/esm2015/lib/modules/infinite-scroll/infinite-scroll-dom-adapter.service.js.map +1 -0
- package/esm2015/lib/modules/infinite-scroll/infinite-scroll.component.js +115 -0
- package/esm2015/lib/modules/infinite-scroll/infinite-scroll.component.js.map +1 -0
- package/esm2015/lib/modules/infinite-scroll/infinite-scroll.module.js +20 -0
- package/esm2015/lib/modules/infinite-scroll/infinite-scroll.module.js.map +1 -0
- package/esm2015/lib/modules/paging/paging.component.js +127 -0
- package/esm2015/lib/modules/paging/paging.component.js.map +1 -0
- package/esm2015/lib/modules/paging/paging.module.js +34 -0
- package/esm2015/lib/modules/paging/paging.module.js.map +1 -0
- package/esm2015/lib/modules/repeater/repeater-adapter.service.js +69 -0
- package/esm2015/lib/modules/repeater/repeater-adapter.service.js.map +1 -0
- package/esm2015/lib/modules/repeater/repeater-item-content.component.js +17 -0
- package/esm2015/lib/modules/repeater/repeater-item-content.component.js.map +1 -0
- package/esm2015/lib/modules/repeater/repeater-item-context-menu.component.js +20 -0
- package/esm2015/lib/modules/repeater/repeater-item-context-menu.component.js.map +1 -0
- package/esm2015/lib/modules/repeater/repeater-item-title.component.js +17 -0
- package/esm2015/lib/modules/repeater/repeater-item-title.component.js.map +1 -0
- package/esm2015/lib/modules/repeater/repeater-item.component.js +389 -0
- package/esm2015/lib/modules/repeater/repeater-item.component.js.map +1 -0
- package/esm2015/lib/modules/repeater/repeater.component.js +262 -0
- package/esm2015/lib/modules/repeater/repeater.component.js.map +1 -0
- package/esm2015/lib/modules/repeater/repeater.module.js +69 -0
- package/esm2015/lib/modules/repeater/repeater.module.js.map +1 -0
- package/esm2015/lib/modules/repeater/repeater.service.js +72 -0
- package/esm2015/lib/modules/repeater/repeater.service.js.map +1 -0
- package/esm2015/lib/modules/shared/sky-lists-resources.module.js +80 -0
- package/esm2015/lib/modules/shared/sky-lists-resources.module.js.map +1 -0
- package/esm2015/{modules → lib/modules}/sort/sort-item.component.js +6 -5
- package/esm2015/lib/modules/sort/sort-item.component.js.map +1 -0
- package/esm2015/{modules → lib/modules}/sort/sort-menu-heading.component.js +4 -4
- package/esm2015/lib/modules/sort/sort-menu-heading.component.js.map +1 -0
- package/esm2015/{modules → lib/modules}/sort/sort.component.js +4 -4
- package/esm2015/lib/modules/sort/sort.component.js.map +1 -0
- package/esm2015/lib/modules/sort/sort.module.js +50 -0
- package/esm2015/lib/modules/sort/sort.module.js.map +1 -0
- package/esm2015/lib/modules/sort/sort.service.js +20 -0
- package/esm2015/lib/modules/sort/sort.service.js.map +1 -0
- package/esm2015/skyux-lists.js +2 -2
- package/esm2015/skyux-lists.js.map +1 -0
- package/esm2015/testing/filter/filter-fixture-button.js +1 -1
- package/esm2015/testing/filter/filter-fixture-button.js.map +1 -0
- package/esm2015/testing/filter/filter-fixture-summary.js +1 -1
- package/esm2015/testing/filter/filter-fixture-summary.js.map +1 -0
- package/esm2015/testing/filter/filter-testing.module.js +5 -5
- package/esm2015/testing/filter/filter-testing.module.js.map +1 -0
- package/esm2015/testing/filter/lists-filter-fixture-button.js +1 -1
- package/esm2015/testing/filter/lists-filter-fixture-button.js.map +1 -0
- package/esm2015/testing/infinite-scroll/infinite-scroll-fixture.js +1 -1
- package/esm2015/testing/infinite-scroll/infinite-scroll-fixture.js.map +1 -0
- package/esm2015/testing/infinite-scroll/infinite-scroll-testing.module.js +5 -5
- package/esm2015/testing/infinite-scroll/infinite-scroll-testing.module.js.map +1 -0
- package/esm2015/testing/paging/paging-fixture-button.js +1 -1
- package/esm2015/testing/paging/paging-fixture-button.js.map +1 -0
- package/esm2015/testing/paging/paging-fixture.js +1 -1
- package/esm2015/testing/paging/paging-fixture.js.map +1 -0
- package/esm2015/testing/paging/paging-testing.module.js +5 -5
- package/esm2015/testing/paging/paging-testing.module.js.map +1 -0
- package/esm2015/testing/public-api.js +1 -1
- package/esm2015/testing/public-api.js.map +1 -0
- package/esm2015/testing/skyux-lists-testing.js +1 -1
- package/esm2015/testing/skyux-lists-testing.js.map +1 -0
- package/esm2015/testing/sort/sort-fixture-menu-item.js +1 -1
- package/esm2015/testing/sort/sort-fixture-menu-item.js.map +1 -0
- package/esm2015/testing/sort/sort-fixture-menu.js +1 -1
- package/esm2015/testing/sort/sort-fixture-menu.js.map +1 -0
- package/esm2015/testing/sort/sort-fixture.js +1 -1
- package/esm2015/testing/sort/sort-fixture.js.map +1 -0
- package/esm2015/testing/sort/sort-testing.module.js +5 -5
- package/esm2015/testing/sort/sort-testing.module.js.map +1 -0
- package/fesm2015/skyux-lists-testing.js +16 -16
- package/fesm2015/skyux-lists-testing.js.map +1 -1
- package/fesm2015/skyux-lists.js +154 -115
- package/fesm2015/skyux-lists.js.map +1 -1
- package/index.d.ts +19 -0
- package/{modules → lib/modules}/filter/filter-button.component.d.ts +0 -0
- package/{modules → lib/modules}/filter/filter-inline-item.component.d.ts +0 -0
- package/{modules → lib/modules}/filter/filter-inline.component.d.ts +0 -0
- package/{modules → lib/modules}/filter/filter-summary-item.component.d.ts +0 -0
- package/{modules → lib/modules}/filter/filter-summary.component.d.ts +0 -0
- package/{modules → lib/modules}/filter/filter.module.d.ts +0 -0
- package/{modules → lib/modules}/infinite-scroll/infinite-scroll-dom-adapter.service.d.ts +0 -0
- package/{modules → lib/modules}/infinite-scroll/infinite-scroll.component.d.ts +0 -0
- package/{modules → lib/modules}/infinite-scroll/infinite-scroll.module.d.ts +0 -0
- package/{modules → lib/modules}/paging/paging.component.d.ts +1 -1
- package/{modules → lib/modules}/paging/paging.module.d.ts +0 -0
- package/{modules → lib/modules}/repeater/repeater-adapter.service.d.ts +0 -0
- package/{modules → lib/modules}/repeater/repeater-item-content.component.d.ts +0 -0
- package/{modules → lib/modules}/repeater/repeater-item-context-menu.component.d.ts +0 -0
- package/{modules → lib/modules}/repeater/repeater-item-title.component.d.ts +0 -0
- package/{modules → lib/modules}/repeater/repeater-item.component.d.ts +0 -0
- package/{modules → lib/modules}/repeater/repeater.component.d.ts +2 -2
- package/{modules → lib/modules}/repeater/repeater.module.d.ts +0 -0
- package/{modules → lib/modules}/repeater/repeater.service.d.ts +0 -0
- package/{modules → lib/modules}/shared/sky-lists-resources.module.d.ts +0 -0
- package/{modules → lib/modules}/sort/sort-item.component.d.ts +0 -0
- package/{modules → lib/modules}/sort/sort-menu-heading.component.d.ts +0 -0
- package/{modules → lib/modules}/sort/sort.component.d.ts +0 -0
- package/{modules → lib/modules}/sort/sort.module.d.ts +0 -0
- package/{modules → lib/modules}/sort/sort.service.d.ts +0 -0
- package/package.json +26 -12
- package/skyux-lists.d.ts +1 -1
- package/LICENSE +0 -21
- package/esm2015/modules/filter/filter-inline-item.component.js +0 -18
- package/esm2015/modules/filter/filter-inline.component.js +0 -18
- package/esm2015/modules/filter/filter-summary-item.component.js +0 -50
- package/esm2015/modules/filter/filter-summary.component.js +0 -20
- package/esm2015/modules/filter/filter.module.js +0 -61
- package/esm2015/modules/infinite-scroll/infinite-scroll-dom-adapter.service.js +0 -92
- package/esm2015/modules/infinite-scroll/infinite-scroll.component.js +0 -115
- package/esm2015/modules/infinite-scroll/infinite-scroll.module.js +0 -20
- package/esm2015/modules/paging/paging.component.js +0 -127
- package/esm2015/modules/paging/paging.module.js +0 -34
- package/esm2015/modules/repeater/repeater-adapter.service.js +0 -68
- package/esm2015/modules/repeater/repeater-item-content.component.js +0 -17
- package/esm2015/modules/repeater/repeater-item-context-menu.component.js +0 -20
- package/esm2015/modules/repeater/repeater-item-title.component.js +0 -17
- package/esm2015/modules/repeater/repeater-item.component.js +0 -386
- package/esm2015/modules/repeater/repeater.component.js +0 -261
- package/esm2015/modules/repeater/repeater.module.js +0 -69
- package/esm2015/modules/repeater/repeater.service.js +0 -72
- package/esm2015/modules/shared/sky-lists-resources.module.js +0 -41
- package/esm2015/modules/sort/sort.module.js +0 -50
- package/esm2015/modules/sort/sort.service.js +0 -20
- package/esm2015/public-api.js +0 -22
- package/public-api.d.ts +0 -19
|
@@ -0,0 +1,262 @@
|
|
|
1
|
+
import { ChangeDetectionStrategy, ChangeDetectorRef, Component, ContentChildren, ElementRef, EventEmitter, Input, Output, QueryList, Renderer2, } from '@angular/core';
|
|
2
|
+
import { DragulaService } from 'ng2-dragula';
|
|
3
|
+
import { Subject } from 'rxjs';
|
|
4
|
+
import { takeUntil } from 'rxjs/operators';
|
|
5
|
+
import { SkyRepeaterItemComponent } from './repeater-item.component';
|
|
6
|
+
import { SkyRepeaterService } from './repeater.service';
|
|
7
|
+
import { SkyRepeaterAdapterService } from './repeater-adapter.service';
|
|
8
|
+
import * as i0 from "@angular/core";
|
|
9
|
+
import * as i1 from "./repeater.service";
|
|
10
|
+
import * as i2 from "./repeater-adapter.service";
|
|
11
|
+
import * as i3 from "ng2-dragula";
|
|
12
|
+
import * as i4 from "@skyux/i18n";
|
|
13
|
+
let uniqueId = 0;
|
|
14
|
+
/**
|
|
15
|
+
* Creates a container to display repeater items.
|
|
16
|
+
*/
|
|
17
|
+
export class SkyRepeaterComponent {
|
|
18
|
+
constructor(changeDetector, repeaterService, adapterService, dragulaService, elementRef, renderer) {
|
|
19
|
+
this.changeDetector = changeDetector;
|
|
20
|
+
this.repeaterService = repeaterService;
|
|
21
|
+
this.adapterService = adapterService;
|
|
22
|
+
this.dragulaService = dragulaService;
|
|
23
|
+
this.elementRef = elementRef;
|
|
24
|
+
this.renderer = renderer;
|
|
25
|
+
/**
|
|
26
|
+
* Indicates whether users can change the order of items in the repeater list.
|
|
27
|
+
* Each repeater item also has `reorderable` property to indicate whether
|
|
28
|
+
* users can change its order.
|
|
29
|
+
*/
|
|
30
|
+
this.reorderable = false;
|
|
31
|
+
/**
|
|
32
|
+
* Fires when the active repeater item changes.
|
|
33
|
+
*/
|
|
34
|
+
this.activeIndexChange = new EventEmitter();
|
|
35
|
+
/**
|
|
36
|
+
* Fires when users change the order of repeater items.
|
|
37
|
+
* This event emits an ordered array of the `tag` properties that the consumer provides for each repeater item.
|
|
38
|
+
*/
|
|
39
|
+
this.orderChange = new EventEmitter();
|
|
40
|
+
this.dragulaUnsubscribe = new Subject();
|
|
41
|
+
this.ngUnsubscribe = new Subject();
|
|
42
|
+
this._expandMode = 'none';
|
|
43
|
+
this.dragulaGroupName = `sky-repeater-dragula-${++uniqueId}`;
|
|
44
|
+
this.repeaterService.itemCollapseStateChange
|
|
45
|
+
.pipe(takeUntil(this.ngUnsubscribe))
|
|
46
|
+
.subscribe((item) => {
|
|
47
|
+
if (this.expandMode === 'single' && item.isExpanded) {
|
|
48
|
+
this.items.forEach((otherItem) => {
|
|
49
|
+
if (otherItem !== item &&
|
|
50
|
+
otherItem.isExpanded &&
|
|
51
|
+
otherItem.isCollapsible) {
|
|
52
|
+
otherItem.isExpanded = false;
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
this.repeaterService.activeItemIndexChange
|
|
58
|
+
.pipe(takeUntil(this.ngUnsubscribe))
|
|
59
|
+
.subscribe((index) => {
|
|
60
|
+
if (index !== this.activeIndex) {
|
|
61
|
+
this.activeIndex = index;
|
|
62
|
+
this.activeIndexChange.emit(index);
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
this.repeaterService.orderChange
|
|
66
|
+
.pipe(takeUntil(this.ngUnsubscribe))
|
|
67
|
+
.subscribe(() => {
|
|
68
|
+
this.emitTags();
|
|
69
|
+
});
|
|
70
|
+
this.repeaterService.repeaterGroupId = uniqueId;
|
|
71
|
+
this.updateForExpandMode();
|
|
72
|
+
this.adapterService.setRepeaterHost(this.elementRef);
|
|
73
|
+
this.initializeDragAndDrop();
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Specifies a layout to determine which repeater items are expanded by default and whether
|
|
77
|
+
* repeater items are expandable and collapsible. Collapsed items display titles only.
|
|
78
|
+
* The valid options are `multiple`, `none`, and `single`.
|
|
79
|
+
* - `multiple` loads repeater items in an expanded state unless `isExpanded` is set to
|
|
80
|
+
* `false` for a repeater item. This layout allows users to expand and collapse
|
|
81
|
+
* as many repeater items as necessary. It is best-suited to repeater items where body
|
|
82
|
+
* content is important but users don't always need to see it.
|
|
83
|
+
* - `none` loads all repeater items in an expanded state and does not allow users to
|
|
84
|
+
* collapse them. This default layout provides the quickest access to the details in the
|
|
85
|
+
* repeater items. It is best-suited to repeater items with concise content
|
|
86
|
+
* that users need to view frequently.
|
|
87
|
+
* - `single` loads one repeater item in an expanded state and collapses all others.
|
|
88
|
+
* The expanded repeater item is the first one where `isExpanded` is set to `true`. This layout
|
|
89
|
+
* allows users to expand one item at a time. It provides the most compact view and is
|
|
90
|
+
* best-suited to repeater items where the most important information is in the titles
|
|
91
|
+
* and users only occasionally need to view the body content.
|
|
92
|
+
* @default "none"
|
|
93
|
+
*/
|
|
94
|
+
set expandMode(value) {
|
|
95
|
+
this.repeaterService.expandMode = value;
|
|
96
|
+
this._expandMode = value;
|
|
97
|
+
this.updateForExpandMode();
|
|
98
|
+
}
|
|
99
|
+
get expandMode() {
|
|
100
|
+
return this._expandMode || 'none';
|
|
101
|
+
}
|
|
102
|
+
ngAfterContentInit() {
|
|
103
|
+
// If activeIndex has been set on init, call service to activate the appropriate item.
|
|
104
|
+
setTimeout(() => {
|
|
105
|
+
if (this.activeIndex || this.activeIndex === 0) {
|
|
106
|
+
this.repeaterService.activateItemByIndex(this.activeIndex);
|
|
107
|
+
}
|
|
108
|
+
if (this.reorderable && !this.everyItemHasTag()) {
|
|
109
|
+
console.warn('Please supply tag properties for each repeater item when reordering functionality is enabled.');
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
// HACK: Not updating for expand mode in a timeout causes an error.
|
|
113
|
+
// https://github.com/angular/angular/issues/6005
|
|
114
|
+
this.items.changes.pipe(takeUntil(this.ngUnsubscribe)).subscribe(() => {
|
|
115
|
+
setTimeout(() => {
|
|
116
|
+
if (!!this.items.last) {
|
|
117
|
+
this.updateForExpandMode(this.items.last);
|
|
118
|
+
this.items.last.reorderable = this.reorderable;
|
|
119
|
+
}
|
|
120
|
+
if (this.activeIndex !== undefined) {
|
|
121
|
+
this.repeaterService.activateItemByIndex(this.activeIndex);
|
|
122
|
+
}
|
|
123
|
+
});
|
|
124
|
+
});
|
|
125
|
+
setTimeout(() => {
|
|
126
|
+
this.updateForExpandMode();
|
|
127
|
+
this.items.forEach((item) => {
|
|
128
|
+
item.reorderable = this.reorderable;
|
|
129
|
+
});
|
|
130
|
+
}, 0);
|
|
131
|
+
}
|
|
132
|
+
ngOnChanges(changes) {
|
|
133
|
+
if (changes['activeIndex']) {
|
|
134
|
+
this.repeaterService.enableActiveState = true;
|
|
135
|
+
if (changes['activeIndex'].currentValue !==
|
|
136
|
+
changes['activeIndex'].previousValue) {
|
|
137
|
+
this.repeaterService.activateItemByIndex(this.activeIndex);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
if (changes.reorderable) {
|
|
141
|
+
if (this.items) {
|
|
142
|
+
this.items.forEach((item) => (item.reorderable = this.reorderable));
|
|
143
|
+
}
|
|
144
|
+
this.changeDetector.markForCheck();
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
ngOnDestroy() {
|
|
148
|
+
this.ngUnsubscribe.next();
|
|
149
|
+
this.ngUnsubscribe.complete();
|
|
150
|
+
this.destroyDragAndDrop();
|
|
151
|
+
}
|
|
152
|
+
updateForExpandMode(itemAdded) {
|
|
153
|
+
if (this.items) {
|
|
154
|
+
let foundExpanded = false;
|
|
155
|
+
let isCollapsible = this.expandMode !== 'none';
|
|
156
|
+
let isSingle = this.expandMode === 'single';
|
|
157
|
+
// Keep any newly-added expanded item expanded and collapse the rest.
|
|
158
|
+
if (itemAdded && itemAdded.isExpanded) {
|
|
159
|
+
foundExpanded = true;
|
|
160
|
+
}
|
|
161
|
+
this.items.forEach((item) => {
|
|
162
|
+
item.isCollapsible = isCollapsible && !!item.hasItemContent;
|
|
163
|
+
if (item !== itemAdded && isSingle && item.isExpanded) {
|
|
164
|
+
if (foundExpanded) {
|
|
165
|
+
item.updateForExpanded(false, false);
|
|
166
|
+
}
|
|
167
|
+
foundExpanded = true;
|
|
168
|
+
}
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
initializeDragAndDrop() {
|
|
173
|
+
/* Sanity check that we haven't already set up dragging abilities */
|
|
174
|
+
/* istanbul ignore else */
|
|
175
|
+
if (!this.dragulaService.find(this.dragulaGroupName)) {
|
|
176
|
+
this.dragulaService.setOptions(this.dragulaGroupName, {
|
|
177
|
+
moves: (el, container, handle) => {
|
|
178
|
+
const target = el.querySelector('.sky-repeater-item-grab-handle');
|
|
179
|
+
return this.reorderable && target && target.contains(handle);
|
|
180
|
+
},
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
let draggedItemIndex;
|
|
184
|
+
this.dragulaService.drag
|
|
185
|
+
.pipe(takeUntil(this.dragulaUnsubscribe))
|
|
186
|
+
.subscribe(([groupName, subject]) => {
|
|
187
|
+
/* istanbul ignore else */
|
|
188
|
+
if (groupName === this.dragulaGroupName) {
|
|
189
|
+
this.renderer.addClass(subject, 'sky-repeater-item-dragging');
|
|
190
|
+
draggedItemIndex = this.adapterService.getRepeaterItemIndex(subject);
|
|
191
|
+
}
|
|
192
|
+
});
|
|
193
|
+
this.dragulaService.dragend
|
|
194
|
+
.pipe(takeUntil(this.dragulaUnsubscribe))
|
|
195
|
+
.subscribe(([groupName, subject]) => {
|
|
196
|
+
/* istanbul ignore else */
|
|
197
|
+
if (groupName === this.dragulaGroupName) {
|
|
198
|
+
this.renderer.removeClass(subject, 'sky-repeater-item-dragging');
|
|
199
|
+
let newItemIndex = this.adapterService.getRepeaterItemIndex(subject);
|
|
200
|
+
/* sanity check */
|
|
201
|
+
/* istanbul ignore else */
|
|
202
|
+
if (draggedItemIndex >= 0) {
|
|
203
|
+
this.repeaterService.reorderItem(draggedItemIndex, newItemIndex);
|
|
204
|
+
draggedItemIndex = undefined;
|
|
205
|
+
}
|
|
206
|
+
this.emitTags();
|
|
207
|
+
}
|
|
208
|
+
});
|
|
209
|
+
}
|
|
210
|
+
destroyDragAndDrop() {
|
|
211
|
+
this.dragulaUnsubscribe.next();
|
|
212
|
+
this.dragulaUnsubscribe.complete();
|
|
213
|
+
this.dragulaUnsubscribe = undefined;
|
|
214
|
+
/* Sanity check that we have set up dragging abilities */
|
|
215
|
+
/* istanbul ignore else */
|
|
216
|
+
if (this.dragulaService.find(this.dragulaGroupName)) {
|
|
217
|
+
this.dragulaService.destroy(this.dragulaGroupName);
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
emitTags() {
|
|
221
|
+
const tags = this.repeaterService.items.map((item) => item.tag);
|
|
222
|
+
this.orderChange.emit(tags);
|
|
223
|
+
}
|
|
224
|
+
everyItemHasTag() {
|
|
225
|
+
/* sanity check */
|
|
226
|
+
/* istanbul ignore if */
|
|
227
|
+
if (!this.items || this.items.length === 0) {
|
|
228
|
+
return false;
|
|
229
|
+
}
|
|
230
|
+
return this.items.toArray().every((item) => {
|
|
231
|
+
return item.tag !== undefined;
|
|
232
|
+
});
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
SkyRepeaterComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyRepeaterComponent, deps: [{ token: i0.ChangeDetectorRef }, { token: i1.SkyRepeaterService }, { token: i2.SkyRepeaterAdapterService }, { token: i3.DragulaService }, { token: i0.ElementRef }, { token: i0.Renderer2 }], target: i0.ɵɵFactoryTarget.Component });
|
|
236
|
+
SkyRepeaterComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: SkyRepeaterComponent, selector: "sky-repeater", inputs: { activeIndex: "activeIndex", ariaLabel: "ariaLabel", reorderable: "reorderable", expandMode: "expandMode" }, outputs: { activeIndexChange: "activeIndexChange", orderChange: "orderChange" }, providers: [SkyRepeaterService, SkyRepeaterAdapterService], queries: [{ propertyName: "items", predicate: SkyRepeaterItemComponent }], usesOnChanges: true, ngImport: i0, template: "<ng-container #repeaterHost>\n <div\n class=\"sky-repeater\"\n role=\"listbox\"\n [attr.aria-label]=\"ariaLabel || ('skyux_repeater_label' | skyLibResources)\"\n [dragula]=\"dragulaGroupName\"\n >\n <ng-content></ng-content>\n </div>\n</ng-container>\n", styles: [".sky-repeater{padding:0}\n"], directives: [{ type: i3.DragulaDirective, selector: "[dragula]", inputs: ["dragula", "dragulaModel", "dragulaOptions"] }], pipes: { "skyLibResources": i4.SkyLibResourcesPipe }, changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
237
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyRepeaterComponent, decorators: [{
|
|
238
|
+
type: Component,
|
|
239
|
+
args: [{
|
|
240
|
+
selector: 'sky-repeater',
|
|
241
|
+
styleUrls: ['./repeater.component.scss'],
|
|
242
|
+
templateUrl: './repeater.component.html',
|
|
243
|
+
providers: [SkyRepeaterService, SkyRepeaterAdapterService],
|
|
244
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
245
|
+
}]
|
|
246
|
+
}], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }, { type: i1.SkyRepeaterService }, { type: i2.SkyRepeaterAdapterService }, { type: i3.DragulaService }, { type: i0.ElementRef }, { type: i0.Renderer2 }]; }, propDecorators: { activeIndex: [{
|
|
247
|
+
type: Input
|
|
248
|
+
}], ariaLabel: [{
|
|
249
|
+
type: Input
|
|
250
|
+
}], reorderable: [{
|
|
251
|
+
type: Input
|
|
252
|
+
}], expandMode: [{
|
|
253
|
+
type: Input
|
|
254
|
+
}], activeIndexChange: [{
|
|
255
|
+
type: Output
|
|
256
|
+
}], orderChange: [{
|
|
257
|
+
type: Output
|
|
258
|
+
}], items: [{
|
|
259
|
+
type: ContentChildren,
|
|
260
|
+
args: [SkyRepeaterItemComponent]
|
|
261
|
+
}] } });
|
|
262
|
+
//# sourceMappingURL=repeater.component.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"repeater.component.js","sourceRoot":"","sources":["../../../../../../../../libs/components/lists/src/lib/modules/repeater/repeater.component.ts","../../../../../../../../libs/components/lists/src/lib/modules/repeater/repeater.component.html"],"names":[],"mappings":"AAAA,OAAO,EAEL,uBAAuB,EACvB,iBAAiB,EACjB,SAAS,EACT,eAAe,EACf,UAAU,EACV,YAAY,EACZ,KAAK,EAGL,MAAM,EACN,SAAS,EACT,SAAS,GAEV,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAE7C,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAE/B,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C,OAAO,EAAE,wBAAwB,EAAE,MAAM,2BAA2B,CA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AK,CAAC,CAAC,IAAI,EAAE,EAAE;YACzC,OAAO,IAAI,CAAC,GAAG,KAAK,SAAS,CAAC;QAChC,CAAC,CAAC,CAAC;IACL,CAAC;;kHAxSU,oBAAoB;sGAApB,oBAAoB,8OAHpB,CAAC,kBAAkB,EAAE,yBAAyB,CAAC,gDA2EzC,wBAAwB,kDCjH3C,gRAUA;4FD+Ba,oBAAoB;kBAPhC,SAAS;mBAAC;oBACT,QAAQ,EAAE,cAAc;oBACxB,SAAS,EAAE,CAAC,2BAA2B,CAAC;oBACxC,WAAW,EAAE,2BAA2B;oBACxC,SAAS,EAAE,CAAC,kBAAkB,EAAE,yBAAyB,CAAC;oBAC1D,eAAe,EAAE,uBAAuB,CAAC,MAAM;iBAChD;+PAWQ,WAAW;sBADjB,KAAK;gBAUC,SAAS;sBADf,KAAK;gBASC,WAAW;sBADjB,KAAK;gBAuBK,UAAU;sBADpB,KAAK;gBAeC,iBAAiB;sBADvB,MAAM;gBAQA,WAAW;sBADjB,MAAM;gBAIA,KAAK;sBADX,eAAe;uBAAC,wBAAwB","sourcesContent":["import {\n AfterContentInit,\n ChangeDetectionStrategy,\n ChangeDetectorRef,\n Component,\n ContentChildren,\n ElementRef,\n EventEmitter,\n Input,\n OnChanges,\n OnDestroy,\n Output,\n QueryList,\n Renderer2,\n SimpleChanges,\n} from '@angular/core';\n\nimport { DragulaService } from 'ng2-dragula';\n\nimport { Subject } from 'rxjs';\n\nimport { takeUntil } from 'rxjs/operators';\n\nimport { SkyRepeaterItemComponent } from './repeater-item.component';\n\nimport { SkyRepeaterService } from './repeater.service';\n\nimport { SkyRepeaterAdapterService } from './repeater-adapter.service';\n\nlet uniqueId = 0;\n\n/**\n * Creates a container to display repeater items.\n */\n@Component({\n selector: 'sky-repeater',\n styleUrls: ['./repeater.component.scss'],\n templateUrl: './repeater.component.html',\n providers: [SkyRepeaterService, SkyRepeaterAdapterService],\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class SkyRepeaterComponent\n implements AfterContentInit, OnChanges, OnDestroy\n{\n /**\n * Specifies the index of the repeater item to visually highlight as active.\n * For example, use this property in conjunction with the\n * [split view component](https://developer.blackbaud.com/skyux/components/split-view)\n * to highlight a repeater item while users edit it. Only one item can be active at a time.\n */\n @Input()\n public activeIndex: number;\n\n /**\n * Specifies an ARIA label for the repeater list.\n * This sets the repeater list's `aria-label` attribute\n * [to support accessibility](https://developer.blackbaud.com/skyux/learn/accessibility).\n * @default \"List of items\"\n */\n @Input()\n public ariaLabel: string;\n\n /**\n * Indicates whether users can change the order of items in the repeater list.\n * Each repeater item also has `reorderable` property to indicate whether\n * users can change its order.\n */\n @Input()\n public reorderable: boolean = false;\n\n /**\n * Specifies a layout to determine which repeater items are expanded by default and whether\n * repeater items are expandable and collapsible. Collapsed items display titles only.\n * The valid options are `multiple`, `none`, and `single`.\n * - `multiple` loads repeater items in an expanded state unless `isExpanded` is set to\n * `false` for a repeater item. This layout allows users to expand and collapse\n * as many repeater items as necessary. It is best-suited to repeater items where body\n * content is important but users don't always need to see it.\n * - `none` loads all repeater items in an expanded state and does not allow users to\n * collapse them. This default layout provides the quickest access to the details in the\n * repeater items. It is best-suited to repeater items with concise content\n * that users need to view frequently.\n * - `single` loads one repeater item in an expanded state and collapses all others.\n * The expanded repeater item is the first one where `isExpanded` is set to `true`. This layout\n * allows users to expand one item at a time. It provides the most compact view and is\n * best-suited to repeater items where the most important information is in the titles\n * and users only occasionally need to view the body content.\n * @default \"none\"\n */\n @Input()\n public set expandMode(value: string) {\n this.repeaterService.expandMode = value;\n this._expandMode = value;\n this.updateForExpandMode();\n }\n\n public get expandMode(): string {\n return this._expandMode || 'none';\n }\n\n /**\n * Fires when the active repeater item changes.\n */\n @Output()\n public activeIndexChange = new EventEmitter<number>();\n\n /**\n * Fires when users change the order of repeater items.\n * This event emits an ordered array of the `tag` properties that the consumer provides for each repeater item.\n */\n @Output()\n public orderChange = new EventEmitter<any[]>();\n\n @ContentChildren(SkyRepeaterItemComponent)\n public items: QueryList<SkyRepeaterItemComponent>;\n\n public dragulaGroupName: string;\n\n private dragulaUnsubscribe = new Subject<void>();\n\n private ngUnsubscribe = new Subject<void>();\n\n private _expandMode = 'none';\n\n constructor(\n private changeDetector: ChangeDetectorRef,\n private repeaterService: SkyRepeaterService,\n private adapterService: SkyRepeaterAdapterService,\n private dragulaService: DragulaService,\n private elementRef: ElementRef,\n private renderer: Renderer2\n ) {\n this.dragulaGroupName = `sky-repeater-dragula-${++uniqueId}`;\n\n this.repeaterService.itemCollapseStateChange\n .pipe(takeUntil(this.ngUnsubscribe))\n .subscribe((item: SkyRepeaterItemComponent) => {\n if (this.expandMode === 'single' && item.isExpanded) {\n this.items.forEach((otherItem) => {\n if (\n otherItem !== item &&\n otherItem.isExpanded &&\n otherItem.isCollapsible\n ) {\n otherItem.isExpanded = false;\n }\n });\n }\n });\n\n this.repeaterService.activeItemIndexChange\n .pipe(takeUntil(this.ngUnsubscribe))\n .subscribe((index: number) => {\n if (index !== this.activeIndex) {\n this.activeIndex = index;\n this.activeIndexChange.emit(index);\n }\n });\n\n this.repeaterService.orderChange\n .pipe(takeUntil(this.ngUnsubscribe))\n .subscribe(() => {\n this.emitTags();\n });\n\n this.repeaterService.repeaterGroupId = uniqueId;\n\n this.updateForExpandMode();\n\n this.adapterService.setRepeaterHost(this.elementRef);\n\n this.initializeDragAndDrop();\n }\n\n public ngAfterContentInit(): void {\n // If activeIndex has been set on init, call service to activate the appropriate item.\n setTimeout(() => {\n if (this.activeIndex || this.activeIndex === 0) {\n this.repeaterService.activateItemByIndex(this.activeIndex);\n }\n\n if (this.reorderable && !this.everyItemHasTag()) {\n console.warn(\n 'Please supply tag properties for each repeater item when reordering functionality is enabled.'\n );\n }\n });\n\n // HACK: Not updating for expand mode in a timeout causes an error.\n // https://github.com/angular/angular/issues/6005\n this.items.changes.pipe(takeUntil(this.ngUnsubscribe)).subscribe(() => {\n setTimeout(() => {\n if (!!this.items.last) {\n this.updateForExpandMode(this.items.last);\n this.items.last.reorderable = this.reorderable;\n }\n\n if (this.activeIndex !== undefined) {\n this.repeaterService.activateItemByIndex(this.activeIndex);\n }\n });\n });\n\n setTimeout(() => {\n this.updateForExpandMode();\n\n this.items.forEach((item) => {\n item.reorderable = this.reorderable;\n });\n }, 0);\n }\n\n public ngOnChanges(changes: SimpleChanges): void {\n if (changes['activeIndex']) {\n this.repeaterService.enableActiveState = true;\n if (\n changes['activeIndex'].currentValue !==\n changes['activeIndex'].previousValue\n ) {\n this.repeaterService.activateItemByIndex(this.activeIndex);\n }\n }\n\n if (changes.reorderable) {\n if (this.items) {\n this.items.forEach((item) => (item.reorderable = this.reorderable));\n }\n\n this.changeDetector.markForCheck();\n }\n }\n\n public ngOnDestroy(): void {\n this.ngUnsubscribe.next();\n this.ngUnsubscribe.complete();\n this.destroyDragAndDrop();\n }\n\n private updateForExpandMode(itemAdded?: SkyRepeaterItemComponent): void {\n if (this.items) {\n let foundExpanded = false;\n let isCollapsible = this.expandMode !== 'none';\n let isSingle = this.expandMode === 'single';\n\n // Keep any newly-added expanded item expanded and collapse the rest.\n if (itemAdded && itemAdded.isExpanded) {\n foundExpanded = true;\n }\n\n this.items.forEach((item) => {\n item.isCollapsible = isCollapsible && !!item.hasItemContent;\n\n if (item !== itemAdded && isSingle && item.isExpanded) {\n if (foundExpanded) {\n item.updateForExpanded(false, false);\n }\n\n foundExpanded = true;\n }\n });\n }\n }\n\n private initializeDragAndDrop(): void {\n /* Sanity check that we haven't already set up dragging abilities */\n /* istanbul ignore else */\n if (!this.dragulaService.find(this.dragulaGroupName)) {\n this.dragulaService.setOptions(this.dragulaGroupName, {\n moves: (\n el: HTMLElement,\n container: HTMLElement,\n handle: HTMLElement\n ) => {\n const target = el.querySelector('.sky-repeater-item-grab-handle');\n return this.reorderable && target && target.contains(handle);\n },\n });\n }\n\n let draggedItemIndex: number;\n\n this.dragulaService.drag\n .pipe(takeUntil(this.dragulaUnsubscribe))\n .subscribe(([groupName, subject]: any[]) => {\n /* istanbul ignore else */\n if (groupName === this.dragulaGroupName) {\n this.renderer.addClass(subject, 'sky-repeater-item-dragging');\n draggedItemIndex = this.adapterService.getRepeaterItemIndex(subject);\n }\n });\n\n this.dragulaService.dragend\n .pipe(takeUntil(this.dragulaUnsubscribe))\n .subscribe(([groupName, subject]: any[]) => {\n /* istanbul ignore else */\n if (groupName === this.dragulaGroupName) {\n this.renderer.removeClass(subject, 'sky-repeater-item-dragging');\n let newItemIndex = this.adapterService.getRepeaterItemIndex(subject);\n\n /* sanity check */\n /* istanbul ignore else */\n if (draggedItemIndex >= 0) {\n this.repeaterService.reorderItem(draggedItemIndex, newItemIndex);\n draggedItemIndex = undefined;\n }\n\n this.emitTags();\n }\n });\n }\n\n private destroyDragAndDrop(): void {\n this.dragulaUnsubscribe.next();\n this.dragulaUnsubscribe.complete();\n this.dragulaUnsubscribe = undefined;\n\n /* Sanity check that we have set up dragging abilities */\n /* istanbul ignore else */\n if (this.dragulaService.find(this.dragulaGroupName)) {\n this.dragulaService.destroy(this.dragulaGroupName);\n }\n }\n\n private emitTags(): void {\n const tags = this.repeaterService.items.map((item) => item.tag);\n this.orderChange.emit(tags);\n }\n\n private everyItemHasTag(): boolean {\n /* sanity check */\n /* istanbul ignore if */\n if (!this.items || this.items.length === 0) {\n return false;\n }\n return this.items.toArray().every((item) => {\n return item.tag !== undefined;\n });\n }\n}\n","<ng-container #repeaterHost>\n <div\n class=\"sky-repeater\"\n role=\"listbox\"\n [attr.aria-label]=\"ariaLabel || ('skyux_repeater_label' | skyLibResources)\"\n [dragula]=\"dragulaGroupName\"\n >\n <ng-content></ng-content>\n </div>\n</ng-container>\n"]}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { CommonModule } from '@angular/common';
|
|
2
|
+
import { NgModule } from '@angular/core';
|
|
3
|
+
import { SkyCheckboxModule } from '@skyux/forms';
|
|
4
|
+
import { SkyChevronModule, SkyIconModule } from '@skyux/indicators';
|
|
5
|
+
import { SkyInlineFormModule } from '@skyux/inline-form';
|
|
6
|
+
import { DragulaModule } from 'ng2-dragula';
|
|
7
|
+
import { SkyRepeaterComponent } from './repeater.component';
|
|
8
|
+
import { SkyRepeaterItemContentComponent } from './repeater-item-content.component';
|
|
9
|
+
import { SkyRepeaterItemContextMenuComponent } from './repeater-item-context-menu.component';
|
|
10
|
+
import { SkyRepeaterItemComponent } from './repeater-item.component';
|
|
11
|
+
import { SkyRepeaterItemTitleComponent } from './repeater-item-title.component';
|
|
12
|
+
import { SkyListsResourcesModule } from '../shared/sky-lists-resources.module';
|
|
13
|
+
import * as i0 from "@angular/core";
|
|
14
|
+
export class SkyRepeaterModule {
|
|
15
|
+
}
|
|
16
|
+
SkyRepeaterModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyRepeaterModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
17
|
+
SkyRepeaterModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyRepeaterModule, declarations: [SkyRepeaterComponent,
|
|
18
|
+
SkyRepeaterItemComponent,
|
|
19
|
+
SkyRepeaterItemContentComponent,
|
|
20
|
+
SkyRepeaterItemContextMenuComponent,
|
|
21
|
+
SkyRepeaterItemTitleComponent], imports: [CommonModule,
|
|
22
|
+
DragulaModule,
|
|
23
|
+
SkyChevronModule,
|
|
24
|
+
SkyCheckboxModule,
|
|
25
|
+
SkyIconModule,
|
|
26
|
+
SkyInlineFormModule,
|
|
27
|
+
SkyListsResourcesModule], exports: [SkyRepeaterComponent,
|
|
28
|
+
SkyRepeaterItemComponent,
|
|
29
|
+
SkyRepeaterItemContentComponent,
|
|
30
|
+
SkyRepeaterItemContextMenuComponent,
|
|
31
|
+
SkyRepeaterItemTitleComponent] });
|
|
32
|
+
SkyRepeaterModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyRepeaterModule, imports: [[
|
|
33
|
+
CommonModule,
|
|
34
|
+
DragulaModule,
|
|
35
|
+
SkyChevronModule,
|
|
36
|
+
SkyCheckboxModule,
|
|
37
|
+
SkyIconModule,
|
|
38
|
+
SkyInlineFormModule,
|
|
39
|
+
SkyListsResourcesModule,
|
|
40
|
+
]] });
|
|
41
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyRepeaterModule, decorators: [{
|
|
42
|
+
type: NgModule,
|
|
43
|
+
args: [{
|
|
44
|
+
declarations: [
|
|
45
|
+
SkyRepeaterComponent,
|
|
46
|
+
SkyRepeaterItemComponent,
|
|
47
|
+
SkyRepeaterItemContentComponent,
|
|
48
|
+
SkyRepeaterItemContextMenuComponent,
|
|
49
|
+
SkyRepeaterItemTitleComponent,
|
|
50
|
+
],
|
|
51
|
+
imports: [
|
|
52
|
+
CommonModule,
|
|
53
|
+
DragulaModule,
|
|
54
|
+
SkyChevronModule,
|
|
55
|
+
SkyCheckboxModule,
|
|
56
|
+
SkyIconModule,
|
|
57
|
+
SkyInlineFormModule,
|
|
58
|
+
SkyListsResourcesModule,
|
|
59
|
+
],
|
|
60
|
+
exports: [
|
|
61
|
+
SkyRepeaterComponent,
|
|
62
|
+
SkyRepeaterItemComponent,
|
|
63
|
+
SkyRepeaterItemContentComponent,
|
|
64
|
+
SkyRepeaterItemContextMenuComponent,
|
|
65
|
+
SkyRepeaterItemTitleComponent,
|
|
66
|
+
],
|
|
67
|
+
}]
|
|
68
|
+
}] });
|
|
69
|
+
//# sourceMappingURL=repeater.module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"repeater.module.js","sourceRoot":"","sources":["../../../../../../../../libs/components/lists/src/lib/modules/repeater/repeater.module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEzC,OAAO,EAA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,OAAO,EAAE;wBACP,oBAAoB;wBACpB,wBAAwB;wBACxB,+BAA+B;wBAC/B,mCAAmC;wBACnC,6BAA6B;qBAC9B;iBACF","sourcesContent":["import { CommonModule } from '@angular/common';\n\nimport { NgModule } from '@angular/core';\n\nimport { SkyCheckboxModule } from '@skyux/forms';\n\nimport { SkyChevronModule, SkyIconModule } from '@skyux/indicators';\n\nimport { SkyInlineFormModule } from '@skyux/inline-form';\n\nimport { DragulaModule } from 'ng2-dragula';\n\nimport { SkyRepeaterComponent } from './repeater.component';\n\nimport { SkyRepeaterItemContentComponent } from './repeater-item-content.component';\n\nimport { SkyRepeaterItemContextMenuComponent } from './repeater-item-context-menu.component';\n\nimport { SkyRepeaterItemComponent } from './repeater-item.component';\n\nimport { SkyRepeaterItemTitleComponent } from './repeater-item-title.component';\n\nimport { SkyListsResourcesModule } from '../shared/sky-lists-resources.module';\n\n@NgModule({\n declarations: [\n SkyRepeaterComponent,\n SkyRepeaterItemComponent,\n SkyRepeaterItemContentComponent,\n SkyRepeaterItemContextMenuComponent,\n SkyRepeaterItemTitleComponent,\n ],\n imports: [\n CommonModule,\n DragulaModule,\n SkyChevronModule,\n SkyCheckboxModule,\n SkyIconModule,\n SkyInlineFormModule,\n SkyListsResourcesModule,\n ],\n exports: [\n SkyRepeaterComponent,\n SkyRepeaterItemComponent,\n SkyRepeaterItemContentComponent,\n SkyRepeaterItemContextMenuComponent,\n SkyRepeaterItemTitleComponent,\n ],\n})\nexport class SkyRepeaterModule {}\n"]}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { EventEmitter, Injectable } from '@angular/core';
|
|
2
|
+
import { BehaviorSubject } from 'rxjs';
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
4
|
+
/**
|
|
5
|
+
* @internal
|
|
6
|
+
*/
|
|
7
|
+
export class SkyRepeaterService {
|
|
8
|
+
constructor() {
|
|
9
|
+
this.activeItemChange = new BehaviorSubject(undefined);
|
|
10
|
+
this.activeItemIndexChange = new BehaviorSubject(undefined);
|
|
11
|
+
this.enableActiveState = false;
|
|
12
|
+
this.itemCollapseStateChange = new EventEmitter();
|
|
13
|
+
this.items = [];
|
|
14
|
+
this.orderChange = new BehaviorSubject(undefined);
|
|
15
|
+
}
|
|
16
|
+
ngOnDestroy() {
|
|
17
|
+
this.activeItemChange.complete();
|
|
18
|
+
this.itemCollapseStateChange.complete();
|
|
19
|
+
this.orderChange.complete();
|
|
20
|
+
}
|
|
21
|
+
activateItem(item) {
|
|
22
|
+
if (this.enableActiveState) {
|
|
23
|
+
/* istanbul ignore else */
|
|
24
|
+
if (item) {
|
|
25
|
+
const index = this.items.findIndex((i) => i === item);
|
|
26
|
+
this.activeItemIndexChange.next(index);
|
|
27
|
+
this.activeItemChange.next(item);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
activateItemByIndex(index) {
|
|
32
|
+
/* istanbul ignore else */
|
|
33
|
+
if (this.enableActiveState) {
|
|
34
|
+
if (index === undefined) {
|
|
35
|
+
this.activeItemChange.next(undefined);
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
const activeItem = this.items[index];
|
|
39
|
+
if (activeItem) {
|
|
40
|
+
this.activeItemChange.next(activeItem);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
registerItem(item) {
|
|
46
|
+
this.items.push(item);
|
|
47
|
+
}
|
|
48
|
+
unregisterItem(item) {
|
|
49
|
+
const indexOfDestroyedItem = this.items.indexOf(item);
|
|
50
|
+
if (indexOfDestroyedItem > -1) {
|
|
51
|
+
this.items.splice(indexOfDestroyedItem, 1);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
onItemCollapseStateChange(item) {
|
|
55
|
+
this.itemCollapseStateChange.emit(item);
|
|
56
|
+
}
|
|
57
|
+
getItemIndex(item) {
|
|
58
|
+
return this.items.indexOf(item);
|
|
59
|
+
}
|
|
60
|
+
registerOrderChange() {
|
|
61
|
+
this.orderChange.next();
|
|
62
|
+
}
|
|
63
|
+
reorderItem(oldIndex, newIndex) {
|
|
64
|
+
this.items.splice(newIndex, 0, this.items.splice(oldIndex, 1)[0]);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
SkyRepeaterService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyRepeaterService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
68
|
+
SkyRepeaterService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyRepeaterService });
|
|
69
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyRepeaterService, decorators: [{
|
|
70
|
+
type: Injectable
|
|
71
|
+
}] });
|
|
72
|
+
//# sourceMappingURL=repeater.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"repeater.service.js","sourceRoot":"","sources":["../../../../../../../../libs/components/lists/src/lib/modules/repeater/repeater.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,UAAU,EAAa,MAAM,eAAe,CAAC;AAEpE,OAAO,EAAE,eAAe,EAAE,MAAM,MAAM,CAAC;;AAIvC;;GAEG;AAEH,MAAM,OAAO,kBAAkB;IAD/B;QAES,qBAAgB,GAAG,IAAI,eAAe,CAC3C,SAAS,CACV,CAAC;QAEK,0BAAqB,GAAG,IAAI,eAAe,CAAS,SAAS,CAAC,CAAC;QAE/D,sBAAiB,GAAG,KAAK,CAAC;QAI1B,4BAAuB,GAAG,IAAI,YAAY,EAA4B,CAAC;QAEvE,UAAK,GAA+B,EAAE,CAAC;QAEvC,gBAAW,GAAG,IAAI,eAAe,CAAO,SAAS,CAAC,CAAC;KA6D3D;IAzDQ,WAAW;QAChB,IAAI,CAAC,gBAAgB,CAAC,QAAQ,EAAE,CAAC;QACjC,IAAI,CAAC,u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C,uBAAuB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC1C,CAAC;IAEM,YAAY,CAAC,IAA8B;QAChD,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IAClC,CAAC;IAEM,mBAAmB;QACxB,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,CAAC;IAC1B,CAAC;IAEM,WAAW,CAAC,QAAgB,EAAE,QAAgB;QACnD,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACpE,CAAC;;gHA3EU,kBAAkB;oHAAlB,kBAAkB;4FAAlB,kBAAkB;kBAD9B,UAAU","sourcesContent":["import { EventEmitter, Injectable, OnDestroy } from '@angular/core';\n\nimport { BehaviorSubject } from 'rxjs';\n\nimport { SkyRepeaterItemComponent } from './repeater-item.component';\n\n/**\n * @internal\n */\n@Injectable()\nexport class SkyRepeaterService implements OnDestroy {\n public activeItemChange = new BehaviorSubject<SkyRepeaterItemComponent>(\n undefined\n );\n\n public activeItemIndexChange = new BehaviorSubject<number>(undefined);\n\n public enableActiveState = false;\n\n public expandMode: string;\n\n public itemCollapseStateChange = new EventEmitter<SkyRepeaterItemComponent>();\n\n public items: SkyRepeaterItemComponent[] = [];\n\n public orderChange = new BehaviorSubject<void>(undefined);\n\n public repeaterGroupId: number;\n\n public ngOnDestroy(): void {\n this.activeItemChange.complete();\n this.itemCollapseStateChange.complete();\n this.orderChange.complete();\n }\n\n public activateItem(item: SkyRepeaterItemComponent): void {\n if (this.enableActiveState) {\n /* istanbul ignore else */\n if (item) {\n const index = this.items.findIndex((i) => i === item);\n this.activeItemIndexChange.next(index);\n this.activeItemChange.next(item);\n }\n }\n }\n\n public activateItemByIndex(index: number): void {\n /* istanbul ignore else */\n if (this.enableActiveState) {\n if (index === undefined) {\n this.activeItemChange.next(undefined);\n } else {\n const activeItem = this.items[index];\n if (activeItem) {\n this.activeItemChange.next(activeItem);\n }\n }\n }\n }\n\n public registerItem(item: SkyRepeaterItemComponent): void {\n this.items.push(item);\n }\n\n public unregisterItem(item: SkyRepeaterItemComponent): void {\n const indexOfDestroyedItem = this.items.indexOf(item);\n if (indexOfDestroyedItem > -1) {\n this.items.splice(indexOfDestroyedItem, 1);\n }\n }\n\n public onItemCollapseStateChange(item: SkyRepeaterItemComponent): void {\n this.itemCollapseStateChange.emit(item);\n }\n\n public getItemIndex(item: SkyRepeaterItemComponent): number {\n return this.items.indexOf(item);\n }\n\n public registerOrderChange(): void {\n this.orderChange.next();\n }\n\n public reorderItem(oldIndex: number, newIndex: number): void {\n this.items.splice(newIndex, 0, this.items.splice(oldIndex, 1)[0]);\n }\n}\n"]}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* NOTICE: DO NOT MODIFY THIS FILE!
|
|
3
|
+
* The contents of this file were automatically generated by
|
|
4
|
+
* the 'ng generate @skyux/i18n:lib-resources-module modules/shared/sky-lists' schematic.
|
|
5
|
+
* To update this file, simply rerun the command.
|
|
6
|
+
*/
|
|
7
|
+
import { NgModule } from '@angular/core';
|
|
8
|
+
import { getLibStringForLocale, SkyI18nModule, SKY_LIB_RESOURCES_PROVIDERS, } from '@skyux/i18n';
|
|
9
|
+
import * as i0 from "@angular/core";
|
|
10
|
+
const RESOURCES = {
|
|
11
|
+
'EN-US': {
|
|
12
|
+
skyux_filter_button_title: { message: 'Filter' },
|
|
13
|
+
skyux_filter_summary_close: { message: 'Remove filter' },
|
|
14
|
+
skyux_filter_summary_header: { message: 'Filter' },
|
|
15
|
+
skyux_infinite_scroll_load_more_button: { message: 'Load more' },
|
|
16
|
+
skyux_paging_label: { message: 'Pagination' },
|
|
17
|
+
skyux_paging_next: { message: 'Next' },
|
|
18
|
+
skyux_paging_previous: { message: 'Previous' },
|
|
19
|
+
skyux_repeater_label: { message: 'List of items' },
|
|
20
|
+
skyux_repeater_item_expand: { message: 'Expand or collapse {0}' },
|
|
21
|
+
skyux_repeater_item_expand_default: { message: 'Expand or collapse' },
|
|
22
|
+
skyux_repeater_item_checkbox_label: { message: 'Select {0}' },
|
|
23
|
+
skyux_repeater_item_checkbox_label_default: { message: 'Select row' },
|
|
24
|
+
skyux_repeater_item_reorder_cancel: {
|
|
25
|
+
message: 'Item reordering was canceled. The item was returned to its original position.',
|
|
26
|
+
},
|
|
27
|
+
skyux_repeater_item_reorder_finish: {
|
|
28
|
+
message: 'Dropped the item in position',
|
|
29
|
+
},
|
|
30
|
+
skyux_repeater_item_reorder_instructions: {
|
|
31
|
+
message: 'Item grabbed. Press the up and down arrow keys to change position. Press the spacebar or enter key to drop. And press the escape key to cancel.',
|
|
32
|
+
},
|
|
33
|
+
skyux_repeater_item_reorder_moved: {
|
|
34
|
+
message: 'Moved the item to position',
|
|
35
|
+
},
|
|
36
|
+
skyux_repeater_item_reorder_label_default: { message: 'Reorder' },
|
|
37
|
+
skyux_repeater_item_reorder_label: { message: 'Reorder {0}' },
|
|
38
|
+
skyux_repeater_item_reorder_operation: {
|
|
39
|
+
message: 'Press the spacebar or enter key to reorder.',
|
|
40
|
+
},
|
|
41
|
+
skyux_repeater_item_reorder_top: { message: 'Top' },
|
|
42
|
+
skyux_repeater_item_reorder_top_label: { message: 'Move {0} to top' },
|
|
43
|
+
skyux_repeater_item_reorder_top_label_default: { message: 'Move to top' },
|
|
44
|
+
skyux_sort_button_label: { message: 'Sort' },
|
|
45
|
+
skyux_sort_menu_heading: { message: 'Sort by' },
|
|
46
|
+
},
|
|
47
|
+
};
|
|
48
|
+
export class SkyListsResourcesProvider {
|
|
49
|
+
getString(localeInfo, name) {
|
|
50
|
+
return getLibStringForLocale(RESOURCES, localeInfo.locale, name);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Import into any component library module that needs to use resource strings.
|
|
55
|
+
*/
|
|
56
|
+
export class SkyListsResourcesModule {
|
|
57
|
+
}
|
|
58
|
+
SkyListsResourcesModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyListsResourcesModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
59
|
+
SkyListsResourcesModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyListsResourcesModule, exports: [SkyI18nModule] });
|
|
60
|
+
SkyListsResourcesModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyListsResourcesModule, providers: [
|
|
61
|
+
{
|
|
62
|
+
provide: SKY_LIB_RESOURCES_PROVIDERS,
|
|
63
|
+
useClass: SkyListsResourcesProvider,
|
|
64
|
+
multi: true,
|
|
65
|
+
},
|
|
66
|
+
], imports: [SkyI18nModule] });
|
|
67
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyListsResourcesModule, decorators: [{
|
|
68
|
+
type: NgModule,
|
|
69
|
+
args: [{
|
|
70
|
+
exports: [SkyI18nModule],
|
|
71
|
+
providers: [
|
|
72
|
+
{
|
|
73
|
+
provide: SKY_LIB_RESOURCES_PROVIDERS,
|
|
74
|
+
useClass: SkyListsResourcesProvider,
|
|
75
|
+
multi: true,
|
|
76
|
+
},
|
|
77
|
+
],
|
|
78
|
+
}]
|
|
79
|
+
}] });
|
|
80
|
+
//# sourceMappingURL=sky-lists-resources.module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sky-lists-resources.module.js","sourceRoot":"","sources":["../../../../../../../../libs/components/lists/src/lib/modules/shared/sky-lists-resources.module.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EACL,qBAAqB,EAErB,aAAa,EAGb,2BA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OAAO,EAAE,MAAM,EAAE;QAC5C,uBAAuB,EAAE,EAAE,OAAO,EAAE,SAAS,EAAE;KAChD;CACF,CAAC;AAEF,MAAM,OAAO,yBAAyB;IAC7B,SAAS,CAAC,UAA4B,EAAE,IAAY;QACzD,OAAO,qBAAqB,CAAC,SAAS,EAAE,UAAU,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;IACnE,CAAC;CACF;AAED;;GAEG;AAWH,MAAM,OAAO,uBAAuB;;qHAAvB,uBAAuB;sHAAvB,uBAAuB,YATxB,aAAa;sHASZ,uBAAuB,aARvB;QACT;YACE,OAAO,EAAE,2BAA2B;YACpC,QAAQ,EAAE,yBAAyB;YACnC,KAAK,EAAE,IAAI;SACZ;KACF,YAPS,aAAa;4FASZ,uBAAuB;kBAVnC,QAAQ;mBAAC;oBACR,OAAO,EAAE,CAAC,aAAa,CAAC;oBACxB,SAAS,EAAE;wBACT;4BACE,OAAO,EAAE,2BAA2B;4BACpC,QAAQ,EAAE,yBAAyB;4BACnC,KAAK,EAAE,IAAI;yBACZ;qBACF;iBACF","sourcesContent":["/**\n * NOTICE: DO NOT MODIFY THIS FILE!\n * The contents of this file were automatically generated by\n * the 'ng generate @skyux/i18n:lib-resources-module modules/shared/sky-lists' schematic.\n * To update this file, simply rerun the command.\n */\n\nimport { NgModule } from '@angular/core';\nimport {\n getLibStringForLocale,\n SkyAppLocaleInfo,\n SkyI18nModule,\n SkyLibResources,\n SkyLibResourcesProvider,\n SKY_LIB_RESOURCES_PROVIDERS,\n} from '@skyux/i18n';\n\nconst RESOURCES: { [locale: string]: SkyLibResources } = {\n 'EN-US': {\n skyux_filter_button_title: { message: 'Filter' },\n skyux_filter_summary_close: { message: 'Remove filter' },\n skyux_filter_summary_header: { message: 'Filter' },\n skyux_infinite_scroll_load_more_button: { message: 'Load more' },\n skyux_paging_label: { message: 'Pagination' },\n skyux_paging_next: { message: 'Next' },\n skyux_paging_previous: { message: 'Previous' },\n skyux_repeater_label: { message: 'List of items' },\n skyux_repeater_item_expand: { message: 'Expand or collapse {0}' },\n skyux_repeater_item_expand_default: { message: 'Expand or collapse' },\n skyux_repeater_item_checkbox_label: { message: 'Select {0}' },\n skyux_repeater_item_checkbox_label_default: { message: 'Select row' },\n skyux_repeater_item_reorder_cancel: {\n message:\n 'Item reordering was canceled. The item was returned to its original position.',\n },\n skyux_repeater_item_reorder_finish: {\n message: 'Dropped the item in position',\n },\n skyux_repeater_item_reorder_instructions: {\n message:\n 'Item grabbed. Press the up and down arrow keys to change position. Press the spacebar or enter key to drop. And press the escape key to cancel.',\n },\n skyux_repeater_item_reorder_moved: {\n message: 'Moved the item to position',\n },\n skyux_repeater_item_reorder_label_default: { message: 'Reorder' },\n skyux_repeater_item_reorder_label: { message: 'Reorder {0}' },\n skyux_repeater_item_reorder_operation: {\n message: 'Press the spacebar or enter key to reorder.',\n },\n skyux_repeater_item_reorder_top: { message: 'Top' },\n skyux_repeater_item_reorder_top_label: { message: 'Move {0} to top' },\n skyux_repeater_item_reorder_top_label_default: { message: 'Move to top' },\n skyux_sort_button_label: { message: 'Sort' },\n skyux_sort_menu_heading: { message: 'Sort by' },\n },\n};\n\nexport class SkyListsResourcesProvider implements SkyLibResourcesProvider {\n public getString(localeInfo: SkyAppLocaleInfo, name: string): string {\n return getLibStringForLocale(RESOURCES, localeInfo.locale, name);\n }\n}\n\n/**\n * Import into any component library module that needs to use resource strings.\n */\n@NgModule({\n exports: [SkyI18nModule],\n providers: [\n {\n provide: SKY_LIB_RESOURCES_PROVIDERS,\n useClass: SkyListsResourcesProvider,\n multi: true,\n },\n ],\n})\nexport class SkyListsResourcesModule {}\n"]}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { ChangeDetectionStrategy, Component, EventEmitter, Input, Output, } from '@angular/core';
|
|
1
|
+
import { ChangeDetectionStrategy, ChangeDetectorRef, Component, EventEmitter, Input, Output, } from '@angular/core';
|
|
2
2
|
import { BehaviorSubject } from 'rxjs';
|
|
3
|
+
import { SkySortService } from './sort.service';
|
|
3
4
|
import * as i0 from "@angular/core";
|
|
4
5
|
import * as i1 from "./sort.service";
|
|
5
6
|
import * as i2 from "@angular/common";
|
|
@@ -46,9 +47,9 @@ export class SkySortItemComponent {
|
|
|
46
47
|
}
|
|
47
48
|
}
|
|
48
49
|
}
|
|
49
|
-
SkySortItemComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.
|
|
50
|
-
SkySortItemComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.
|
|
51
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.
|
|
50
|
+
SkySortItemComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkySortItemComponent, deps: [{ token: i1.SkySortService }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
51
|
+
SkySortItemComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: SkySortItemComponent, selector: "sky-sort-item", inputs: { active: "active" }, outputs: { itemSelect: "itemSelect" }, usesOnChanges: true, ngImport: i0, template: "<div\n class=\"sky-sort-item\"\n role=\"menuitemradio\"\n [attr.aria-checked]=\"isSelected | async\"\n [ngClass]=\"{ 'sky-sort-item-selected': (isSelected | async) }\"\n>\n <button\n type=\"button\"\n [ngClass]=\"{ 'sky-emphasized': (isSelected | async) }\"\n (click)=\"itemClicked()\"\n >\n <ng-content></ng-content>\n </button>\n</div>\n", styles: [".sky-sort-item{background-color:transparent;border:none;display:block;margin:4px;min-width:160px;text-align:left;transition:background-color .15s}.sky-sort-item.sky-dropdown-item-active,.sky-sort-item:hover{background-color:#eeeeef}.sky-sort-item.sky-dropdown-item-disabled{cursor:default}.sky-sort-item.sky-dropdown-item-disabled:hover{background-color:transparent}.sky-sort-item ::ng-deep>button{background-color:transparent;border:none;color:#212327;cursor:pointer;display:block;padding:3px 20px;text-align:left;width:100%}.sky-sort-item ::ng-deep>button[disabled]{color:#686c73}.sky-sort-item ::ng-deep>button[disabled]:hover{cursor:default}.sky-sort-item-selected{background-color:#f1eef6;padding:4px;margin:0}:host-context(.sky-theme-modern) .sky-sort-item{margin:0 0 10px;border:none;border-radius:0;font-weight:400;transition:box-shadow .15s;padding:10px 20px}:host-context(.sky-theme-modern) .sky-sort-item:hover:not(.sky-btn-tab-disabled):not(.sky-btn-tab-selected):not(.sky-dropdown-button-type-tab):not(:focus){background-color:transparent;border-bottom:solid 1px #00b4f1;padding-bottom:9px}:host-context(.sky-theme-modern) .sky-sort-item:focus{background-color:transparent;outline:none}:host-context(.sky-theme-modern) .sky-sort-item:focus:not(:active){outline:solid 2px #1870B8;outline-offset:-2px;box-shadow:0 1px 8px #0000004d}:host-context(.sky-theme-modern) .sky-sort-item:active{border-bottom:solid 3px #00b4f1;padding-bottom:7px}:host-context(.sky-theme-modern) .sky-sort-item:hover:not(.sky-btn-tab-disabled){background-color:transparent;border-bottom:none;outline:solid 1px #1870B8;outline-offset:-1px}:host-context(.sky-theme-modern) .sky-sort-item:focus:not(:active){background-color:transparent;box-shadow:0 1px 8px #0000004d;outline:solid 2px #1870B8;outline-offset:-2px}:host-context(.sky-theme-modern) .sky-sort-item button{padding:0;color:#686c73}:host-context(.sky-theme-modern) .sky-sort-item-selected{color:#212327;border-bottom:none;border-left:solid 3px #1870B8;padding-bottom:10px;padding-left:13px;padding-left:calc(20px - 3px);background-color:inherit}:host-context(.sky-theme-modern) .sky-sort-item-selected button{font-weight:400;color:#212327}.sky-theme-modern .sky-sort-item{margin:0 0 10px;border:none;border-radius:0;font-weight:400;transition:box-shadow .15s;padding:10px 20px}.sky-theme-modern .sky-sort-item:hover:not(.sky-btn-tab-disabled):not(.sky-btn-tab-selected):not(.sky-dropdown-button-type-tab):not(:focus){background-color:transparent;border-bottom:solid 1px #00b4f1;padding-bottom:9px}.sky-theme-modern .sky-sort-item:focus{background-color:transparent;outline:none}.sky-theme-modern .sky-sort-item:focus:not(:active){outline:solid 2px #1870B8;outline-offset:-2px;box-shadow:0 1px 8px #0000004d}.sky-theme-modern .sky-sort-item:active{border-bottom:solid 3px #00b4f1;padding-bottom:7px}.sky-theme-modern .sky-sort-item:hover:not(.sky-btn-tab-disabled){background-color:transparent;border-bottom:none;outline:solid 1px #1870B8;outline-offset:-1px}.sky-theme-modern .sky-sort-item:focus:not(:active){background-color:transparent;box-shadow:0 1px 8px #0000004d;outline:solid 2px #1870B8;outline-offset:-2px}.sky-theme-modern .sky-sort-item button{padding:0;color:#686c73}.sky-theme-modern .sky-sort-item-selected{color:#212327;border-bottom:none;border-left:solid 3px #1870B8;padding-bottom:10px;padding-left:13px;padding-left:calc(20px - 3px);background-color:inherit}.sky-theme-modern .sky-sort-item-selected button{font-weight:400;color:#212327}:host-context(.sky-theme-modern.sky-theme-mode-dark) .sky-sort-item button{color:#c0c2c5}:host-context(.sky-theme-modern.sky-theme-mode-dark) .sky-sort-item-selected button{color:#fbfcfe}.sky-theme-modern.sky-theme-mode-dark .sky-sort-item button{color:#c0c2c5}.sky-theme-modern.sky-theme-mode-dark .sky-sort-item-selected button{color:#fbfcfe}\n"], directives: [{ type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }], pipes: { "async": i2.AsyncPipe }, changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
52
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkySortItemComponent, decorators: [{
|
|
52
53
|
type: Component,
|
|
53
54
|
args: [{
|
|
54
55
|
selector: 'sky-sort-item',
|
|
@@ -61,4 +62,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImpo
|
|
|
61
62
|
}], itemSelect: [{
|
|
62
63
|
type: Output
|
|
63
64
|
}] } });
|
|
64
|
-
//# sourceMappingURL=
|
|
65
|
+
//# sourceMappingURL=sort-item.component.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sort-item.component.js","sourceRoot":"","sources":["../../../../../../../../libs/components/lists/src/lib/modules/sort/sort-item.component.ts","../../../../../../../../libs/components/lists/src/lib/modules/sort/sort-item.component.html"],"names":[],"mappings":"AAAA,OAAO,EACL,uBAAuB,EACvB,iBAAiB,EACjB,SAAS,EACT,YAAY,EACZ,KAAK,EACL,MAAM,GAKP,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,eAAe,EAAgB,MAAM,MAAM,CAAC;AAErD,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;;;;AAEhD,MAAM,mBAAmB,GAAG,gBAAgB,CAAC;AAE7C,IAAI,gBAAgB,GAAW,CAAC,CAAC;AAQjC,MAAM,OAAO,oBAAoB;IAqB/B,YACU,WAA2B,EAC3B,QAA2B;QAD3B,gBAAW,GAAX,WAAW,CAAgB;QAC3B,aAAQ,GAAR,QAAQ,CAAmB;QAhBrC;;WAEG;QAEI,eAAU,GAAsB,IAAI,YAAY,EAAE,CAAC;QAEnD,eAAU,GAA6B,IAAI,eAAe,CAC/D,KAAK,CACN,CAAC;IASC,CAAC;IAEG,QAAQ;QACb,gBAAgB,EAAE,CAAC;QACnB,IAAI,CAAC,UAAU,GAAG,mBAAmB,GAAG,gBAAgB,CAAC,QAAQ,EAAE,CAAC;QACpE,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,WAAW,CAAC,YAAY,CAAC,SAAS,CACzD,CAAC,MAAc,EAAE,EAAE;YACjB,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,MAAM,KAAK,IAAI,CAAC,UAAU,CAAC,CAAC;YACjD,IAAI,CAAC,QAAQ,CAAC,aAAa,EAAE,CAAC;QAChC,CAAC,CACF,CAAC;QAEF,IAAI,IAAI,CAAC,MAAM,EAAE;YACf,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;SAC9C;IACH,CAAC;IAEM,WAAW,CAAC,OAAsB;QACvC,IACE,OAAO;YACP,OAAO,CAAC,QAAQ,CAAC;YACjB,OAAO,CAAC,QAAQ,CAAC,CAAC,YAAY;YAC9B,OAAO,CAAC,QAAQ,CAAC,CAAC,YAAY,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAC,aAAa,EAClE;YACA,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;SAC9C;IACH,CAAC;IAEM,WAAW;QAChB,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAC7C,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE,CAAC;IACzB,CAAC;IAEM,WAAW;QAChB,0BAA0B;QAC1B,kBAAkB;QAClB,IAAI,IAAI,CAAC,YAAY,EAAE;YACrB,IAAI,CAAC,YAAY,CAAC,WAAW,EAAE,CAAC;SACjC;IACH,CAAC;;kHA/DU,oBAAoB;sGAApB,oBAAoB,+IC3BjC,wWAcA;4FDaa,oBAAoB;kBANhC,SAAS;mBAAC;oBACT,QAAQ,EAAE,eAAe;oBACzB,SAAS,EAAE,CAAC,4BAA4B,CAAC;oBACzC,WAAW,EAAE,4BAA4B;oBACzC,eAAe,EAAE,uBAAuB,CAAC,MAAM;iBAChD;qIAMQ,MAAM;sBADZ,KAAK;gBAOC,UAAU;sBADhB,MAAM","sourcesContent":["import {\n ChangeDetectionStrategy,\n ChangeDetectorRef,\n Component,\n EventEmitter,\n Input,\n Output,\n OnChanges,\n OnDestroy,\n OnInit,\n SimpleChanges,\n} from '@angular/core';\n\nimport { BehaviorSubject, Subscription } from 'rxjs';\n\nimport { SkySortService } from './sort.service';\n\nconst SORT_ITEM_ID_PREFIX = 'sky-sort-item-';\n\nlet sortItemIdNumber: number = 0;\n\n@Component({\n selector: 'sky-sort-item',\n styleUrls: ['./sort-item.component.scss'],\n templateUrl: './sort-item.component.html',\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class SkySortItemComponent implements OnInit, OnChanges, OnDestroy {\n /**\n * Indicates whether the sorting option is active.\n */\n @Input()\n public active: boolean;\n\n /**\n * Fires when a sort item is selected.\n */\n @Output()\n public itemSelect: EventEmitter<any> = new EventEmitter();\n\n public isSelected: BehaviorSubject<boolean> = new BehaviorSubject<boolean>(\n false\n );\n\n private subscription: Subscription;\n\n private sortItemId: string;\n\n constructor(\n private sortService: SkySortService,\n private detector: ChangeDetectorRef\n ) {}\n\n public ngOnInit() {\n sortItemIdNumber++;\n this.sortItemId = SORT_ITEM_ID_PREFIX + sortItemIdNumber.toString();\n this.subscription = this.sortService.selectedItem.subscribe(\n (itemId: string) => {\n this.isSelected.next(itemId === this.sortItemId);\n this.detector.detectChanges();\n }\n );\n\n if (this.active) {\n this.sortService.selectItem(this.sortItemId);\n }\n }\n\n public ngOnChanges(changes: SimpleChanges) {\n if (\n changes &&\n changes['active'] &&\n changes['active'].currentValue &&\n changes['active'].currentValue !== changes['active'].previousValue\n ) {\n this.sortService.selectItem(this.sortItemId);\n }\n }\n\n public itemClicked() {\n this.sortService.selectItem(this.sortItemId);\n this.itemSelect.emit();\n }\n\n public ngOnDestroy() {\n /* istanbul ignore else */\n /* sanity check */\n if (this.subscription) {\n this.subscription.unsubscribe();\n }\n }\n}\n","<div\n class=\"sky-sort-item\"\n role=\"menuitemradio\"\n [attr.aria-checked]=\"isSelected | async\"\n [ngClass]=\"{ 'sky-sort-item-selected': (isSelected | async) }\"\n>\n <button\n type=\"button\"\n [ngClass]=\"{ 'sky-emphasized': (isSelected | async) }\"\n (click)=\"itemClicked()\"\n >\n <ng-content></ng-content>\n </button>\n</div>\n"]}
|