@skyux/list-builder-view-checklist 5.0.1 → 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-list-builder-view-checklist.umd.js +20 -20
- package/documentation.json +9468 -372
- package/esm2015/index.js +15 -0
- package/esm2015/index.js.map +1 -0
- package/esm2015/{modules → lib/modules}/list-view-checklist/list-view-checklist-item.component.js +5 -4
- package/esm2015/lib/modules/list-view-checklist/list-view-checklist-item.component.js.map +1 -0
- package/esm2015/lib/modules/list-view-checklist/list-view-checklist.component.js +294 -0
- package/esm2015/lib/modules/list-view-checklist/list-view-checklist.component.js.map +1 -0
- package/esm2015/lib/modules/list-view-checklist/list-view-checklist.module.js +25 -0
- package/esm2015/lib/modules/list-view-checklist/list-view-checklist.module.js.map +1 -0
- package/esm2015/lib/modules/list-view-checklist/state/checklist-state-action.type.js +2 -0
- package/esm2015/lib/modules/list-view-checklist/state/checklist-state-action.type.js.map +1 -0
- package/esm2015/lib/modules/list-view-checklist/state/checklist-state.model.js +7 -0
- package/esm2015/lib/modules/list-view-checklist/state/checklist-state.model.js.map +1 -0
- package/esm2015/lib/modules/list-view-checklist/state/checklist-state.rxstate.js +13 -0
- package/esm2015/lib/modules/list-view-checklist/state/checklist-state.rxstate.js.map +1 -0
- package/esm2015/lib/modules/list-view-checklist/state/checklist-state.state-node.js +20 -0
- package/esm2015/lib/modules/list-view-checklist/state/checklist-state.state-node.js.map +1 -0
- package/esm2015/lib/modules/list-view-checklist/state/items/item.model.js +10 -0
- package/esm2015/lib/modules/list-view-checklist/state/items/item.model.js.map +1 -0
- package/esm2015/lib/modules/list-view-checklist/state/items/items.orchestrator.js +19 -0
- package/esm2015/lib/modules/list-view-checklist/state/items/items.orchestrator.js.map +1 -0
- package/esm2015/lib/modules/list-view-checklist/state/items/load.action.js +9 -0
- package/esm2015/lib/modules/list-view-checklist/state/items/load.action.js.map +1 -0
- package/esm2015/skyux-list-builder-view-checklist.js +2 -2
- package/esm2015/skyux-list-builder-view-checklist.js.map +1 -0
- package/esm2015/testing/list-view-checklist-fixture.js +1 -1
- package/esm2015/testing/list-view-checklist-fixture.js.map +1 -0
- package/esm2015/testing/list-view-checklist-item.js +1 -1
- package/esm2015/testing/list-view-checklist-item.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-list-builder-view-checklist-testing.js +1 -1
- package/esm2015/testing/skyux-list-builder-view-checklist-testing.js.map +1 -0
- package/fesm2015/skyux-list-builder-view-checklist-testing.js.map +1 -1
- package/fesm2015/skyux-list-builder-view-checklist.js +27 -27
- package/fesm2015/skyux-list-builder-view-checklist.js.map +1 -1
- package/index.d.ts +10 -0
- package/{modules → lib/modules}/list-view-checklist/list-view-checklist-item.component.d.ts +0 -0
- package/{modules → lib/modules}/list-view-checklist/list-view-checklist.component.d.ts +4 -4
- package/{modules → lib/modules}/list-view-checklist/list-view-checklist.module.d.ts +0 -0
- package/{modules → lib/modules}/list-view-checklist/state/checklist-state-action.type.d.ts +0 -0
- package/{modules → lib/modules}/list-view-checklist/state/checklist-state.model.d.ts +0 -0
- package/{modules → lib/modules}/list-view-checklist/state/checklist-state.rxstate.d.ts +0 -0
- package/{modules → lib/modules}/list-view-checklist/state/checklist-state.state-node.d.ts +0 -0
- package/{modules → lib/modules}/list-view-checklist/state/items/item.model.d.ts +0 -0
- package/{modules → lib/modules}/list-view-checklist/state/items/items.orchestrator.d.ts +0 -0
- package/{modules → lib/modules}/list-view-checklist/state/items/load.action.d.ts +0 -0
- package/package.json +22 -8
- package/skyux-list-builder-view-checklist.d.ts +1 -1
- package/LICENSE +0 -21
- package/bundles/skyux-list-builder-view-checklist-testing.umd.js.map +0 -1
- package/bundles/skyux-list-builder-view-checklist.umd.js.map +0 -1
- package/esm2015/modules/list-view-checklist/list-view-checklist.component.js +0 -294
- package/esm2015/modules/list-view-checklist/list-view-checklist.module.js +0 -25
- package/esm2015/modules/list-view-checklist/state/checklist-state-action.type.js +0 -2
- package/esm2015/modules/list-view-checklist/state/checklist-state.model.js +0 -7
- package/esm2015/modules/list-view-checklist/state/checklist-state.rxstate.js +0 -13
- package/esm2015/modules/list-view-checklist/state/checklist-state.state-node.js +0 -18
- package/esm2015/modules/list-view-checklist/state/items/item.model.js +0 -10
- package/esm2015/modules/list-view-checklist/state/items/items.orchestrator.js +0 -19
- package/esm2015/modules/list-view-checklist/state/items/load.action.js +0 -9
- package/esm2015/public-api.js +0 -15
- package/public-api.d.ts +0 -10
package/esm2015/index.js
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export * from './lib/modules/list-view-checklist/list-view-checklist.module';
|
|
2
|
+
export * from './lib/modules/list-view-checklist/state/checklist-state-action.type';
|
|
3
|
+
export * from './lib/modules/list-view-checklist/state/checklist-state.model';
|
|
4
|
+
export * from './lib/modules/list-view-checklist/state/checklist-state.rxstate';
|
|
5
|
+
export * from './lib/modules/list-view-checklist/state/checklist-state.state-node';
|
|
6
|
+
export * from './lib/modules/list-view-checklist/state/items/item.model';
|
|
7
|
+
export * from './lib/modules/list-view-checklist/state/items/items.orchestrator';
|
|
8
|
+
export * from './lib/modules/list-view-checklist/state/items/load.action';
|
|
9
|
+
// The following export is used internally by `@skyux/select-field`.
|
|
10
|
+
// TODO: Find a way to remove this in the next major version release.
|
|
11
|
+
export * from './lib/modules/list-view-checklist/list-view-checklist.component';
|
|
12
|
+
// Components and directives must be exported to support Angular’s “partial” Ivy compiler.
|
|
13
|
+
// Obscure names are used to indicate types are not part of the public API.
|
|
14
|
+
export { SkyListViewChecklistItemComponent as λ1 } from './lib/modules/list-view-checklist/list-view-checklist-item.component';
|
|
15
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../libs/components/list-builder-view-checklist/src/index.ts"],"names":[],"mappings":"AAAA,cAAc,8DAA8D,CAAC;AAC7E,cAAc,qEAAqE,CAAC;AACpF,cAAc,+DAA+D,CAAC;AAC9E,cAAc,iEAAiE,CAAC;AAChF,cAAc,oEAAoE,CAAC;AACnF,cAAc,0DAA0D,CAAC;AACzE,cAAc,kEAAkE,CAAC;AACjF,cAAc,2DAA2D,CAAC;AAE1E,oEAAoE;AACpE,qEAAqE;AACrE,cAAc,iEAAiE,CAAC;AAEhF,0FAA0F;AAC1F,2EAA2E;AAC3E,OAAO,EAAE,iCAAiC,IAAI,EAAE,EAAE,MAAM,sEAAsE,CAAC","sourcesContent":["export * from './lib/modules/list-view-checklist/list-view-checklist.module';\nexport * from './lib/modules/list-view-checklist/state/checklist-state-action.type';\nexport * from './lib/modules/list-view-checklist/state/checklist-state.model';\nexport * from './lib/modules/list-view-checklist/state/checklist-state.rxstate';\nexport * from './lib/modules/list-view-checklist/state/checklist-state.state-node';\nexport * from './lib/modules/list-view-checklist/state/items/item.model';\nexport * from './lib/modules/list-view-checklist/state/items/items.orchestrator';\nexport * from './lib/modules/list-view-checklist/state/items/load.action';\n\n// The following export is used internally by `@skyux/select-field`.\n// TODO: Find a way to remove this in the next major version release.\nexport * from './lib/modules/list-view-checklist/list-view-checklist.component';\n\n// Components and directives must be exported to support Angular’s “partial” Ivy compiler.\n// Obscure names are used to indicate types are not part of the public API.\nexport { SkyListViewChecklistItemComponent as λ1 } from './lib/modules/list-view-checklist/list-view-checklist-item.component';\n"]}
|
package/esm2015/{modules → lib/modules}/list-view-checklist/list-view-checklist-item.component.js
RENAMED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { Component, Input, ChangeDetectionStrategy } from '@angular/core';
|
|
2
|
+
import { ListViewChecklistItemModel } from './state/items/item.model';
|
|
2
3
|
import * as i0 from "@angular/core";
|
|
3
4
|
export class SkyListViewChecklistItemComponent {
|
|
4
5
|
}
|
|
5
|
-
SkyListViewChecklistItemComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.
|
|
6
|
-
SkyListViewChecklistItemComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.
|
|
7
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.
|
|
6
|
+
SkyListViewChecklistItemComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyListViewChecklistItemComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
7
|
+
SkyListViewChecklistItemComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: SkyListViewChecklistItemComponent, selector: "sky-list-view-checklist-item", inputs: { item: "item" }, ngImport: i0, template: "<div class=\"sky-list-view-checklist-item\">\n <ng-content></ng-content>\n</div>\n", styles: [".sky-list-view-checklist-item{display:block;width:100%;cursor:pointer;word-wrap:break-word}.sky-list-view-checklist-item:last-child{border-bottom-width:0}.sky-list-view-checklist-item ::ng-deep sky-checkbox{display:block;position:relative;width:100%;padding:10px;cursor:pointer;border-bottom:1px dotted #cdcfd2}.sky-list-view-checklist-item ::ng-deep sky-checkbox-label div{overflow:hidden;text-overflow:ellipsis}.sky-list-view-checklist-item ::ng-deep .sky-list-view-checklist-single-button{background-color:transparent;border:none;border-bottom:1px dotted #cdcfd2;display:block;text-align:left;margin-bottom:0;padding:10px;width:100%;cursor:pointer}.sky-list-view-checklist-item ::ng-deep .sky-list-view-checklist-single-button.sky-list-view-checklist-row-selected{background-color:#f1eef6}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
8
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyListViewChecklistItemComponent, decorators: [{
|
|
8
9
|
type: Component,
|
|
9
10
|
args: [{
|
|
10
11
|
selector: 'sky-list-view-checklist-item',
|
|
@@ -15,4 +16,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.13", ngImpo
|
|
|
15
16
|
}], propDecorators: { item: [{
|
|
16
17
|
type: Input
|
|
17
18
|
}] } });
|
|
18
|
-
//# sourceMappingURL=
|
|
19
|
+
//# sourceMappingURL=list-view-checklist-item.component.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list-view-checklist-item.component.js","sourceRoot":"","sources":["../../../../../../../../libs/components/list-builder-view-checklist/src/lib/modules/list-view-checklist/list-view-checklist-item.component.ts","../../../../../../../../libs/components/list-builder-view-checklist/src/lib/modules/list-view-checklist/list-view-checklist-item.component.html"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AAE1E,OAAO,EAAE,0BAA0B,EAAE,MAAM,0BAA0B,CAAC;;AAQtE,MAAM,OAAO,iCAAiC;;+HAAjC,iCAAiC;mHAAjC,iCAAiC,8FCV9C,qFAGA;4FDOa,iCAAiC;kBAN7C,SAAS;mBAAC;oBACT,QAAQ,EAAE,8BAA8B;oBACxC,WAAW,EAAE,2CAA2C;oBACxD,SAAS,EAAE,CAAC,2CAA2C,CAAC;oBACxD,eAAe,EAAE,uBAAuB,CAAC,MAAM;iBAChD;8BAGQ,IAAI;sBADV,KAAK","sourcesContent":["import { Component, Input, ChangeDetectionStrategy } from '@angular/core';\n\nimport { ListViewChecklistItemModel } from './state/items/item.model';\n\n@Component({\n selector: 'sky-list-view-checklist-item',\n templateUrl: './list-view-checklist-item.component.html',\n styleUrls: ['./list-view-checklist-item.component.scss'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class SkyListViewChecklistItemComponent {\n @Input()\n public item: ListViewChecklistItemModel;\n}\n","<div class=\"sky-list-view-checklist-item\">\n <ng-content></ng-content>\n</div>\n"]}
|
|
@@ -0,0 +1,294 @@
|
|
|
1
|
+
import { ChangeDetectionStrategy, Component, forwardRef, Input, } from '@angular/core';
|
|
2
|
+
import { ListState, ListStateDispatcher, ListFilterModel, ListSelectedSetItemSelectedAction, ListSelectedSetItemsSelectedAction, ListToolbarSetTypeAction, ListViewComponent, } from '@skyux/list-builder';
|
|
3
|
+
import { getData, } from '@skyux/list-builder-common';
|
|
4
|
+
import { Subject } from 'rxjs';
|
|
5
|
+
import { distinctUntilChanged, map as observableMap, take, takeUntil, } from 'rxjs/operators';
|
|
6
|
+
import { ChecklistState } from './state/checklist-state.state-node';
|
|
7
|
+
import { ChecklistStateDispatcher } from './state/checklist-state.rxstate';
|
|
8
|
+
import { ChecklistStateModel } from './state/checklist-state.model';
|
|
9
|
+
import { ListViewChecklistItemsLoadAction } from './state/items/load.action';
|
|
10
|
+
import { ListViewChecklistItemModel } from './state/items/item.model';
|
|
11
|
+
import * as i0 from "@angular/core";
|
|
12
|
+
import * as i1 from "@skyux/list-builder";
|
|
13
|
+
import * as i2 from "./state/checklist-state.state-node";
|
|
14
|
+
import * as i3 from "./state/checklist-state.rxstate";
|
|
15
|
+
import * as i4 from "./list-view-checklist-item.component";
|
|
16
|
+
import * as i5 from "@skyux/forms";
|
|
17
|
+
import * as i6 from "@angular/common";
|
|
18
|
+
export class SkyListViewChecklistComponent extends ListViewComponent {
|
|
19
|
+
constructor(state, dispatcher, checklistState, checklistDispatcher) {
|
|
20
|
+
super(state, 'Checklist View');
|
|
21
|
+
this.dispatcher = dispatcher;
|
|
22
|
+
this.checklistState = checklistState;
|
|
23
|
+
this.checklistDispatcher = checklistDispatcher;
|
|
24
|
+
/**
|
|
25
|
+
* Specifies a search function to apply on the view data.
|
|
26
|
+
* The default function searches view data on label, description,
|
|
27
|
+
* and category if field selectors are defined for the given field.
|
|
28
|
+
* @default default search function
|
|
29
|
+
*/
|
|
30
|
+
this.search = this.searchFunction();
|
|
31
|
+
/**
|
|
32
|
+
* Specifies the name of the label field selector.
|
|
33
|
+
* @default "label"
|
|
34
|
+
*/
|
|
35
|
+
// eslint-disable-next-line @angular-eslint/no-input-rename
|
|
36
|
+
this.labelFieldSelector = 'label';
|
|
37
|
+
/**
|
|
38
|
+
* Specifies the name of the description field selector.
|
|
39
|
+
* @default "description"
|
|
40
|
+
*/
|
|
41
|
+
this.description = 'description';
|
|
42
|
+
this.ngUnsubscribe = new Subject();
|
|
43
|
+
this._selectMode = 'multiple';
|
|
44
|
+
this._selectedIdMap = new Map();
|
|
45
|
+
this._showOnlySelected = false;
|
|
46
|
+
let lastUpdate;
|
|
47
|
+
this.state
|
|
48
|
+
.pipe(observableMap((s) => s.items), distinctUntilChanged(), observableMap((items) => {
|
|
49
|
+
let dataChanged = lastUpdate === undefined || items.lastUpdate !== lastUpdate;
|
|
50
|
+
lastUpdate = items.lastUpdate;
|
|
51
|
+
let newItems = items.items.map((item) => {
|
|
52
|
+
return new ListViewChecklistItemModel(item.id, {
|
|
53
|
+
label: this.labelFieldSelector
|
|
54
|
+
? getData(item.data, this.labelFieldSelector)
|
|
55
|
+
: undefined,
|
|
56
|
+
description: this.description
|
|
57
|
+
? getData(item.data, this.description)
|
|
58
|
+
: undefined,
|
|
59
|
+
});
|
|
60
|
+
});
|
|
61
|
+
this.checklistDispatcher.next(new ListViewChecklistItemsLoadAction(newItems, true, dataChanged, items.count));
|
|
62
|
+
}))
|
|
63
|
+
.pipe(takeUntil(this.ngUnsubscribe))
|
|
64
|
+
.subscribe();
|
|
65
|
+
this.state
|
|
66
|
+
.pipe(observableMap((t) => t.selected), takeUntil(this.ngUnsubscribe))
|
|
67
|
+
.subscribe((selectedItems) => {
|
|
68
|
+
this._selectedIdMap = selectedItems.item.selectedIdMap;
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Specifies the name of the view.
|
|
73
|
+
* @required
|
|
74
|
+
*/
|
|
75
|
+
set name(value) {
|
|
76
|
+
this.viewName = value;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Specifies how many items users can select.
|
|
80
|
+
* `"single"` allows users to select one item in the checklist, while `"multiple"`
|
|
81
|
+
* allows users to select multiple items in the checklist.
|
|
82
|
+
* @default "multiple"
|
|
83
|
+
*/
|
|
84
|
+
set selectMode(value) {
|
|
85
|
+
this._selectMode = value;
|
|
86
|
+
if (this.selectMode === 'multiple') {
|
|
87
|
+
this.dispatcher.toolbarShowMultiselectToolbar(true);
|
|
88
|
+
}
|
|
89
|
+
else {
|
|
90
|
+
this.showOnlySelected = false;
|
|
91
|
+
this.dispatcher.toolbarShowMultiselectToolbar(false);
|
|
92
|
+
}
|
|
93
|
+
this.reapplyFilter(this.showOnlySelected);
|
|
94
|
+
}
|
|
95
|
+
get selectMode() {
|
|
96
|
+
return this._selectMode || 'multiple';
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Indicates whether to display selected items only.
|
|
100
|
+
* @default false
|
|
101
|
+
*/
|
|
102
|
+
set showOnlySelected(value) {
|
|
103
|
+
this._showOnlySelected = value;
|
|
104
|
+
}
|
|
105
|
+
get showOnlySelected() {
|
|
106
|
+
return this._showOnlySelected;
|
|
107
|
+
}
|
|
108
|
+
ngOnInit() {
|
|
109
|
+
if (this.selectMode === 'multiple') {
|
|
110
|
+
this.dispatcher.toolbarShowMultiselectToolbar(true);
|
|
111
|
+
}
|
|
112
|
+
// If 'show-selected' filter is changed from multiselect toolbar (list-builder)
|
|
113
|
+
// make sure the private variable _showOnlySelected stays in sync.
|
|
114
|
+
this.state
|
|
115
|
+
.pipe(observableMap((t) => t.filters), takeUntil(this.ngUnsubscribe), distinctUntilChanged(this.showSelectedValuesEqual))
|
|
116
|
+
.subscribe((filters) => {
|
|
117
|
+
const showSelectedFilter = filters.find((filter) => filter.name === 'show-selected');
|
|
118
|
+
if (showSelectedFilter) {
|
|
119
|
+
this._showOnlySelected = showSelectedFilter.value === 'true';
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
ngOnChanges(changes) {
|
|
124
|
+
if (changes['showOnlySelected'] &&
|
|
125
|
+
changes['showOnlySelected'].currentValue !==
|
|
126
|
+
changes['showOnlySelected'].previousValue) {
|
|
127
|
+
this.reapplyFilter(changes['showOnlySelected'].currentValue);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* @deprecated since version 3.2.0
|
|
132
|
+
* Multiselect toolbar will automatically show if select mode is set to 'multiple'.
|
|
133
|
+
* These methods are no longer needed, as that functionality is part of list-builder.
|
|
134
|
+
*/
|
|
135
|
+
changeVisibleItems(change) {
|
|
136
|
+
this.showOnlySelected = change.checked;
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* @deprecated since version 3.2.0
|
|
140
|
+
* Multiselect toolbar will automatically show if select mode is set to 'multiple'.
|
|
141
|
+
* These methods are no longer needed, as that functionality is part of list-builder.
|
|
142
|
+
*/
|
|
143
|
+
clearSelections() {
|
|
144
|
+
this.state
|
|
145
|
+
.pipe(observableMap((state) => state.items.items), take(1))
|
|
146
|
+
.subscribe((items) => {
|
|
147
|
+
this.dispatcher.next(new ListSelectedSetItemsSelectedAction(items.map((item) => item.id), false, false));
|
|
148
|
+
/* istanbul ignore else */
|
|
149
|
+
if (this.showOnlySelected) {
|
|
150
|
+
this.reapplyFilter(this.showOnlySelected);
|
|
151
|
+
}
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* @deprecated since version 3.2.0
|
|
156
|
+
* Multiselect toolbar will automatically show if select mode is set to 'multiple'.
|
|
157
|
+
* These methods are no longer needed, as that functionality is part of list-builder.
|
|
158
|
+
*/
|
|
159
|
+
selectAll() {
|
|
160
|
+
this.state
|
|
161
|
+
.pipe(observableMap((state) => state.items.items), take(1))
|
|
162
|
+
.subscribe((items) => {
|
|
163
|
+
this.dispatcher.next(new ListSelectedSetItemsSelectedAction(items.map((item) => item.id), true, false));
|
|
164
|
+
/* istanbul ignore else */
|
|
165
|
+
if (this.showOnlySelected) {
|
|
166
|
+
this.reapplyFilter(this.showOnlySelected);
|
|
167
|
+
}
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
onViewActive() {
|
|
171
|
+
if (this.search !== undefined) {
|
|
172
|
+
this.dispatcher.searchSetFunctions([this.search]);
|
|
173
|
+
}
|
|
174
|
+
let fieldSelectors = [];
|
|
175
|
+
if (this.labelFieldSelector) {
|
|
176
|
+
fieldSelectors.push(this.labelFieldSelector);
|
|
177
|
+
}
|
|
178
|
+
if (this.description) {
|
|
179
|
+
fieldSelectors.push(this.description);
|
|
180
|
+
}
|
|
181
|
+
this.dispatcher.searchSetFieldSelectors(fieldSelectors);
|
|
182
|
+
this.dispatcher.next(new ListToolbarSetTypeAction('search'));
|
|
183
|
+
}
|
|
184
|
+
ngOnDestroy() {
|
|
185
|
+
this.ngUnsubscribe.next();
|
|
186
|
+
this.ngUnsubscribe.complete();
|
|
187
|
+
}
|
|
188
|
+
get items() {
|
|
189
|
+
return this.checklistState.pipe(observableMap((state) => state.items.items));
|
|
190
|
+
}
|
|
191
|
+
searchFunction() {
|
|
192
|
+
return (data, searchText) => {
|
|
193
|
+
if (this.labelFieldSelector !== undefined) {
|
|
194
|
+
let label = getData(data, this.labelFieldSelector);
|
|
195
|
+
if (label !== undefined &&
|
|
196
|
+
label !== null &&
|
|
197
|
+
label.toString().toLowerCase().indexOf(searchText) !== -1) {
|
|
198
|
+
return true;
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
if (this.description !== undefined) {
|
|
202
|
+
let description = getData(data, this.description);
|
|
203
|
+
if (description !== undefined &&
|
|
204
|
+
description !== null &&
|
|
205
|
+
description.toString().toLowerCase().indexOf(searchText) !== -1) {
|
|
206
|
+
return true;
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
return false;
|
|
210
|
+
};
|
|
211
|
+
}
|
|
212
|
+
itemSelected(id) {
|
|
213
|
+
return this.state.pipe(observableMap((state) => state.selected.item.selectedIdMap.get(id)));
|
|
214
|
+
}
|
|
215
|
+
setItemSelection(item, event) {
|
|
216
|
+
this.dispatcher.next(new ListSelectedSetItemSelectedAction(item.id, event.checked));
|
|
217
|
+
}
|
|
218
|
+
singleSelectRowClick(item) {
|
|
219
|
+
this.dispatcher.next(new ListSelectedSetItemsSelectedAction([item.id], true, true));
|
|
220
|
+
}
|
|
221
|
+
getShowSelectedFilter(isSelected) {
|
|
222
|
+
return new ListFilterModel({
|
|
223
|
+
name: 'show-selected',
|
|
224
|
+
value: isSelected.toString(),
|
|
225
|
+
filterFunction: (model, showOnlySelected) => {
|
|
226
|
+
/* istanbul ignore else */
|
|
227
|
+
if (showOnlySelected.toString() !== false.toString()) {
|
|
228
|
+
return this._selectedIdMap.get(model.id);
|
|
229
|
+
}
|
|
230
|
+
},
|
|
231
|
+
defaultValue: false.toString(),
|
|
232
|
+
});
|
|
233
|
+
}
|
|
234
|
+
reapplyFilter(isSelected) {
|
|
235
|
+
let self = this;
|
|
236
|
+
this.state
|
|
237
|
+
.pipe(observableMap((state) => state.filters), take(1))
|
|
238
|
+
.subscribe((filters) => {
|
|
239
|
+
filters = filters.filter((filter) => filter.name !== 'show-selected');
|
|
240
|
+
filters.push(self.getShowSelectedFilter(isSelected));
|
|
241
|
+
this.dispatcher.filtersUpdate(filters);
|
|
242
|
+
});
|
|
243
|
+
}
|
|
244
|
+
showSelectedValuesEqual(prev, next) {
|
|
245
|
+
const prevShowSelectedFilter = prev.find((filter) => filter.name === 'show-selected');
|
|
246
|
+
const nextShowSelectedFilter = next.find((filter) => filter.name === 'show-selected');
|
|
247
|
+
if (prevShowSelectedFilter && nextShowSelectedFilter) {
|
|
248
|
+
return prevShowSelectedFilter.value === nextShowSelectedFilter.value;
|
|
249
|
+
}
|
|
250
|
+
return true;
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
SkyListViewChecklistComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyListViewChecklistComponent, deps: [{ token: i1.ListState }, { token: i1.ListStateDispatcher }, { token: i2.ChecklistState }, { token: i3.ChecklistStateDispatcher }], target: i0.ɵɵFactoryTarget.Component });
|
|
254
|
+
SkyListViewChecklistComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: SkyListViewChecklistComponent, selector: "sky-list-view-checklist", inputs: { name: "name", search: "search", labelFieldSelector: ["label", "labelFieldSelector"], description: "description", selectMode: "selectMode", showOnlySelected: "showOnlySelected" }, providers: [
|
|
255
|
+
{
|
|
256
|
+
provide: ListViewComponent,
|
|
257
|
+
useExisting: forwardRef(() => SkyListViewChecklistComponent),
|
|
258
|
+
},
|
|
259
|
+
ChecklistState,
|
|
260
|
+
ChecklistStateDispatcher,
|
|
261
|
+
ChecklistStateModel,
|
|
262
|
+
], usesInheritance: true, usesOnChanges: true, ngImport: i0, template: "<div class=\"sky-list-view-checklist\" *ngIf=\"active | async\">\n <div [ngSwitch]=\"selectMode\">\n <ng-template ngSwitchCase=\"single\">\n <div role=\"radiogroup\">\n <sky-list-view-checklist-item\n *ngFor=\"let item of items | async\"\n [attr.sky-cmp-id]=\"item.id\"\n [item]=\"item\"\n >\n <button\n role=\"radio\"\n type=\"button\"\n class=\"sky-list-view-checklist-single-button\"\n [attr.aria-checked]=\"(itemSelected(item.id) | async) || false\"\n [ngClass]=\"{\n 'sky-list-view-checklist-row-selected':\n (itemSelected(item.id) | async)\n }\"\n (click)=\"singleSelectRowClick(item)\"\n >\n <div *ngIf=\"item.label\" class=\"sky-emphasized\">\n {{ item.label }}\n </div>\n <div *ngIf=\"item.description\">{{ item.description }}</div>\n </button>\n </sky-list-view-checklist-item>\n </div>\n </ng-template>\n\n <ng-template ngSwitchDefault>\n <sky-list-view-checklist-item\n *ngFor=\"let item of items | async\"\n [attr.sky-cmp-id]=\"item.id\"\n [item]=\"item\"\n >\n <sky-checkbox\n [checked]=\"itemSelected(item.id) | async\"\n (change)=\"setItemSelection(item, $event)\"\n >\n <sky-checkbox-label>\n <div\n *ngIf=\"item.label\"\n class=\"sky-emphasized\"\n [attr.title]=\"item.label\"\n >\n {{ item.label }}\n </div>\n <div *ngIf=\"item.description\" [attr.title]=\"item.description\">\n {{ item.description }}\n </div>\n </sky-checkbox-label>\n </sky-checkbox>\n </sky-list-view-checklist-item>\n </ng-template>\n </div>\n</div>\n", styles: [".sky-list-view-checklist ::ng-deep .sky-checkbox-wrapper{display:flex;align-items:flex-start}.sky-list-view-checklist ::ng-deep .sky-checkbox-wrapper>.sky-checkbox,.sky-list-view-checklist ::ng-deep .sky-checkbox-wrapper>input{flex:1;max-width:22px}.sky-list-view-checklist ::ng-deep .sky-switch{white-space:nowrap}.sky-list-view-checklist ::ng-deep .sky-switch-label{margin:0}.sky-list-view-checklist ::ng-deep sky-checkbox-label{min-width:0}.sky-list-view-checklist ::ng-deep .sky-switch-control{margin:0 5px 0 0}\n"], components: [{ type: i4.SkyListViewChecklistItemComponent, selector: "sky-list-view-checklist-item", inputs: ["item"] }, { type: i5.λ3, selector: "sky-checkbox", inputs: ["label", "labelledBy", "id", "disabled", "tabindex", "name", "icon", "checkboxType", "checked", "required"], outputs: ["change", "checkedChange", "disabledChange"] }, { type: i5.λ4, selector: "sky-checkbox-label" }], directives: [{ type: i6.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i6.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { type: i6.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { type: i6.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i6.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i6.NgSwitchDefault, selector: "[ngSwitchDefault]" }], pipes: { "async": i6.AsyncPipe }, changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
263
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyListViewChecklistComponent, decorators: [{
|
|
264
|
+
type: Component,
|
|
265
|
+
args: [{
|
|
266
|
+
selector: 'sky-list-view-checklist',
|
|
267
|
+
templateUrl: './list-view-checklist.component.html',
|
|
268
|
+
styleUrls: ['./list-view-checklist.component.scss'],
|
|
269
|
+
providers: [
|
|
270
|
+
{
|
|
271
|
+
provide: ListViewComponent,
|
|
272
|
+
useExisting: forwardRef(() => SkyListViewChecklistComponent),
|
|
273
|
+
},
|
|
274
|
+
ChecklistState,
|
|
275
|
+
ChecklistStateDispatcher,
|
|
276
|
+
ChecklistStateModel,
|
|
277
|
+
],
|
|
278
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
279
|
+
}]
|
|
280
|
+
}], ctorParameters: function () { return [{ type: i1.ListState }, { type: i1.ListStateDispatcher }, { type: i2.ChecklistState }, { type: i3.ChecklistStateDispatcher }]; }, propDecorators: { name: [{
|
|
281
|
+
type: Input
|
|
282
|
+
}], search: [{
|
|
283
|
+
type: Input
|
|
284
|
+
}], labelFieldSelector: [{
|
|
285
|
+
type: Input,
|
|
286
|
+
args: ['label']
|
|
287
|
+
}], description: [{
|
|
288
|
+
type: Input
|
|
289
|
+
}], selectMode: [{
|
|
290
|
+
type: Input
|
|
291
|
+
}], showOnlySelected: [{
|
|
292
|
+
type: Input
|
|
293
|
+
}] } });
|
|
294
|
+
//# sourceMappingURL=list-view-checklist.component.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list-view-checklist.component.js","sourceRoot":"","sources":["../../../../../../../../libs/components/list-builder-view-checklist/src/lib/modules/list-view-checklist/list-view-checklist.component.ts","../../../../../../../../libs/components/list-builder-view-checklist/src/lib/modules/list-view-checklist/list-view-checklist.component.html"],"names":[],"mappings":"AAAA,OAAO,EACL,uBAAuB,EACvB,SAAS,EACT,UAAU,EACV,KAAK,GAKN,MAAM,eAAe,CAAC;AAIvB,OAAO,EACL,SAAS,EACT,mBAAmB,EAEnB,eAAe,EACf,iCAAiC,EACjC,kCAAkC,EAClC,wBAAwB,EACxB,iBAAiB,GAClB,MAAM,qBAAqB,CAAC;AAE7B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AAe,CAC5C,CAAC;QACF,MAAM,sBAAsB,GAAG,IAAI,CAAC,IAAI,CACtC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,KAAK,eAAe,CAC5C,CAAC;QAEF,IAAI,sBAAsB,IAAI,sBAAsB,EAAE;YACpD,OAAO,sBAAsB,CAAC,KAAK,KAAK,sBAAsB,CAAC,KAAK,CAAC;SACtE;QAED,OAAO,IAAI,CAAC;IACd,CAAC;;2HA/VU,6BAA6B;+GAA7B,6BAA6B,+OAX7B;QACT;YACE,OAAO,EAAE,iBAAiB;YAC1B,WAAW,EAAE,UAAU,CAAC,GAAG,EAAE,CAAC,6BAA6B,CAAC;SAC7D;QACD,cAAc;QACd,wBAAwB;QACxB,mBAAmB;KACpB,sEC9DH,k3DAwDA;4FDSa,6BAA6B;kBAfzC,SAAS;mBAAC;oBACT,QAAQ,EAAE,yBAAyB;oBACnC,WAAW,EAAE,sCAAsC;oBACnD,SAAS,EAAE,CAAC,sCAAsC,CAAC;oBACnD,SAAS,EAAE;wBACT;4BACE,OAAO,EAAE,iBAAiB;4BAC1B,WAAW,EAAE,UAAU,CAAC,GAAG,EAAE,8BAA8B,CAAC;yBAC7D;wBACD,cAAc;wBACd,wBAAwB;wBACxB,mBAAmB;qBACpB;oBACD,eAAe,EAAE,uBAAuB,CAAC,MAAM;iBAChD;sMAUK,IAAI;sBADP,KAAK;gBAYC,MAAM;sBADZ,KAAK;gBAUC,kBAAkB;sBADxB,KAAK;uBAAC,OAAO;gBAQP,WAAW;sBADjB,KAAK;gBAUK,UAAU;sBADpB,KAAK;gBAuBK,gBAAgB;sBAD1B,KAAK","sourcesContent":["import {\n ChangeDetectionStrategy,\n Component,\n forwardRef,\n Input,\n OnDestroy,\n SimpleChanges,\n OnChanges,\n OnInit,\n} from '@angular/core';\n\nimport { SkyCheckboxChange } from '@skyux/forms';\n\nimport {\n ListState,\n ListStateDispatcher,\n ListSelectedModel,\n ListFilterModel,\n ListSelectedSetItemSelectedAction,\n ListSelectedSetItemsSelectedAction,\n ListToolbarSetTypeAction,\n ListViewComponent,\n} from '@skyux/list-builder';\n\nimport {\n AsyncItem,\n AsyncList,\n getData,\n ListItemModel,\n} from '@skyux/list-builder-common';\n\nimport { Observable, Subject } from 'rxjs';\n\nimport {\n distinctUntilChanged,\n map as observableMap,\n take,\n takeUntil,\n} from 'rxjs/operators';\n\nimport { ChecklistState } from './state/checklist-state.state-node';\n\nimport { ChecklistStateDispatcher } from './state/checklist-state.rxstate';\n\nimport { ChecklistStateModel } from './state/checklist-state.model';\n\nimport { ListViewChecklistItemsLoadAction } from './state/items/load.action';\n\nimport { ListViewChecklistItemModel } from './state/items/item.model';\n\n@Component({\n selector: 'sky-list-view-checklist',\n templateUrl: './list-view-checklist.component.html',\n styleUrls: ['./list-view-checklist.component.scss'],\n providers: [\n {\n provide: ListViewComponent,\n useExisting: forwardRef(() => SkyListViewChecklistComponent),\n },\n ChecklistState,\n ChecklistStateDispatcher,\n ChecklistStateModel,\n ],\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class SkyListViewChecklistComponent\n extends ListViewComponent\n implements OnInit, OnDestroy, OnChanges\n{\n /**\n * Specifies the name of the view.\n * @required\n */\n @Input()\n set name(value: string) {\n this.viewName = value;\n }\n\n /**\n * Specifies a search function to apply on the view data.\n * The default function searches view data on label, description,\n * and category if field selectors are defined for the given field.\n * @default default search function\n */\n @Input()\n public search: (data: any, searchText: string) => boolean =\n this.searchFunction();\n\n /**\n * Specifies the name of the label field selector.\n * @default \"label\"\n */\n // eslint-disable-next-line @angular-eslint/no-input-rename\n @Input('label')\n public labelFieldSelector: string = 'label';\n\n /**\n * Specifies the name of the description field selector.\n * @default \"description\"\n */\n @Input()\n public description: string = 'description';\n\n /**\n * Specifies how many items users can select.\n * `\"single\"` allows users to select one item in the checklist, while `\"multiple\"`\n * allows users to select multiple items in the checklist.\n * @default \"multiple\"\n */\n @Input()\n public set selectMode(value: string) {\n this._selectMode = value;\n\n if (this.selectMode === 'multiple') {\n this.dispatcher.toolbarShowMultiselectToolbar(true);\n } else {\n this.showOnlySelected = false;\n this.dispatcher.toolbarShowMultiselectToolbar(false);\n }\n\n this.reapplyFilter(this.showOnlySelected);\n }\n\n public get selectMode(): string {\n return this._selectMode || 'multiple';\n }\n\n /**\n * Indicates whether to display selected items only.\n * @default false\n */\n @Input()\n public set showOnlySelected(value: boolean) {\n this._showOnlySelected = value;\n }\n\n public get showOnlySelected(): boolean {\n return this._showOnlySelected;\n }\n\n private ngUnsubscribe = new Subject();\n\n private _selectMode = 'multiple';\n\n private _selectedIdMap: Map<string, boolean> = new Map<string, boolean>();\n\n private _showOnlySelected: boolean = false;\n\n constructor(\n state: ListState,\n private dispatcher: ListStateDispatcher,\n private checklistState: ChecklistState,\n private checklistDispatcher: ChecklistStateDispatcher\n ) {\n super(state, 'Checklist View');\n\n let lastUpdate: any;\n this.state\n .pipe(\n observableMap((s) => s.items),\n distinctUntilChanged(),\n observableMap((items: AsyncList<ListItemModel>) => {\n let dataChanged =\n lastUpdate === undefined || items.lastUpdate !== lastUpdate;\n lastUpdate = items.lastUpdate;\n let newItems = items.items.map((item) => {\n return new ListViewChecklistItemModel(item.id, {\n label: this.labelFieldSelector\n ? getData(item.data, this.labelFieldSelector)\n : undefined,\n description: this.description\n ? getData(item.data, this.description)\n : undefined,\n });\n });\n\n this.checklistDispatcher.next(\n new ListViewChecklistItemsLoadAction(\n newItems,\n true,\n dataChanged,\n items.count\n )\n );\n })\n )\n .pipe(takeUntil(this.ngUnsubscribe))\n .subscribe();\n\n this.state\n .pipe(\n observableMap((t) => t.selected),\n takeUntil(this.ngUnsubscribe)\n )\n .subscribe((selectedItems: AsyncItem<ListSelectedModel>) => {\n this._selectedIdMap = selectedItems.item.selectedIdMap;\n });\n }\n\n public ngOnInit() {\n if (this.selectMode === 'multiple') {\n this.dispatcher.toolbarShowMultiselectToolbar(true);\n }\n\n // If 'show-selected' filter is changed from multiselect toolbar (list-builder)\n // make sure the private variable _showOnlySelected stays in sync.\n this.state\n .pipe(\n observableMap((t) => t.filters),\n takeUntil(this.ngUnsubscribe),\n distinctUntilChanged(this.showSelectedValuesEqual)\n )\n .subscribe((filters: ListFilterModel[]) => {\n const showSelectedFilter = filters.find(\n (filter: ListFilterModel) => filter.name === 'show-selected'\n );\n if (showSelectedFilter) {\n this._showOnlySelected = showSelectedFilter.value === 'true';\n }\n });\n }\n\n public ngOnChanges(changes: SimpleChanges) {\n if (\n changes['showOnlySelected'] &&\n changes['showOnlySelected'].currentValue !==\n changes['showOnlySelected'].previousValue\n ) {\n this.reapplyFilter(changes['showOnlySelected'].currentValue);\n }\n }\n\n /**\n * @deprecated since version 3.2.0\n * Multiselect toolbar will automatically show if select mode is set to 'multiple'.\n * These methods are no longer needed, as that functionality is part of list-builder.\n */\n public changeVisibleItems(change: SkyCheckboxChange) {\n this.showOnlySelected = change.checked;\n }\n\n /**\n * @deprecated since version 3.2.0\n * Multiselect toolbar will automatically show if select mode is set to 'multiple'.\n * These methods are no longer needed, as that functionality is part of list-builder.\n */\n public clearSelections() {\n this.state\n .pipe(\n observableMap((state) => state.items.items),\n take(1)\n )\n .subscribe((items) => {\n this.dispatcher.next(\n new ListSelectedSetItemsSelectedAction(\n items.map((item) => item.id),\n false,\n false\n )\n );\n\n /* istanbul ignore else */\n if (this.showOnlySelected) {\n this.reapplyFilter(this.showOnlySelected);\n }\n });\n }\n\n /**\n * @deprecated since version 3.2.0\n * Multiselect toolbar will automatically show if select mode is set to 'multiple'.\n * These methods are no longer needed, as that functionality is part of list-builder.\n */\n public selectAll() {\n this.state\n .pipe(\n observableMap((state) => state.items.items),\n take(1)\n )\n .subscribe((items) => {\n this.dispatcher.next(\n new ListSelectedSetItemsSelectedAction(\n items.map((item) => item.id),\n true,\n false\n )\n );\n\n /* istanbul ignore else */\n if (this.showOnlySelected) {\n this.reapplyFilter(this.showOnlySelected);\n }\n });\n }\n\n public onViewActive() {\n if (this.search !== undefined) {\n this.dispatcher.searchSetFunctions([this.search]);\n }\n\n let fieldSelectors: Array<string> = [];\n if (this.labelFieldSelector) {\n fieldSelectors.push(this.labelFieldSelector);\n }\n\n if (this.description) {\n fieldSelectors.push(this.description);\n }\n\n this.dispatcher.searchSetFieldSelectors(fieldSelectors);\n\n this.dispatcher.next(new ListToolbarSetTypeAction('search'));\n }\n\n public ngOnDestroy() {\n this.ngUnsubscribe.next();\n this.ngUnsubscribe.complete();\n }\n\n get items(): Observable<ListViewChecklistItemModel[]> {\n return this.checklistState.pipe(\n observableMap((state) => state.items.items)\n );\n }\n\n public searchFunction() {\n return (data: any, searchText: string) => {\n if (this.labelFieldSelector !== undefined) {\n let label = getData(data, this.labelFieldSelector);\n if (\n label !== undefined &&\n label !== null &&\n label.toString().toLowerCase().indexOf(searchText) !== -1\n ) {\n return true;\n }\n }\n\n if (this.description !== undefined) {\n let description = getData(data, this.description);\n if (\n description !== undefined &&\n description !== null &&\n description.toString().toLowerCase().indexOf(searchText) !== -1\n ) {\n return true;\n }\n }\n\n return false;\n };\n }\n\n public itemSelected(id: string): Observable<boolean> {\n return this.state.pipe(\n observableMap((state) => state.selected.item.selectedIdMap.get(id))\n );\n }\n\n public setItemSelection(item: ListItemModel, event: any) {\n this.dispatcher.next(\n new ListSelectedSetItemSelectedAction(item.id, event.checked)\n );\n }\n\n public singleSelectRowClick(item: ListItemModel) {\n this.dispatcher.next(\n new ListSelectedSetItemsSelectedAction([item.id], true, true)\n );\n }\n\n private getShowSelectedFilter(isSelected: boolean) {\n return new ListFilterModel({\n name: 'show-selected',\n value: isSelected.toString(),\n filterFunction: (model: ListItemModel, showOnlySelected: boolean) => {\n /* istanbul ignore else */\n if (showOnlySelected.toString() !== false.toString()) {\n return this._selectedIdMap.get(model.id);\n }\n },\n defaultValue: false.toString(),\n });\n }\n\n private reapplyFilter(isSelected: boolean) {\n let self = this;\n\n this.state\n .pipe(\n observableMap((state) => state.filters),\n take(1)\n )\n .subscribe((filters: ListFilterModel[]) => {\n filters = filters.filter((filter) => filter.name !== 'show-selected');\n filters.push(self.getShowSelectedFilter(isSelected));\n this.dispatcher.filtersUpdate(filters);\n });\n }\n\n private showSelectedValuesEqual(\n prev: ListFilterModel[],\n next: ListFilterModel[]\n ) {\n const prevShowSelectedFilter = prev.find(\n (filter) => filter.name === 'show-selected'\n );\n const nextShowSelectedFilter = next.find(\n (filter) => filter.name === 'show-selected'\n );\n\n if (prevShowSelectedFilter && nextShowSelectedFilter) {\n return prevShowSelectedFilter.value === nextShowSelectedFilter.value;\n }\n\n return true;\n }\n}\n","<div class=\"sky-list-view-checklist\" *ngIf=\"active | async\">\n <div [ngSwitch]=\"selectMode\">\n <ng-template ngSwitchCase=\"single\">\n <div role=\"radiogroup\">\n <sky-list-view-checklist-item\n *ngFor=\"let item of items | async\"\n [attr.sky-cmp-id]=\"item.id\"\n [item]=\"item\"\n >\n <button\n role=\"radio\"\n type=\"button\"\n class=\"sky-list-view-checklist-single-button\"\n [attr.aria-checked]=\"(itemSelected(item.id) | async) || false\"\n [ngClass]=\"{\n 'sky-list-view-checklist-row-selected':\n (itemSelected(item.id) | async)\n }\"\n (click)=\"singleSelectRowClick(item)\"\n >\n <div *ngIf=\"item.label\" class=\"sky-emphasized\">\n {{ item.label }}\n </div>\n <div *ngIf=\"item.description\">{{ item.description }}</div>\n </button>\n </sky-list-view-checklist-item>\n </div>\n </ng-template>\n\n <ng-template ngSwitchDefault>\n <sky-list-view-checklist-item\n *ngFor=\"let item of items | async\"\n [attr.sky-cmp-id]=\"item.id\"\n [item]=\"item\"\n >\n <sky-checkbox\n [checked]=\"itemSelected(item.id) | async\"\n (change)=\"setItemSelection(item, $event)\"\n >\n <sky-checkbox-label>\n <div\n *ngIf=\"item.label\"\n class=\"sky-emphasized\"\n [attr.title]=\"item.label\"\n >\n {{ item.label }}\n </div>\n <div *ngIf=\"item.description\" [attr.title]=\"item.description\">\n {{ item.description }}\n </div>\n </sky-checkbox-label>\n </sky-checkbox>\n </sky-list-view-checklist-item>\n </ng-template>\n </div>\n</div>\n"]}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { NgModule } from '@angular/core';
|
|
2
|
+
import { CommonModule } from '@angular/common';
|
|
3
|
+
import { FormsModule } from '@angular/forms';
|
|
4
|
+
import { SkyCheckboxModule } from '@skyux/forms';
|
|
5
|
+
import { SkyListViewChecklistComponent } from './list-view-checklist.component';
|
|
6
|
+
import { SkyListViewChecklistItemComponent } from './list-view-checklist-item.component';
|
|
7
|
+
import * as i0 from "@angular/core";
|
|
8
|
+
export class SkyListViewChecklistModule {
|
|
9
|
+
}
|
|
10
|
+
SkyListViewChecklistModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyListViewChecklistModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
11
|
+
SkyListViewChecklistModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyListViewChecklistModule, declarations: [SkyListViewChecklistComponent,
|
|
12
|
+
SkyListViewChecklistItemComponent], imports: [CommonModule, FormsModule, SkyCheckboxModule], exports: [SkyListViewChecklistComponent, SkyListViewChecklistItemComponent] });
|
|
13
|
+
SkyListViewChecklistModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyListViewChecklistModule, imports: [[CommonModule, FormsModule, SkyCheckboxModule]] });
|
|
14
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyListViewChecklistModule, decorators: [{
|
|
15
|
+
type: NgModule,
|
|
16
|
+
args: [{
|
|
17
|
+
declarations: [
|
|
18
|
+
SkyListViewChecklistComponent,
|
|
19
|
+
SkyListViewChecklistItemComponent,
|
|
20
|
+
],
|
|
21
|
+
imports: [CommonModule, FormsModule, SkyCheckboxModule],
|
|
22
|
+
exports: [SkyListViewChecklistComponent, SkyListViewChecklistItemComponent],
|
|
23
|
+
}]
|
|
24
|
+
}] });
|
|
25
|
+
//# sourceMappingURL=list-view-checklist.module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list-view-checklist.module.js","sourceRoot":"","sources":["../../../../../../../../libs/components/list-builder-view-checklist/src/lib/modules/list-view-checklist/list-view-checklist.module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEzC,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAEjD,OAAO,EAAE,6BAA6B,EAAE,MAAM,iCAAiC,CAAC;AAEhF,OAAO,EAAE,iCAAiC,EAAE,MAAM,sCAAsC,CAAC;;AAUzF,MAAM,OAAO,0BAA0B;;wHAA1B,0BAA0B;yHAA1B,0BAA0B,iBANnC,6BAA6B;QAC7B,iCAAiC,aAEzB,YAAY,EAAE,WAAW,EAAE,iBAAiB,aAC5C,6BAA6B,EAAE,iCAAiC;yHAE/D,0BAA0B,YAH5B,CAAC,YAAY,EAAE,WAAW,EAAE,iBAAiB,CAAC;4FAG5C,0BAA0B;kBARtC,QAAQ;mBAAC;oBACR,YAAY,EAAE;wBACZ,6BAA6B;wBAC7B,iCAAiC;qBAClC;oBACD,OAAO,EAAE,CAAC,YAAY,EAAE,WAAW,EAAE,iBAAiB,CAAC;oBACvD,OAAO,EAAE,CAAC,6BAA6B,EAAE,iCAAiC,CAAC;iBAC5E","sourcesContent":["import { NgModule } from '@angular/core';\n\nimport { CommonModule } from '@angular/common';\n\nimport { FormsModule } from '@angular/forms';\n\nimport { SkyCheckboxModule } from '@skyux/forms';\n\nimport { SkyListViewChecklistComponent } from './list-view-checklist.component';\n\nimport { SkyListViewChecklistItemComponent } from './list-view-checklist-item.component';\n\n@NgModule({\n declarations: [\n SkyListViewChecklistComponent,\n SkyListViewChecklistItemComponent,\n ],\n imports: [CommonModule, FormsModule, SkyCheckboxModule],\n exports: [SkyListViewChecklistComponent, SkyListViewChecklistItemComponent],\n})\nexport class SkyListViewChecklistModule {}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"checklist-state-action.type.js","sourceRoot":"","sources":["../../../../../../../../../libs/components/list-builder-view-checklist/src/lib/modules/list-view-checklist/state/checklist-state-action.type.ts"],"names":[],"mappings":"","sourcesContent":["import { ListViewChecklistItemsLoadAction } from './items/load.action';\n\nexport type ChecklistStateAction = ListViewChecklistItemsLoadAction;\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"checklist-state.model.js","sourceRoot":"","sources":["../../../../../../../../../libs/components/list-builder-view-checklist/src/lib/modules/list-view-checklist/state/checklist-state.model.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAIvD,MAAM,OAAO,mBAAmB;IAAhC;QACS,UAAK,GACV,IAAI,SAAS,EAA8B,CAAC;IAChD,CAAC;CAAA","sourcesContent":["import { AsyncList } from '@skyux/list-builder-common';\n\nimport { ListViewChecklistItemModel } from './items/item.model';\n\nexport class ChecklistStateModel {\n public items: AsyncList<ListViewChecklistItemModel> =\n new AsyncList<ListViewChecklistItemModel>();\n}\n"]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Injectable } from '@angular/core';
|
|
2
|
+
import { StateDispatcher, StateOrchestrator } from '@skyux/list-builder-common';
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
4
|
+
export class ChecklistStateDispatcher extends StateDispatcher {
|
|
5
|
+
}
|
|
6
|
+
ChecklistStateDispatcher.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: ChecklistStateDispatcher, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
|
|
7
|
+
ChecklistStateDispatcher.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: ChecklistStateDispatcher });
|
|
8
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: ChecklistStateDispatcher, decorators: [{
|
|
9
|
+
type: Injectable
|
|
10
|
+
}] });
|
|
11
|
+
export class ChecklistStateOrchestrator extends StateOrchestrator {
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=checklist-state.rxstate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"checklist-state.rxstate.js","sourceRoot":"","sources":["../../../../../../../../../libs/components/list-builder-view-checklist/src/lib/modules/list-view-checklist/state/checklist-state.rxstate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;;AAKhF,MAAM,OAAO,wBAAyB,SAAQ,eAAqC;;sHAAtE,wBAAwB;0HAAxB,wBAAwB;4FAAxB,wBAAwB;kBADpC,UAAU;;AAGX,MAAM,OAAO,0BAA8B,SAAQ,iBAGlD;CAAG","sourcesContent":["import { Injectable } from '@angular/core';\n\nimport { StateDispatcher, StateOrchestrator } from '@skyux/list-builder-common';\n\nimport { ChecklistStateAction } from './checklist-state-action.type';\n\n@Injectable()\nexport class ChecklistStateDispatcher extends StateDispatcher<ChecklistStateAction> {}\n\nexport class ChecklistStateOrchestrator<T> extends StateOrchestrator<\n T,\n ChecklistStateAction\n> {}\n"]}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Injectable } from '@angular/core';
|
|
2
|
+
import { StateNode } from '@skyux/list-builder-common';
|
|
3
|
+
import { ChecklistStateModel } from './checklist-state.model';
|
|
4
|
+
import { ChecklistStateDispatcher } from './checklist-state.rxstate';
|
|
5
|
+
import { ListViewChecklistItemsOrchestrator } from './items/items.orchestrator';
|
|
6
|
+
import * as i0 from "@angular/core";
|
|
7
|
+
import * as i1 from "./checklist-state.model";
|
|
8
|
+
import * as i2 from "./checklist-state.rxstate";
|
|
9
|
+
export class ChecklistState extends StateNode {
|
|
10
|
+
constructor(initialState, dispatcher) {
|
|
11
|
+
super(initialState, dispatcher);
|
|
12
|
+
this.register('items', ListViewChecklistItemsOrchestrator).begin();
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
ChecklistState.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: ChecklistState, deps: [{ token: i1.ChecklistStateModel }, { token: i2.ChecklistStateDispatcher }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
16
|
+
ChecklistState.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: ChecklistState });
|
|
17
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: ChecklistState, decorators: [{
|
|
18
|
+
type: Injectable
|
|
19
|
+
}], ctorParameters: function () { return [{ type: i1.ChecklistStateModel }, { type: i2.ChecklistStateDispatcher }]; } });
|
|
20
|
+
//# sourceMappingURL=checklist-state.state-node.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"checklist-state.state-node.js","sourceRoot":"","sources":["../../../../../../../../../libs/components/list-builder-view-checklist/src/lib/modules/list-view-checklist/state/checklist-state.state-node.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAEvD,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAE9D,OAAO,EAAE,wBAAwB,EAAE,MAAM,2BAA2B,CAAC;AAErE,OAAO,EAAE,kCAAkC,EAAE,MAAM,4BAA4B,CAAC;;;;AAGhF,MAAM,OAAO,cAAe,SAAQ,SAA8B;IAChE,YACE,YAAiC,EACjC,UAAoC;QAEpC,KAAK,CAAC,YAAY,EAAE,UAAU,CAAC,CAAC;QAEhC,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,kCAAkC,CAAC,CAAC,KAAK,EAAE,CAAC;IACrE,CAAC;;4GARU,cAAc;gHAAd,cAAc;4FAAd,cAAc;kBAD1B,UAAU","sourcesContent":["import { Injectable } from '@angular/core';\n\nimport { StateNode } from '@skyux/list-builder-common';\n\nimport { ChecklistStateModel } from './checklist-state.model';\n\nimport { ChecklistStateDispatcher } from './checklist-state.rxstate';\n\nimport { ListViewChecklistItemsOrchestrator } from './items/items.orchestrator';\n\n@Injectable()\nexport class ChecklistState extends StateNode<ChecklistStateModel> {\n constructor(\n initialState: ChecklistStateModel,\n dispatcher: ChecklistStateDispatcher\n ) {\n super(initialState, dispatcher);\n\n this.register('items', ListViewChecklistItemsOrchestrator).begin();\n }\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"item.model.js","sourceRoot":"","sources":["../../../../../../../../../../libs/components/list-builder-view-checklist/src/lib/modules/list-view-checklist/state/items/item.model.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,0BAA0B;IAKrC,YAAY,EAAU,EAAE,IAAU;QAChC,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;QAEb,IAAI,IAAI,EAAE;YACR,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;YACxB,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,WAAW,CAAC;SACrC;IACH,CAAC;CACF","sourcesContent":["export class ListViewChecklistItemModel {\n public id: string;\n public label: string;\n public description: string;\n\n constructor(id: string, data?: any) {\n this.id = id;\n\n if (data) {\n this.label = data.label;\n this.description = data.description;\n }\n }\n}\n"]}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { ChecklistStateOrchestrator } from '../checklist-state.rxstate';
|
|
2
|
+
import { AsyncList } from '@skyux/list-builder-common';
|
|
3
|
+
import { ListViewChecklistItemModel } from './item.model';
|
|
4
|
+
import { ListViewChecklistItemsLoadAction } from './load.action';
|
|
5
|
+
export class ListViewChecklistItemsOrchestrator extends ChecklistStateOrchestrator {
|
|
6
|
+
/* istanbul ignore next */
|
|
7
|
+
constructor() {
|
|
8
|
+
super();
|
|
9
|
+
this.register(ListViewChecklistItemsLoadAction, this.load);
|
|
10
|
+
}
|
|
11
|
+
load(state, action) {
|
|
12
|
+
const newListItems = action.items.map((item) => new ListViewChecklistItemModel(item.id, item));
|
|
13
|
+
if (action.refresh) {
|
|
14
|
+
return new AsyncList([...newListItems], action.dataChanged ? Date.now() : state.lastUpdate, false, state.count);
|
|
15
|
+
}
|
|
16
|
+
return new AsyncList([...state.items, ...newListItems], action.dataChanged ? Date.now() : state.lastUpdate, false, action.itemCount);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=items.orchestrator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"items.orchestrator.js","sourceRoot":"","sources":["../../../../../../../../../../libs/components/list-builder-view-checklist/src/lib/modules/list-view-checklist/state/items/items.orchestrator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,0BAA0B,EAAE,MAAM,4BAA4B,CAAC;AAExE,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAEvD,OAAO,EAAE,0BAA0B,EAAE,MAAM,cAAc,CAAC;AAE1D,OAAO,EAAE,gCAAgC,EAAE,MAAM,eAAe,CAAC;AAEjE,MAAM,OAAO,kCAAmC,SAAQ,0BAEvD;IACC,0BAA0B;IAC1B;QACE,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,QAAQ,CAAC,gCAAgC,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;IAC7D,CAAC;IAEO,IAAI,CACV,KAA4C,EAC5C,MAAwC;QAExC,MAAM,YAAY,GAAG,MAAM,CAAC,KAAK,CAAC,GAAG,CACnC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,0BAA0B,CAAC,IAAI,CAAC,EAAE,EAAE,IAAI,CAAC,CACxD,CAAC;QAEF,IAAI,MAAM,CAAC,OAAO,EAAE;YAClB,OAAO,IAAI,SAAS,CAClB,CAAC,GAAG,YAAY,CAAC,EACjB,MAAM,CAAC,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,UAAU,EAClD,KAAK,EACL,KAAK,CAAC,KAAK,CACZ,CAAC;SACH;QAED,OAAO,IAAI,SAAS,CAClB,CAAC,GAAG,KAAK,CAAC,KAAK,EAAE,GAAG,YAAY,CAAC,EACjC,MAAM,CAAC,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,UAAU,EAClD,KAAK,EACL,MAAM,CAAC,SAAS,CACjB,CAAC;IACJ,CAAC;CACF","sourcesContent":["import { ChecklistStateOrchestrator } from '../checklist-state.rxstate';\n\nimport { AsyncList } from '@skyux/list-builder-common';\n\nimport { ListViewChecklistItemModel } from './item.model';\n\nimport { ListViewChecklistItemsLoadAction } from './load.action';\n\nexport class ListViewChecklistItemsOrchestrator extends ChecklistStateOrchestrator<\n AsyncList<ListViewChecklistItemModel>\n> {\n /* istanbul ignore next */\n constructor() {\n super();\n this.register(ListViewChecklistItemsLoadAction, this.load);\n }\n\n private load(\n state: AsyncList<ListViewChecklistItemModel>,\n action: ListViewChecklistItemsLoadAction\n ): AsyncList<ListViewChecklistItemModel> {\n const newListItems = action.items.map(\n (item) => new ListViewChecklistItemModel(item.id, item)\n );\n\n if (action.refresh) {\n return new AsyncList<ListViewChecklistItemModel>(\n [...newListItems],\n action.dataChanged ? Date.now() : state.lastUpdate,\n false,\n state.count\n );\n }\n\n return new AsyncList<ListViewChecklistItemModel>(\n [...state.items, ...newListItems],\n action.dataChanged ? Date.now() : state.lastUpdate,\n false,\n action.itemCount\n );\n }\n}\n"]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export class ListViewChecklistItemsLoadAction {
|
|
2
|
+
constructor(items = [], refresh = false, dataChanged = true, itemCount = items.length) {
|
|
3
|
+
this.items = items;
|
|
4
|
+
this.refresh = refresh;
|
|
5
|
+
this.dataChanged = dataChanged;
|
|
6
|
+
this.itemCount = itemCount;
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=load.action.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"load.action.js","sourceRoot":"","sources":["../../../../../../../../../../libs/components/list-builder-view-checklist/src/lib/modules/list-view-checklist/state/items/load.action.ts"],"names":[],"mappings":"AAEA,MAAM,OAAO,gCAAgC;IAC3C,YACS,QAA2C,EAAE,EAC7C,UAAmB,KAAK,EACxB,cAAuB,IAAI,EAC3B,YAAoB,KAAK,CAAC,MAAM;QAHhC,UAAK,GAAL,KAAK,CAAwC;QAC7C,YAAO,GAAP,OAAO,CAAiB;QACxB,gBAAW,GAAX,WAAW,CAAgB;QAC3B,cAAS,GAAT,SAAS,CAAuB;IACtC,CAAC;CACL","sourcesContent":["import { ListViewChecklistItemModel } from './item.model';\n\nexport class ListViewChecklistItemsLoadAction {\n constructor(\n public items: Array<ListViewChecklistItemModel> = [],\n public refresh: boolean = false,\n public dataChanged: boolean = true,\n public itemCount: number = items.length\n ) {}\n}\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Generated bundle index. Do not edit.
|
|
3
3
|
*/
|
|
4
|
-
export * from './
|
|
5
|
-
//# sourceMappingURL=
|
|
4
|
+
export * from './index';
|
|
5
|
+
//# sourceMappingURL=skyux-list-builder-view-checklist.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"skyux-list-builder-view-checklist.js","sourceRoot":"","sources":["../../../../../libs/components/list-builder-view-checklist/src/skyux-list-builder-view-checklist.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,SAAS,CAAC","sourcesContent":["/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"]}
|
|
@@ -80,4 +80,4 @@ export class SkyListViewChecklistFixture {
|
|
|
80
80
|
return el.getAttribute('aria-checked') === 'true';
|
|
81
81
|
}
|
|
82
82
|
}
|
|
83
|
-
//# sourceMappingURL=
|
|
83
|
+
//# sourceMappingURL=list-view-checklist-fixture.js.map
|