cmat 0.0.78 → 0.0.80
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/fesm2022/cmat-components-adapter.mjs +9 -46
- package/fesm2022/cmat-components-adapter.mjs.map +1 -1
- package/fesm2022/cmat-components-breadcrumb.mjs +104 -205
- package/fesm2022/cmat-components-breadcrumb.mjs.map +1 -1
- package/fesm2022/cmat-components-card.mjs +4 -8
- package/fesm2022/cmat-components-card.mjs.map +1 -1
- package/fesm2022/cmat-components-carousel.mjs +21 -21
- package/fesm2022/cmat-components-carousel.mjs.map +1 -1
- package/fesm2022/cmat-components-cascade.mjs +18 -24
- package/fesm2022/cmat-components-cascade.mjs.map +1 -1
- package/fesm2022/cmat-components-chip-input.mjs +21 -21
- package/fesm2022/cmat-components-chip-input.mjs.map +1 -1
- package/fesm2022/cmat-components-code-editor.mjs +4 -22
- package/fesm2022/cmat-components-code-editor.mjs.map +1 -1
- package/fesm2022/cmat-components-custom-formly.mjs +181 -245
- package/fesm2022/cmat-components-custom-formly.mjs.map +1 -1
- package/fesm2022/cmat-components-date-range.mjs +12 -184
- package/fesm2022/cmat-components-date-range.mjs.map +1 -1
- package/fesm2022/cmat-components-date-time-display.mjs +3 -15
- package/fesm2022/cmat-components-date-time-display.mjs.map +1 -1
- package/fesm2022/cmat-components-drawer.mjs +10 -100
- package/fesm2022/cmat-components-drawer.mjs.map +1 -1
- package/fesm2022/cmat-components-empty-state.mjs +4 -25
- package/fesm2022/cmat-components-empty-state.mjs.map +1 -1
- package/fesm2022/cmat-components-file-preview.mjs +3 -21
- package/fesm2022/cmat-components-file-preview.mjs.map +1 -1
- package/fesm2022/cmat-components-filter-toolbar.mjs +7 -50
- package/fesm2022/cmat-components-filter-toolbar.mjs.map +1 -1
- package/fesm2022/cmat-components-form-actions.mjs +3 -9
- package/fesm2022/cmat-components-form-actions.mjs.map +1 -1
- package/fesm2022/cmat-components-fullscreen.mjs +4 -4
- package/fesm2022/cmat-components-fullscreen.mjs.map +1 -1
- package/fesm2022/cmat-components-highlight.mjs +6 -32
- package/fesm2022/cmat-components-highlight.mjs.map +1 -1
- package/fesm2022/cmat-components-image-viewer.mjs +12 -24
- package/fesm2022/cmat-components-image-viewer.mjs.map +1 -1
- package/fesm2022/cmat-components-inline-loading.mjs +3 -12
- package/fesm2022/cmat-components-inline-loading.mjs.map +1 -1
- package/fesm2022/cmat-components-json-editor.mjs +11 -16
- package/fesm2022/cmat-components-json-editor.mjs.map +1 -1
- package/fesm2022/cmat-components-knob-input.mjs +24 -18
- package/fesm2022/cmat-components-knob-input.mjs.map +1 -1
- package/fesm2022/cmat-components-masonry.mjs +8 -17
- package/fesm2022/cmat-components-masonry.mjs.map +1 -1
- package/fesm2022/cmat-components-material-color-picker.mjs +13 -34
- package/fesm2022/cmat-components-material-color-picker.mjs.map +1 -1
- package/fesm2022/cmat-components-material-datetimepicker.mjs +80 -436
- package/fesm2022/cmat-components-material-datetimepicker.mjs.map +1 -1
- package/fesm2022/cmat-components-navigation.mjs +266 -816
- package/fesm2022/cmat-components-navigation.mjs.map +1 -1
- package/fesm2022/cmat-components-opt-input.mjs +7 -10
- package/fesm2022/cmat-components-opt-input.mjs.map +1 -1
- package/fesm2022/cmat-components-org-chart.mjs +11 -11
- package/fesm2022/cmat-components-org-chart.mjs.map +1 -1
- package/fesm2022/cmat-components-page-header.mjs +8 -19
- package/fesm2022/cmat-components-page-header.mjs.map +1 -1
- package/fesm2022/cmat-components-pagination.mjs +113 -108
- package/fesm2022/cmat-components-pagination.mjs.map +1 -1
- package/fesm2022/cmat-components-password-strength.mjs +13 -16
- package/fesm2022/cmat-components-password-strength.mjs.map +1 -1
- package/fesm2022/cmat-components-popover.mjs +15 -151
- package/fesm2022/cmat-components-popover.mjs.map +1 -1
- package/fesm2022/cmat-components-progress-bar.mjs +16 -26
- package/fesm2022/cmat-components-progress-bar.mjs.map +1 -1
- package/fesm2022/cmat-components-qrcode.mjs +5 -11
- package/fesm2022/cmat-components-qrcode.mjs.map +1 -1
- package/fesm2022/cmat-components-rating.mjs +14 -14
- package/fesm2022/cmat-components-rating.mjs.map +1 -1
- package/fesm2022/cmat-components-rich-text-editor.mjs +4 -25
- package/fesm2022/cmat-components-rich-text-editor.mjs.map +1 -1
- package/fesm2022/cmat-components-select-search.mjs +51 -79
- package/fesm2022/cmat-components-select-search.mjs.map +1 -1
- package/fesm2022/cmat-components-select-table.mjs +204 -162
- package/fesm2022/cmat-components-select-table.mjs.map +1 -1
- package/fesm2022/cmat-components-select-tree.mjs +142 -97
- package/fesm2022/cmat-components-select-tree.mjs.map +1 -1
- package/fesm2022/cmat-components-skeleton.mjs +4 -22
- package/fesm2022/cmat-components-skeleton.mjs.map +1 -1
- package/fesm2022/cmat-components-speed-dial.mjs +14 -19
- package/fesm2022/cmat-components-speed-dial.mjs.map +1 -1
- package/fesm2022/cmat-components-status-tag.mjs +3 -18
- package/fesm2022/cmat-components-status-tag.mjs.map +1 -1
- package/fesm2022/cmat-components-table-toolbar.mjs +3 -15
- package/fesm2022/cmat-components-table-toolbar.mjs.map +1 -1
- package/fesm2022/cmat-components-timeline.mjs +18 -21
- package/fesm2022/cmat-components-timeline.mjs.map +1 -1
- package/fesm2022/cmat-components-toast.mjs +20 -20
- package/fesm2022/cmat-components-toast.mjs.map +1 -1
- package/fesm2022/cmat-components-transfer-picker.mjs +159 -123
- package/fesm2022/cmat-components-transfer-picker.mjs.map +1 -1
- package/fesm2022/cmat-components-treetable.mjs +17 -19
- package/fesm2022/cmat-components-treetable.mjs.map +1 -1
- package/fesm2022/cmat-components-upload.mjs +35 -57
- package/fesm2022/cmat-components-upload.mjs.map +1 -1
- package/fesm2022/cmat-components-x6-angular-shape.mjs +0 -4
- package/fesm2022/cmat-components-x6-angular-shape.mjs.map +1 -1
- package/fesm2022/cmat-directives-animate-on-scroll.mjs +6 -27
- package/fesm2022/cmat-directives-animate-on-scroll.mjs.map +1 -1
- package/fesm2022/cmat-directives-arrow-cursor.mjs +7 -9
- package/fesm2022/cmat-directives-arrow-cursor.mjs.map +1 -1
- package/fesm2022/cmat-directives-autofocus.mjs +3 -3
- package/fesm2022/cmat-directives-data-exporter.mjs +24 -33
- package/fesm2022/cmat-directives-data-exporter.mjs.map +1 -1
- package/fesm2022/cmat-directives-debounce.mjs +14 -17
- package/fesm2022/cmat-directives-debounce.mjs.map +1 -1
- package/fesm2022/cmat-directives-digit-only.mjs +6 -23
- package/fesm2022/cmat-directives-digit-only.mjs.map +1 -1
- package/fesm2022/cmat-directives-equal-validator.mjs +3 -3
- package/fesm2022/cmat-directives-seamless-auto-scroll.mjs +4 -11
- package/fesm2022/cmat-directives-seamless-auto-scroll.mjs.map +1 -1
- package/fesm2022/cmat-lib-mock-api.mjs +6 -43
- package/fesm2022/cmat-lib-mock-api.mjs.map +1 -1
- package/fesm2022/cmat-pipes-bytes.mjs +3 -3
- package/fesm2022/cmat-pipes-date-format.mjs +3 -3
- package/fesm2022/cmat-pipes-find-by-key.mjs +3 -5
- package/fesm2022/cmat-pipes-find-by-key.mjs.map +1 -1
- package/fesm2022/cmat-pipes-group-by.mjs +3 -3
- package/fesm2022/cmat-pipes-keys.mjs +3 -3
- package/fesm2022/cmat-pipes-secure.mjs +8 -12
- package/fesm2022/cmat-pipes-secure.mjs.map +1 -1
- package/fesm2022/cmat-pipes-uppercase.mjs +3 -3
- package/fesm2022/cmat-services-alert.mjs +3 -3
- package/fesm2022/cmat-services-config.mjs +50 -26
- package/fesm2022/cmat-services-config.mjs.map +1 -1
- package/fesm2022/cmat-services-confirmation.mjs +9 -11
- package/fesm2022/cmat-services-confirmation.mjs.map +1 -1
- package/fesm2022/cmat-services-data.mjs +56 -101
- package/fesm2022/cmat-services-data.mjs.map +1 -1
- package/fesm2022/cmat-services-export-as.mjs +4 -32
- package/fesm2022/cmat-services-export-as.mjs.map +1 -1
- package/fesm2022/cmat-services-loading.mjs +49 -40
- package/fesm2022/cmat-services-loading.mjs.map +1 -1
- package/fesm2022/cmat-services-local-storage.mjs +3 -3
- package/fesm2022/cmat-services-media-watcher.mjs +19 -25
- package/fesm2022/cmat-services-media-watcher.mjs.map +1 -1
- package/fesm2022/cmat-services-platform.mjs +3 -10
- package/fesm2022/cmat-services-platform.mjs.map +1 -1
- package/fesm2022/cmat-services-splash-screen.mjs +8 -13
- package/fesm2022/cmat-services-splash-screen.mjs.map +1 -1
- package/fesm2022/cmat-services-title.mjs +8 -12
- package/fesm2022/cmat-services-title.mjs.map +1 -1
- package/fesm2022/cmat-services-translation.mjs +3 -3
- package/fesm2022/cmat-services-utils.mjs +5 -27
- package/fesm2022/cmat-services-utils.mjs.map +1 -1
- package/fesm2022/cmat-validators.mjs +0 -8
- package/fesm2022/cmat-validators.mjs.map +1 -1
- package/fesm2022/cmat.mjs +3477 -3795
- package/fesm2022/cmat.mjs.map +1 -1
- package/package.json +1 -1
- package/tailwind/plugins/helpers.js +1 -10
- package/tailwind/plugins/scrollbar/index.js +0 -1
- package/tailwind/plugins/scrollbar/typedefs.js +1 -7
- package/tailwind/plugins/scrollbar/utilities.js +9 -58
- package/tailwind/plugins/scrollbar/variants.js +2 -17
- package/tailwind/plugins/theming.js +1 -57
- package/tailwind/utils/generate-contrasts.js +1 -12
- package/tailwind/utils/generate-palette.js +1 -32
- package/types/cmat-components-adapter.d.ts +0 -25
- package/types/cmat-components-breadcrumb.d.ts +25 -175
- package/types/cmat-components-carousel.d.ts +2 -20
- package/types/cmat-components-cascade.d.ts +4 -4
- package/types/cmat-components-chip-input.d.ts +4 -3
- package/types/cmat-components-code-editor.d.ts +0 -18
- package/types/cmat-components-custom-formly.d.ts +30 -37
- package/types/cmat-components-date-range.d.ts +1 -72
- package/types/cmat-components-date-time-display.d.ts +0 -15
- package/types/cmat-components-drawer.d.ts +2 -44
- package/types/cmat-components-empty-state.d.ts +0 -21
- package/types/cmat-components-file-preview.d.ts +0 -18
- package/types/cmat-components-filter-toolbar.d.ts +3 -43
- package/types/cmat-components-form-actions.d.ts +0 -6
- package/types/cmat-components-image-viewer.d.ts +5 -18
- package/types/cmat-components-inline-loading.d.ts +0 -9
- package/types/cmat-components-json-editor.d.ts +0 -1
- package/types/cmat-components-knob-input.d.ts +3 -3
- package/types/cmat-components-masonry.d.ts +1 -2
- package/types/cmat-components-material-color-picker.d.ts +1 -2
- package/types/cmat-components-material-datetimepicker.d.ts +6 -272
- package/types/cmat-components-navigation.d.ts +34 -171
- package/types/cmat-components-opt-input.d.ts +1 -1
- package/types/cmat-components-page-header.d.ts +2 -16
- package/types/cmat-components-pagination.d.ts +26 -27
- package/types/cmat-components-password-strength.d.ts +1 -2
- package/types/cmat-components-popover.d.ts +1 -110
- package/types/cmat-components-progress-bar.d.ts +9 -11
- package/types/cmat-components-rating.d.ts +6 -7
- package/types/cmat-components-rich-text-editor.d.ts +0 -21
- package/types/cmat-components-select-search.d.ts +4 -20
- package/types/cmat-components-select-table.d.ts +24 -12
- package/types/cmat-components-select-tree.d.ts +29 -29
- package/types/cmat-components-skeleton.d.ts +0 -18
- package/types/cmat-components-speed-dial.d.ts +1 -2
- package/types/cmat-components-status-tag.d.ts +0 -15
- package/types/cmat-components-table-toolbar.d.ts +0 -12
- package/types/cmat-components-timeline.d.ts +3 -4
- package/types/cmat-components-toast.d.ts +2 -2
- package/types/cmat-components-transfer-picker.d.ts +42 -36
- package/types/cmat-components-treetable.d.ts +3 -4
- package/types/cmat-components-upload.d.ts +12 -17
- package/types/cmat-components-x6-angular-shape.d.ts +0 -1
- package/types/cmat-directives-arrow-cursor.d.ts +1 -1
- package/types/cmat-directives-debounce.d.ts +3 -4
- package/types/cmat-pipes-secure.d.ts +3 -4
- package/types/cmat-services-config.d.ts +35 -13
- package/types/cmat-services-data.d.ts +13 -12
- package/types/cmat-services-export-as.d.ts +0 -22
- package/types/cmat-services-loading.d.ts +15 -10
- package/types/cmat-services-media-watcher.d.ts +10 -13
- package/types/cmat-services-splash-screen.d.ts +2 -4
- package/types/cmat-services-title.d.ts +3 -5
- package/types/cmat.d.ts +733 -1391
|
@@ -5,21 +5,21 @@ import { PortalModule } from '@angular/cdk/portal';
|
|
|
5
5
|
import * as i3 from '@angular/common';
|
|
6
6
|
import { CommonModule } from '@angular/common';
|
|
7
7
|
import * as i0 from '@angular/core';
|
|
8
|
-
import { Injectable, inject, ViewChild, Input, ChangeDetectionStrategy, ViewEncapsulation, Component,
|
|
8
|
+
import { signal, Injectable, inject, ViewChild, Input, ChangeDetectionStrategy, ViewEncapsulation, Component, computed, DestroyRef, EventEmitter, Output, Injector, afterNextRender } from '@angular/core';
|
|
9
9
|
import * as i5 from '@angular/material/button';
|
|
10
10
|
import { MatButtonModule } from '@angular/material/button';
|
|
11
11
|
import * as i1 from '@angular/material/button-toggle';
|
|
12
12
|
import { MatButtonToggleModule } from '@angular/material/button-toggle';
|
|
13
13
|
import * as i2 from '@angular/material/icon';
|
|
14
14
|
import { MatIconModule } from '@angular/material/icon';
|
|
15
|
-
import {
|
|
15
|
+
import { toObservable, takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
16
16
|
import * as i3$1 from '@angular/forms';
|
|
17
17
|
import { FormControl, ReactiveFormsModule } from '@angular/forms';
|
|
18
18
|
import * as i1$1 from '@angular/material/form-field';
|
|
19
19
|
import { MatFormFieldModule } from '@angular/material/form-field';
|
|
20
20
|
import * as i5$1 from '@angular/material/input';
|
|
21
21
|
import { MatInputModule } from '@angular/material/input';
|
|
22
|
-
import { debounceTime, distinctUntilChanged,
|
|
22
|
+
import { debounceTime, distinctUntilChanged, filter } from 'rxjs/operators';
|
|
23
23
|
import { SelectionModel } from '@angular/cdk/collections';
|
|
24
24
|
import { ScrollingModule } from '@angular/cdk/scrolling';
|
|
25
25
|
import * as i1$2 from '@angular/material/card';
|
|
@@ -28,16 +28,23 @@ import * as i3$2 from '@angular/material/checkbox';
|
|
|
28
28
|
import { MatCheckboxModule } from '@angular/material/checkbox';
|
|
29
29
|
import * as i2$1 from '@angular/material/tree';
|
|
30
30
|
import { MatTreeModule } from '@angular/material/tree';
|
|
31
|
+
import { of } from 'rxjs';
|
|
31
32
|
import * as i2$2 from '@angular/material/list';
|
|
32
33
|
import { MatListModule } from '@angular/material/list';
|
|
33
34
|
|
|
34
35
|
class CmatTransferPickerService {
|
|
35
36
|
constructor() {
|
|
36
|
-
this.
|
|
37
|
-
this.
|
|
38
|
-
this.
|
|
39
|
-
this.
|
|
40
|
-
this.
|
|
37
|
+
this._dataSourceChange = signal([], ...(ngDevMode ? [{ debugName: "_dataSourceChange" }] : /* istanbul ignore next */ []));
|
|
38
|
+
this._refreshDataSourceChange = signal({ clear: true, nonce: 0 }, ...(ngDevMode ? [{ debugName: "_refreshDataSourceChange" }] : /* istanbul ignore next */ []));
|
|
39
|
+
this._filtersChange = signal([], ...(ngDevMode ? [{ debugName: "_filtersChange" }] : /* istanbul ignore next */ []));
|
|
40
|
+
this._sourceOptionsChange = signal(void 0, ...(ngDevMode ? [{ debugName: "_sourceOptionsChange" }] : /* istanbul ignore next */ []));
|
|
41
|
+
this._selectedValuesChange = signal([], ...(ngDevMode ? [{ debugName: "_selectedValuesChange" }] : /* istanbul ignore next */ []));
|
|
42
|
+
this._refreshNonce = 0;
|
|
43
|
+
this._dataSourceChange$ = toObservable(this._dataSourceChange);
|
|
44
|
+
this._refreshDataSourceChange$ = toObservable(this._refreshDataSourceChange);
|
|
45
|
+
this._filtersChange$ = toObservable(this._filtersChange);
|
|
46
|
+
this._sourceOptionsChange$ = toObservable(this._sourceOptionsChange);
|
|
47
|
+
this._selectedValuesChange$ = toObservable(this._selectedValuesChange);
|
|
41
48
|
this._compareMap = new Map([
|
|
42
49
|
['0', (a, b) => a === b],
|
|
43
50
|
['1', (a, b) => a !== b],
|
|
@@ -59,6 +66,21 @@ class CmatTransferPickerService {
|
|
|
59
66
|
}).result],
|
|
60
67
|
]);
|
|
61
68
|
}
|
|
69
|
+
get dataSourceChange() {
|
|
70
|
+
return this._dataSourceChange$;
|
|
71
|
+
}
|
|
72
|
+
get refreshDataSourceChange() {
|
|
73
|
+
return this._refreshDataSourceChange$;
|
|
74
|
+
}
|
|
75
|
+
get filtersChange() {
|
|
76
|
+
return this._filtersChange$;
|
|
77
|
+
}
|
|
78
|
+
get sourceOptionsChange() {
|
|
79
|
+
return this._sourceOptionsChange$;
|
|
80
|
+
}
|
|
81
|
+
get selectedValuesChange() {
|
|
82
|
+
return this._selectedValuesChange$;
|
|
83
|
+
}
|
|
62
84
|
get dataSource() {
|
|
63
85
|
return this._dataSource;
|
|
64
86
|
}
|
|
@@ -67,13 +89,13 @@ class CmatTransferPickerService {
|
|
|
67
89
|
if (!this._originalDataSource) {
|
|
68
90
|
this._originalDataSource = JSON.parse(JSON.stringify(data));
|
|
69
91
|
}
|
|
70
|
-
this.
|
|
92
|
+
this._dataSourceChange.set(data);
|
|
71
93
|
}
|
|
72
94
|
set sourceOptions(value) {
|
|
73
|
-
this.
|
|
95
|
+
this._sourceOptionsChange.set(value);
|
|
74
96
|
}
|
|
75
97
|
set selectedValues(value) {
|
|
76
|
-
this.
|
|
98
|
+
this._selectedValuesChange.set(value);
|
|
77
99
|
}
|
|
78
100
|
filterDataSource({ filterData, keyword }) {
|
|
79
101
|
this._filterData = filterData ?? this._filterData;
|
|
@@ -108,7 +130,7 @@ class CmatTransferPickerService {
|
|
|
108
130
|
resetDataSource(clear) {
|
|
109
131
|
this.dataSource = this._originalDataSource;
|
|
110
132
|
this._filteredDataSource = [];
|
|
111
|
-
this.
|
|
133
|
+
this._refreshDataSourceChange.set({ clear, nonce: ++this._refreshNonce });
|
|
112
134
|
}
|
|
113
135
|
_filterDataSourceByType(dataSource, type) {
|
|
114
136
|
this._filteredDataSource = [];
|
|
@@ -121,7 +143,7 @@ class CmatTransferPickerService {
|
|
|
121
143
|
break;
|
|
122
144
|
}
|
|
123
145
|
this.dataSource = this._filteredDataSource;
|
|
124
|
-
this.
|
|
146
|
+
this._refreshDataSourceChange.set({ clear: false, nonce: ++this._refreshNonce });
|
|
125
147
|
}
|
|
126
148
|
_setFilteredDataSourceByFilters(dataSource) {
|
|
127
149
|
dataSource.map((data) => {
|
|
@@ -155,10 +177,10 @@ class CmatTransferPickerService {
|
|
|
155
177
|
}
|
|
156
178
|
});
|
|
157
179
|
}
|
|
158
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.
|
|
159
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.
|
|
180
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: CmatTransferPickerService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
181
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: CmatTransferPickerService, providedIn: 'root' }); }
|
|
160
182
|
}
|
|
161
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.
|
|
183
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: CmatTransferPickerService, decorators: [{
|
|
162
184
|
type: Injectable,
|
|
163
185
|
args: [{
|
|
164
186
|
providedIn: 'root'
|
|
@@ -225,10 +247,10 @@ class CmatTransferPickerFilterComponent {
|
|
|
225
247
|
changeFilterData() {
|
|
226
248
|
this._service.filterDataSource({ filterData: this.filterData });
|
|
227
249
|
}
|
|
228
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.
|
|
229
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.
|
|
250
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: CmatTransferPickerFilterComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
251
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.9", type: CmatTransferPickerFilterComponent, isStandalone: true, selector: "cmat-transfer-picker-filter", inputs: { filters: "filters" }, viewQueries: [{ propertyName: "overlayOrigin", first: true, predicate: CdkOverlayOrigin, descendants: true, static: true }, { propertyName: "filterTemplate", first: true, predicate: ["filterTemplate"], descendants: true, static: true }], exportAs: ["cmatTransferPickerFilter"], ngImport: i0, template: "<button type=\"button\" class=\"mr-2 mt-1\" matIconButton cdk-overlay-origin (click)=\"toggleFilter()\">\r\n <mat-icon svgIcon=\"mat_outline:filter_list\"></mat-icon>\r\n</button>\r\n<ng-template #filterTemplate=\"cdkPortal\" cdkPortal>\r\n <div\r\n class=\"transfer-picker-filter-panel bg-card flex flex-col flex-nowrap place-content-start box-border items-start w-full shadow\">\r\n <mat-button-toggle-group name=\"condition\" [hideSingleSelectionIndicator]=\"true\" (change)=\"onConditionChange($event.value)\">\r\n <mat-button-toggle value=\"or\" [checked]=\"filterData.condition === 'or'\">\u6216</mat-button-toggle>\r\n <mat-button-toggle value=\"and\" [checked]=\"filterData.condition === 'and'\">\u4E14</mat-button-toggle>\r\n </mat-button-toggle-group>\r\n\r\n <div class=\"chip-list\">\r\n @for (item of filters; track $index) {\r\n <div class=\"chip-wrapper\" role=\"presentation\"\r\n (click)=\"onFilterClick(item)\">\r\n <span class=\"chip\" [ngClass]=\"{selected: item?.selected}\">{{item.label}}</span>\r\n </div>\r\n }\r\n </div>\r\n </div>\r\n</ng-template>", styles: [".transfer-picker-filter-panel{min-width:276px;padding:10px 0;border-width:1px}.transfer-picker-filter-panel .mat-button-toggle-group{font-size:12px;margin-right:15px;margin-bottom:20px;align-self:flex-end}.transfer-picker-filter-panel .mat-button-toggle-group .mat-button-toggle-label-content{line-height:1.8}.transfer-picker-filter-panel .chip-list{width:276px;display:flex;flex-direction:row;flex-wrap:wrap;justify-content:space-between;box-sizing:border-box}.transfer-picker-filter-panel .chip-list:after{content:\"\";flex:1 1 0%;max-width:33.333333%}.transfer-picker-filter-panel .chip-list .chip-wrapper{flex:1 1 0%;box-sizing:border-box;max-width:33.333333%;text-align:center;margin-bottom:20px}.transfer-picker-filter-panel .chip-list .chip-wrapper .chip{display:inline-block;min-width:50%;cursor:pointer;padding:5px 10px;font-size:12px}\n"], dependencies: [{ kind: "ngmodule", type: MatButtonToggleModule }, { kind: "directive", type: i1.MatButtonToggleGroup, selector: "mat-button-toggle-group", inputs: ["appearance", "name", "vertical", "value", "multiple", "disabled", "disabledInteractive", "hideSingleSelectionIndicator", "hideMultipleSelectionIndicator"], outputs: ["valueChange", "change"], exportAs: ["matButtonToggleGroup"] }, { kind: "component", type: i1.MatButtonToggle, selector: "mat-button-toggle", inputs: ["aria-label", "aria-labelledby", "id", "name", "value", "tabIndex", "disableRipple", "appearance", "checked", "disabled", "disabledInteractive"], outputs: ["change"], exportAs: ["matButtonToggle"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i2.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i3.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "ngmodule", type: PortalModule }, { kind: "directive", type: i4.CdkPortal, selector: "[cdkPortal]", exportAs: ["cdkPortal"] }, { kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i5.MatIconButton, selector: "button[mat-icon-button], a[mat-icon-button], button[matIconButton], a[matIconButton]", exportAs: ["matButton", "matAnchor"] }, { kind: "ngmodule", type: OverlayModule }, { kind: "directive", type: i6.CdkOverlayOrigin, selector: "[cdk-overlay-origin], [overlay-origin], [cdkOverlayOrigin]", exportAs: ["cdkOverlayOrigin"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
230
252
|
}
|
|
231
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.
|
|
253
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: CmatTransferPickerFilterComponent, decorators: [{
|
|
232
254
|
type: Component,
|
|
233
255
|
args: [{ selector: 'cmat-transfer-picker-filter', encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, exportAs: 'cmatTransferPickerFilter', imports: [MatButtonToggleModule, MatIconModule, CommonModule, PortalModule, MatButtonModule, OverlayModule], template: "<button type=\"button\" class=\"mr-2 mt-1\" matIconButton cdk-overlay-origin (click)=\"toggleFilter()\">\r\n <mat-icon svgIcon=\"mat_outline:filter_list\"></mat-icon>\r\n</button>\r\n<ng-template #filterTemplate=\"cdkPortal\" cdkPortal>\r\n <div\r\n class=\"transfer-picker-filter-panel bg-card flex flex-col flex-nowrap place-content-start box-border items-start w-full shadow\">\r\n <mat-button-toggle-group name=\"condition\" [hideSingleSelectionIndicator]=\"true\" (change)=\"onConditionChange($event.value)\">\r\n <mat-button-toggle value=\"or\" [checked]=\"filterData.condition === 'or'\">\u6216</mat-button-toggle>\r\n <mat-button-toggle value=\"and\" [checked]=\"filterData.condition === 'and'\">\u4E14</mat-button-toggle>\r\n </mat-button-toggle-group>\r\n\r\n <div class=\"chip-list\">\r\n @for (item of filters; track $index) {\r\n <div class=\"chip-wrapper\" role=\"presentation\"\r\n (click)=\"onFilterClick(item)\">\r\n <span class=\"chip\" [ngClass]=\"{selected: item?.selected}\">{{item.label}}</span>\r\n </div>\r\n }\r\n </div>\r\n </div>\r\n</ng-template>", styles: [".transfer-picker-filter-panel{min-width:276px;padding:10px 0;border-width:1px}.transfer-picker-filter-panel .mat-button-toggle-group{font-size:12px;margin-right:15px;margin-bottom:20px;align-self:flex-end}.transfer-picker-filter-panel .mat-button-toggle-group .mat-button-toggle-label-content{line-height:1.8}.transfer-picker-filter-panel .chip-list{width:276px;display:flex;flex-direction:row;flex-wrap:wrap;justify-content:space-between;box-sizing:border-box}.transfer-picker-filter-panel .chip-list:after{content:\"\";flex:1 1 0%;max-width:33.333333%}.transfer-picker-filter-panel .chip-list .chip-wrapper{flex:1 1 0%;box-sizing:border-box;max-width:33.333333%;text-align:center;margin-bottom:20px}.transfer-picker-filter-panel .chip-list .chip-wrapper .chip{display:inline-block;min-width:50%;cursor:pointer;padding:5px 10px;font-size:12px}\n"] }]
|
|
234
256
|
}], ctorParameters: () => [], propDecorators: { filters: [{
|
|
@@ -255,10 +277,10 @@ class CmatTransferPickerSearchComponent {
|
|
|
255
277
|
reset() {
|
|
256
278
|
this.keyword.setValue('');
|
|
257
279
|
}
|
|
258
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.
|
|
259
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.
|
|
280
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: CmatTransferPickerSearchComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
281
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.9", type: CmatTransferPickerSearchComponent, isStandalone: true, selector: "cmat-transfer-picker-search", inputs: { searchPlaceholder: "searchPlaceholder" }, exportAs: ["cmatTransferPickerSearch"], ngImport: i0, template: "<mat-form-field>\r\n <input placeholder=\"{{searchPlaceholder}}\" matInput type=\"text\" [formControl]=\"keyword\">\r\n @if (keyword.value) {\r\n <button type=\"button\" matSuffix matIconButton (click)=\"reset()\">\r\n <mat-icon svgIcon=\"mat_outline:close\"></mat-icon>\r\n </button>\r\n }\r\n</mat-form-field>", styles: ["cmat-transfer-picker-search{display:flex;flex-direction:row;flex-wrap:nowrap;justify-content:center;align-items:center}cmat-transfer-picker-search .mat-mdc-form-field{width:88%}\n"], dependencies: [{ kind: "ngmodule", type: MatFormFieldModule }, { kind: "component", type: i1$1.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i1$1.MatSuffix, selector: "[matSuffix], [matIconSuffix], [matTextSuffix]", inputs: ["matTextSuffix"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i2.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i3$1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i3$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i3$1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i5.MatIconButton, selector: "button[mat-icon-button], a[mat-icon-button], button[matIconButton], a[matIconButton]", exportAs: ["matButton", "matAnchor"] }, { kind: "ngmodule", type: MatInputModule }, { kind: "directive", type: i5$1.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly", "disabledInteractive"], exportAs: ["matInput"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
260
282
|
}
|
|
261
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.
|
|
283
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: CmatTransferPickerSearchComponent, decorators: [{
|
|
262
284
|
type: Component,
|
|
263
285
|
args: [{ selector: 'cmat-transfer-picker-search', encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, exportAs: 'cmatTransferPickerSearch', imports: [MatFormFieldModule, MatIconModule, ReactiveFormsModule, MatButtonModule, MatInputModule], template: "<mat-form-field>\r\n <input placeholder=\"{{searchPlaceholder}}\" matInput type=\"text\" [formControl]=\"keyword\">\r\n @if (keyword.value) {\r\n <button type=\"button\" matSuffix matIconButton (click)=\"reset()\">\r\n <mat-icon svgIcon=\"mat_outline:close\"></mat-icon>\r\n </button>\r\n }\r\n</mat-form-field>", styles: ["cmat-transfer-picker-search{display:flex;flex-direction:row;flex-wrap:nowrap;justify-content:center;align-items:center}cmat-transfer-picker-search .mat-mdc-form-field{width:88%}\n"] }]
|
|
264
286
|
}], ctorParameters: () => [], propDecorators: { searchPlaceholder: [{
|
|
@@ -266,12 +288,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.7", ngImpor
|
|
|
266
288
|
}] } });
|
|
267
289
|
|
|
268
290
|
/* eslint-disable @typescript-eslint/naming-convention */
|
|
269
|
-
/**
|
|
270
|
-
* Node for Transfer item
|
|
271
|
-
*/
|
|
272
291
|
class CmatTransferItemNode {
|
|
273
292
|
}
|
|
274
|
-
/** Flat Transfer item node with expandable and level information */
|
|
275
293
|
class CmatTransferItemFlatNode {
|
|
276
294
|
}
|
|
277
295
|
var CmatTransferFilterCondition;
|
|
@@ -284,21 +302,27 @@ var CmatTransferFilterCondition;
|
|
|
284
302
|
|
|
285
303
|
class CmatTransferPickerSourceComponent {
|
|
286
304
|
constructor() {
|
|
287
|
-
/** Map from nested node to flattened node. This helps us to keep the same object for selection */
|
|
288
305
|
this.nestedNodeMap = new Map();
|
|
289
|
-
|
|
306
|
+
this.dataSource = signal([], ...(ngDevMode ? [{ debugName: "dataSource" }] : /* istanbul ignore next */ []));
|
|
307
|
+
this.dataFlatNodes = signal([], ...(ngDevMode ? [{ debugName: "dataFlatNodes" }] : /* istanbul ignore next */ []));
|
|
290
308
|
this.checklistSelection = new SelectionModel(true /* multiple */);
|
|
309
|
+
this.options = signal({
|
|
310
|
+
title: '',
|
|
311
|
+
filterable: false,
|
|
312
|
+
searchable: false,
|
|
313
|
+
searchPlaceholder: '',
|
|
314
|
+
filters: []
|
|
315
|
+
}, ...(ngDevMode ? [{ debugName: "options" }] : /* istanbul ignore next */ []));
|
|
316
|
+
this.committedSelection = signal([], ...(ngDevMode ? [{ debugName: "committedSelection" }] : /* istanbul ignore next */ []));
|
|
317
|
+
this.committedValueSet = computed(() => new Set(this.committedSelection().map(node => node.value)), ...(ngDevMode ? [{ debugName: "committedValueSet" }] : /* istanbul ignore next */ []));
|
|
318
|
+
this._flatNodeByValue = new Map();
|
|
291
319
|
this._service = inject(CmatTransferPickerService);
|
|
292
|
-
this.
|
|
293
|
-
this._unsubscribeAll = new Subject();
|
|
320
|
+
this._destroyRef = inject(DestroyRef);
|
|
294
321
|
this.childrenAccessor = (node) => node.children ?? [];
|
|
295
322
|
this.hasChild = (_, node) => !!node.children && node.children.length > 0;
|
|
296
323
|
this._getLevel = (node) => node.level;
|
|
297
324
|
this._isExpandable = (node) => node.expandable;
|
|
298
325
|
this._getChildren = (node) => of(node.children ?? []);
|
|
299
|
-
/**
|
|
300
|
-
* Transformer to convert nested node to flat node. Record the nodes in maps for later use.
|
|
301
|
-
*/
|
|
302
326
|
this._transformer = (node, level) => {
|
|
303
327
|
const flatNode = this.nestedNodeMap.has(node) && this.nestedNodeMap.get(node)?.value === node.value
|
|
304
328
|
? this.nestedNodeMap.get(node)
|
|
@@ -309,122 +333,109 @@ class CmatTransferPickerSourceComponent {
|
|
|
309
333
|
flatNode.level = level;
|
|
310
334
|
flatNode.expandable = !!node.children;
|
|
311
335
|
this.nestedNodeMap.set(node, flatNode);
|
|
336
|
+
this._flatNodeByValue.set(node.value, flatNode);
|
|
312
337
|
return flatNode;
|
|
313
338
|
};
|
|
314
339
|
}
|
|
315
340
|
ngOnInit() {
|
|
341
|
+
// 监听数据源变化并重建平铺节点
|
|
316
342
|
this._service
|
|
317
343
|
.dataSourceChange
|
|
318
|
-
.pipe(
|
|
344
|
+
.pipe(takeUntilDestroyed(this._destroyRef))
|
|
319
345
|
.subscribe((data) => {
|
|
320
|
-
this.dataSource
|
|
321
|
-
this.
|
|
322
|
-
this.
|
|
346
|
+
this.dataSource.set(data);
|
|
347
|
+
this._flatNodeByValue.clear();
|
|
348
|
+
this.dataFlatNodes.set(this._getFlattenNodes(this.dataSource()));
|
|
323
349
|
});
|
|
324
|
-
this._service.refreshDataSourceChange.pipe(
|
|
325
|
-
.subscribe((
|
|
326
|
-
|
|
350
|
+
this._service.refreshDataSourceChange.pipe(takeUntilDestroyed(this._destroyRef))
|
|
351
|
+
.subscribe(({ clear }) => {
|
|
352
|
+
// 刷新时按状态重置或恢复选择
|
|
353
|
+
if (clear) {
|
|
327
354
|
this.checklistSelection.clear();
|
|
328
|
-
this.
|
|
355
|
+
this.committedSelection.set([]);
|
|
329
356
|
}
|
|
330
357
|
else {
|
|
331
|
-
this.checklistSelection.selected.map(
|
|
332
|
-
|
|
333
|
-
if (node.value === selectedNode.value) {
|
|
334
|
-
this.checklistSelection.deselect(selectedNode);
|
|
335
|
-
this.checklistSelection.select(node);
|
|
336
|
-
}
|
|
337
|
-
});
|
|
338
|
-
});
|
|
339
|
-
this.getSelectedList();
|
|
358
|
+
this._selectNodesByValues(this.checklistSelection.selected.map(node => node.value));
|
|
359
|
+
this.commitSelection();
|
|
340
360
|
}
|
|
341
361
|
});
|
|
342
362
|
this._service
|
|
343
363
|
.selectedValuesChange
|
|
344
|
-
.pipe(filter((values) => !!values.length),
|
|
364
|
+
.pipe(filter((values) => !!values.length), takeUntilDestroyed(this._destroyRef))
|
|
345
365
|
.subscribe((values) => {
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
this.checklistSelection.select(node);
|
|
350
|
-
}
|
|
351
|
-
});
|
|
352
|
-
});
|
|
353
|
-
this._changeDetectorRef.markForCheck();
|
|
366
|
+
// 根据外部值同步选中节点
|
|
367
|
+
this._selectNodesByValues(values);
|
|
368
|
+
this.commitSelection();
|
|
354
369
|
});
|
|
355
370
|
this._service
|
|
356
371
|
.sourceOptionsChange
|
|
357
|
-
.pipe(
|
|
372
|
+
.pipe(takeUntilDestroyed(this._destroyRef))
|
|
358
373
|
.subscribe((options) => { if (options)
|
|
359
|
-
this.options
|
|
374
|
+
this.options.set(options); });
|
|
360
375
|
}
|
|
361
376
|
ngAfterViewInit() {
|
|
377
|
+
// 初始化时展开整棵树
|
|
362
378
|
this.tree.expandAll();
|
|
363
379
|
}
|
|
364
|
-
|
|
365
|
-
this.
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
if (this.selectedList.length) {
|
|
371
|
-
this.selectedList.map((item) => {
|
|
372
|
-
/* 禁用 */
|
|
373
|
-
item.disabled = true;
|
|
374
|
-
/* 选中 */
|
|
375
|
-
this.checklistSelection.select(item);
|
|
376
|
-
});
|
|
377
|
-
}
|
|
378
|
-
this._changeDetectorRef.markForCheck();
|
|
379
|
-
return this.selectedList;
|
|
380
|
+
getCommittedSelection() {
|
|
381
|
+
return this.committedSelection();
|
|
382
|
+
}
|
|
383
|
+
commitSelection() {
|
|
384
|
+
this.committedSelection.set(this._cloneFlatNodes(this.checklistSelection.selected));
|
|
385
|
+
return this.committedSelection();
|
|
380
386
|
}
|
|
381
387
|
resetSelectedItem(item) {
|
|
382
|
-
const
|
|
383
|
-
if (
|
|
384
|
-
|
|
385
|
-
s.disabled = false;
|
|
386
|
-
/* 取消选中 */
|
|
387
|
-
this.checklistSelection.deselect(s);
|
|
388
|
-
this._changeDetectorRef.markForCheck();
|
|
388
|
+
const target = this._flatNodeByValue.get(item.value) ?? this.checklistSelection.selected.find(i => i.value === item.value);
|
|
389
|
+
if (!target) {
|
|
390
|
+
return;
|
|
389
391
|
}
|
|
392
|
+
const descendants = this._getDescendants(target);
|
|
393
|
+
this.checklistSelection.deselect(target, ...descendants.filter(node => this.checklistSelection.isSelected(node)));
|
|
394
|
+
this._checkAllParentsSelection(target);
|
|
395
|
+
this.commitSelection();
|
|
390
396
|
}
|
|
391
|
-
/** Whether all the descendants of the node are selected */
|
|
392
397
|
descendantsAllSelected(node) {
|
|
398
|
+
// 判断后代是否全部选中
|
|
393
399
|
const descendants = this._getDescendants(node);
|
|
394
400
|
return descendants.every(child => this.checklistSelection.isSelected(child));
|
|
395
401
|
}
|
|
396
|
-
/** Whether part of the descendants are selected */
|
|
397
402
|
descendantsPartiallySelected(node) {
|
|
403
|
+
// 判断后代是否部分选中
|
|
398
404
|
const descendants = this._getDescendants(node);
|
|
399
405
|
const result = descendants.some(child => this.checklistSelection.isSelected(child));
|
|
400
406
|
return result && !this.descendantsAllSelected(node);
|
|
401
407
|
}
|
|
402
|
-
/** Toggle the transfer item selection. Select/deselect all the descendants node */
|
|
403
408
|
transferItemSelectionToggle(node) {
|
|
409
|
+
// 切换分支节点选择状态
|
|
404
410
|
this.checklistSelection.toggle(node);
|
|
405
411
|
let descendants = this._getDescendants(node);
|
|
406
|
-
descendants = descendants.filter(n => !n
|
|
412
|
+
descendants = descendants.filter(n => !this.isNodeDisabled(n));
|
|
407
413
|
this.checklistSelection.isSelected(node)
|
|
408
414
|
? this.checklistSelection.select(...descendants)
|
|
409
415
|
: this.checklistSelection.deselect(...descendants);
|
|
410
|
-
// Force update for the parent
|
|
411
416
|
descendants.every(child => this.checklistSelection.isSelected(child));
|
|
412
417
|
this._checkAllParentsSelection(node);
|
|
413
418
|
}
|
|
414
|
-
/** Toggle a leaf transfer item selection. Check all the parents to see if they changed */
|
|
415
419
|
transferLeafItemSelectionToggle(node) {
|
|
420
|
+
// 切换叶子节点选择状态
|
|
416
421
|
this.checklistSelection.toggle(node);
|
|
417
422
|
this._checkAllParentsSelection(node);
|
|
418
423
|
}
|
|
424
|
+
isNodeDisabled(node) {
|
|
425
|
+
return !!node.disabled || this.committedValueSet().has(node.value);
|
|
426
|
+
}
|
|
419
427
|
_getDescendants(dataNode) {
|
|
420
|
-
|
|
428
|
+
// 收集当前节点的所有后代节点
|
|
429
|
+
const flatNodes = this.dataFlatNodes();
|
|
430
|
+
const startIndex = flatNodes.findIndex(j => j === dataNode);
|
|
421
431
|
const results = [];
|
|
422
|
-
for (let i = startIndex + 1; i <
|
|
423
|
-
results.push(
|
|
432
|
+
for (let i = startIndex + 1; i < flatNodes.length && this._getLevel(dataNode) < this._getLevel(flatNodes[i]); i++) {
|
|
433
|
+
results.push(flatNodes[i]);
|
|
424
434
|
}
|
|
425
435
|
return results;
|
|
426
436
|
}
|
|
427
437
|
_getFlattenNodes(nodes, i = 0) {
|
|
438
|
+
// 将树结构转换为平铺节点
|
|
428
439
|
const flattenedNodes = [];
|
|
429
440
|
for (const node of nodes) {
|
|
430
441
|
flattenedNodes.push(this._transformer(node, i));
|
|
@@ -434,16 +445,16 @@ class CmatTransferPickerSourceComponent {
|
|
|
434
445
|
}
|
|
435
446
|
return flattenedNodes;
|
|
436
447
|
}
|
|
437
|
-
/* Checks all the parents when a leaf node is selected/unselected */
|
|
438
448
|
_checkAllParentsSelection(node) {
|
|
449
|
+
// 逐级回溯父节点并更新选择状态
|
|
439
450
|
let parent = this._getParentNode(node);
|
|
440
451
|
while (parent) {
|
|
441
452
|
this._checkRootNodeSelection(parent);
|
|
442
453
|
parent = this._getParentNode(parent);
|
|
443
454
|
}
|
|
444
455
|
}
|
|
445
|
-
/** Check root node checked state and change it accordingly */
|
|
446
456
|
_checkRootNodeSelection(node) {
|
|
457
|
+
// 根据子节点状态更新当前节点
|
|
447
458
|
const nodeSelected = this.checklistSelection.isSelected(node);
|
|
448
459
|
const descendants = this._getDescendants(node);
|
|
449
460
|
const descAllSelected = descendants.every(child => this.checklistSelection.isSelected(child));
|
|
@@ -454,28 +465,50 @@ class CmatTransferPickerSourceComponent {
|
|
|
454
465
|
this.checklistSelection.select(node);
|
|
455
466
|
}
|
|
456
467
|
}
|
|
457
|
-
|
|
468
|
+
_cloneFlatNode(node) {
|
|
469
|
+
return {
|
|
470
|
+
label: node.label,
|
|
471
|
+
value: node.value,
|
|
472
|
+
level: node.level,
|
|
473
|
+
disabled: node.disabled,
|
|
474
|
+
expandable: node.expandable
|
|
475
|
+
};
|
|
476
|
+
}
|
|
477
|
+
_cloneFlatNodes(nodes) {
|
|
478
|
+
return nodes.map(node => this._cloneFlatNode(node));
|
|
479
|
+
}
|
|
458
480
|
_getParentNode(node) {
|
|
481
|
+
// 获取当前节点的父节点
|
|
459
482
|
const currentLevel = this._getLevel(node);
|
|
483
|
+
const flatNodes = this.dataFlatNodes();
|
|
460
484
|
if (currentLevel < 1) {
|
|
461
485
|
return null;
|
|
462
486
|
}
|
|
463
|
-
const startIndex =
|
|
487
|
+
const startIndex = flatNodes.findIndex(j => j === node) - 1;
|
|
464
488
|
for (let i = startIndex; i >= 0; i--) {
|
|
465
|
-
const currentNode =
|
|
489
|
+
const currentNode = flatNodes[i];
|
|
466
490
|
if (this._getLevel(currentNode) < currentLevel) {
|
|
467
491
|
return currentNode;
|
|
468
492
|
}
|
|
469
493
|
}
|
|
470
494
|
return null;
|
|
471
495
|
}
|
|
472
|
-
|
|
473
|
-
|
|
496
|
+
_selectNodesByValues(values) {
|
|
497
|
+
this.checklistSelection.clear();
|
|
498
|
+
for (const value of values) {
|
|
499
|
+
const node = this._flatNodeByValue.get(value);
|
|
500
|
+
if (node) {
|
|
501
|
+
this.checklistSelection.select(node);
|
|
502
|
+
}
|
|
503
|
+
}
|
|
504
|
+
}
|
|
505
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: CmatTransferPickerSourceComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
506
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.9", type: CmatTransferPickerSourceComponent, isStandalone: true, selector: "cmat-transfer-picker-source", viewQueries: [{ propertyName: "tree", first: true, predicate: ["componentTree"], descendants: true }], exportAs: ["cmatTransferPickerSource"], ngImport: i0, template: "<mat-card class=\"transfer-picker-source shadow\">\r\n <mat-card-header class=\"pb-3 items-center\">\r\n <mat-card-title class=\"transfer-picker-source-title\">{{options().title}}</mat-card-title>\r\n @if (options().filterable) {\r\n <cmat-transfer-picker-filter\r\n [filters]=\"options().filters\"></cmat-transfer-picker-filter>\r\n }\r\n </mat-card-header>\r\n <mat-card-content class=\"transfer-picker-source-content\">\r\n @if (options().searchable) {\r\n <cmat-transfer-picker-search\r\n [searchPlaceholder]=\"options().searchPlaceholder\"></cmat-transfer-picker-search>\r\n }\r\n\r\n <cdk-virtual-scroll-viewport itemSize=\"48\"\r\n class=\"transfer-picker-source-scroll-wrapper overflow-y-auto scrollbar-custom\">\r\n <mat-tree #componentTree [dataSource]=\"dataSource()\" [childrenAccessor]=\"childrenAccessor\">\r\n <mat-tree-node *matTreeNodeDef=\"let node\" [matTreeNodePadding]=\"nestedNodeMap.get(node)?.level\">\r\n <button type=\"button\" matIconButton disabled> </button>\r\n <mat-checkbox class=\"checklist-leaf-node\" [checked]=\"checklistSelection.isSelected(nestedNodeMap.get(node)!)\"\r\n [disabled]=\"isNodeDisabled(nestedNodeMap.get(node)!)\" (change)=\"transferLeafItemSelectionToggle(nestedNodeMap.get(node)!);\">\r\n {{node.label}}\r\n </mat-checkbox>\r\n </mat-tree-node>\r\n\r\n <mat-tree-node *matTreeNodeDef=\"let node; when: hasChild\" [matTreeNodePadding]=\"nestedNodeMap.get(node)?.level\">\r\n <button type=\"button\" matIconButton matTreeNodeToggle>\r\n <mat-icon svgIcon=\"{{componentTree.isExpanded(node) ? 'mat_outline:expand_more' : 'mat_outline:chevron_right'}}\"\r\n class=\"mat-icon-rtl-mirror\">\r\n </mat-icon>\r\n </button>\r\n <mat-checkbox [checked]=\"descendantsAllSelected(nestedNodeMap.get(node)!)||committedValueSet().has(nestedNodeMap.get(node)!.value)\"\r\n [indeterminate]=\"descendantsPartiallySelected(nestedNodeMap.get(node)!)\" [disabled]=\"isNodeDisabled(nestedNodeMap.get(node)!)\"\r\n (change)=\"transferItemSelectionToggle(nestedNodeMap.get(node)!)\">\r\n {{node.label}}\r\n </mat-checkbox>\r\n </mat-tree-node>\r\n </mat-tree>\r\n @if (!dataSource().length) {\r\n <div class=\"transfer-picker-source-empty\">\u6682\u65E0\u6570\u636E</div>\r\n }\r\n </cdk-virtual-scroll-viewport>\r\n </mat-card-content>\r\n</mat-card>\r\n", styles: [".transfer-picker-source{width:276px;height:100%;padding:0}.transfer-picker-source .mat-mdc-card-header{display:flex;flex-direction:row;flex-wrap:nowrap;box-sizing:border-box;place-content:space-between;align-items:flex-start;margin-bottom:-8px}.transfer-picker-source-title{font-size:1rem;margin-bottom:0}.transfer-picker-source-scroll-wrapper{height:300px}.transfer-picker-source-empty{text-align:center;font-size:1rem;margin-top:20px;color:#00000040}\n"], dependencies: [{ kind: "ngmodule", type: MatCardModule }, { kind: "component", type: i1$2.MatCard, selector: "mat-card", inputs: ["appearance"], exportAs: ["matCard"] }, { kind: "directive", type: i1$2.MatCardContent, selector: "mat-card-content" }, { kind: "component", type: i1$2.MatCardHeader, selector: "mat-card-header" }, { kind: "directive", type: i1$2.MatCardTitle, selector: "mat-card-title, [mat-card-title], [matCardTitle]" }, { kind: "ngmodule", type: MatTreeModule }, { kind: "directive", type: i2$1.MatTreeNodeDef, selector: "[matTreeNodeDef]", inputs: ["matTreeNodeDefWhen", "matTreeNode"] }, { kind: "directive", type: i2$1.MatTreeNodePadding, selector: "[matTreeNodePadding]", inputs: ["matTreeNodePadding", "matTreeNodePaddingIndent"] }, { kind: "directive", type: i2$1.MatTreeNodeToggle, selector: "[matTreeNodeToggle]", inputs: ["matTreeNodeToggleRecursive"] }, { kind: "component", type: i2$1.MatTree, selector: "mat-tree", exportAs: ["matTree"] }, { kind: "directive", type: i2$1.MatTreeNode, selector: "mat-tree-node", inputs: ["tabIndex", "disabled"], outputs: ["activation", "expandedChange"], exportAs: ["matTreeNode"] }, { kind: "ngmodule", type: MatCheckboxModule }, { kind: "component", type: i3$2.MatCheckbox, selector: "mat-checkbox", inputs: ["aria-label", "aria-labelledby", "aria-describedby", "aria-expanded", "aria-controls", "aria-owns", "id", "required", "labelPosition", "name", "value", "disableRipple", "tabIndex", "color", "disabledInteractive", "checked", "disabled", "indeterminate"], outputs: ["change", "indeterminateChange"], exportAs: ["matCheckbox"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i2.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i5.MatIconButton, selector: "button[mat-icon-button], a[mat-icon-button], button[matIconButton], a[matIconButton]", exportAs: ["matButton", "matAnchor"] }, { kind: "component", type: CmatTransferPickerFilterComponent, selector: "cmat-transfer-picker-filter", inputs: ["filters"], exportAs: ["cmatTransferPickerFilter"] }, { kind: "component", type: CmatTransferPickerSearchComponent, selector: "cmat-transfer-picker-search", inputs: ["searchPlaceholder"], exportAs: ["cmatTransferPickerSearch"] }, { kind: "ngmodule", type: ScrollingModule }, { kind: "directive", type: i6.ɵɵCdkFixedSizeVirtualScroll, selector: "cdk-virtual-scroll-viewport[itemSize]", inputs: ["itemSize", "minBufferPx", "maxBufferPx"] }, { kind: "component", type: i6.ɵɵCdkVirtualScrollViewport, selector: "cdk-virtual-scroll-viewport", inputs: ["orientation", "appendOnly"], outputs: ["scrolledIndexChange"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
474
507
|
}
|
|
475
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.
|
|
508
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: CmatTransferPickerSourceComponent, decorators: [{
|
|
476
509
|
type: Component,
|
|
477
510
|
args: [{ selector: 'cmat-transfer-picker-source', encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, exportAs: 'cmatTransferPickerSource', imports: [MatCardModule, MatTreeModule, MatCheckboxModule, MatIconModule, MatButtonModule,
|
|
478
|
-
CmatTransferPickerFilterComponent, CmatTransferPickerSearchComponent, ScrollingModule], template: "<mat-card class=\"transfer-picker-source shadow\">\r\n <mat-card-header class=\"pb-3 items-center\">\r\n <mat-card-title class=\"transfer-picker-source-title\">{{options.title}}</mat-card-title>\r\n @if (options.filterable) {\r\n <cmat-transfer-picker-filter\r\n [filters]=\"options.filters\"></cmat-transfer-picker-filter>\r\n }\r\n </mat-card-header>\r\n <mat-card-content class=\"transfer-picker-source-content\">\r\n @if (options.searchable) {\r\n <cmat-transfer-picker-search\r\n [searchPlaceholder]=\"options.searchPlaceholder\"></cmat-transfer-picker-search>\r\n }\r\n\r\n <cdk-virtual-scroll-viewport itemSize=\"48\"\r\n class=\"transfer-picker-source-scroll-wrapper overflow-y-auto scrollbar-custom\">\r\n
|
|
511
|
+
CmatTransferPickerFilterComponent, CmatTransferPickerSearchComponent, ScrollingModule], template: "<mat-card class=\"transfer-picker-source shadow\">\r\n <mat-card-header class=\"pb-3 items-center\">\r\n <mat-card-title class=\"transfer-picker-source-title\">{{options().title}}</mat-card-title>\r\n @if (options().filterable) {\r\n <cmat-transfer-picker-filter\r\n [filters]=\"options().filters\"></cmat-transfer-picker-filter>\r\n }\r\n </mat-card-header>\r\n <mat-card-content class=\"transfer-picker-source-content\">\r\n @if (options().searchable) {\r\n <cmat-transfer-picker-search\r\n [searchPlaceholder]=\"options().searchPlaceholder\"></cmat-transfer-picker-search>\r\n }\r\n\r\n <cdk-virtual-scroll-viewport itemSize=\"48\"\r\n class=\"transfer-picker-source-scroll-wrapper overflow-y-auto scrollbar-custom\">\r\n <mat-tree #componentTree [dataSource]=\"dataSource()\" [childrenAccessor]=\"childrenAccessor\">\r\n <mat-tree-node *matTreeNodeDef=\"let node\" [matTreeNodePadding]=\"nestedNodeMap.get(node)?.level\">\r\n <button type=\"button\" matIconButton disabled> </button>\r\n <mat-checkbox class=\"checklist-leaf-node\" [checked]=\"checklistSelection.isSelected(nestedNodeMap.get(node)!)\"\r\n [disabled]=\"isNodeDisabled(nestedNodeMap.get(node)!)\" (change)=\"transferLeafItemSelectionToggle(nestedNodeMap.get(node)!);\">\r\n {{node.label}}\r\n </mat-checkbox>\r\n </mat-tree-node>\r\n\r\n <mat-tree-node *matTreeNodeDef=\"let node; when: hasChild\" [matTreeNodePadding]=\"nestedNodeMap.get(node)?.level\">\r\n <button type=\"button\" matIconButton matTreeNodeToggle>\r\n <mat-icon svgIcon=\"{{componentTree.isExpanded(node) ? 'mat_outline:expand_more' : 'mat_outline:chevron_right'}}\"\r\n class=\"mat-icon-rtl-mirror\">\r\n </mat-icon>\r\n </button>\r\n <mat-checkbox [checked]=\"descendantsAllSelected(nestedNodeMap.get(node)!)||committedValueSet().has(nestedNodeMap.get(node)!.value)\"\r\n [indeterminate]=\"descendantsPartiallySelected(nestedNodeMap.get(node)!)\" [disabled]=\"isNodeDisabled(nestedNodeMap.get(node)!)\"\r\n (change)=\"transferItemSelectionToggle(nestedNodeMap.get(node)!)\">\r\n {{node.label}}\r\n </mat-checkbox>\r\n </mat-tree-node>\r\n </mat-tree>\r\n @if (!dataSource().length) {\r\n <div class=\"transfer-picker-source-empty\">\u6682\u65E0\u6570\u636E</div>\r\n }\r\n </cdk-virtual-scroll-viewport>\r\n </mat-card-content>\r\n</mat-card>\r\n", styles: [".transfer-picker-source{width:276px;height:100%;padding:0}.transfer-picker-source .mat-mdc-card-header{display:flex;flex-direction:row;flex-wrap:nowrap;box-sizing:border-box;place-content:space-between;align-items:flex-start;margin-bottom:-8px}.transfer-picker-source-title{font-size:1rem;margin-bottom:0}.transfer-picker-source-scroll-wrapper{height:300px}.transfer-picker-source-empty{text-align:center;font-size:1rem;margin-top:20px;color:#00000040}\n"] }]
|
|
479
512
|
}], propDecorators: { tree: [{
|
|
480
513
|
type: ViewChild,
|
|
481
514
|
args: ['componentTree', { static: false }]
|
|
@@ -486,16 +519,15 @@ class CmatTransferPickerTargetComponent {
|
|
|
486
519
|
this.clearItemChange = new EventEmitter();
|
|
487
520
|
}
|
|
488
521
|
clearItem(item) {
|
|
489
|
-
this.selectedList.splice(this.selectedList.findIndex(j => j === item), 1);
|
|
490
522
|
this.clearItemChange.emit(item);
|
|
491
523
|
}
|
|
492
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.
|
|
493
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.
|
|
524
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: CmatTransferPickerTargetComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
525
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.9", type: CmatTransferPickerTargetComponent, isStandalone: true, selector: "cmat-transfer-picker-target", inputs: { committedSelection: "committedSelection" }, outputs: { clearItemChange: "clearItemChange" }, exportAs: ["cmatTransferPickerTarget"], ngImport: i0, template: "<mat-card class=\"transfer-picker-target shadow\">\r\n <mat-card-header class=\"pb-3 items-center\">\r\n <mat-card-title class=\"transfer-picker-target-title\">\u5DF2\u9009\u62E9 {{committedSelection.length}} \u9879</mat-card-title>\r\n </mat-card-header>\r\n <mat-card-content>\r\n <cdk-virtual-scroll-viewport itemSize=\"40\"\r\n class=\"transfer-picker-target-scroll-wrapper overflow-y-auto scrollbar-custom\">\r\n <mat-list dense>\r\n @for (item of committedSelection; track $index) {\r\n <mat-list-item class=\"transfer-picker-target-item\">\r\n <div mat-line class=\"flex flex-row items-center\">\r\n <div class=\"flex-1\">{{item.label}}</div>\r\n <button type=\"button\" matIconButton (click)=\"clearItem(item)\">\r\n <mat-icon svgIcon=\"heroicons_solid:x-circle\"></mat-icon>\r\n </button>\r\n </div>\r\n </mat-list-item>\r\n }\r\n </mat-list>\r\n @if (!committedSelection.length) {\r\n <div class=\"transfer-picker-target-empty\">\u6682\u65E0\u6570\u636E</div>\r\n }\r\n </cdk-virtual-scroll-viewport>\r\n </mat-card-content>\r\n</mat-card>\r\n", styles: [".transfer-picker-target{height:100%;padding:0;width:276px}.transfer-picker-target .mat-mdc-card-header{margin-bottom:-8px}.transfer-picker-target-title{font-size:1rem;margin-bottom:0;padding:12px 0}.transfer-picker-target-item{width:100%}.transfer-picker-target-scroll-wrapper{height:356px}.transfer-picker-target-empty{text-align:center;margin-top:20px;color:#00000040}\n"], dependencies: [{ kind: "ngmodule", type: MatCardModule }, { kind: "component", type: i1$2.MatCard, selector: "mat-card", inputs: ["appearance"], exportAs: ["matCard"] }, { kind: "directive", type: i1$2.MatCardContent, selector: "mat-card-content" }, { kind: "component", type: i1$2.MatCardHeader, selector: "mat-card-header" }, { kind: "directive", type: i1$2.MatCardTitle, selector: "mat-card-title, [mat-card-title], [matCardTitle]" }, { kind: "ngmodule", type: MatListModule }, { kind: "component", type: i2$2.MatList, selector: "mat-list", exportAs: ["matList"] }, { kind: "component", type: i2$2.MatListItem, selector: "mat-list-item, a[mat-list-item], button[mat-list-item]", inputs: ["activated"], exportAs: ["matListItem"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i2.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "ngmodule", type: ScrollingModule }, { kind: "directive", type: i6.ɵɵCdkFixedSizeVirtualScroll, selector: "cdk-virtual-scroll-viewport[itemSize]", inputs: ["itemSize", "minBufferPx", "maxBufferPx"] }, { kind: "component", type: i6.ɵɵCdkVirtualScrollViewport, selector: "cdk-virtual-scroll-viewport", inputs: ["orientation", "appendOnly"], outputs: ["scrolledIndexChange"] }, { kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i5.MatIconButton, selector: "button[mat-icon-button], a[mat-icon-button], button[matIconButton], a[matIconButton]", exportAs: ["matButton", "matAnchor"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
494
526
|
}
|
|
495
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.
|
|
527
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: CmatTransferPickerTargetComponent, decorators: [{
|
|
496
528
|
type: Component,
|
|
497
|
-
args: [{ selector: 'cmat-transfer-picker-target', encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, exportAs: 'cmatTransferPickerTarget', imports: [MatCardModule, MatListModule, MatIconModule, ScrollingModule, MatButtonModule], template: "<mat-card class=\"transfer-picker-target shadow\">\r\n <mat-card-header class=\"pb-3 items-center\">\r\n <mat-card-title class=\"transfer-picker-target-title\">\u5DF2\u9009\u62E9 {{
|
|
498
|
-
}], ctorParameters: () => [], propDecorators: {
|
|
529
|
+
args: [{ selector: 'cmat-transfer-picker-target', encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, exportAs: 'cmatTransferPickerTarget', imports: [MatCardModule, MatListModule, MatIconModule, ScrollingModule, MatButtonModule], template: "<mat-card class=\"transfer-picker-target shadow\">\r\n <mat-card-header class=\"pb-3 items-center\">\r\n <mat-card-title class=\"transfer-picker-target-title\">\u5DF2\u9009\u62E9 {{committedSelection.length}} \u9879</mat-card-title>\r\n </mat-card-header>\r\n <mat-card-content>\r\n <cdk-virtual-scroll-viewport itemSize=\"40\"\r\n class=\"transfer-picker-target-scroll-wrapper overflow-y-auto scrollbar-custom\">\r\n <mat-list dense>\r\n @for (item of committedSelection; track $index) {\r\n <mat-list-item class=\"transfer-picker-target-item\">\r\n <div mat-line class=\"flex flex-row items-center\">\r\n <div class=\"flex-1\">{{item.label}}</div>\r\n <button type=\"button\" matIconButton (click)=\"clearItem(item)\">\r\n <mat-icon svgIcon=\"heroicons_solid:x-circle\"></mat-icon>\r\n </button>\r\n </div>\r\n </mat-list-item>\r\n }\r\n </mat-list>\r\n @if (!committedSelection.length) {\r\n <div class=\"transfer-picker-target-empty\">\u6682\u65E0\u6570\u636E</div>\r\n }\r\n </cdk-virtual-scroll-viewport>\r\n </mat-card-content>\r\n</mat-card>\r\n", styles: [".transfer-picker-target{height:100%;padding:0;width:276px}.transfer-picker-target .mat-mdc-card-header{margin-bottom:-8px}.transfer-picker-target-title{font-size:1rem;margin-bottom:0;padding:12px 0}.transfer-picker-target-item{width:100%}.transfer-picker-target-scroll-wrapper{height:356px}.transfer-picker-target-empty{text-align:center;margin-top:20px;color:#00000040}\n"] }]
|
|
530
|
+
}], ctorParameters: () => [], propDecorators: { committedSelection: [{
|
|
499
531
|
type: Input
|
|
500
532
|
}], clearItemChange: [{
|
|
501
533
|
type: Output
|
|
@@ -503,12 +535,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.7", ngImpor
|
|
|
503
535
|
|
|
504
536
|
class CmatTransferPickerComponent {
|
|
505
537
|
constructor() {
|
|
538
|
+
this.committedSelection = signal([], ...(ngDevMode ? [{ debugName: "committedSelection" }] : /* istanbul ignore next */ []));
|
|
506
539
|
this._service = inject(CmatTransferPickerService);
|
|
507
|
-
this.
|
|
540
|
+
this._injector = inject(Injector);
|
|
508
541
|
this.filterable = true;
|
|
509
542
|
this.dataSource = [];
|
|
510
543
|
this.filters = [];
|
|
511
|
-
this.
|
|
544
|
+
this.committedSelection.set([]);
|
|
512
545
|
this.selectedValues = [];
|
|
513
546
|
}
|
|
514
547
|
ngOnInit() {
|
|
@@ -525,36 +558,39 @@ class CmatTransferPickerComponent {
|
|
|
525
558
|
}
|
|
526
559
|
ngAfterViewInit() {
|
|
527
560
|
if (this.selectedValues.length) {
|
|
528
|
-
|
|
561
|
+
afterNextRender(() => {
|
|
562
|
+
this.pick();
|
|
563
|
+
}, { injector: this._injector });
|
|
529
564
|
}
|
|
530
565
|
}
|
|
531
566
|
pick() {
|
|
532
|
-
this.
|
|
533
|
-
this._emitterChange();
|
|
567
|
+
this._commitSelection(this.source.commitSelection());
|
|
534
568
|
}
|
|
535
569
|
reset() {
|
|
536
|
-
if (this.
|
|
537
|
-
this.
|
|
570
|
+
if (this.committedSelection().length) {
|
|
571
|
+
this._commitSelection([]);
|
|
538
572
|
this._service.resetDataSource(true);
|
|
539
|
-
this._emitterChange();
|
|
540
573
|
}
|
|
541
574
|
}
|
|
542
575
|
onClearItemChange(item) {
|
|
543
576
|
if (item) {
|
|
544
577
|
this.source.resetSelectedItem(item);
|
|
545
|
-
this.
|
|
578
|
+
this._commitSelection(this.source.getCommittedSelection());
|
|
546
579
|
}
|
|
547
580
|
}
|
|
581
|
+
_commitSelection(selectedList) {
|
|
582
|
+
this.committedSelection.set([...selectedList]);
|
|
583
|
+
this._emitterChange();
|
|
584
|
+
}
|
|
548
585
|
_emitterChange() {
|
|
549
|
-
this.selectChange.emit(this.
|
|
550
|
-
this._changeDetectorRef.detectChanges();
|
|
586
|
+
this.selectChange.emit(this.committedSelection());
|
|
551
587
|
}
|
|
552
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.
|
|
553
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.
|
|
588
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: CmatTransferPickerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
589
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.9", type: CmatTransferPickerComponent, isStandalone: true, selector: "cmat-transfer-picker", inputs: { title: "title", filterable: "filterable", searchable: "searchable", searchPlaceholder: "searchPlaceholder", dataSource: "dataSource", filters: "filters", selectedValues: "selectedValues" }, outputs: { selectChange: "selectChange" }, viewQueries: [{ propertyName: "source", first: true, predicate: CmatTransferPickerSourceComponent, descendants: true, static: true }], exportAs: ["cmatTransferPicker"], ngImport: i0, template: "<cmat-transfer-picker-source></cmat-transfer-picker-source>\r\n<div class=\"cmat-transfer-picker-operation flex flex-col flex-nowrap gap-2 mx-2\">\r\n <button type=\"button\" class=\"pl-2\" matButton=\"filled\" color=\"primary\" (click)=\"pick()\">\r\n \u9009\u62E9<mat-icon svgIcon=\"mat_outline:chevron_right\"></mat-icon>\r\n </button>\r\n <button type=\"button\" class=\"pl-2\" matButton=\"filled\" color=\"primary\" (click)=\"reset()\">\r\n <mat-icon svgIcon=\"mat_outline:chevron_left\"></mat-icon>\u91CD\u7F6E\r\n </button>\r\n</div>\r\n<cmat-transfer-picker-target [committedSelection]=\"committedSelection()\" (clearItemChange)=\"onClearItemChange($event)\">\r\n</cmat-transfer-picker-target>\r\n", styles: ["cmat-transfer-picker{height:100%;overflow:hidden;padding:1rem;display:flex;flex-wrap:nowrap;justify-items:center;align-items:center;gap:.5rem}cmat-transfer-picker cmat-transfer-picker-source,cmat-transfer-picker cmat-transfer-picker-target{height:100%}\n"], dependencies: [{ kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i2.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i5.MatButton, selector: " button[matButton], a[matButton], button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button], a[mat-button], a[mat-raised-button], a[mat-flat-button], a[mat-stroked-button] ", inputs: ["matButton"], exportAs: ["matButton", "matAnchor"] }, { kind: "component", type: CmatTransferPickerSourceComponent, selector: "cmat-transfer-picker-source", exportAs: ["cmatTransferPickerSource"] }, { kind: "component", type: CmatTransferPickerTargetComponent, selector: "cmat-transfer-picker-target", inputs: ["committedSelection"], outputs: ["clearItemChange"], exportAs: ["cmatTransferPickerTarget"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
554
590
|
}
|
|
555
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.
|
|
591
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: CmatTransferPickerComponent, decorators: [{
|
|
556
592
|
type: Component,
|
|
557
|
-
args: [{ selector: 'cmat-transfer-picker', encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, exportAs: 'cmatTransferPicker', imports: [MatIconModule, MatButtonModule, CmatTransferPickerSourceComponent, CmatTransferPickerTargetComponent], template: "<cmat-transfer-picker-source></cmat-transfer-picker-source>\r\n<div class=\"cmat-transfer-picker-operation flex flex-col flex-nowrap gap-2 mx-2\">\r\n <button type=\"button\" class=\"pl-2\" matButton=\"filled\" color=\"primary\" (click)=\"pick()\">\r\n \u9009\u62E9<mat-icon svgIcon=\"mat_outline:chevron_right\"></mat-icon>\r\n </button>\r\n <button type=\"button\" class=\"pl-2\" matButton=\"filled\" color=\"primary\" (click)=\"reset()\">\r\n <mat-icon svgIcon=\"mat_outline:chevron_left\"></mat-icon>\u91CD\u7F6E\r\n </button>\r\n</div>\r\n<cmat-transfer-picker-target [
|
|
593
|
+
args: [{ selector: 'cmat-transfer-picker', encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, exportAs: 'cmatTransferPicker', imports: [MatIconModule, MatButtonModule, CmatTransferPickerSourceComponent, CmatTransferPickerTargetComponent], template: "<cmat-transfer-picker-source></cmat-transfer-picker-source>\r\n<div class=\"cmat-transfer-picker-operation flex flex-col flex-nowrap gap-2 mx-2\">\r\n <button type=\"button\" class=\"pl-2\" matButton=\"filled\" color=\"primary\" (click)=\"pick()\">\r\n \u9009\u62E9<mat-icon svgIcon=\"mat_outline:chevron_right\"></mat-icon>\r\n </button>\r\n <button type=\"button\" class=\"pl-2\" matButton=\"filled\" color=\"primary\" (click)=\"reset()\">\r\n <mat-icon svgIcon=\"mat_outline:chevron_left\"></mat-icon>\u91CD\u7F6E\r\n </button>\r\n</div>\r\n<cmat-transfer-picker-target [committedSelection]=\"committedSelection()\" (clearItemChange)=\"onClearItemChange($event)\">\r\n</cmat-transfer-picker-target>\r\n", styles: ["cmat-transfer-picker{height:100%;overflow:hidden;padding:1rem;display:flex;flex-wrap:nowrap;justify-items:center;align-items:center;gap:.5rem}cmat-transfer-picker cmat-transfer-picker-source,cmat-transfer-picker cmat-transfer-picker-target{height:100%}\n"] }]
|
|
558
594
|
}], ctorParameters: () => [], propDecorators: { title: [{
|
|
559
595
|
type: Input
|
|
560
596
|
}], filterable: [{
|