cmat 0.0.110 → 0.0.112
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 +531 -536
- package/fesm2022/cmat-components-adapter.mjs.map +1 -1
- package/fesm2022/cmat-components-breadcrumb.mjs +521 -356
- package/fesm2022/cmat-components-breadcrumb.mjs.map +1 -1
- package/fesm2022/cmat-components-card.mjs +150 -42
- package/fesm2022/cmat-components-card.mjs.map +1 -1
- package/fesm2022/cmat-components-carousel.mjs +1120 -629
- package/fesm2022/cmat-components-carousel.mjs.map +1 -1
- package/fesm2022/cmat-components-cascade.mjs +861 -441
- package/fesm2022/cmat-components-cascade.mjs.map +1 -1
- package/fesm2022/cmat-components-chip-input.mjs +580 -335
- package/fesm2022/cmat-components-chip-input.mjs.map +1 -1
- package/fesm2022/cmat-components-code-editor.mjs +197 -105
- package/fesm2022/cmat-components-code-editor.mjs.map +1 -1
- package/fesm2022/cmat-components-color-picker.mjs +1762 -825
- package/fesm2022/cmat-components-color-picker.mjs.map +1 -1
- package/fesm2022/cmat-components-custom-formly.mjs +5196 -2531
- package/fesm2022/cmat-components-custom-formly.mjs.map +1 -1
- package/fesm2022/cmat-components-data-picker.mjs +1901 -1073
- package/fesm2022/cmat-components-data-picker.mjs.map +1 -1
- package/fesm2022/cmat-components-date-range.mjs +701 -456
- package/fesm2022/cmat-components-date-range.mjs.map +1 -1
- package/fesm2022/cmat-components-date-time-display.mjs +137 -30
- package/fesm2022/cmat-components-date-time-display.mjs.map +1 -1
- package/fesm2022/cmat-components-drawer.mjs +410 -258
- package/fesm2022/cmat-components-drawer.mjs.map +1 -1
- package/fesm2022/cmat-components-empty-state.mjs +201 -41
- package/fesm2022/cmat-components-empty-state.mjs.map +1 -1
- package/fesm2022/cmat-components-file-preview.mjs +198 -35
- package/fesm2022/cmat-components-file-preview.mjs.map +1 -1
- package/fesm2022/cmat-components-filter-toolbar.mjs +320 -72
- package/fesm2022/cmat-components-filter-toolbar.mjs.map +1 -1
- package/fesm2022/cmat-components-form-actions.mjs +102 -26
- package/fesm2022/cmat-components-form-actions.mjs.map +1 -1
- package/fesm2022/cmat-components-fullscreen.mjs +167 -47
- package/fesm2022/cmat-components-fullscreen.mjs.map +1 -1
- package/fesm2022/cmat-components-highlight.mjs +203 -112
- package/fesm2022/cmat-components-highlight.mjs.map +1 -1
- package/fesm2022/cmat-components-image-viewer.mjs +489 -215
- package/fesm2022/cmat-components-image-viewer.mjs.map +1 -1
- package/fesm2022/cmat-components-inline-loading.mjs +117 -27
- package/fesm2022/cmat-components-inline-loading.mjs.map +1 -1
- package/fesm2022/cmat-components-json-editor.mjs +276 -230
- package/fesm2022/cmat-components-json-editor.mjs.map +1 -1
- package/fesm2022/cmat-components-knob-input.mjs +615 -420
- package/fesm2022/cmat-components-knob-input.mjs.map +1 -1
- package/fesm2022/cmat-components-loading-overlay.mjs +53 -25
- package/fesm2022/cmat-components-loading-overlay.mjs.map +1 -1
- package/fesm2022/cmat-components-masonry.mjs +120 -40
- package/fesm2022/cmat-components-masonry.mjs.map +1 -1
- package/fesm2022/cmat-components-material-color-picker.mjs +332 -155
- package/fesm2022/cmat-components-material-color-picker.mjs.map +1 -1
- package/fesm2022/cmat-components-material-datetimepicker.mjs +4283 -2504
- package/fesm2022/cmat-components-material-datetimepicker.mjs.map +1 -1
- package/fesm2022/cmat-components-navigation.mjs +3080 -1404
- package/fesm2022/cmat-components-navigation.mjs.map +1 -1
- package/fesm2022/cmat-components-opt-input.mjs +540 -466
- package/fesm2022/cmat-components-opt-input.mjs.map +1 -1
- package/fesm2022/cmat-components-org-chart.mjs +528 -125
- package/fesm2022/cmat-components-org-chart.mjs.map +1 -1
- package/fesm2022/cmat-components-page-header.mjs +141 -32
- package/fesm2022/cmat-components-page-header.mjs.map +1 -1
- package/fesm2022/cmat-components-pagination.mjs +866 -534
- package/fesm2022/cmat-components-pagination.mjs.map +1 -1
- package/fesm2022/cmat-components-password-strength.mjs +873 -434
- package/fesm2022/cmat-components-password-strength.mjs.map +1 -1
- package/fesm2022/cmat-components-popover.mjs +1012 -731
- package/fesm2022/cmat-components-popover.mjs.map +1 -1
- package/fesm2022/cmat-components-progress-bar.mjs +98 -35
- package/fesm2022/cmat-components-progress-bar.mjs.map +1 -1
- package/fesm2022/cmat-components-qrcode.mjs +463 -287
- package/fesm2022/cmat-components-qrcode.mjs.map +1 -1
- package/fesm2022/cmat-components-rating.mjs +377 -203
- package/fesm2022/cmat-components-rating.mjs.map +1 -1
- package/fesm2022/cmat-components-rich-text-editor.mjs +153 -39
- package/fesm2022/cmat-components-rich-text-editor.mjs.map +1 -1
- package/fesm2022/cmat-components-select-search.mjs +926 -496
- package/fesm2022/cmat-components-select-search.mjs.map +1 -1
- package/fesm2022/cmat-components-select-table.mjs +1280 -842
- package/fesm2022/cmat-components-select-table.mjs.map +1 -1
- package/fesm2022/cmat-components-select-tree.mjs +998 -690
- package/fesm2022/cmat-components-select-tree.mjs.map +1 -1
- package/fesm2022/cmat-components-skeleton.mjs +143 -57
- package/fesm2022/cmat-components-skeleton.mjs.map +1 -1
- package/fesm2022/cmat-components-speed-dial.mjs +457 -303
- package/fesm2022/cmat-components-speed-dial.mjs.map +1 -1
- package/fesm2022/cmat-components-status-tag.mjs +136 -44
- package/fesm2022/cmat-components-status-tag.mjs.map +1 -1
- package/fesm2022/cmat-components-table-toolbar.mjs +120 -28
- package/fesm2022/cmat-components-table-toolbar.mjs.map +1 -1
- package/fesm2022/cmat-components-timeline.mjs +464 -168
- package/fesm2022/cmat-components-timeline.mjs.map +1 -1
- package/fesm2022/cmat-components-toast.mjs +346 -262
- package/fesm2022/cmat-components-toast.mjs.map +1 -1
- package/fesm2022/cmat-components-transfer-picker.mjs +1427 -593
- package/fesm2022/cmat-components-transfer-picker.mjs.map +1 -1
- package/fesm2022/cmat-components-treetable.mjs +372 -112
- package/fesm2022/cmat-components-treetable.mjs.map +1 -1
- package/fesm2022/cmat-components-upload.mjs +904 -410
- package/fesm2022/cmat-components-upload.mjs.map +1 -1
- package/fesm2022/cmat-components-x6-angular-shape.mjs +153 -170
- package/fesm2022/cmat-components-x6-angular-shape.mjs.map +1 -1
- package/fesm2022/cmat-directives-animate-on-scroll.mjs +220 -138
- package/fesm2022/cmat-directives-animate-on-scroll.mjs.map +1 -1
- package/fesm2022/cmat-directives-arrow-cursor.mjs +246 -193
- package/fesm2022/cmat-directives-arrow-cursor.mjs.map +1 -1
- package/fesm2022/cmat-directives-autofocus.mjs +43 -25
- package/fesm2022/cmat-directives-autofocus.mjs.map +1 -1
- package/fesm2022/cmat-directives-data-exporter.mjs +537 -338
- package/fesm2022/cmat-directives-data-exporter.mjs.map +1 -1
- package/fesm2022/cmat-directives-debounce.mjs +162 -76
- package/fesm2022/cmat-directives-debounce.mjs.map +1 -1
- package/fesm2022/cmat-directives-digit-only.mjs +457 -356
- package/fesm2022/cmat-directives-digit-only.mjs.map +1 -1
- package/fesm2022/cmat-directives-equal-validator.mjs +70 -53
- package/fesm2022/cmat-directives-equal-validator.mjs.map +1 -1
- package/fesm2022/cmat-directives-seamless-auto-scroll.mjs +180 -132
- package/fesm2022/cmat-directives-seamless-auto-scroll.mjs.map +1 -1
- package/fesm2022/cmat-lib-mock-api.mjs +207 -195
- package/fesm2022/cmat-lib-mock-api.mjs.map +1 -1
- package/fesm2022/cmat-pipes-bytes.mjs +50 -30
- package/fesm2022/cmat-pipes-bytes.mjs.map +1 -1
- package/fesm2022/cmat-pipes-date-format.mjs +41 -25
- package/fesm2022/cmat-pipes-date-format.mjs.map +1 -1
- package/fesm2022/cmat-pipes-find-by-key.mjs +44 -26
- package/fesm2022/cmat-pipes-find-by-key.mjs.map +1 -1
- package/fesm2022/cmat-pipes-group-by.mjs +50 -38
- package/fesm2022/cmat-pipes-group-by.mjs.map +1 -1
- package/fesm2022/cmat-pipes-keys.mjs +44 -31
- package/fesm2022/cmat-pipes-keys.mjs.map +1 -1
- package/fesm2022/cmat-pipes-secure.mjs +60 -49
- package/fesm2022/cmat-pipes-secure.mjs.map +1 -1
- package/fesm2022/cmat-pipes-uppercase.mjs +39 -22
- package/fesm2022/cmat-pipes-uppercase.mjs.map +1 -1
- package/fesm2022/cmat-reports.mjs +2751 -0
- package/fesm2022/cmat-reports.mjs.map +1 -0
- package/fesm2022/cmat-services-alert.mjs +249 -277
- package/fesm2022/cmat-services-alert.mjs.map +1 -1
- package/fesm2022/cmat-services-config.mjs +110 -81
- package/fesm2022/cmat-services-config.mjs.map +1 -1
- package/fesm2022/cmat-services-confirmation.mjs +184 -73
- package/fesm2022/cmat-services-confirmation.mjs.map +1 -1
- package/fesm2022/cmat-services-data.mjs +136 -125
- package/fesm2022/cmat-services-data.mjs.map +1 -1
- package/fesm2022/cmat-services-export-as.mjs +165 -183
- package/fesm2022/cmat-services-export-as.mjs.map +1 -1
- package/fesm2022/cmat-services-loading.mjs +116 -95
- package/fesm2022/cmat-services-loading.mjs.map +1 -1
- package/fesm2022/cmat-services-local-storage.mjs +75 -66
- package/fesm2022/cmat-services-local-storage.mjs.map +1 -1
- package/fesm2022/cmat-services-media-watcher.mjs +69 -64
- package/fesm2022/cmat-services-media-watcher.mjs.map +1 -1
- package/fesm2022/cmat-services-platform.mjs +48 -45
- package/fesm2022/cmat-services-platform.mjs.map +1 -1
- package/fesm2022/cmat-services-print.mjs +985 -669
- package/fesm2022/cmat-services-print.mjs.map +1 -1
- package/fesm2022/cmat-services-splash-screen.mjs +53 -38
- package/fesm2022/cmat-services-splash-screen.mjs.map +1 -1
- package/fesm2022/cmat-services-title.mjs +57 -47
- package/fesm2022/cmat-services-title.mjs.map +1 -1
- package/fesm2022/cmat-services-translation.mjs +79 -68
- package/fesm2022/cmat-services-translation.mjs.map +1 -1
- package/fesm2022/cmat-services-utils.mjs +424 -517
- package/fesm2022/cmat-services-utils.mjs.map +1 -1
- package/fesm2022/cmat-validators.mjs +23 -33
- package/fesm2022/cmat-validators.mjs.map +1 -1
- package/fesm2022/cmat-version.mjs +12 -16
- package/fesm2022/cmat-version.mjs.map +1 -1
- package/fesm2022/cmat.mjs +39806 -22071
- package/fesm2022/cmat.mjs.map +1 -1
- package/package.json +5 -1
- package/types/cmat-components-adapter.d.ts +145 -156
- package/types/cmat-components-breadcrumb.d.ts +108 -86
- package/types/cmat-components-card.d.ts +34 -18
- package/types/cmat-components-carousel.d.ts +251 -134
- package/types/cmat-components-cascade.d.ts +158 -117
- package/types/cmat-components-chip-input.d.ts +105 -71
- package/types/cmat-components-code-editor.d.ts +59 -34
- package/types/cmat-components-color-picker.d.ts +378 -236
- package/types/cmat-components-custom-formly.d.ts +776 -814
- package/types/cmat-components-data-picker.d.ts +502 -360
- package/types/cmat-components-date-range.d.ts +106 -77
- package/types/cmat-components-date-time-display.d.ts +36 -13
- package/types/cmat-components-drawer.d.ts +91 -61
- package/types/cmat-components-empty-state.d.ts +47 -17
- package/types/cmat-components-file-preview.d.ts +42 -14
- package/types/cmat-components-filter-toolbar.d.ts +57 -25
- package/types/cmat-components-form-actions.d.ts +18 -10
- package/types/cmat-components-fullscreen.d.ts +21 -13
- package/types/cmat-components-highlight.d.ts +33 -26
- package/types/cmat-components-image-viewer.d.ts +119 -58
- package/types/cmat-components-inline-loading.d.ts +24 -11
- package/types/cmat-components-json-editor.d.ts +39 -28
- package/types/cmat-components-knob-input.d.ts +172 -101
- package/types/cmat-components-loading-overlay.d.ts +8 -11
- package/types/cmat-components-masonry.d.ts +27 -14
- package/types/cmat-components-material-color-picker.d.ts +56 -42
- package/types/cmat-components-material-datetimepicker.d.ts +817 -454
- package/types/cmat-components-navigation.d.ts +295 -221
- package/types/cmat-components-opt-input.d.ts +111 -90
- package/types/cmat-components-org-chart.d.ts +53 -35
- package/types/cmat-components-page-header.d.ts +37 -14
- package/types/cmat-components-pagination.d.ts +144 -107
- package/types/cmat-components-password-strength.d.ts +197 -86
- package/types/cmat-components-popover.d.ts +264 -166
- package/types/cmat-components-progress-bar.d.ts +17 -14
- package/types/cmat-components-qrcode.d.ts +111 -42
- package/types/cmat-components-rating.d.ts +105 -59
- package/types/cmat-components-rich-text-editor.d.ts +39 -16
- package/types/cmat-components-select-search.d.ts +195 -99
- package/types/cmat-components-select-table.d.ts +241 -142
- package/types/cmat-components-select-tree.d.ts +185 -118
- package/types/cmat-components-skeleton.d.ts +55 -32
- package/types/cmat-components-speed-dial.d.ts +86 -61
- package/types/cmat-components-status-tag.d.ts +42 -24
- package/types/cmat-components-table-toolbar.d.ts +30 -12
- package/types/cmat-components-timeline.d.ts +83 -51
- package/types/cmat-components-toast.d.ts +84 -85
- package/types/cmat-components-transfer-picker.d.ts +228 -181
- package/types/cmat-components-treetable.d.ts +63 -39
- package/types/cmat-components-upload.d.ts +205 -106
- package/types/cmat-components-x6-angular-shape.d.ts +29 -37
- package/types/cmat-directives-animate-on-scroll.d.ts +48 -30
- package/types/cmat-directives-arrow-cursor.d.ts +55 -35
- package/types/cmat-directives-autofocus.d.ts +8 -11
- package/types/cmat-directives-data-exporter.d.ts +71 -40
- package/types/cmat-directives-debounce.d.ts +31 -28
- package/types/cmat-directives-digit-only.d.ts +90 -53
- package/types/cmat-directives-equal-validator.d.ts +11 -14
- package/types/cmat-directives-seamless-auto-scroll.d.ts +42 -29
- package/types/cmat-lib-mock-api.d.ts +46 -55
- package/types/cmat-pipes-bytes.d.ts +7 -10
- package/types/cmat-pipes-date-format.d.ts +7 -10
- package/types/cmat-pipes-find-by-key.d.ts +8 -12
- package/types/cmat-pipes-group-by.d.ts +11 -15
- package/types/cmat-pipes-keys.d.ts +10 -13
- package/types/cmat-pipes-secure.d.ts +14 -17
- package/types/cmat-pipes-uppercase.d.ts +7 -10
- package/types/cmat-reports.d.ts +1131 -0
- package/types/cmat-services-alert.d.ts +80 -87
- package/types/cmat-services-config.d.ts +37 -43
- package/types/cmat-services-confirmation.d.ts +31 -37
- package/types/cmat-services-data.d.ts +18 -21
- package/types/cmat-services-export-as.d.ts +28 -33
- package/types/cmat-services-loading.d.ts +27 -31
- package/types/cmat-services-local-storage.d.ts +17 -21
- package/types/cmat-services-media-watcher.d.ts +14 -18
- package/types/cmat-services-platform.d.ts +8 -11
- package/types/cmat-services-print.d.ts +97 -92
- package/types/cmat-services-splash-screen.d.ts +11 -14
- package/types/cmat-services-title.d.ts +9 -12
- package/types/cmat-services-translation.d.ts +19 -22
- package/types/cmat-services-utils.d.ts +76 -80
- package/types/cmat-validators.d.ts +5 -8
- package/types/cmat-version.d.ts +8 -10
- package/types/cmat.d.ts +7551 -5194
|
@@ -1,1077 +1,1905 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import * as i1 from
|
|
3
|
-
import { CommonModule } from
|
|
4
|
-
import * as i0 from
|
|
5
|
-
import {
|
|
6
|
-
import { takeUntilDestroyed } from
|
|
7
|
-
import * as i2 from
|
|
8
|
-
import { FormControl,
|
|
9
|
-
import * as i1$1 from
|
|
10
|
-
import { MatButtonModule } from
|
|
11
|
-
import * as i3 from
|
|
12
|
-
import { MatCheckboxModule } from
|
|
13
|
-
import * as
|
|
14
|
-
import { MatIconModule } from
|
|
15
|
-
import * as i5 from
|
|
16
|
-
import { MatInputModule } from
|
|
17
|
-
import * as i6 from
|
|
18
|
-
import { MatProgressSpinnerModule } from
|
|
19
|
-
import * as i7 from
|
|
20
|
-
import { MatRadioModule } from
|
|
21
|
-
import * as i8 from
|
|
22
|
-
import { MatSortModule } from
|
|
23
|
-
import * as i9 from
|
|
24
|
-
import { MatTableModule } from
|
|
25
|
-
import {
|
|
26
|
-
import { EMPTY, Subject } from
|
|
27
|
-
import { MAT_BOTTOM_SHEET_DATA,
|
|
28
|
-
import { MAT_DIALOG_DATA,
|
|
29
|
-
import { coerceBooleanProperty } from
|
|
30
|
-
import { Overlay } from
|
|
31
|
-
import { ComponentPortal } from
|
|
32
|
-
import * as i1
|
|
33
|
-
import { MatChipsModule } from
|
|
34
|
-
import { MatFormField, MatFormFieldControl } from
|
|
35
|
-
import { CmatMediaWatcherService } from
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
// 尝试常见的数据字段名
|
|
73
|
-
const data = (record['data'] ?? record['detail'] ?? record['items'] ?? record['list'] ?? []);
|
|
74
|
-
// 尝试常见的总数字段名
|
|
75
|
-
const total = (record['total'] ?? record['totalCount'] ?? record['count'] ?? record['totalItems'] ?? 0);
|
|
76
|
-
return {
|
|
77
|
-
data,
|
|
78
|
-
total
|
|
79
|
-
};
|
|
80
|
-
}));
|
|
81
|
-
}
|
|
82
|
-
/**
|
|
83
|
-
* 按 key 批量加载完整对象
|
|
84
|
-
*/
|
|
85
|
-
loadByKeys(keys) {
|
|
86
|
-
const { url, loadByUrl, method = 'post', params = {}, keysParam = 'keys', loadByKeysMapper } = this._config;
|
|
87
|
-
// 使用专用的 loadByUrl 或主 url
|
|
88
|
-
const targetUrl = loadByUrl ?? url;
|
|
89
|
-
const requestParams = { ...params };
|
|
90
|
-
requestParams[keysParam] = keys;
|
|
91
|
-
const request$ = method.toLowerCase() === 'get'
|
|
92
|
-
? this._dataService.get(targetUrl, requestParams)
|
|
93
|
-
: this._dataService.post(targetUrl, requestParams);
|
|
94
|
-
return request$.pipe(map((res) => {
|
|
95
|
-
// 如果提供了自定义映射函数,优先使用
|
|
96
|
-
if (loadByKeysMapper) {
|
|
97
|
-
return loadByKeysMapper(res);
|
|
98
|
-
}
|
|
99
|
-
// 默认提取:尝试常见格式
|
|
100
|
-
const record = res;
|
|
101
|
-
return (record['data'] ?? record['detail'] ?? record['items'] ?? record['list'] ?? res);
|
|
102
|
-
}));
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
/**
|
|
106
|
-
* 创建HTTP数据提供者的工厂函数
|
|
107
|
-
* @param config 数据源配置
|
|
108
|
-
* @param dataService CmatDataService 实例
|
|
109
|
-
*/
|
|
1
|
+
import { catchError, debounceTime, distinctUntilChanged, map, startWith, switchMap, tap } from "rxjs/operators";
|
|
2
|
+
import * as i1$2 from "@angular/common";
|
|
3
|
+
import { CommonModule } from "@angular/common";
|
|
4
|
+
import * as i0 from "@angular/core";
|
|
5
|
+
import { ChangeDetectionStrategy, Component, DestroyRef, ElementRef, Input, ViewEncapsulation, computed, effect, inject, input, output, signal, untracked, viewChild } from "@angular/core";
|
|
6
|
+
import { takeUntilDestroyed } from "@angular/core/rxjs-interop";
|
|
7
|
+
import * as i2 from "@angular/forms";
|
|
8
|
+
import { FormControl, NgControl, ReactiveFormsModule } from "@angular/forms";
|
|
9
|
+
import * as i1$1 from "@angular/material/button";
|
|
10
|
+
import { MatButtonModule } from "@angular/material/button";
|
|
11
|
+
import * as i3 from "@angular/material/checkbox";
|
|
12
|
+
import { MatCheckboxModule } from "@angular/material/checkbox";
|
|
13
|
+
import * as i4 from "@angular/material/icon";
|
|
14
|
+
import { MatIconModule } from "@angular/material/icon";
|
|
15
|
+
import * as i5 from "@angular/material/input";
|
|
16
|
+
import { MatInputModule } from "@angular/material/input";
|
|
17
|
+
import * as i6 from "@angular/material/progress-spinner";
|
|
18
|
+
import { MatProgressSpinnerModule } from "@angular/material/progress-spinner";
|
|
19
|
+
import * as i7 from "@angular/material/radio";
|
|
20
|
+
import { MatRadioModule } from "@angular/material/radio";
|
|
21
|
+
import * as i8 from "@angular/material/sort";
|
|
22
|
+
import { MatSortModule } from "@angular/material/sort";
|
|
23
|
+
import * as i9 from "@angular/material/table";
|
|
24
|
+
import { MatTableModule } from "@angular/material/table";
|
|
25
|
+
import { CmatPaginatePipe, CmatPaginationComponent } from "cmat/components/pagination";
|
|
26
|
+
import { EMPTY, Subject } from "rxjs";
|
|
27
|
+
import { MAT_BOTTOM_SHEET_DATA, MatBottomSheet, MatBottomSheetRef } from "@angular/material/bottom-sheet";
|
|
28
|
+
import { MAT_DIALOG_DATA, MatDialog, MatDialogRef } from "@angular/material/dialog";
|
|
29
|
+
import { coerceBooleanProperty } from "@angular/cdk/coercion";
|
|
30
|
+
import { Overlay } from "@angular/cdk/overlay";
|
|
31
|
+
import { ComponentPortal } from "@angular/cdk/portal";
|
|
32
|
+
import * as i1 from "@angular/material/chips";
|
|
33
|
+
import { MatChipsModule } from "@angular/material/chips";
|
|
34
|
+
import { MatFormField, MatFormFieldControl } from "@angular/material/form-field";
|
|
35
|
+
import { CmatMediaWatcherService } from "cmat/services/media-watcher";
|
|
36
|
+
var HttpDataPickerProvider = class {
|
|
37
|
+
constructor(_dataService, _config) {
|
|
38
|
+
this._dataService = _dataService;
|
|
39
|
+
this._config = _config;
|
|
40
|
+
}
|
|
41
|
+
loadPage(query) {
|
|
42
|
+
const { url, method = "post", params = {}, searchParam = "search", orderByField = "orderBy", descField = "desc", responseMapper } = this._config;
|
|
43
|
+
const requestParams = { ...params };
|
|
44
|
+
requestParams.pageIndex = query.page;
|
|
45
|
+
requestParams.pageSize = query.size;
|
|
46
|
+
if (query.search) requestParams[searchParam] = query.search;
|
|
47
|
+
if (query.orderBy) {
|
|
48
|
+
requestParams[orderByField] = query.orderBy;
|
|
49
|
+
requestParams[descField] = query.desc ?? false;
|
|
50
|
+
}
|
|
51
|
+
return (method.toLowerCase() === "get" ? this._dataService.get(url, requestParams) : this._dataService.post(url, requestParams)).pipe(map((res) => {
|
|
52
|
+
if (responseMapper) return responseMapper(res);
|
|
53
|
+
const record = res;
|
|
54
|
+
return {
|
|
55
|
+
data: record["data"] ?? record["detail"] ?? record["items"] ?? record["list"] ?? [],
|
|
56
|
+
total: record["total"] ?? record["totalCount"] ?? record["count"] ?? record["totalItems"] ?? 0
|
|
57
|
+
};
|
|
58
|
+
}));
|
|
59
|
+
}
|
|
60
|
+
loadByKeys(keys) {
|
|
61
|
+
const { url, loadByUrl, method = "post", params = {}, keysParam = "keys", loadByKeysMapper } = this._config;
|
|
62
|
+
const targetUrl = loadByUrl ?? url;
|
|
63
|
+
const requestParams = { ...params };
|
|
64
|
+
requestParams[keysParam] = keys;
|
|
65
|
+
return (method.toLowerCase() === "get" ? this._dataService.get(targetUrl, requestParams) : this._dataService.post(targetUrl, requestParams)).pipe(map((res) => {
|
|
66
|
+
if (loadByKeysMapper) return loadByKeysMapper(res);
|
|
67
|
+
const record = res;
|
|
68
|
+
return record["data"] ?? record["detail"] ?? record["items"] ?? record["list"] ?? res;
|
|
69
|
+
}));
|
|
70
|
+
}
|
|
71
|
+
};
|
|
110
72
|
function createHttpDataProvider(config, dataService) {
|
|
111
|
-
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
class CmatDataPickerListComponent {
|
|
115
|
-
constructor() {
|
|
116
|
-
// === 输入 ===
|
|
117
|
-
this.dataProvider = input.required(/* @ts-ignore */
|
|
118
|
-
...(ngDevMode ? [{ debugName: "dataProvider" }] : /* istanbul ignore next */ []));
|
|
119
|
-
this.columns = input.required(/* @ts-ignore */
|
|
120
|
-
...(ngDevMode ? [{ debugName: "columns" }] : /* istanbul ignore next */ []));
|
|
121
|
-
this.keyField = input('id', /* @ts-ignore */
|
|
122
|
-
...(ngDevMode ? [{ debugName: "keyField" }] : /* istanbul ignore next */ []));
|
|
123
|
-
this.multiple = input(false, /* @ts-ignore */
|
|
124
|
-
...(ngDevMode ? [{ debugName: "multiple" }] : /* istanbul ignore next */ []));
|
|
125
|
-
this.searchable = input(true, /* @ts-ignore */
|
|
126
|
-
...(ngDevMode ? [{ debugName: "searchable" }] : /* istanbul ignore next */ []));
|
|
127
|
-
this.pageSize = input(20, /* @ts-ignore */
|
|
128
|
-
...(ngDevMode ? [{ debugName: "pageSize" }] : /* istanbul ignore next */ []));
|
|
129
|
-
this.searchPlaceholder = input('搜索...', /* @ts-ignore */
|
|
130
|
-
...(ngDevMode ? [{ debugName: "searchPlaceholder" }] : /* istanbul ignore next */ []));
|
|
131
|
-
this.emptyText = input('暂无数据', /* @ts-ignore */
|
|
132
|
-
...(ngDevMode ? [{ debugName: "emptyText" }] : /* istanbul ignore next */ []));
|
|
133
|
-
this.paginationId = input('data-picker-pagination', /* @ts-ignore */
|
|
134
|
-
...(ngDevMode ? [{ debugName: "paginationId" }] : /* istanbul ignore next */ []));
|
|
135
|
-
// === 输出 ===
|
|
136
|
-
this.selectionChange = output();
|
|
137
|
-
// === 内部状态 ===
|
|
138
|
-
this.items = signal([], /* @ts-ignore */
|
|
139
|
-
...(ngDevMode ? [{ debugName: "items" }] : /* istanbul ignore next */ []));
|
|
140
|
-
this.loading = signal(false, /* @ts-ignore */
|
|
141
|
-
...(ngDevMode ? [{ debugName: "loading" }] : /* istanbul ignore next */ []));
|
|
142
|
-
this.selectedItems = signal(new Map(), /* @ts-ignore */
|
|
143
|
-
...(ngDevMode ? [{ debugName: "selectedItems" }] : /* istanbul ignore next */ []));
|
|
144
|
-
// === 分页状态(统一管理) ===
|
|
145
|
-
this.pagination = signal({
|
|
146
|
-
currentPage: 1,
|
|
147
|
-
itemsPerPage: 20,
|
|
148
|
-
totalItems: 0
|
|
149
|
-
}, /* @ts-ignore */
|
|
150
|
-
...(ngDevMode ? [{ debugName: "pagination" }] : /* istanbul ignore next */ []));
|
|
151
|
-
// === 排序状态 ===
|
|
152
|
-
this.sortState = signal({}, /* @ts-ignore */
|
|
153
|
-
...(ngDevMode ? [{ debugName: "sortState" }] : /* istanbul ignore next */ []));
|
|
154
|
-
// === 搜索控制 ===
|
|
155
|
-
this.searchControl = new FormControl('');
|
|
156
|
-
// === 计算属性 ===
|
|
157
|
-
this.displayedColumns = computed(() => {
|
|
158
|
-
const cols = this.columns().map(c => c.key);
|
|
159
|
-
return ['_selection', ...cols];
|
|
160
|
-
}, /* @ts-ignore */
|
|
161
|
-
...(ngDevMode ? [{ debugName: "displayedColumns" }] : /* istanbul ignore next */ []));
|
|
162
|
-
this.selectedCount = computed(() => this.selectedItems().size, /* @ts-ignore */
|
|
163
|
-
...(ngDevMode ? [{ debugName: "selectedCount" }] : /* istanbul ignore next */ []));
|
|
164
|
-
this.isAllSelected = computed(() => {
|
|
165
|
-
if (!this.multiple() || this.items().length === 0) {
|
|
166
|
-
return false;
|
|
167
|
-
}
|
|
168
|
-
return this.items().every(item => this.selectedItems().has(this.getItemKey(item)));
|
|
169
|
-
}, /* @ts-ignore */
|
|
170
|
-
...(ngDevMode ? [{ debugName: "isAllSelected" }] : /* istanbul ignore next */ []));
|
|
171
|
-
this.isIndeterminate = computed(() => {
|
|
172
|
-
if (!this.multiple()) {
|
|
173
|
-
return false;
|
|
174
|
-
}
|
|
175
|
-
const selectedCount = this.items().filter(item => this.selectedItems().has(this.getItemKey(item))).length;
|
|
176
|
-
return selectedCount > 0 && selectedCount < this.items().length;
|
|
177
|
-
}, /* @ts-ignore */
|
|
178
|
-
...(ngDevMode ? [{ debugName: "isIndeterminate" }] : /* istanbul ignore next */ []));
|
|
179
|
-
this._destroyRef = inject(DestroyRef);
|
|
180
|
-
// 监听搜索变化,带防抖
|
|
181
|
-
effect(() => {
|
|
182
|
-
const provider = this.dataProvider();
|
|
183
|
-
if (!provider)
|
|
184
|
-
return;
|
|
185
|
-
untracked(() => {
|
|
186
|
-
this.searchControl.valueChanges.pipe(startWith(''), debounceTime(300), distinctUntilChanged(), tap(() => this.loading.set(true)), switchMap((search) => {
|
|
187
|
-
// 在闭包中捕获当前的排序状态
|
|
188
|
-
const currentSort = this.sortState();
|
|
189
|
-
return provider.loadPage({
|
|
190
|
-
page: 1,
|
|
191
|
-
size: this.pagination().itemsPerPage,
|
|
192
|
-
search: search ?? undefined,
|
|
193
|
-
orderBy: currentSort.active,
|
|
194
|
-
desc: currentSort.direction === 'desc'
|
|
195
|
-
});
|
|
196
|
-
}), takeUntilDestroyed(this._destroyRef), catchError((error) => {
|
|
197
|
-
console.error('Search failed:', error);
|
|
198
|
-
this.items.set([]);
|
|
199
|
-
return EMPTY;
|
|
200
|
-
})).subscribe((result) => {
|
|
201
|
-
// 确保即使返回空数组也正确更新状态
|
|
202
|
-
this.items.set(result.data || []);
|
|
203
|
-
this.pagination.update(p => ({ ...p, currentPage: 1, totalItems: result.total || 0 }));
|
|
204
|
-
this.loading.set(false);
|
|
205
|
-
});
|
|
206
|
-
});
|
|
207
|
-
});
|
|
208
|
-
}
|
|
209
|
-
/**
|
|
210
|
-
* 加载数据(公共方法,用于初始化和重置)
|
|
211
|
-
*/
|
|
212
|
-
loadData() {
|
|
213
|
-
this._loadPageData(this.pagination().currentPage, this.pagination().itemsPerPage, this.searchControl.value ?? undefined);
|
|
214
|
-
}
|
|
215
|
-
/**
|
|
216
|
-
* 重置组件状态(用于重新打开时)
|
|
217
|
-
*/
|
|
218
|
-
reset() {
|
|
219
|
-
// 重置分页状态
|
|
220
|
-
this.pagination.set({
|
|
221
|
-
currentPage: 1,
|
|
222
|
-
itemsPerPage: this.pageSize(),
|
|
223
|
-
totalItems: 0
|
|
224
|
-
});
|
|
225
|
-
// 重置排序状态
|
|
226
|
-
this.sortState.set({});
|
|
227
|
-
// 清空搜索(不触发事件,避免重复加载)
|
|
228
|
-
this.searchControl.setValue('', { emitEvent: false });
|
|
229
|
-
// 清空选中项
|
|
230
|
-
this.selectedItems.set(new Map());
|
|
231
|
-
// 清空数据列表
|
|
232
|
-
this.items.set([]);
|
|
233
|
-
// 重新加载数据
|
|
234
|
-
this._loadPageData(1, this.pageSize(), '', undefined, undefined);
|
|
235
|
-
}
|
|
236
|
-
/**
|
|
237
|
-
* 获取项的唯一键
|
|
238
|
-
*/
|
|
239
|
-
getItemKey(item) {
|
|
240
|
-
return item[this.keyField()];
|
|
241
|
-
}
|
|
242
|
-
/**
|
|
243
|
-
* 判断是否选中
|
|
244
|
-
*/
|
|
245
|
-
isSelected(item) {
|
|
246
|
-
return this.selectedItems().has(this.getItemKey(item));
|
|
247
|
-
}
|
|
248
|
-
/**
|
|
249
|
-
* 切换单个项的选中状态
|
|
250
|
-
*/
|
|
251
|
-
toggleSelection(item, checked) {
|
|
252
|
-
const key = this.getItemKey(item);
|
|
253
|
-
const newMap = new Map(this.selectedItems());
|
|
254
|
-
if (checked) {
|
|
255
|
-
newMap.set(key, item);
|
|
256
|
-
}
|
|
257
|
-
else {
|
|
258
|
-
newMap.delete(key);
|
|
259
|
-
}
|
|
260
|
-
this.selectedItems.set(newMap);
|
|
261
|
-
this._emitSelectionChange();
|
|
262
|
-
}
|
|
263
|
-
/**
|
|
264
|
-
* 单选模式
|
|
265
|
-
*/
|
|
266
|
-
selectSingle(item) {
|
|
267
|
-
const key = this.getItemKey(item);
|
|
268
|
-
const newMap = new Map();
|
|
269
|
-
newMap.set(key, item);
|
|
270
|
-
this.selectedItems.set(newMap);
|
|
271
|
-
this._emitSelectionChange();
|
|
272
|
-
}
|
|
273
|
-
/**
|
|
274
|
-
* 全选/取消全选当前页
|
|
275
|
-
*/
|
|
276
|
-
toggleSelectAll(checked) {
|
|
277
|
-
const newMap = new Map(this.selectedItems());
|
|
278
|
-
if (checked) {
|
|
279
|
-
// 选中当前页所有项
|
|
280
|
-
this.items().forEach((item) => {
|
|
281
|
-
newMap.set(this.getItemKey(item), item);
|
|
282
|
-
});
|
|
283
|
-
}
|
|
284
|
-
else {
|
|
285
|
-
// 取消当前页所有项
|
|
286
|
-
const currentKeys = new Set(this.items().map(item => this.getItemKey(item)));
|
|
287
|
-
currentKeys.forEach(key => newMap.delete(key));
|
|
288
|
-
}
|
|
289
|
-
this.selectedItems.set(newMap);
|
|
290
|
-
this._emitSelectionChange();
|
|
291
|
-
}
|
|
292
|
-
/**
|
|
293
|
-
* 行点击事件
|
|
294
|
-
*/
|
|
295
|
-
onRowClick(item) {
|
|
296
|
-
if (this.multiple()) {
|
|
297
|
-
const checked = !this.isSelected(item);
|
|
298
|
-
this.toggleSelection(item, checked);
|
|
299
|
-
}
|
|
300
|
-
else {
|
|
301
|
-
this.selectSingle(item);
|
|
302
|
-
}
|
|
303
|
-
}
|
|
304
|
-
/**
|
|
305
|
-
* 排序变化
|
|
306
|
-
*/
|
|
307
|
-
onSortChange(sort) {
|
|
308
|
-
// 更新排序状态
|
|
309
|
-
this.sortState.set({
|
|
310
|
-
active: sort.active || undefined,
|
|
311
|
-
direction: sort.direction === 'asc' || sort.direction === 'desc' ? sort.direction : undefined
|
|
312
|
-
});
|
|
313
|
-
// 重置到第一页并重新加载数据
|
|
314
|
-
this.pagination.update(p => ({ ...p, currentPage: 1 }));
|
|
315
|
-
this._loadPageData(1, this.pagination().itemsPerPage, this.searchControl.value ?? undefined, sort.active || undefined, sort.direction === 'desc');
|
|
316
|
-
}
|
|
317
|
-
/**
|
|
318
|
-
* 页码变化
|
|
319
|
-
*/
|
|
320
|
-
onPageChange(page) {
|
|
321
|
-
this.pagination.update(p => ({ ...p, currentPage: page }));
|
|
322
|
-
const currentSort = this.sortState();
|
|
323
|
-
this._loadPageData(page, this.pagination().itemsPerPage, this.searchControl.value ?? undefined, currentSort.active, currentSort.direction === 'desc');
|
|
324
|
-
}
|
|
325
|
-
/**
|
|
326
|
-
* 每页数量变化
|
|
327
|
-
*/
|
|
328
|
-
onPageSizeChange(size) {
|
|
329
|
-
// 更新分页状态
|
|
330
|
-
this.pagination.update(p => ({ ...p, itemsPerPage: size, currentPage: 1 }));
|
|
331
|
-
// 直接使用新的 size 加载第一页数据
|
|
332
|
-
const currentSort = this.sortState();
|
|
333
|
-
this._loadPageData(1, size, this.searchControl.value ?? undefined, currentSort.active, currentSort.direction === 'desc');
|
|
334
|
-
}
|
|
335
|
-
/**
|
|
336
|
-
* 获取选中的项数组
|
|
337
|
-
*/
|
|
338
|
-
getSelectedArray() {
|
|
339
|
-
return Array.from(this.selectedItems().values());
|
|
340
|
-
}
|
|
341
|
-
/**
|
|
342
|
-
* 设置选中项(用于初始化)
|
|
343
|
-
*/
|
|
344
|
-
setSelectedItems(items) {
|
|
345
|
-
const newMap = new Map();
|
|
346
|
-
items.forEach((item) => {
|
|
347
|
-
newMap.set(this.getItemKey(item), item);
|
|
348
|
-
});
|
|
349
|
-
this.selectedItems.set(newMap);
|
|
350
|
-
}
|
|
351
|
-
/**
|
|
352
|
-
* 加载数据(统一入口,私有方法)
|
|
353
|
-
*/
|
|
354
|
-
_loadPageData(page, size, search, orderBy, desc) {
|
|
355
|
-
const provider = this.dataProvider();
|
|
356
|
-
if (!provider) {
|
|
357
|
-
this.loading.set(false);
|
|
358
|
-
return;
|
|
359
|
-
}
|
|
360
|
-
this.loading.set(true);
|
|
361
|
-
provider.loadPage({
|
|
362
|
-
page,
|
|
363
|
-
size,
|
|
364
|
-
search: search ?? undefined,
|
|
365
|
-
orderBy,
|
|
366
|
-
desc
|
|
367
|
-
}).subscribe({
|
|
368
|
-
next: (result) => {
|
|
369
|
-
// 确保即使返回空数组也正确更新状态
|
|
370
|
-
this.items.set(result.data || []);
|
|
371
|
-
this.pagination.update(p => ({ ...p, totalItems: result.total || 0 }));
|
|
372
|
-
// 无论数据是否为空,都要关闭加载状态
|
|
373
|
-
this.loading.set(false);
|
|
374
|
-
},
|
|
375
|
-
error: (error) => {
|
|
376
|
-
console.error('Failed to load data:', error);
|
|
377
|
-
// 发生错误时也要关闭加载状态
|
|
378
|
-
this.items.set([]);
|
|
379
|
-
this.loading.set(false);
|
|
380
|
-
},
|
|
381
|
-
complete: () => {
|
|
382
|
-
// 确保在流完成时也关闭加载状态(防御性编程)
|
|
383
|
-
if (this.loading()) {
|
|
384
|
-
this.loading.set(false);
|
|
385
|
-
}
|
|
386
|
-
}
|
|
387
|
-
});
|
|
388
|
-
}
|
|
389
|
-
/**
|
|
390
|
-
* 发出选择变化事件(私有方法)
|
|
391
|
-
*/
|
|
392
|
-
_emitSelectionChange() {
|
|
393
|
-
const keys = new Set(this.selectedItems().keys());
|
|
394
|
-
this.selectionChange.emit(keys);
|
|
395
|
-
}
|
|
396
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.2.0", ngImport: i0, type: CmatDataPickerListComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
397
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.2.0", type: CmatDataPickerListComponent, isStandalone: true, selector: "cmat-data-picker-list", inputs: { dataProvider: { classPropertyName: "dataProvider", publicName: "dataProvider", isSignal: true, isRequired: true, transformFunction: null }, columns: { classPropertyName: "columns", publicName: "columns", isSignal: true, isRequired: true, transformFunction: null }, keyField: { classPropertyName: "keyField", publicName: "keyField", isSignal: true, isRequired: false, transformFunction: null }, multiple: { classPropertyName: "multiple", publicName: "multiple", isSignal: true, isRequired: false, transformFunction: null }, searchable: { classPropertyName: "searchable", publicName: "searchable", isSignal: true, isRequired: false, transformFunction: null }, pageSize: { classPropertyName: "pageSize", publicName: "pageSize", isSignal: true, isRequired: false, transformFunction: null }, searchPlaceholder: { classPropertyName: "searchPlaceholder", publicName: "searchPlaceholder", isSignal: true, isRequired: false, transformFunction: null }, emptyText: { classPropertyName: "emptyText", publicName: "emptyText", isSignal: true, isRequired: false, transformFunction: null }, paginationId: { classPropertyName: "paginationId", publicName: "paginationId", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { selectionChange: "selectionChange" }, ngImport: i0, template: "<div class=\"flex flex-col h-full\">\r\n <!-- \u641C\u7D22\u6846 -->\r\n @if (searchable()) {\r\n <div class=\"px-4 py-3 border-b\">\r\n <mat-form-field class=\"w-full\">\r\n <mat-icon matPrefix [svgIcon]=\"'heroicons_outline:magnifying-glass'\"></mat-icon>\r\n <input matInput [formControl]=\"searchControl\" [placeholder]=\"searchPlaceholder()\" />\r\n </mat-form-field>\r\n </div>\r\n }\r\n\r\n <!-- \u6570\u636E\u8868\u683C -->\r\n <div class=\"flex-1 overflow-y-auto scrollbar-custom\">\r\n @if (loading()) {\r\n <div class=\"flex items-center justify-center h-full min-h-30\">\r\n <mat-progress-spinner mode=\"indeterminate\" diameter=\"40\"></mat-progress-spinner>\r\n </div>\r\n } @else if (items().length === 0) {\r\n <div class=\"flex flex-col items-center justify-center h-full py-8\">\r\n <mat-icon class=\"icon-size-16 text-hint\" [svgIcon]=\"'heroicons_outline:inbox'\"></mat-icon>\r\n <p class=\"mt-2 text-secondary\">{{ emptyText() }}</p>\r\n </div>\r\n } @else {\r\n <table mat-table matSort class=\"w-full\"\r\n [dataSource]=\"items() | paginate: {id:paginationId(),currentPage: pagination().currentPage, itemsPerPage: pagination().itemsPerPage, totalItems: pagination().totalItems}\"\r\n (matSortChange)=\"onSortChange($event)\">\r\n\r\n <!-- \u9009\u62E9\u5217 -->\r\n <ng-container matColumnDef=\"_selection\">\r\n <th *matHeaderCellDef mat-header-cell class=\"w-12\">\r\n @if (multiple()) {\r\n <mat-checkbox [checked]=\"isAllSelected()\" [indeterminate]=\"isIndeterminate()\"\r\n (change)=\"toggleSelectAll($event.checked)\">\r\n </mat-checkbox>\r\n }\r\n </th>\r\n <td *matCellDef=\"let item\" mat-cell class=\"w-12\">\r\n @if (multiple()) {\r\n <mat-checkbox [checked]=\"isSelected(item)\" (click)=\"$event.stopPropagation()\"\r\n (change)=\"toggleSelection(item, $event.checked)\">\r\n </mat-checkbox>\r\n } @else {\r\n <mat-radio-button [checked]=\"isSelected(item)\" (click)=\"$event.stopPropagation()\"\r\n (change)=\"selectSingle(item)\">\r\n </mat-radio-button>\r\n }\r\n </td>\r\n </ng-container>\r\n\r\n <!-- \u6570\u636E\u5217 -->\r\n @for (column of columns(); track column.key) {\r\n <ng-container [matColumnDef]=\"column.key\">\r\n <th *matHeaderCellDef mat-header-cell \r\n [mat-sort-header]=\"column.sortable ? column.key : ''\"\r\n [disabled]=\"!column.sortable\"\r\n [start]=\"column.sortable ? 'asc' : ''\">\r\n {{ column.name }}\r\n </th>\r\n <td *matCellDef=\"let item\" mat-cell>\r\n <div class=\"has-label-on-mobile\" [attr.data-label]=\"column.name + ':'\">\r\n {{ item[column.key] }}\r\n </div>\r\n </td>\r\n </ng-container>\r\n }\r\n\r\n <tr *matHeaderRowDef=\"displayedColumns(); sticky: true\" mat-header-row></tr>\r\n <tr *matRowDef=\"let item; columns: displayedColumns()\" mat-row class=\"cursor-pointer\" (click)=\"onRowClick(item)\">\r\n </tr>\r\n </table>\r\n }\r\n </div>\r\n\r\n <!-- \u5206\u9875\u5668 -->\r\n <div class=\"border-t\">\r\n <cmat-pagination class=\"bg-slate-50 dark:bg-transparent\" [id]=\"paginationId()\" [initPerPage]=\"pageSize()\"\r\n [ngClass]=\"{'pointer-events-none': loading()}\" [hidden]=\"pagination().totalItems=== 0\" (pageChange)=\"onPageChange($event)\"\r\n (perPageCountChange)=\"onPageSizeChange($event)\">\r\n </cmat-pagination>\r\n </div>\r\n\r\n</div>", styles: ["cmat-data-picker-list{display:flex;flex-direction:column;width:100%}cmat-data-picker-list .mat-mdc-row{border-width:1px}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i2.DefaultValueAccessor, selector: "input:not([type=checkbox]):not([ngNoCva])[formControlName],textarea:not([ngNoCva])[formControlName],input:not([type=checkbox]):not([ngNoCva])[formControl],textarea:not([ngNoCva])[formControl],input:not([type=checkbox]):not([ngNoCva])[ngModel],textarea:not([ngNoCva])[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "ngmodule", type: MatButtonModule }, { kind: "ngmodule", type: MatCheckboxModule }, { kind: "component", type: i3.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$1.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "ngmodule", type: MatInputModule }, { kind: "directive", type: i5.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"] }, { kind: "component", type: i5.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i5.MatPrefix, selector: "[matPrefix], [matIconPrefix], [matTextPrefix]", inputs: ["matTextPrefix"] }, { kind: "ngmodule", type: MatProgressSpinnerModule }, { kind: "component", type: i6.MatProgressSpinner, selector: "mat-progress-spinner, mat-spinner", inputs: ["color", "mode", "value", "diameter", "strokeWidth"], exportAs: ["matProgressSpinner"] }, { kind: "ngmodule", type: MatRadioModule }, { kind: "component", type: i7.MatRadioButton, selector: "mat-radio-button", inputs: ["id", "name", "aria-label", "aria-labelledby", "aria-describedby", "disableRipple", "tabIndex", "checked", "value", "labelPosition", "disabled", "required", "color", "disabledInteractive"], outputs: ["change"], exportAs: ["matRadioButton"] }, { kind: "ngmodule", type: MatSortModule }, { kind: "directive", type: i8.MatSort, selector: "[matSort]", inputs: ["matSortActive", "matSortStart", "matSortDirection", "matSortDisableClear", "matSortDisabled"], outputs: ["matSortChange"], exportAs: ["matSort"] }, { kind: "component", type: i8.MatSortHeader, selector: "[mat-sort-header]", inputs: ["mat-sort-header", "arrowPosition", "start", "disabled", "sortActionDescription", "disableClear"], exportAs: ["matSortHeader"] }, { kind: "ngmodule", type: MatTableModule }, { kind: "component", type: i9.MatTable, selector: "mat-table, table[mat-table]", exportAs: ["matTable"] }, { kind: "directive", type: i9.MatHeaderCellDef, selector: "[matHeaderCellDef]" }, { kind: "directive", type: i9.MatHeaderRowDef, selector: "[matHeaderRowDef]", inputs: ["matHeaderRowDef", "matHeaderRowDefSticky"] }, { kind: "directive", type: i9.MatColumnDef, selector: "[matColumnDef]", inputs: ["matColumnDef"] }, { kind: "directive", type: i9.MatCellDef, selector: "[matCellDef]" }, { kind: "directive", type: i9.MatRowDef, selector: "[matRowDef]", inputs: ["matRowDefColumns", "matRowDefWhen"] }, { kind: "directive", type: i9.MatHeaderCell, selector: "mat-header-cell, th[mat-header-cell]" }, { kind: "directive", type: i9.MatCell, selector: "mat-cell, td[mat-cell]" }, { kind: "component", type: i9.MatHeaderRow, selector: "mat-header-row, tr[mat-header-row]", exportAs: ["matHeaderRow"] }, { kind: "component", type: i9.MatRow, selector: "mat-row, tr[mat-row]", exportAs: ["matRow"] }, { kind: "component", type: CmatPaginationComponent, selector: "cmat-pagination", inputs: ["id", "maxSize", "itemsPerPages", "initPerPage", "autoHide"], outputs: ["pageChange", "pageBoundsCorrection", "perPageCountChange"], exportAs: ["cmatPagination"] }, { kind: "pipe", type: CmatPaginatePipe, name: "paginate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
398
|
-
}
|
|
399
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.0", ngImport: i0, type: CmatDataPickerListComponent, decorators: [{
|
|
400
|
-
type: Component,
|
|
401
|
-
args: [{ selector: 'cmat-data-picker-list', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, imports: [
|
|
402
|
-
CommonModule,
|
|
403
|
-
ReactiveFormsModule,
|
|
404
|
-
MatButtonModule,
|
|
405
|
-
MatCheckboxModule,
|
|
406
|
-
MatIconModule,
|
|
407
|
-
MatInputModule,
|
|
408
|
-
MatProgressSpinnerModule,
|
|
409
|
-
MatRadioModule,
|
|
410
|
-
MatSortModule,
|
|
411
|
-
MatTableModule,
|
|
412
|
-
CmatPaginationComponent,
|
|
413
|
-
CmatPaginatePipe
|
|
414
|
-
], template: "<div class=\"flex flex-col h-full\">\r\n <!-- \u641C\u7D22\u6846 -->\r\n @if (searchable()) {\r\n <div class=\"px-4 py-3 border-b\">\r\n <mat-form-field class=\"w-full\">\r\n <mat-icon matPrefix [svgIcon]=\"'heroicons_outline:magnifying-glass'\"></mat-icon>\r\n <input matInput [formControl]=\"searchControl\" [placeholder]=\"searchPlaceholder()\" />\r\n </mat-form-field>\r\n </div>\r\n }\r\n\r\n <!-- \u6570\u636E\u8868\u683C -->\r\n <div class=\"flex-1 overflow-y-auto scrollbar-custom\">\r\n @if (loading()) {\r\n <div class=\"flex items-center justify-center h-full min-h-30\">\r\n <mat-progress-spinner mode=\"indeterminate\" diameter=\"40\"></mat-progress-spinner>\r\n </div>\r\n } @else if (items().length === 0) {\r\n <div class=\"flex flex-col items-center justify-center h-full py-8\">\r\n <mat-icon class=\"icon-size-16 text-hint\" [svgIcon]=\"'heroicons_outline:inbox'\"></mat-icon>\r\n <p class=\"mt-2 text-secondary\">{{ emptyText() }}</p>\r\n </div>\r\n } @else {\r\n <table mat-table matSort class=\"w-full\"\r\n [dataSource]=\"items() | paginate: {id:paginationId(),currentPage: pagination().currentPage, itemsPerPage: pagination().itemsPerPage, totalItems: pagination().totalItems}\"\r\n (matSortChange)=\"onSortChange($event)\">\r\n\r\n <!-- \u9009\u62E9\u5217 -->\r\n <ng-container matColumnDef=\"_selection\">\r\n <th *matHeaderCellDef mat-header-cell class=\"w-12\">\r\n @if (multiple()) {\r\n <mat-checkbox [checked]=\"isAllSelected()\" [indeterminate]=\"isIndeterminate()\"\r\n (change)=\"toggleSelectAll($event.checked)\">\r\n </mat-checkbox>\r\n }\r\n </th>\r\n <td *matCellDef=\"let item\" mat-cell class=\"w-12\">\r\n @if (multiple()) {\r\n <mat-checkbox [checked]=\"isSelected(item)\" (click)=\"$event.stopPropagation()\"\r\n (change)=\"toggleSelection(item, $event.checked)\">\r\n </mat-checkbox>\r\n } @else {\r\n <mat-radio-button [checked]=\"isSelected(item)\" (click)=\"$event.stopPropagation()\"\r\n (change)=\"selectSingle(item)\">\r\n </mat-radio-button>\r\n }\r\n </td>\r\n </ng-container>\r\n\r\n <!-- \u6570\u636E\u5217 -->\r\n @for (column of columns(); track column.key) {\r\n <ng-container [matColumnDef]=\"column.key\">\r\n <th *matHeaderCellDef mat-header-cell \r\n [mat-sort-header]=\"column.sortable ? column.key : ''\"\r\n [disabled]=\"!column.sortable\"\r\n [start]=\"column.sortable ? 'asc' : ''\">\r\n {{ column.name }}\r\n </th>\r\n <td *matCellDef=\"let item\" mat-cell>\r\n <div class=\"has-label-on-mobile\" [attr.data-label]=\"column.name + ':'\">\r\n {{ item[column.key] }}\r\n </div>\r\n </td>\r\n </ng-container>\r\n }\r\n\r\n <tr *matHeaderRowDef=\"displayedColumns(); sticky: true\" mat-header-row></tr>\r\n <tr *matRowDef=\"let item; columns: displayedColumns()\" mat-row class=\"cursor-pointer\" (click)=\"onRowClick(item)\">\r\n </tr>\r\n </table>\r\n }\r\n </div>\r\n\r\n <!-- \u5206\u9875\u5668 -->\r\n <div class=\"border-t\">\r\n <cmat-pagination class=\"bg-slate-50 dark:bg-transparent\" [id]=\"paginationId()\" [initPerPage]=\"pageSize()\"\r\n [ngClass]=\"{'pointer-events-none': loading()}\" [hidden]=\"pagination().totalItems=== 0\" (pageChange)=\"onPageChange($event)\"\r\n (perPageCountChange)=\"onPageSizeChange($event)\">\r\n </cmat-pagination>\r\n </div>\r\n\r\n</div>", styles: ["cmat-data-picker-list{display:flex;flex-direction:column;width:100%}cmat-data-picker-list .mat-mdc-row{border-width:1px}\n"] }]
|
|
415
|
-
}], ctorParameters: () => [], propDecorators: { dataProvider: [{ type: i0.Input, args: [{ isSignal: true, alias: "dataProvider", required: true }] }], columns: [{ type: i0.Input, args: [{ isSignal: true, alias: "columns", required: true }] }], keyField: [{ type: i0.Input, args: [{ isSignal: true, alias: "keyField", required: false }] }], multiple: [{ type: i0.Input, args: [{ isSignal: true, alias: "multiple", required: false }] }], searchable: [{ type: i0.Input, args: [{ isSignal: true, alias: "searchable", required: false }] }], pageSize: [{ type: i0.Input, args: [{ isSignal: true, alias: "pageSize", required: false }] }], searchPlaceholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "searchPlaceholder", required: false }] }], emptyText: [{ type: i0.Input, args: [{ isSignal: true, alias: "emptyText", required: false }] }], paginationId: [{ type: i0.Input, args: [{ isSignal: true, alias: "paginationId", required: false }] }], selectionChange: [{ type: i0.Output, args: ["selectionChange"] }] } });
|
|
416
|
-
|
|
417
|
-
class CmatDataPickerSheetComponent {
|
|
418
|
-
constructor() {
|
|
419
|
-
this.data = inject(MAT_BOTTOM_SHEET_DATA);
|
|
420
|
-
this.title = computed(() => this.data.multiple ? '选择多项' : '选择一项', /* @ts-ignore */
|
|
421
|
-
...(ngDevMode ? [{ debugName: "title" }] : /* istanbul ignore next */ []));
|
|
422
|
-
this._listComponent = viewChild.required((CmatDataPickerListComponent), /* @ts-ignore */
|
|
423
|
-
...(ngDevMode ? [{ debugName: "_listComponent" }] : /* istanbul ignore next */ []));
|
|
424
|
-
this._bottomSheetRef = inject((MatBottomSheetRef));
|
|
425
|
-
this._selectedKeys = new Set();
|
|
426
|
-
// 初始化选中项
|
|
427
|
-
if (this.data.initialSelection && this.data.initialSelection.length > 0) {
|
|
428
|
-
const keys = this.data.initialSelection.map(item => item[this.data.keyField]);
|
|
429
|
-
this._selectedKeys = new Set(keys);
|
|
430
|
-
}
|
|
431
|
-
}
|
|
432
|
-
ngAfterViewInit() {
|
|
433
|
-
// 在视图初始化后,如果已有选中项,设置到 list 组件
|
|
434
|
-
if (this.data.initialSelection && this.data.initialSelection.length > 0) {
|
|
435
|
-
this._listComponent().setSelectedItems(this.data.initialSelection);
|
|
436
|
-
}
|
|
437
|
-
}
|
|
438
|
-
onSelectionChange(keys) {
|
|
439
|
-
this._selectedKeys = keys;
|
|
440
|
-
}
|
|
441
|
-
dismiss() {
|
|
442
|
-
this._bottomSheetRef.dismiss();
|
|
443
|
-
}
|
|
444
|
-
confirm() {
|
|
445
|
-
const selectedItems = this._listComponent().getSelectedArray();
|
|
446
|
-
const result = this.data.multiple ? selectedItems : (selectedItems[0] ?? null);
|
|
447
|
-
this._bottomSheetRef.dismiss(result);
|
|
448
|
-
}
|
|
449
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.2.0", ngImport: i0, type: CmatDataPickerSheetComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
450
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "22.2.0", type: CmatDataPickerSheetComponent, isStandalone: true, selector: "cmat-data-picker-sheet", viewQueries: [{ propertyName: "_listComponent", first: true, predicate: (CmatDataPickerListComponent), descendants: true, isSignal: true }], ngImport: i0, template: "<div class=\"flex flex-col h-full max-h-[70vh] -mx-4\">\r\n <!-- \u5934\u90E8 -->\r\n <div class=\"flex items-center justify-between px-4 py-3 border-b bg-card\">\r\n <h2 class=\"text-lg font-semibold\">{{ title() }}</h2>\r\n <button matIconButton (click)=\"dismiss()\">\r\n <mat-icon [svgIcon]=\"'heroicons_outline:x-mark'\"></mat-icon>\r\n </button>\r\n </div>\r\n\r\n <!-- \u5217\u8868\u5185\u5BB9 -->\r\n <div class=\"flex-1 overflow-hidden min-h-0 flex\">\r\n <cmat-data-picker-list [dataProvider]=\"data.dataProvider\" [columns]=\"data.columns\" [keyField]=\"data.keyField\"\r\n [multiple]=\"data.multiple\" [searchable]=\"data.searchable\" [pageSize]=\"data.pageSize\"\r\n (selectionChange)=\"onSelectionChange($event)\">\r\n </cmat-data-picker-list>\r\n </div>\r\n <!-- \u5E95\u90E8\u64CD\u4F5C\u680F -->\r\n <div class=\"px-4 py-3 border-t flex justify-end gap-2\">\r\n <button matButton=\"filled\" color=\"primary\" (click)=\"confirm()\">\r\n \u786E\u5B9A\r\n </button>\r\n <button matButton=\"outlined\" (click)=\"dismiss()\">\u53D6\u6D88</button>\r\n </div>\r\n</div>", styles: [":host{display:block;height:100%}\n"], dependencies: [{ kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i1$1.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: i1$1.MatIconButton, selector: "button[mat-icon-button], a[mat-icon-button], button[matIconButton], a[matIconButton]", exportAs: ["matButton", "matAnchor"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i2$1.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "component", type: CmatDataPickerListComponent, selector: "cmat-data-picker-list", inputs: ["dataProvider", "columns", "keyField", "multiple", "searchable", "pageSize", "searchPlaceholder", "emptyText", "paginationId"], outputs: ["selectionChange"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
451
|
-
}
|
|
452
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.0", ngImport: i0, type: CmatDataPickerSheetComponent, decorators: [{
|
|
453
|
-
type: Component,
|
|
454
|
-
args: [{ selector: 'cmat-data-picker-sheet', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, imports: [
|
|
455
|
-
MatButtonModule,
|
|
456
|
-
MatIconModule,
|
|
457
|
-
CmatDataPickerListComponent
|
|
458
|
-
], template: "<div class=\"flex flex-col h-full max-h-[70vh] -mx-4\">\r\n <!-- \u5934\u90E8 -->\r\n <div class=\"flex items-center justify-between px-4 py-3 border-b bg-card\">\r\n <h2 class=\"text-lg font-semibold\">{{ title() }}</h2>\r\n <button matIconButton (click)=\"dismiss()\">\r\n <mat-icon [svgIcon]=\"'heroicons_outline:x-mark'\"></mat-icon>\r\n </button>\r\n </div>\r\n\r\n <!-- \u5217\u8868\u5185\u5BB9 -->\r\n <div class=\"flex-1 overflow-hidden min-h-0 flex\">\r\n <cmat-data-picker-list [dataProvider]=\"data.dataProvider\" [columns]=\"data.columns\" [keyField]=\"data.keyField\"\r\n [multiple]=\"data.multiple\" [searchable]=\"data.searchable\" [pageSize]=\"data.pageSize\"\r\n (selectionChange)=\"onSelectionChange($event)\">\r\n </cmat-data-picker-list>\r\n </div>\r\n <!-- \u5E95\u90E8\u64CD\u4F5C\u680F -->\r\n <div class=\"px-4 py-3 border-t flex justify-end gap-2\">\r\n <button matButton=\"filled\" color=\"primary\" (click)=\"confirm()\">\r\n \u786E\u5B9A\r\n </button>\r\n <button matButton=\"outlined\" (click)=\"dismiss()\">\u53D6\u6D88</button>\r\n </div>\r\n</div>", styles: [":host{display:block;height:100%}\n"] }]
|
|
459
|
-
}], ctorParameters: () => [], propDecorators: { _listComponent: [{ type: i0.ViewChild, args: [i0.forwardRef(() => CmatDataPickerListComponent), { isSignal: true }] }] } });
|
|
460
|
-
|
|
461
|
-
class CmatDataPickerDialogComponent {
|
|
462
|
-
constructor() {
|
|
463
|
-
this.data = inject(MAT_DIALOG_DATA);
|
|
464
|
-
this.title = computed(() => this.data.multiple ? '选择多项' : '选择一项', /* @ts-ignore */
|
|
465
|
-
...(ngDevMode ? [{ debugName: "title" }] : /* istanbul ignore next */ []));
|
|
466
|
-
this._listComponent = viewChild.required((CmatDataPickerListComponent), /* @ts-ignore */
|
|
467
|
-
...(ngDevMode ? [{ debugName: "_listComponent" }] : /* istanbul ignore next */ []));
|
|
468
|
-
this._dialogRef = inject((MatDialogRef));
|
|
469
|
-
this._selectedKeys = new Set();
|
|
470
|
-
// 初始化选中项
|
|
471
|
-
if (this.data.initialSelection && this.data.initialSelection.length > 0) {
|
|
472
|
-
const keys = this.data.initialSelection.map(item => item[this.data.keyField]);
|
|
473
|
-
this._selectedKeys = new Set(keys);
|
|
474
|
-
}
|
|
475
|
-
}
|
|
476
|
-
ngAfterViewInit() {
|
|
477
|
-
// 在视图初始化后,如果已有选中项,设置到 list 组件
|
|
478
|
-
if (this.data.initialSelection && this.data.initialSelection.length > 0) {
|
|
479
|
-
this._listComponent().setSelectedItems(this.data.initialSelection);
|
|
480
|
-
}
|
|
481
|
-
}
|
|
482
|
-
onSelectionChange(keys) {
|
|
483
|
-
this._selectedKeys = keys;
|
|
484
|
-
}
|
|
485
|
-
dismiss() {
|
|
486
|
-
this._dialogRef.close();
|
|
487
|
-
}
|
|
488
|
-
confirm() {
|
|
489
|
-
const selectedItems = this._listComponent().getSelectedArray();
|
|
490
|
-
const result = this.data.multiple ? selectedItems : (selectedItems[0] ?? null);
|
|
491
|
-
this._dialogRef.close(result);
|
|
492
|
-
}
|
|
493
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.2.0", ngImport: i0, type: CmatDataPickerDialogComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
494
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "22.2.0", type: CmatDataPickerDialogComponent, isStandalone: true, selector: "cmat-data-picker-dialog", viewQueries: [{ propertyName: "_listComponent", first: true, predicate: (CmatDataPickerListComponent), descendants: true, isSignal: true }], ngImport: i0, template: "<div class=\"flex flex-col h-full max-h-[80vh]\">\r\n <!-- \u5934\u90E8 -->\r\n <div class=\"flex items-center justify-between px-6 py-4 border-b\">\r\n <h2 class=\"text-xl font-semibold\">{{ title() }}</h2>\r\n <button matIconButton (click)=\"dismiss()\">\r\n <mat-icon [svgIcon]=\"'heroicons_outline:x-mark'\"></mat-icon>\r\n </button>\r\n </div>\r\n\r\n <!-- \u5217\u8868\u5185\u5BB9 -->\r\n <div class=\"flex-1 overflow-hidden min-h-0 flex\">\r\n <cmat-data-picker-list [dataProvider]=\"data.dataProvider\" [columns]=\"data.columns\" [keyField]=\"data.keyField\"\r\n [multiple]=\"data.multiple\" [searchable]=\"data.searchable\" [pageSize]=\"data.pageSize\"\r\n (selectionChange)=\"onSelectionChange($event)\">\r\n </cmat-data-picker-list>\r\n </div>\r\n\r\n <!-- \u5E95\u90E8\u64CD\u4F5C\u680F -->\r\n <div class=\"px-6 py-4 border-t flex justify-end gap-2\">\r\n <button matButton=\"filled\" color=\"primary\" (click)=\"confirm()\">\r\n \u786E\u5B9A\r\n </button>\r\n <button matButton=\"outlined\" (click)=\"dismiss()\">\u53D6\u6D88</button>\r\n </div>\r\n</div>", dependencies: [{ kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i1$1.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: i1$1.MatIconButton, selector: "button[mat-icon-button], a[mat-icon-button], button[matIconButton], a[matIconButton]", exportAs: ["matButton", "matAnchor"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i2$1.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "component", type: CmatDataPickerListComponent, selector: "cmat-data-picker-list", inputs: ["dataProvider", "columns", "keyField", "multiple", "searchable", "pageSize", "searchPlaceholder", "emptyText", "paginationId"], outputs: ["selectionChange"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
73
|
+
return new HttpDataPickerProvider(dataService, config);
|
|
495
74
|
}
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
75
|
+
var CmatDataPickerListComponent = class CmatDataPickerListComponent {
|
|
76
|
+
constructor() {
|
|
77
|
+
this.dataProvider = input.required(...ngDevMode ? [{ debugName: "dataProvider" }] : /* istanbul ignore next */ []);
|
|
78
|
+
this.columns = input.required(...ngDevMode ? [{ debugName: "columns" }] : /* istanbul ignore next */ []);
|
|
79
|
+
this.keyField = input("id", ...ngDevMode ? [{ debugName: "keyField" }] : /* istanbul ignore next */ []);
|
|
80
|
+
this.multiple = input(false, ...ngDevMode ? [{ debugName: "multiple" }] : /* istanbul ignore next */ []);
|
|
81
|
+
this.searchable = input(true, ...ngDevMode ? [{ debugName: "searchable" }] : /* istanbul ignore next */ []);
|
|
82
|
+
this.pageSize = input(20, ...ngDevMode ? [{ debugName: "pageSize" }] : /* istanbul ignore next */ []);
|
|
83
|
+
this.searchPlaceholder = input("搜索...", ...ngDevMode ? [{ debugName: "searchPlaceholder" }] : /* istanbul ignore next */ []);
|
|
84
|
+
this.emptyText = input("暂无数据", ...ngDevMode ? [{ debugName: "emptyText" }] : /* istanbul ignore next */ []);
|
|
85
|
+
this.paginationId = input("data-picker-pagination", ...ngDevMode ? [{ debugName: "paginationId" }] : /* istanbul ignore next */ []);
|
|
86
|
+
this.selectionChange = output();
|
|
87
|
+
this.items = signal([], ...ngDevMode ? [{ debugName: "items" }] : /* istanbul ignore next */ []);
|
|
88
|
+
this.loading = signal(false, ...ngDevMode ? [{ debugName: "loading" }] : /* istanbul ignore next */ []);
|
|
89
|
+
this.selectedItems = signal(/* @__PURE__ */ new Map(), ...ngDevMode ? [{ debugName: "selectedItems" }] : /* istanbul ignore next */ []);
|
|
90
|
+
this.pagination = signal({
|
|
91
|
+
currentPage: 1,
|
|
92
|
+
itemsPerPage: 20,
|
|
93
|
+
totalItems: 0
|
|
94
|
+
}, ...ngDevMode ? [{ debugName: "pagination" }] : /* istanbul ignore next */ []);
|
|
95
|
+
this.sortState = signal({}, ...ngDevMode ? [{ debugName: "sortState" }] : /* istanbul ignore next */ []);
|
|
96
|
+
this.searchControl = new FormControl("");
|
|
97
|
+
this.displayedColumns = computed(() => {
|
|
98
|
+
return ["_selection", ...this.columns().map((c) => c.key)];
|
|
99
|
+
}, ...ngDevMode ? [{ debugName: "displayedColumns" }] : /* istanbul ignore next */ []);
|
|
100
|
+
this.selectedCount = computed(() => this.selectedItems().size, ...ngDevMode ? [{ debugName: "selectedCount" }] : /* istanbul ignore next */ []);
|
|
101
|
+
this.isAllSelected = computed(() => {
|
|
102
|
+
if (!this.multiple() || this.items().length === 0) return false;
|
|
103
|
+
return this.items().every((item) => this.selectedItems().has(this.getItemKey(item)));
|
|
104
|
+
}, ...ngDevMode ? [{ debugName: "isAllSelected" }] : /* istanbul ignore next */ []);
|
|
105
|
+
this.isIndeterminate = computed(() => {
|
|
106
|
+
if (!this.multiple()) return false;
|
|
107
|
+
const selectedCount = this.items().filter((item) => this.selectedItems().has(this.getItemKey(item))).length;
|
|
108
|
+
return selectedCount > 0 && selectedCount < this.items().length;
|
|
109
|
+
}, ...ngDevMode ? [{ debugName: "isIndeterminate" }] : /* istanbul ignore next */ []);
|
|
110
|
+
this._destroyRef = inject(DestroyRef);
|
|
111
|
+
effect(() => {
|
|
112
|
+
const provider = this.dataProvider();
|
|
113
|
+
if (!provider) return;
|
|
114
|
+
untracked(() => {
|
|
115
|
+
this.searchControl.valueChanges.pipe(startWith(""), debounceTime(300), distinctUntilChanged(), tap(() => this.loading.set(true)), switchMap((search) => {
|
|
116
|
+
const currentSort = this.sortState();
|
|
117
|
+
return provider.loadPage({
|
|
118
|
+
page: 1,
|
|
119
|
+
size: this.pagination().itemsPerPage,
|
|
120
|
+
search: search ?? void 0,
|
|
121
|
+
orderBy: currentSort.active,
|
|
122
|
+
desc: currentSort.direction === "desc"
|
|
123
|
+
});
|
|
124
|
+
}), takeUntilDestroyed(this._destroyRef), catchError((error) => {
|
|
125
|
+
console.error("Search failed:", error);
|
|
126
|
+
this.items.set([]);
|
|
127
|
+
return EMPTY;
|
|
128
|
+
})).subscribe((result) => {
|
|
129
|
+
this.items.set(result.data || []);
|
|
130
|
+
this.pagination.update((p) => ({
|
|
131
|
+
...p,
|
|
132
|
+
currentPage: 1,
|
|
133
|
+
totalItems: result.total || 0
|
|
134
|
+
}));
|
|
135
|
+
this.loading.set(false);
|
|
136
|
+
});
|
|
137
|
+
});
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
loadData() {
|
|
141
|
+
this._loadPageData(this.pagination().currentPage, this.pagination().itemsPerPage, this.searchControl.value ?? void 0);
|
|
142
|
+
}
|
|
143
|
+
reset() {
|
|
144
|
+
this.pagination.set({
|
|
145
|
+
currentPage: 1,
|
|
146
|
+
itemsPerPage: this.pageSize(),
|
|
147
|
+
totalItems: 0
|
|
148
|
+
});
|
|
149
|
+
this.sortState.set({});
|
|
150
|
+
this.searchControl.setValue("", { emitEvent: false });
|
|
151
|
+
this.selectedItems.set(/* @__PURE__ */ new Map());
|
|
152
|
+
this.items.set([]);
|
|
153
|
+
this._loadPageData(1, this.pageSize(), "", void 0, void 0);
|
|
154
|
+
}
|
|
155
|
+
getItemKey(item) {
|
|
156
|
+
return item[this.keyField()];
|
|
157
|
+
}
|
|
158
|
+
isSelected(item) {
|
|
159
|
+
return this.selectedItems().has(this.getItemKey(item));
|
|
160
|
+
}
|
|
161
|
+
toggleSelection(item, checked) {
|
|
162
|
+
const key = this.getItemKey(item);
|
|
163
|
+
const newMap = new Map(this.selectedItems());
|
|
164
|
+
if (checked) newMap.set(key, item);
|
|
165
|
+
else newMap.delete(key);
|
|
166
|
+
this.selectedItems.set(newMap);
|
|
167
|
+
this._emitSelectionChange();
|
|
168
|
+
}
|
|
169
|
+
selectSingle(item) {
|
|
170
|
+
const key = this.getItemKey(item);
|
|
171
|
+
const newMap = /* @__PURE__ */ new Map();
|
|
172
|
+
newMap.set(key, item);
|
|
173
|
+
this.selectedItems.set(newMap);
|
|
174
|
+
this._emitSelectionChange();
|
|
175
|
+
}
|
|
176
|
+
toggleSelectAll(checked) {
|
|
177
|
+
const newMap = new Map(this.selectedItems());
|
|
178
|
+
if (checked) this.items().forEach((item) => {
|
|
179
|
+
newMap.set(this.getItemKey(item), item);
|
|
180
|
+
});
|
|
181
|
+
else new Set(this.items().map((item) => this.getItemKey(item))).forEach((key) => newMap.delete(key));
|
|
182
|
+
this.selectedItems.set(newMap);
|
|
183
|
+
this._emitSelectionChange();
|
|
184
|
+
}
|
|
185
|
+
onRowClick(item) {
|
|
186
|
+
if (this.multiple()) {
|
|
187
|
+
const checked = !this.isSelected(item);
|
|
188
|
+
this.toggleSelection(item, checked);
|
|
189
|
+
} else this.selectSingle(item);
|
|
190
|
+
}
|
|
191
|
+
onSortChange(sort) {
|
|
192
|
+
this.sortState.set({
|
|
193
|
+
active: sort.active || void 0,
|
|
194
|
+
direction: sort.direction === "asc" || sort.direction === "desc" ? sort.direction : void 0
|
|
195
|
+
});
|
|
196
|
+
this.pagination.update((p) => ({
|
|
197
|
+
...p,
|
|
198
|
+
currentPage: 1
|
|
199
|
+
}));
|
|
200
|
+
this._loadPageData(1, this.pagination().itemsPerPage, this.searchControl.value ?? void 0, sort.active || void 0, sort.direction === "desc");
|
|
201
|
+
}
|
|
202
|
+
onPageChange(page) {
|
|
203
|
+
this.pagination.update((p) => ({
|
|
204
|
+
...p,
|
|
205
|
+
currentPage: page
|
|
206
|
+
}));
|
|
207
|
+
const currentSort = this.sortState();
|
|
208
|
+
this._loadPageData(page, this.pagination().itemsPerPage, this.searchControl.value ?? void 0, currentSort.active, currentSort.direction === "desc");
|
|
209
|
+
}
|
|
210
|
+
onPageSizeChange(size) {
|
|
211
|
+
this.pagination.update((p) => ({
|
|
212
|
+
...p,
|
|
213
|
+
itemsPerPage: size,
|
|
214
|
+
currentPage: 1
|
|
215
|
+
}));
|
|
216
|
+
const currentSort = this.sortState();
|
|
217
|
+
this._loadPageData(1, size, this.searchControl.value ?? void 0, currentSort.active, currentSort.direction === "desc");
|
|
218
|
+
}
|
|
219
|
+
getSelectedArray() {
|
|
220
|
+
return Array.from(this.selectedItems().values());
|
|
221
|
+
}
|
|
222
|
+
setSelectedItems(items) {
|
|
223
|
+
const newMap = /* @__PURE__ */ new Map();
|
|
224
|
+
items.forEach((item) => {
|
|
225
|
+
newMap.set(this.getItemKey(item), item);
|
|
226
|
+
});
|
|
227
|
+
this.selectedItems.set(newMap);
|
|
228
|
+
}
|
|
229
|
+
_loadPageData(page, size, search, orderBy, desc) {
|
|
230
|
+
const provider = this.dataProvider();
|
|
231
|
+
if (!provider) {
|
|
232
|
+
this.loading.set(false);
|
|
233
|
+
return;
|
|
234
|
+
}
|
|
235
|
+
this.loading.set(true);
|
|
236
|
+
provider.loadPage({
|
|
237
|
+
page,
|
|
238
|
+
size,
|
|
239
|
+
search: search ?? void 0,
|
|
240
|
+
orderBy,
|
|
241
|
+
desc
|
|
242
|
+
}).subscribe({
|
|
243
|
+
next: (result) => {
|
|
244
|
+
this.items.set(result.data || []);
|
|
245
|
+
this.pagination.update((p) => ({
|
|
246
|
+
...p,
|
|
247
|
+
totalItems: result.total || 0
|
|
248
|
+
}));
|
|
249
|
+
this.loading.set(false);
|
|
250
|
+
},
|
|
251
|
+
error: (error) => {
|
|
252
|
+
console.error("Failed to load data:", error);
|
|
253
|
+
this.items.set([]);
|
|
254
|
+
this.loading.set(false);
|
|
255
|
+
},
|
|
256
|
+
complete: () => {
|
|
257
|
+
if (this.loading()) this.loading.set(false);
|
|
258
|
+
}
|
|
259
|
+
});
|
|
260
|
+
}
|
|
261
|
+
_emitSelectionChange() {
|
|
262
|
+
const keys = new Set(this.selectedItems().keys());
|
|
263
|
+
this.selectionChange.emit(keys);
|
|
264
|
+
}
|
|
265
|
+
static {
|
|
266
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
267
|
+
minVersion: "12.0.0",
|
|
268
|
+
version: "22.2.3",
|
|
269
|
+
ngImport: i0,
|
|
270
|
+
type: CmatDataPickerListComponent,
|
|
271
|
+
deps: [],
|
|
272
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
273
|
+
});
|
|
274
|
+
}
|
|
275
|
+
static {
|
|
276
|
+
this.ɵcmp = i0.ɵɵngDeclareComponent({
|
|
277
|
+
minVersion: "17.0.0",
|
|
278
|
+
version: "22.2.3",
|
|
279
|
+
type: CmatDataPickerListComponent,
|
|
280
|
+
isStandalone: true,
|
|
281
|
+
selector: "cmat-data-picker-list",
|
|
282
|
+
inputs: {
|
|
283
|
+
dataProvider: {
|
|
284
|
+
classPropertyName: "dataProvider",
|
|
285
|
+
publicName: "dataProvider",
|
|
286
|
+
isSignal: true,
|
|
287
|
+
isRequired: true,
|
|
288
|
+
transformFunction: null
|
|
289
|
+
},
|
|
290
|
+
columns: {
|
|
291
|
+
classPropertyName: "columns",
|
|
292
|
+
publicName: "columns",
|
|
293
|
+
isSignal: true,
|
|
294
|
+
isRequired: true,
|
|
295
|
+
transformFunction: null
|
|
296
|
+
},
|
|
297
|
+
keyField: {
|
|
298
|
+
classPropertyName: "keyField",
|
|
299
|
+
publicName: "keyField",
|
|
300
|
+
isSignal: true,
|
|
301
|
+
isRequired: false,
|
|
302
|
+
transformFunction: null
|
|
303
|
+
},
|
|
304
|
+
multiple: {
|
|
305
|
+
classPropertyName: "multiple",
|
|
306
|
+
publicName: "multiple",
|
|
307
|
+
isSignal: true,
|
|
308
|
+
isRequired: false,
|
|
309
|
+
transformFunction: null
|
|
310
|
+
},
|
|
311
|
+
searchable: {
|
|
312
|
+
classPropertyName: "searchable",
|
|
313
|
+
publicName: "searchable",
|
|
314
|
+
isSignal: true,
|
|
315
|
+
isRequired: false,
|
|
316
|
+
transformFunction: null
|
|
317
|
+
},
|
|
318
|
+
pageSize: {
|
|
319
|
+
classPropertyName: "pageSize",
|
|
320
|
+
publicName: "pageSize",
|
|
321
|
+
isSignal: true,
|
|
322
|
+
isRequired: false,
|
|
323
|
+
transformFunction: null
|
|
324
|
+
},
|
|
325
|
+
searchPlaceholder: {
|
|
326
|
+
classPropertyName: "searchPlaceholder",
|
|
327
|
+
publicName: "searchPlaceholder",
|
|
328
|
+
isSignal: true,
|
|
329
|
+
isRequired: false,
|
|
330
|
+
transformFunction: null
|
|
331
|
+
},
|
|
332
|
+
emptyText: {
|
|
333
|
+
classPropertyName: "emptyText",
|
|
334
|
+
publicName: "emptyText",
|
|
335
|
+
isSignal: true,
|
|
336
|
+
isRequired: false,
|
|
337
|
+
transformFunction: null
|
|
338
|
+
},
|
|
339
|
+
paginationId: {
|
|
340
|
+
classPropertyName: "paginationId",
|
|
341
|
+
publicName: "paginationId",
|
|
342
|
+
isSignal: true,
|
|
343
|
+
isRequired: false,
|
|
344
|
+
transformFunction: null
|
|
345
|
+
}
|
|
346
|
+
},
|
|
347
|
+
outputs: { selectionChange: "selectionChange" },
|
|
348
|
+
ngImport: i0,
|
|
349
|
+
template: "<div class=\"flex flex-col h-full\">\r\n <!-- 搜索框 -->\r\n @if (searchable()) {\r\n <div class=\"px-4 py-3 border-b\">\r\n <mat-form-field class=\"w-full\">\r\n <mat-icon matPrefix [svgIcon]=\"'heroicons_outline:magnifying-glass'\"></mat-icon>\r\n <input matInput [formControl]=\"searchControl\" [placeholder]=\"searchPlaceholder()\" />\r\n </mat-form-field>\r\n </div>\r\n }\r\n\r\n <!-- 数据表格 -->\r\n <div class=\"flex-1 overflow-y-auto scrollbar-custom\">\r\n @if (loading()) {\r\n <div class=\"flex items-center justify-center h-full min-h-30\">\r\n <mat-progress-spinner mode=\"indeterminate\" diameter=\"40\"></mat-progress-spinner>\r\n </div>\r\n } @else if (items().length === 0) {\r\n <div class=\"flex flex-col items-center justify-center h-full py-8\">\r\n <mat-icon class=\"icon-size-16 text-hint\" [svgIcon]=\"'heroicons_outline:inbox'\"></mat-icon>\r\n <p class=\"mt-2 text-secondary\">{{ emptyText() }}</p>\r\n </div>\r\n } @else {\r\n <table mat-table matSort class=\"w-full\"\r\n [dataSource]=\"items() | paginate: {id:paginationId(),currentPage: pagination().currentPage, itemsPerPage: pagination().itemsPerPage, totalItems: pagination().totalItems}\"\r\n (matSortChange)=\"onSortChange($event)\">\r\n\r\n <!-- 选择列 -->\r\n <ng-container matColumnDef=\"_selection\">\r\n <th *matHeaderCellDef mat-header-cell class=\"w-12\">\r\n @if (multiple()) {\r\n <mat-checkbox [checked]=\"isAllSelected()\" [indeterminate]=\"isIndeterminate()\"\r\n (change)=\"toggleSelectAll($event.checked)\">\r\n </mat-checkbox>\r\n }\r\n </th>\r\n <td *matCellDef=\"let item\" mat-cell class=\"w-12\">\r\n @if (multiple()) {\r\n <mat-checkbox [checked]=\"isSelected(item)\" (click)=\"$event.stopPropagation()\"\r\n (change)=\"toggleSelection(item, $event.checked)\">\r\n </mat-checkbox>\r\n } @else {\r\n <mat-radio-button [checked]=\"isSelected(item)\" (click)=\"$event.stopPropagation()\"\r\n (change)=\"selectSingle(item)\">\r\n </mat-radio-button>\r\n }\r\n </td>\r\n </ng-container>\r\n\r\n <!-- 数据列 -->\r\n @for (column of columns(); track column.key) {\r\n <ng-container [matColumnDef]=\"column.key\">\r\n <th *matHeaderCellDef mat-header-cell \r\n [mat-sort-header]=\"column.sortable ? column.key : ''\"\r\n [disabled]=\"!column.sortable\"\r\n [start]=\"column.sortable ? 'asc' : ''\">\r\n {{ column.name }}\r\n </th>\r\n <td *matCellDef=\"let item\" mat-cell>\r\n <div class=\"has-label-on-mobile\" [attr.data-label]=\"column.name + ':'\">\r\n {{ item[column.key] }}\r\n </div>\r\n </td>\r\n </ng-container>\r\n }\r\n\r\n <tr *matHeaderRowDef=\"displayedColumns(); sticky: true\" mat-header-row></tr>\r\n <tr *matRowDef=\"let item; columns: displayedColumns()\" mat-row class=\"cursor-pointer\" (click)=\"onRowClick(item)\">\r\n </tr>\r\n </table>\r\n }\r\n </div>\r\n\r\n <!-- 分页器 -->\r\n <div class=\"border-t\">\r\n <cmat-pagination class=\"bg-slate-50 dark:bg-transparent\" [id]=\"paginationId()\" [initPerPage]=\"pageSize()\"\r\n [ngClass]=\"{'pointer-events-none': loading()}\" [hidden]=\"pagination().totalItems=== 0\" (pageChange)=\"onPageChange($event)\"\r\n (perPageCountChange)=\"onPageSizeChange($event)\">\r\n </cmat-pagination>\r\n </div>\r\n\r\n</div>",
|
|
350
|
+
styles: ["cmat-data-picker-list{display:flex;flex-direction:column;width:100%}cmat-data-picker-list .mat-mdc-row{border-width:1px}\n"],
|
|
351
|
+
dependencies: [
|
|
352
|
+
{
|
|
353
|
+
kind: "ngmodule",
|
|
354
|
+
type: CommonModule
|
|
355
|
+
},
|
|
356
|
+
{
|
|
357
|
+
kind: "directive",
|
|
358
|
+
type: i1$2.NgClass,
|
|
359
|
+
selector: "[ngClass]",
|
|
360
|
+
inputs: ["class", "ngClass"]
|
|
361
|
+
},
|
|
362
|
+
{
|
|
363
|
+
kind: "ngmodule",
|
|
364
|
+
type: ReactiveFormsModule
|
|
365
|
+
},
|
|
366
|
+
{
|
|
367
|
+
kind: "directive",
|
|
368
|
+
type: i2.DefaultValueAccessor,
|
|
369
|
+
selector: "input:not([type=checkbox]):not([ngNoCva])[formControlName],textarea:not([ngNoCva])[formControlName],input:not([type=checkbox]):not([ngNoCva])[formControl],textarea:not([ngNoCva])[formControl],input:not([type=checkbox]):not([ngNoCva])[ngModel],textarea:not([ngNoCva])[ngModel],[ngDefaultControl]"
|
|
370
|
+
},
|
|
371
|
+
{
|
|
372
|
+
kind: "directive",
|
|
373
|
+
type: i2.NgControlStatus,
|
|
374
|
+
selector: "[formControlName],[ngModel],[formControl]"
|
|
375
|
+
},
|
|
376
|
+
{
|
|
377
|
+
kind: "directive",
|
|
378
|
+
type: i2.FormControlDirective,
|
|
379
|
+
selector: "[formControl]",
|
|
380
|
+
inputs: [
|
|
381
|
+
"formControl",
|
|
382
|
+
"disabled",
|
|
383
|
+
"ngModel"
|
|
384
|
+
],
|
|
385
|
+
outputs: ["ngModelChange"],
|
|
386
|
+
exportAs: ["ngForm"]
|
|
387
|
+
},
|
|
388
|
+
{
|
|
389
|
+
kind: "ngmodule",
|
|
390
|
+
type: MatButtonModule
|
|
391
|
+
},
|
|
392
|
+
{
|
|
393
|
+
kind: "ngmodule",
|
|
394
|
+
type: MatCheckboxModule
|
|
395
|
+
},
|
|
396
|
+
{
|
|
397
|
+
kind: "component",
|
|
398
|
+
type: i3.MatCheckbox,
|
|
399
|
+
selector: "mat-checkbox",
|
|
400
|
+
inputs: [
|
|
401
|
+
"aria-label",
|
|
402
|
+
"aria-labelledby",
|
|
403
|
+
"aria-describedby",
|
|
404
|
+
"aria-expanded",
|
|
405
|
+
"aria-controls",
|
|
406
|
+
"aria-owns",
|
|
407
|
+
"id",
|
|
408
|
+
"required",
|
|
409
|
+
"labelPosition",
|
|
410
|
+
"name",
|
|
411
|
+
"value",
|
|
412
|
+
"disableRipple",
|
|
413
|
+
"tabIndex",
|
|
414
|
+
"color",
|
|
415
|
+
"disabledInteractive",
|
|
416
|
+
"checked",
|
|
417
|
+
"disabled",
|
|
418
|
+
"indeterminate"
|
|
419
|
+
],
|
|
420
|
+
outputs: ["change", "indeterminateChange"],
|
|
421
|
+
exportAs: ["matCheckbox"]
|
|
422
|
+
},
|
|
423
|
+
{
|
|
424
|
+
kind: "ngmodule",
|
|
425
|
+
type: MatIconModule
|
|
426
|
+
},
|
|
427
|
+
{
|
|
428
|
+
kind: "component",
|
|
429
|
+
type: i4.MatIcon,
|
|
430
|
+
selector: "mat-icon",
|
|
431
|
+
inputs: [
|
|
432
|
+
"color",
|
|
433
|
+
"inline",
|
|
434
|
+
"svgIcon",
|
|
435
|
+
"fontSet",
|
|
436
|
+
"fontIcon"
|
|
437
|
+
],
|
|
438
|
+
exportAs: ["matIcon"]
|
|
439
|
+
},
|
|
440
|
+
{
|
|
441
|
+
kind: "ngmodule",
|
|
442
|
+
type: MatInputModule
|
|
443
|
+
},
|
|
444
|
+
{
|
|
445
|
+
kind: "directive",
|
|
446
|
+
type: i5.MatInput,
|
|
447
|
+
selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]",
|
|
448
|
+
inputs: [
|
|
449
|
+
"disabled",
|
|
450
|
+
"id",
|
|
451
|
+
"placeholder",
|
|
452
|
+
"name",
|
|
453
|
+
"required",
|
|
454
|
+
"type",
|
|
455
|
+
"errorStateMatcher",
|
|
456
|
+
"aria-describedby",
|
|
457
|
+
"value",
|
|
458
|
+
"readonly",
|
|
459
|
+
"disabledInteractive"
|
|
460
|
+
],
|
|
461
|
+
exportAs: ["matInput"]
|
|
462
|
+
},
|
|
463
|
+
{
|
|
464
|
+
kind: "component",
|
|
465
|
+
type: i5.MatFormField,
|
|
466
|
+
selector: "mat-form-field",
|
|
467
|
+
inputs: [
|
|
468
|
+
"hideRequiredMarker",
|
|
469
|
+
"color",
|
|
470
|
+
"floatLabel",
|
|
471
|
+
"appearance",
|
|
472
|
+
"subscriptSizing",
|
|
473
|
+
"hintLabel"
|
|
474
|
+
],
|
|
475
|
+
exportAs: ["matFormField"]
|
|
476
|
+
},
|
|
477
|
+
{
|
|
478
|
+
kind: "directive",
|
|
479
|
+
type: i5.MatPrefix,
|
|
480
|
+
selector: "[matPrefix], [matIconPrefix], [matTextPrefix]",
|
|
481
|
+
inputs: ["matTextPrefix"]
|
|
482
|
+
},
|
|
483
|
+
{
|
|
484
|
+
kind: "ngmodule",
|
|
485
|
+
type: MatProgressSpinnerModule
|
|
486
|
+
},
|
|
487
|
+
{
|
|
488
|
+
kind: "component",
|
|
489
|
+
type: i6.MatProgressSpinner,
|
|
490
|
+
selector: "mat-progress-spinner, mat-spinner",
|
|
491
|
+
inputs: [
|
|
492
|
+
"color",
|
|
493
|
+
"mode",
|
|
494
|
+
"value",
|
|
495
|
+
"diameter",
|
|
496
|
+
"strokeWidth"
|
|
497
|
+
],
|
|
498
|
+
exportAs: ["matProgressSpinner"]
|
|
499
|
+
},
|
|
500
|
+
{
|
|
501
|
+
kind: "ngmodule",
|
|
502
|
+
type: MatRadioModule
|
|
503
|
+
},
|
|
504
|
+
{
|
|
505
|
+
kind: "component",
|
|
506
|
+
type: i7.MatRadioButton,
|
|
507
|
+
selector: "mat-radio-button",
|
|
508
|
+
inputs: [
|
|
509
|
+
"id",
|
|
510
|
+
"name",
|
|
511
|
+
"aria-label",
|
|
512
|
+
"aria-labelledby",
|
|
513
|
+
"aria-describedby",
|
|
514
|
+
"disableRipple",
|
|
515
|
+
"tabIndex",
|
|
516
|
+
"checked",
|
|
517
|
+
"value",
|
|
518
|
+
"labelPosition",
|
|
519
|
+
"disabled",
|
|
520
|
+
"required",
|
|
521
|
+
"color",
|
|
522
|
+
"disabledInteractive"
|
|
523
|
+
],
|
|
524
|
+
outputs: ["change"],
|
|
525
|
+
exportAs: ["matRadioButton"]
|
|
526
|
+
},
|
|
527
|
+
{
|
|
528
|
+
kind: "ngmodule",
|
|
529
|
+
type: MatSortModule
|
|
530
|
+
},
|
|
531
|
+
{
|
|
532
|
+
kind: "directive",
|
|
533
|
+
type: i8.MatSort,
|
|
534
|
+
selector: "[matSort]",
|
|
535
|
+
inputs: [
|
|
536
|
+
"matSortActive",
|
|
537
|
+
"matSortStart",
|
|
538
|
+
"matSortDirection",
|
|
539
|
+
"matSortDisableClear",
|
|
540
|
+
"matSortDisabled"
|
|
541
|
+
],
|
|
542
|
+
outputs: ["matSortChange"],
|
|
543
|
+
exportAs: ["matSort"]
|
|
544
|
+
},
|
|
545
|
+
{
|
|
546
|
+
kind: "component",
|
|
547
|
+
type: i8.MatSortHeader,
|
|
548
|
+
selector: "[mat-sort-header]",
|
|
549
|
+
inputs: [
|
|
550
|
+
"mat-sort-header",
|
|
551
|
+
"arrowPosition",
|
|
552
|
+
"start",
|
|
553
|
+
"disabled",
|
|
554
|
+
"sortActionDescription",
|
|
555
|
+
"disableClear"
|
|
556
|
+
],
|
|
557
|
+
exportAs: ["matSortHeader"]
|
|
558
|
+
},
|
|
559
|
+
{
|
|
560
|
+
kind: "ngmodule",
|
|
561
|
+
type: MatTableModule
|
|
562
|
+
},
|
|
563
|
+
{
|
|
564
|
+
kind: "component",
|
|
565
|
+
type: i9.MatTable,
|
|
566
|
+
selector: "mat-table, table[mat-table]",
|
|
567
|
+
exportAs: ["matTable"]
|
|
568
|
+
},
|
|
569
|
+
{
|
|
570
|
+
kind: "directive",
|
|
571
|
+
type: i9.MatHeaderCellDef,
|
|
572
|
+
selector: "[matHeaderCellDef]"
|
|
573
|
+
},
|
|
574
|
+
{
|
|
575
|
+
kind: "directive",
|
|
576
|
+
type: i9.MatHeaderRowDef,
|
|
577
|
+
selector: "[matHeaderRowDef]",
|
|
578
|
+
inputs: ["matHeaderRowDef", "matHeaderRowDefSticky"]
|
|
579
|
+
},
|
|
580
|
+
{
|
|
581
|
+
kind: "directive",
|
|
582
|
+
type: i9.MatColumnDef,
|
|
583
|
+
selector: "[matColumnDef]",
|
|
584
|
+
inputs: ["matColumnDef"]
|
|
585
|
+
},
|
|
586
|
+
{
|
|
587
|
+
kind: "directive",
|
|
588
|
+
type: i9.MatCellDef,
|
|
589
|
+
selector: "[matCellDef]"
|
|
590
|
+
},
|
|
591
|
+
{
|
|
592
|
+
kind: "directive",
|
|
593
|
+
type: i9.MatRowDef,
|
|
594
|
+
selector: "[matRowDef]",
|
|
595
|
+
inputs: ["matRowDefColumns", "matRowDefWhen"]
|
|
596
|
+
},
|
|
597
|
+
{
|
|
598
|
+
kind: "directive",
|
|
599
|
+
type: i9.MatHeaderCell,
|
|
600
|
+
selector: "mat-header-cell, th[mat-header-cell]"
|
|
601
|
+
},
|
|
602
|
+
{
|
|
603
|
+
kind: "directive",
|
|
604
|
+
type: i9.MatCell,
|
|
605
|
+
selector: "mat-cell, td[mat-cell]"
|
|
606
|
+
},
|
|
607
|
+
{
|
|
608
|
+
kind: "component",
|
|
609
|
+
type: i9.MatHeaderRow,
|
|
610
|
+
selector: "mat-header-row, tr[mat-header-row]",
|
|
611
|
+
exportAs: ["matHeaderRow"]
|
|
612
|
+
},
|
|
613
|
+
{
|
|
614
|
+
kind: "component",
|
|
615
|
+
type: i9.MatRow,
|
|
616
|
+
selector: "mat-row, tr[mat-row]",
|
|
617
|
+
exportAs: ["matRow"]
|
|
618
|
+
},
|
|
619
|
+
{
|
|
620
|
+
kind: "component",
|
|
621
|
+
type: CmatPaginationComponent,
|
|
622
|
+
selector: "cmat-pagination",
|
|
623
|
+
inputs: [
|
|
624
|
+
"id",
|
|
625
|
+
"maxSize",
|
|
626
|
+
"itemsPerPages",
|
|
627
|
+
"initPerPage",
|
|
628
|
+
"autoHide"
|
|
629
|
+
],
|
|
630
|
+
outputs: [
|
|
631
|
+
"pageChange",
|
|
632
|
+
"pageBoundsCorrection",
|
|
633
|
+
"perPageCountChange"
|
|
634
|
+
],
|
|
635
|
+
exportAs: ["cmatPagination"]
|
|
636
|
+
},
|
|
637
|
+
{
|
|
638
|
+
kind: "pipe",
|
|
639
|
+
type: CmatPaginatePipe,
|
|
640
|
+
name: "paginate"
|
|
641
|
+
}
|
|
642
|
+
],
|
|
643
|
+
changeDetection: i0.ChangeDetectionStrategy.OnPush,
|
|
644
|
+
encapsulation: i0.ViewEncapsulation.None
|
|
645
|
+
});
|
|
646
|
+
}
|
|
647
|
+
};
|
|
648
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
649
|
+
minVersion: "12.0.0",
|
|
650
|
+
version: "22.2.3",
|
|
651
|
+
ngImport: i0,
|
|
652
|
+
type: CmatDataPickerListComponent,
|
|
653
|
+
decorators: [{
|
|
654
|
+
type: Component,
|
|
655
|
+
args: [{
|
|
656
|
+
selector: "cmat-data-picker-list",
|
|
657
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
658
|
+
encapsulation: ViewEncapsulation.None,
|
|
659
|
+
imports: [
|
|
660
|
+
CommonModule,
|
|
661
|
+
ReactiveFormsModule,
|
|
662
|
+
MatButtonModule,
|
|
663
|
+
MatCheckboxModule,
|
|
664
|
+
MatIconModule,
|
|
665
|
+
MatInputModule,
|
|
666
|
+
MatProgressSpinnerModule,
|
|
667
|
+
MatRadioModule,
|
|
668
|
+
MatSortModule,
|
|
669
|
+
MatTableModule,
|
|
670
|
+
CmatPaginationComponent,
|
|
671
|
+
CmatPaginatePipe
|
|
672
|
+
],
|
|
673
|
+
template: "<div class=\"flex flex-col h-full\">\r\n <!-- 搜索框 -->\r\n @if (searchable()) {\r\n <div class=\"px-4 py-3 border-b\">\r\n <mat-form-field class=\"w-full\">\r\n <mat-icon matPrefix [svgIcon]=\"'heroicons_outline:magnifying-glass'\"></mat-icon>\r\n <input matInput [formControl]=\"searchControl\" [placeholder]=\"searchPlaceholder()\" />\r\n </mat-form-field>\r\n </div>\r\n }\r\n\r\n <!-- 数据表格 -->\r\n <div class=\"flex-1 overflow-y-auto scrollbar-custom\">\r\n @if (loading()) {\r\n <div class=\"flex items-center justify-center h-full min-h-30\">\r\n <mat-progress-spinner mode=\"indeterminate\" diameter=\"40\"></mat-progress-spinner>\r\n </div>\r\n } @else if (items().length === 0) {\r\n <div class=\"flex flex-col items-center justify-center h-full py-8\">\r\n <mat-icon class=\"icon-size-16 text-hint\" [svgIcon]=\"'heroicons_outline:inbox'\"></mat-icon>\r\n <p class=\"mt-2 text-secondary\">{{ emptyText() }}</p>\r\n </div>\r\n } @else {\r\n <table mat-table matSort class=\"w-full\"\r\n [dataSource]=\"items() | paginate: {id:paginationId(),currentPage: pagination().currentPage, itemsPerPage: pagination().itemsPerPage, totalItems: pagination().totalItems}\"\r\n (matSortChange)=\"onSortChange($event)\">\r\n\r\n <!-- 选择列 -->\r\n <ng-container matColumnDef=\"_selection\">\r\n <th *matHeaderCellDef mat-header-cell class=\"w-12\">\r\n @if (multiple()) {\r\n <mat-checkbox [checked]=\"isAllSelected()\" [indeterminate]=\"isIndeterminate()\"\r\n (change)=\"toggleSelectAll($event.checked)\">\r\n </mat-checkbox>\r\n }\r\n </th>\r\n <td *matCellDef=\"let item\" mat-cell class=\"w-12\">\r\n @if (multiple()) {\r\n <mat-checkbox [checked]=\"isSelected(item)\" (click)=\"$event.stopPropagation()\"\r\n (change)=\"toggleSelection(item, $event.checked)\">\r\n </mat-checkbox>\r\n } @else {\r\n <mat-radio-button [checked]=\"isSelected(item)\" (click)=\"$event.stopPropagation()\"\r\n (change)=\"selectSingle(item)\">\r\n </mat-radio-button>\r\n }\r\n </td>\r\n </ng-container>\r\n\r\n <!-- 数据列 -->\r\n @for (column of columns(); track column.key) {\r\n <ng-container [matColumnDef]=\"column.key\">\r\n <th *matHeaderCellDef mat-header-cell \r\n [mat-sort-header]=\"column.sortable ? column.key : ''\"\r\n [disabled]=\"!column.sortable\"\r\n [start]=\"column.sortable ? 'asc' : ''\">\r\n {{ column.name }}\r\n </th>\r\n <td *matCellDef=\"let item\" mat-cell>\r\n <div class=\"has-label-on-mobile\" [attr.data-label]=\"column.name + ':'\">\r\n {{ item[column.key] }}\r\n </div>\r\n </td>\r\n </ng-container>\r\n }\r\n\r\n <tr *matHeaderRowDef=\"displayedColumns(); sticky: true\" mat-header-row></tr>\r\n <tr *matRowDef=\"let item; columns: displayedColumns()\" mat-row class=\"cursor-pointer\" (click)=\"onRowClick(item)\">\r\n </tr>\r\n </table>\r\n }\r\n </div>\r\n\r\n <!-- 分页器 -->\r\n <div class=\"border-t\">\r\n <cmat-pagination class=\"bg-slate-50 dark:bg-transparent\" [id]=\"paginationId()\" [initPerPage]=\"pageSize()\"\r\n [ngClass]=\"{'pointer-events-none': loading()}\" [hidden]=\"pagination().totalItems=== 0\" (pageChange)=\"onPageChange($event)\"\r\n (perPageCountChange)=\"onPageSizeChange($event)\">\r\n </cmat-pagination>\r\n </div>\r\n\r\n</div>",
|
|
674
|
+
styles: ["cmat-data-picker-list{display:flex;flex-direction:column;width:100%}cmat-data-picker-list .mat-mdc-row{border-width:1px}\n"]
|
|
675
|
+
}]
|
|
676
|
+
}],
|
|
677
|
+
ctorParameters: () => [],
|
|
678
|
+
propDecorators: {
|
|
679
|
+
dataProvider: [{
|
|
680
|
+
type: i0.Input,
|
|
681
|
+
args: [{
|
|
682
|
+
isSignal: true,
|
|
683
|
+
alias: "dataProvider",
|
|
684
|
+
required: true
|
|
685
|
+
}]
|
|
686
|
+
}],
|
|
687
|
+
columns: [{
|
|
688
|
+
type: i0.Input,
|
|
689
|
+
args: [{
|
|
690
|
+
isSignal: true,
|
|
691
|
+
alias: "columns",
|
|
692
|
+
required: true
|
|
693
|
+
}]
|
|
694
|
+
}],
|
|
695
|
+
keyField: [{
|
|
696
|
+
type: i0.Input,
|
|
697
|
+
args: [{
|
|
698
|
+
isSignal: true,
|
|
699
|
+
alias: "keyField",
|
|
700
|
+
required: false
|
|
701
|
+
}]
|
|
702
|
+
}],
|
|
703
|
+
multiple: [{
|
|
704
|
+
type: i0.Input,
|
|
705
|
+
args: [{
|
|
706
|
+
isSignal: true,
|
|
707
|
+
alias: "multiple",
|
|
708
|
+
required: false
|
|
709
|
+
}]
|
|
710
|
+
}],
|
|
711
|
+
searchable: [{
|
|
712
|
+
type: i0.Input,
|
|
713
|
+
args: [{
|
|
714
|
+
isSignal: true,
|
|
715
|
+
alias: "searchable",
|
|
716
|
+
required: false
|
|
717
|
+
}]
|
|
718
|
+
}],
|
|
719
|
+
pageSize: [{
|
|
720
|
+
type: i0.Input,
|
|
721
|
+
args: [{
|
|
722
|
+
isSignal: true,
|
|
723
|
+
alias: "pageSize",
|
|
724
|
+
required: false
|
|
725
|
+
}]
|
|
726
|
+
}],
|
|
727
|
+
searchPlaceholder: [{
|
|
728
|
+
type: i0.Input,
|
|
729
|
+
args: [{
|
|
730
|
+
isSignal: true,
|
|
731
|
+
alias: "searchPlaceholder",
|
|
732
|
+
required: false
|
|
733
|
+
}]
|
|
734
|
+
}],
|
|
735
|
+
emptyText: [{
|
|
736
|
+
type: i0.Input,
|
|
737
|
+
args: [{
|
|
738
|
+
isSignal: true,
|
|
739
|
+
alias: "emptyText",
|
|
740
|
+
required: false
|
|
741
|
+
}]
|
|
742
|
+
}],
|
|
743
|
+
paginationId: [{
|
|
744
|
+
type: i0.Input,
|
|
745
|
+
args: [{
|
|
746
|
+
isSignal: true,
|
|
747
|
+
alias: "paginationId",
|
|
748
|
+
required: false
|
|
749
|
+
}]
|
|
750
|
+
}],
|
|
751
|
+
selectionChange: [{
|
|
752
|
+
type: i0.Output,
|
|
753
|
+
args: ["selectionChange"]
|
|
754
|
+
}]
|
|
755
|
+
}
|
|
756
|
+
});
|
|
757
|
+
var CmatDataPickerSheetComponent = class CmatDataPickerSheetComponent {
|
|
758
|
+
constructor() {
|
|
759
|
+
this.data = inject(MAT_BOTTOM_SHEET_DATA);
|
|
760
|
+
this.title = computed(() => this.data.multiple ? "选择多项" : "选择一项", ...ngDevMode ? [{ debugName: "title" }] : /* istanbul ignore next */ []);
|
|
761
|
+
this._listComponent = viewChild.required(CmatDataPickerListComponent, ...ngDevMode ? [{ debugName: "_listComponent" }] : /* istanbul ignore next */ []);
|
|
762
|
+
this._bottomSheetRef = inject(MatBottomSheetRef);
|
|
763
|
+
this._selectedKeys = /* @__PURE__ */ new Set();
|
|
764
|
+
if (this.data.initialSelection && this.data.initialSelection.length > 0) {
|
|
765
|
+
const keys = this.data.initialSelection.map((item) => item[this.data.keyField]);
|
|
766
|
+
this._selectedKeys = new Set(keys);
|
|
767
|
+
}
|
|
768
|
+
}
|
|
769
|
+
ngAfterViewInit() {
|
|
770
|
+
if (this.data.initialSelection && this.data.initialSelection.length > 0) this._listComponent().setSelectedItems(this.data.initialSelection);
|
|
771
|
+
}
|
|
772
|
+
onSelectionChange(keys) {
|
|
773
|
+
this._selectedKeys = keys;
|
|
774
|
+
}
|
|
775
|
+
dismiss() {
|
|
776
|
+
this._bottomSheetRef.dismiss();
|
|
777
|
+
}
|
|
778
|
+
confirm() {
|
|
779
|
+
const selectedItems = this._listComponent().getSelectedArray();
|
|
780
|
+
const result = this.data.multiple ? selectedItems : selectedItems[0] ?? null;
|
|
781
|
+
this._bottomSheetRef.dismiss(result);
|
|
782
|
+
}
|
|
783
|
+
static {
|
|
784
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
785
|
+
minVersion: "12.0.0",
|
|
786
|
+
version: "22.2.3",
|
|
787
|
+
ngImport: i0,
|
|
788
|
+
type: CmatDataPickerSheetComponent,
|
|
789
|
+
deps: [],
|
|
790
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
791
|
+
});
|
|
792
|
+
}
|
|
793
|
+
static {
|
|
794
|
+
this.ɵcmp = i0.ɵɵngDeclareComponent({
|
|
795
|
+
minVersion: "17.2.0",
|
|
796
|
+
version: "22.2.3",
|
|
797
|
+
type: CmatDataPickerSheetComponent,
|
|
798
|
+
isStandalone: true,
|
|
799
|
+
selector: "cmat-data-picker-sheet",
|
|
800
|
+
viewQueries: [{
|
|
801
|
+
propertyName: "_listComponent",
|
|
802
|
+
first: true,
|
|
803
|
+
predicate: CmatDataPickerListComponent,
|
|
804
|
+
descendants: true,
|
|
805
|
+
isSignal: true
|
|
806
|
+
}],
|
|
807
|
+
ngImport: i0,
|
|
808
|
+
template: "<div class=\"flex flex-col h-full max-h-[70vh] -mx-4\">\r\n <!-- 头部 -->\r\n <div class=\"flex items-center justify-between px-4 py-3 border-b bg-card\">\r\n <h2 class=\"text-lg font-semibold\">{{ title() }}</h2>\r\n <button matIconButton (click)=\"dismiss()\">\r\n <mat-icon [svgIcon]=\"'heroicons_outline:x-mark'\"></mat-icon>\r\n </button>\r\n </div>\r\n\r\n <!-- 列表内容 -->\r\n <div class=\"flex-1 overflow-hidden min-h-0 flex\">\r\n <cmat-data-picker-list [dataProvider]=\"data.dataProvider\" [columns]=\"data.columns\" [keyField]=\"data.keyField\"\r\n [multiple]=\"data.multiple\" [searchable]=\"data.searchable\" [pageSize]=\"data.pageSize\"\r\n (selectionChange)=\"onSelectionChange($event)\">\r\n </cmat-data-picker-list>\r\n </div>\r\n <!-- 底部操作栏 -->\r\n <div class=\"px-4 py-3 border-t flex justify-end gap-2\">\r\n <button matButton=\"filled\" color=\"primary\" (click)=\"confirm()\">\r\n 确定\r\n </button>\r\n <button matButton=\"outlined\" (click)=\"dismiss()\">取消</button>\r\n </div>\r\n</div>",
|
|
809
|
+
styles: [":host{display:block;height:100%}\n"],
|
|
810
|
+
dependencies: [
|
|
811
|
+
{
|
|
812
|
+
kind: "ngmodule",
|
|
813
|
+
type: MatButtonModule
|
|
814
|
+
},
|
|
815
|
+
{
|
|
816
|
+
kind: "component",
|
|
817
|
+
type: i1$1.MatButton,
|
|
818
|
+
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] ",
|
|
819
|
+
inputs: ["matButton"],
|
|
820
|
+
exportAs: ["matButton", "matAnchor"]
|
|
821
|
+
},
|
|
822
|
+
{
|
|
823
|
+
kind: "component",
|
|
824
|
+
type: i1$1.MatIconButton,
|
|
825
|
+
selector: "button[mat-icon-button], a[mat-icon-button], button[matIconButton], a[matIconButton]",
|
|
826
|
+
exportAs: ["matButton", "matAnchor"]
|
|
827
|
+
},
|
|
828
|
+
{
|
|
829
|
+
kind: "ngmodule",
|
|
830
|
+
type: MatIconModule
|
|
831
|
+
},
|
|
832
|
+
{
|
|
833
|
+
kind: "component",
|
|
834
|
+
type: i4.MatIcon,
|
|
835
|
+
selector: "mat-icon",
|
|
836
|
+
inputs: [
|
|
837
|
+
"color",
|
|
838
|
+
"inline",
|
|
839
|
+
"svgIcon",
|
|
840
|
+
"fontSet",
|
|
841
|
+
"fontIcon"
|
|
842
|
+
],
|
|
843
|
+
exportAs: ["matIcon"]
|
|
844
|
+
},
|
|
845
|
+
{
|
|
846
|
+
kind: "component",
|
|
847
|
+
type: CmatDataPickerListComponent,
|
|
848
|
+
selector: "cmat-data-picker-list",
|
|
849
|
+
inputs: [
|
|
850
|
+
"dataProvider",
|
|
851
|
+
"columns",
|
|
852
|
+
"keyField",
|
|
853
|
+
"multiple",
|
|
854
|
+
"searchable",
|
|
855
|
+
"pageSize",
|
|
856
|
+
"searchPlaceholder",
|
|
857
|
+
"emptyText",
|
|
858
|
+
"paginationId"
|
|
859
|
+
],
|
|
860
|
+
outputs: ["selectionChange"]
|
|
861
|
+
}
|
|
862
|
+
],
|
|
863
|
+
changeDetection: i0.ChangeDetectionStrategy.OnPush,
|
|
864
|
+
encapsulation: i0.ViewEncapsulation.None
|
|
865
|
+
});
|
|
866
|
+
}
|
|
867
|
+
};
|
|
868
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
869
|
+
minVersion: "12.0.0",
|
|
870
|
+
version: "22.2.3",
|
|
871
|
+
ngImport: i0,
|
|
872
|
+
type: CmatDataPickerSheetComponent,
|
|
873
|
+
decorators: [{
|
|
874
|
+
type: Component,
|
|
875
|
+
args: [{
|
|
876
|
+
selector: "cmat-data-picker-sheet",
|
|
877
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
878
|
+
encapsulation: ViewEncapsulation.None,
|
|
879
|
+
imports: [
|
|
880
|
+
MatButtonModule,
|
|
881
|
+
MatIconModule,
|
|
882
|
+
CmatDataPickerListComponent
|
|
883
|
+
],
|
|
884
|
+
template: "<div class=\"flex flex-col h-full max-h-[70vh] -mx-4\">\r\n <!-- 头部 -->\r\n <div class=\"flex items-center justify-between px-4 py-3 border-b bg-card\">\r\n <h2 class=\"text-lg font-semibold\">{{ title() }}</h2>\r\n <button matIconButton (click)=\"dismiss()\">\r\n <mat-icon [svgIcon]=\"'heroicons_outline:x-mark'\"></mat-icon>\r\n </button>\r\n </div>\r\n\r\n <!-- 列表内容 -->\r\n <div class=\"flex-1 overflow-hidden min-h-0 flex\">\r\n <cmat-data-picker-list [dataProvider]=\"data.dataProvider\" [columns]=\"data.columns\" [keyField]=\"data.keyField\"\r\n [multiple]=\"data.multiple\" [searchable]=\"data.searchable\" [pageSize]=\"data.pageSize\"\r\n (selectionChange)=\"onSelectionChange($event)\">\r\n </cmat-data-picker-list>\r\n </div>\r\n <!-- 底部操作栏 -->\r\n <div class=\"px-4 py-3 border-t flex justify-end gap-2\">\r\n <button matButton=\"filled\" color=\"primary\" (click)=\"confirm()\">\r\n 确定\r\n </button>\r\n <button matButton=\"outlined\" (click)=\"dismiss()\">取消</button>\r\n </div>\r\n</div>",
|
|
885
|
+
styles: [":host{display:block;height:100%}\n"]
|
|
886
|
+
}]
|
|
887
|
+
}],
|
|
888
|
+
ctorParameters: () => [],
|
|
889
|
+
propDecorators: { _listComponent: [{
|
|
890
|
+
type: i0.ViewChild,
|
|
891
|
+
args: [i0.forwardRef(() => CmatDataPickerListComponent), { isSignal: true }]
|
|
892
|
+
}] }
|
|
893
|
+
});
|
|
894
|
+
var CmatDataPickerDialogComponent = class CmatDataPickerDialogComponent {
|
|
895
|
+
constructor() {
|
|
896
|
+
this.data = inject(MAT_DIALOG_DATA);
|
|
897
|
+
this.title = computed(() => this.data.multiple ? "选择多项" : "选择一项", ...ngDevMode ? [{ debugName: "title" }] : /* istanbul ignore next */ []);
|
|
898
|
+
this._listComponent = viewChild.required(CmatDataPickerListComponent, ...ngDevMode ? [{ debugName: "_listComponent" }] : /* istanbul ignore next */ []);
|
|
899
|
+
this._dialogRef = inject(MatDialogRef);
|
|
900
|
+
this._selectedKeys = /* @__PURE__ */ new Set();
|
|
901
|
+
if (this.data.initialSelection && this.data.initialSelection.length > 0) {
|
|
902
|
+
const keys = this.data.initialSelection.map((item) => item[this.data.keyField]);
|
|
903
|
+
this._selectedKeys = new Set(keys);
|
|
904
|
+
}
|
|
905
|
+
}
|
|
906
|
+
ngAfterViewInit() {
|
|
907
|
+
if (this.data.initialSelection && this.data.initialSelection.length > 0) this._listComponent().setSelectedItems(this.data.initialSelection);
|
|
908
|
+
}
|
|
909
|
+
onSelectionChange(keys) {
|
|
910
|
+
this._selectedKeys = keys;
|
|
911
|
+
}
|
|
912
|
+
dismiss() {
|
|
913
|
+
this._dialogRef.close();
|
|
914
|
+
}
|
|
915
|
+
confirm() {
|
|
916
|
+
const selectedItems = this._listComponent().getSelectedArray();
|
|
917
|
+
const result = this.data.multiple ? selectedItems : selectedItems[0] ?? null;
|
|
918
|
+
this._dialogRef.close(result);
|
|
919
|
+
}
|
|
920
|
+
static {
|
|
921
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
922
|
+
minVersion: "12.0.0",
|
|
923
|
+
version: "22.2.3",
|
|
924
|
+
ngImport: i0,
|
|
925
|
+
type: CmatDataPickerDialogComponent,
|
|
926
|
+
deps: [],
|
|
927
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
928
|
+
});
|
|
929
|
+
}
|
|
930
|
+
static {
|
|
931
|
+
this.ɵcmp = i0.ɵɵngDeclareComponent({
|
|
932
|
+
minVersion: "17.2.0",
|
|
933
|
+
version: "22.2.3",
|
|
934
|
+
type: CmatDataPickerDialogComponent,
|
|
935
|
+
isStandalone: true,
|
|
936
|
+
selector: "cmat-data-picker-dialog",
|
|
937
|
+
viewQueries: [{
|
|
938
|
+
propertyName: "_listComponent",
|
|
939
|
+
first: true,
|
|
940
|
+
predicate: CmatDataPickerListComponent,
|
|
941
|
+
descendants: true,
|
|
942
|
+
isSignal: true
|
|
943
|
+
}],
|
|
944
|
+
ngImport: i0,
|
|
945
|
+
template: "<div class=\"flex flex-col h-full max-h-[80vh]\">\r\n <!-- 头部 -->\r\n <div class=\"flex items-center justify-between px-6 py-4 border-b\">\r\n <h2 class=\"text-xl font-semibold\">{{ title() }}</h2>\r\n <button matIconButton (click)=\"dismiss()\">\r\n <mat-icon [svgIcon]=\"'heroicons_outline:x-mark'\"></mat-icon>\r\n </button>\r\n </div>\r\n\r\n <!-- 列表内容 -->\r\n <div class=\"flex-1 overflow-hidden min-h-0 flex\">\r\n <cmat-data-picker-list [dataProvider]=\"data.dataProvider\" [columns]=\"data.columns\" [keyField]=\"data.keyField\"\r\n [multiple]=\"data.multiple\" [searchable]=\"data.searchable\" [pageSize]=\"data.pageSize\"\r\n (selectionChange)=\"onSelectionChange($event)\">\r\n </cmat-data-picker-list>\r\n </div>\r\n\r\n <!-- 底部操作栏 -->\r\n <div class=\"px-6 py-4 border-t flex justify-end gap-2\">\r\n <button matButton=\"filled\" color=\"primary\" (click)=\"confirm()\">\r\n 确定\r\n </button>\r\n <button matButton=\"outlined\" (click)=\"dismiss()\">取消</button>\r\n </div>\r\n</div>",
|
|
946
|
+
dependencies: [
|
|
947
|
+
{
|
|
948
|
+
kind: "ngmodule",
|
|
949
|
+
type: MatButtonModule
|
|
950
|
+
},
|
|
951
|
+
{
|
|
952
|
+
kind: "component",
|
|
953
|
+
type: i1$1.MatButton,
|
|
954
|
+
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] ",
|
|
955
|
+
inputs: ["matButton"],
|
|
956
|
+
exportAs: ["matButton", "matAnchor"]
|
|
957
|
+
},
|
|
958
|
+
{
|
|
959
|
+
kind: "component",
|
|
960
|
+
type: i1$1.MatIconButton,
|
|
961
|
+
selector: "button[mat-icon-button], a[mat-icon-button], button[matIconButton], a[matIconButton]",
|
|
962
|
+
exportAs: ["matButton", "matAnchor"]
|
|
963
|
+
},
|
|
964
|
+
{
|
|
965
|
+
kind: "ngmodule",
|
|
966
|
+
type: MatIconModule
|
|
967
|
+
},
|
|
968
|
+
{
|
|
969
|
+
kind: "component",
|
|
970
|
+
type: i4.MatIcon,
|
|
971
|
+
selector: "mat-icon",
|
|
972
|
+
inputs: [
|
|
973
|
+
"color",
|
|
974
|
+
"inline",
|
|
975
|
+
"svgIcon",
|
|
976
|
+
"fontSet",
|
|
977
|
+
"fontIcon"
|
|
978
|
+
],
|
|
979
|
+
exportAs: ["matIcon"]
|
|
980
|
+
},
|
|
981
|
+
{
|
|
982
|
+
kind: "component",
|
|
983
|
+
type: CmatDataPickerListComponent,
|
|
984
|
+
selector: "cmat-data-picker-list",
|
|
985
|
+
inputs: [
|
|
986
|
+
"dataProvider",
|
|
987
|
+
"columns",
|
|
988
|
+
"keyField",
|
|
989
|
+
"multiple",
|
|
990
|
+
"searchable",
|
|
991
|
+
"pageSize",
|
|
992
|
+
"searchPlaceholder",
|
|
993
|
+
"emptyText",
|
|
994
|
+
"paginationId"
|
|
995
|
+
],
|
|
996
|
+
outputs: ["selectionChange"]
|
|
997
|
+
}
|
|
998
|
+
],
|
|
999
|
+
changeDetection: i0.ChangeDetectionStrategy.OnPush,
|
|
1000
|
+
encapsulation: i0.ViewEncapsulation.None
|
|
1001
|
+
});
|
|
1002
|
+
}
|
|
1003
|
+
};
|
|
1004
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
1005
|
+
minVersion: "12.0.0",
|
|
1006
|
+
version: "22.2.3",
|
|
1007
|
+
ngImport: i0,
|
|
1008
|
+
type: CmatDataPickerDialogComponent,
|
|
1009
|
+
decorators: [{
|
|
1010
|
+
type: Component,
|
|
1011
|
+
args: [{
|
|
1012
|
+
selector: "cmat-data-picker-dialog",
|
|
1013
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
1014
|
+
encapsulation: ViewEncapsulation.None,
|
|
1015
|
+
imports: [
|
|
1016
|
+
MatButtonModule,
|
|
1017
|
+
MatIconModule,
|
|
1018
|
+
CmatDataPickerListComponent
|
|
1019
|
+
],
|
|
1020
|
+
template: "<div class=\"flex flex-col h-full max-h-[80vh]\">\r\n <!-- 头部 -->\r\n <div class=\"flex items-center justify-between px-6 py-4 border-b\">\r\n <h2 class=\"text-xl font-semibold\">{{ title() }}</h2>\r\n <button matIconButton (click)=\"dismiss()\">\r\n <mat-icon [svgIcon]=\"'heroicons_outline:x-mark'\"></mat-icon>\r\n </button>\r\n </div>\r\n\r\n <!-- 列表内容 -->\r\n <div class=\"flex-1 overflow-hidden min-h-0 flex\">\r\n <cmat-data-picker-list [dataProvider]=\"data.dataProvider\" [columns]=\"data.columns\" [keyField]=\"data.keyField\"\r\n [multiple]=\"data.multiple\" [searchable]=\"data.searchable\" [pageSize]=\"data.pageSize\"\r\n (selectionChange)=\"onSelectionChange($event)\">\r\n </cmat-data-picker-list>\r\n </div>\r\n\r\n <!-- 底部操作栏 -->\r\n <div class=\"px-6 py-4 border-t flex justify-end gap-2\">\r\n <button matButton=\"filled\" color=\"primary\" (click)=\"confirm()\">\r\n 确定\r\n </button>\r\n <button matButton=\"outlined\" (click)=\"dismiss()\">取消</button>\r\n </div>\r\n</div>"
|
|
1021
|
+
}]
|
|
1022
|
+
}],
|
|
1023
|
+
ctorParameters: () => [],
|
|
1024
|
+
propDecorators: { _listComponent: [{
|
|
1025
|
+
type: i0.ViewChild,
|
|
1026
|
+
args: [i0.forwardRef(() => CmatDataPickerListComponent), { isSignal: true }]
|
|
1027
|
+
}] }
|
|
1028
|
+
});
|
|
1029
|
+
var CmatDataPickerDrawerComponent = class CmatDataPickerDrawerComponent {
|
|
1030
|
+
constructor() {
|
|
1031
|
+
this.title = computed(() => this.data?.multiple ? "选择多项" : "选择一项", ...ngDevMode ? [{ debugName: "title" }] : /* istanbul ignore next */ []);
|
|
1032
|
+
this._listComponent = viewChild.required(CmatDataPickerListComponent, ...ngDevMode ? [{ debugName: "_listComponent" }] : /* istanbul ignore next */ []);
|
|
1033
|
+
this._selectedKeys = /* @__PURE__ */ new Set();
|
|
1034
|
+
}
|
|
1035
|
+
ngAfterViewInit() {
|
|
1036
|
+
if (this.data.initialSelection && this.data.initialSelection.length > 0) {
|
|
1037
|
+
const keys = this.data.initialSelection.map((item) => item[this.data.keyField]);
|
|
1038
|
+
this._selectedKeys = new Set(keys);
|
|
1039
|
+
this._listComponent().setSelectedItems(this.data.initialSelection);
|
|
1040
|
+
}
|
|
1041
|
+
}
|
|
1042
|
+
onSelectionChange(keys) {
|
|
1043
|
+
this._selectedKeys = keys;
|
|
1044
|
+
}
|
|
1045
|
+
dismiss() {
|
|
1046
|
+
if (this.data.onClose) this.data.onClose();
|
|
1047
|
+
}
|
|
1048
|
+
confirm() {
|
|
1049
|
+
const selectedItems = this._listComponent().getSelectedArray();
|
|
1050
|
+
const result = this.data.multiple ? selectedItems : selectedItems[0] ?? null;
|
|
1051
|
+
if (this.data.onConfirm) this.data.onConfirm(result);
|
|
1052
|
+
if (this.data.onClose) this.data.onClose();
|
|
1053
|
+
}
|
|
1054
|
+
static {
|
|
1055
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
1056
|
+
minVersion: "12.0.0",
|
|
1057
|
+
version: "22.2.3",
|
|
1058
|
+
ngImport: i0,
|
|
1059
|
+
type: CmatDataPickerDrawerComponent,
|
|
1060
|
+
deps: [],
|
|
1061
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
1062
|
+
});
|
|
1063
|
+
}
|
|
1064
|
+
static {
|
|
1065
|
+
this.ɵcmp = i0.ɵɵngDeclareComponent({
|
|
1066
|
+
minVersion: "17.2.0",
|
|
1067
|
+
version: "22.2.3",
|
|
1068
|
+
type: CmatDataPickerDrawerComponent,
|
|
1069
|
+
isStandalone: true,
|
|
1070
|
+
selector: "cmat-data-picker-drawer",
|
|
1071
|
+
viewQueries: [{
|
|
1072
|
+
propertyName: "_listComponent",
|
|
1073
|
+
first: true,
|
|
1074
|
+
predicate: CmatDataPickerListComponent,
|
|
1075
|
+
descendants: true,
|
|
1076
|
+
isSignal: true
|
|
1077
|
+
}],
|
|
1078
|
+
ngImport: i0,
|
|
1079
|
+
template: "<div class=\"flex flex-col h-full\">\r\n <!-- 头部 -->\r\n <div class=\"flex items-center justify-between px-6 py-4 border-b bg-card\">\r\n <h2 class=\"text-xl font-semibold\">{{ title() }}</h2>\r\n <button matIconButton (click)=\"dismiss()\">\r\n <mat-icon [svgIcon]=\"'heroicons_outline:x-mark'\"></mat-icon>\r\n </button>\r\n </div>\r\n\r\n <!-- 列表内容 -->\r\n <div class=\"flex-1 overflow-hidden min-h-0 flex\">\r\n <cmat-data-picker-list [dataProvider]=\"data.dataProvider\" [columns]=\"data.columns\" [keyField]=\"data.keyField\"\r\n [multiple]=\"data.multiple\" [searchable]=\"data.searchable\" [pageSize]=\"data.pageSize\"\r\n (selectionChange)=\"onSelectionChange($event)\">\r\n </cmat-data-picker-list>\r\n </div>\r\n\r\n <!-- 底部操作栏 -->\r\n <div class=\"px-6 py-4 border-t bg-card flex justify-end gap-2\">\r\n <button matButton=\"filled\" color=\"primary\" (click)=\"confirm()\">\r\n 确定\r\n </button>\r\n <button matButton=\"outlined\" (click)=\"dismiss()\">取消</button>\r\n </div>\r\n</div>",
|
|
1080
|
+
styles: ["cmat-data-picker-drawer{display:block;width:100%}\n"],
|
|
1081
|
+
dependencies: [
|
|
1082
|
+
{
|
|
1083
|
+
kind: "ngmodule",
|
|
1084
|
+
type: MatButtonModule
|
|
1085
|
+
},
|
|
1086
|
+
{
|
|
1087
|
+
kind: "component",
|
|
1088
|
+
type: i1$1.MatButton,
|
|
1089
|
+
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] ",
|
|
1090
|
+
inputs: ["matButton"],
|
|
1091
|
+
exportAs: ["matButton", "matAnchor"]
|
|
1092
|
+
},
|
|
1093
|
+
{
|
|
1094
|
+
kind: "component",
|
|
1095
|
+
type: i1$1.MatIconButton,
|
|
1096
|
+
selector: "button[mat-icon-button], a[mat-icon-button], button[matIconButton], a[matIconButton]",
|
|
1097
|
+
exportAs: ["matButton", "matAnchor"]
|
|
1098
|
+
},
|
|
1099
|
+
{
|
|
1100
|
+
kind: "ngmodule",
|
|
1101
|
+
type: MatIconModule
|
|
1102
|
+
},
|
|
1103
|
+
{
|
|
1104
|
+
kind: "component",
|
|
1105
|
+
type: i4.MatIcon,
|
|
1106
|
+
selector: "mat-icon",
|
|
1107
|
+
inputs: [
|
|
1108
|
+
"color",
|
|
1109
|
+
"inline",
|
|
1110
|
+
"svgIcon",
|
|
1111
|
+
"fontSet",
|
|
1112
|
+
"fontIcon"
|
|
1113
|
+
],
|
|
1114
|
+
exportAs: ["matIcon"]
|
|
1115
|
+
},
|
|
1116
|
+
{
|
|
1117
|
+
kind: "component",
|
|
1118
|
+
type: CmatDataPickerListComponent,
|
|
1119
|
+
selector: "cmat-data-picker-list",
|
|
1120
|
+
inputs: [
|
|
1121
|
+
"dataProvider",
|
|
1122
|
+
"columns",
|
|
1123
|
+
"keyField",
|
|
1124
|
+
"multiple",
|
|
1125
|
+
"searchable",
|
|
1126
|
+
"pageSize",
|
|
1127
|
+
"searchPlaceholder",
|
|
1128
|
+
"emptyText",
|
|
1129
|
+
"paginationId"
|
|
1130
|
+
],
|
|
1131
|
+
outputs: ["selectionChange"]
|
|
1132
|
+
}
|
|
1133
|
+
],
|
|
1134
|
+
changeDetection: i0.ChangeDetectionStrategy.OnPush,
|
|
1135
|
+
encapsulation: i0.ViewEncapsulation.None
|
|
1136
|
+
});
|
|
1137
|
+
}
|
|
1138
|
+
};
|
|
1139
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
1140
|
+
minVersion: "12.0.0",
|
|
1141
|
+
version: "22.2.3",
|
|
1142
|
+
ngImport: i0,
|
|
1143
|
+
type: CmatDataPickerDrawerComponent,
|
|
1144
|
+
decorators: [{
|
|
1145
|
+
type: Component,
|
|
1146
|
+
args: [{
|
|
1147
|
+
selector: "cmat-data-picker-drawer",
|
|
1148
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
1149
|
+
encapsulation: ViewEncapsulation.None,
|
|
1150
|
+
imports: [
|
|
1151
|
+
MatButtonModule,
|
|
1152
|
+
MatIconModule,
|
|
1153
|
+
CmatDataPickerListComponent
|
|
1154
|
+
],
|
|
1155
|
+
template: "<div class=\"flex flex-col h-full\">\r\n <!-- 头部 -->\r\n <div class=\"flex items-center justify-between px-6 py-4 border-b bg-card\">\r\n <h2 class=\"text-xl font-semibold\">{{ title() }}</h2>\r\n <button matIconButton (click)=\"dismiss()\">\r\n <mat-icon [svgIcon]=\"'heroicons_outline:x-mark'\"></mat-icon>\r\n </button>\r\n </div>\r\n\r\n <!-- 列表内容 -->\r\n <div class=\"flex-1 overflow-hidden min-h-0 flex\">\r\n <cmat-data-picker-list [dataProvider]=\"data.dataProvider\" [columns]=\"data.columns\" [keyField]=\"data.keyField\"\r\n [multiple]=\"data.multiple\" [searchable]=\"data.searchable\" [pageSize]=\"data.pageSize\"\r\n (selectionChange)=\"onSelectionChange($event)\">\r\n </cmat-data-picker-list>\r\n </div>\r\n\r\n <!-- 底部操作栏 -->\r\n <div class=\"px-6 py-4 border-t bg-card flex justify-end gap-2\">\r\n <button matButton=\"filled\" color=\"primary\" (click)=\"confirm()\">\r\n 确定\r\n </button>\r\n <button matButton=\"outlined\" (click)=\"dismiss()\">取消</button>\r\n </div>\r\n</div>",
|
|
1156
|
+
styles: ["cmat-data-picker-drawer{display:block;width:100%}\n"]
|
|
1157
|
+
}]
|
|
1158
|
+
}],
|
|
1159
|
+
propDecorators: { _listComponent: [{
|
|
1160
|
+
type: i0.ViewChild,
|
|
1161
|
+
args: [i0.forwardRef(() => CmatDataPickerListComponent), { isSignal: true }]
|
|
1162
|
+
}] }
|
|
1163
|
+
});
|
|
553
1164
|
let NEXT_ID = 0;
|
|
554
|
-
class CmatDataPickerComponent {
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1165
|
+
var CmatDataPickerComponent = class CmatDataPickerComponent {
|
|
1166
|
+
constructor() {
|
|
1167
|
+
this.id = `cmat-data-picker-${NEXT_ID++}`;
|
|
1168
|
+
this.stateChanges = new Subject();
|
|
1169
|
+
this.controlType = "cmat-data-picker";
|
|
1170
|
+
this.ngControl = inject(NgControl, {
|
|
1171
|
+
optional: true,
|
|
1172
|
+
self: true
|
|
1173
|
+
});
|
|
1174
|
+
this.apiUrl = input(...ngDevMode ? [void 0, { debugName: "apiUrl" }] : /* istanbul ignore next */ []);
|
|
1175
|
+
this.dataSource = input(...ngDevMode ? [void 0, { debugName: "dataSource" }] : /* istanbul ignore next */ []);
|
|
1176
|
+
this.dataProvider = input(...ngDevMode ? [void 0, { debugName: "dataProvider" }] : /* istanbul ignore next */ []);
|
|
1177
|
+
this.columns = input([], ...ngDevMode ? [{ debugName: "columns" }] : /* istanbul ignore next */ []);
|
|
1178
|
+
this.keyField = input("id", ...ngDevMode ? [{ debugName: "keyField" }] : /* istanbul ignore next */ []);
|
|
1179
|
+
this.labelField = input("name", ...ngDevMode ? [{ debugName: "labelField" }] : /* istanbul ignore next */ []);
|
|
1180
|
+
this.displayTemplate = input(...ngDevMode ? [void 0, { debugName: "displayTemplate" }] : /* istanbul ignore next */ []);
|
|
1181
|
+
this.displayLabelFn = input(...ngDevMode ? [void 0, { debugName: "displayLabelFn" }] : /* istanbul ignore next */ []);
|
|
1182
|
+
this.multiple = input(false, ...ngDevMode ? [{ debugName: "multiple" }] : /* istanbul ignore next */ []);
|
|
1183
|
+
this.searchable = input(true, ...ngDevMode ? [{ debugName: "searchable" }] : /* istanbul ignore next */ []);
|
|
1184
|
+
this.debounceTime = input(300, ...ngDevMode ? [{ debugName: "debounceTime" }] : /* istanbul ignore next */ []);
|
|
1185
|
+
this.pageSize = input(20, ...ngDevMode ? [{ debugName: "pageSize" }] : /* istanbul ignore next */ []);
|
|
1186
|
+
this.uiMode = input("auto", ...ngDevMode ? [{ debugName: "uiMode" }] : /* istanbul ignore next */ []);
|
|
1187
|
+
this.drawerPosition = input("end", ...ngDevMode ? [{ debugName: "drawerPosition" }] : /* istanbul ignore next */ []);
|
|
1188
|
+
this.drawerWidth = input("600px", ...ngDevMode ? [{ debugName: "drawerWidth" }] : /* istanbul ignore next */ []);
|
|
1189
|
+
this.dialogWidth = input("800px", ...ngDevMode ? [{ debugName: "dialogWidth" }] : /* istanbul ignore next */ []);
|
|
1190
|
+
this.dialogMaxHeight = input("80vh", ...ngDevMode ? [{ debugName: "dialogMaxHeight" }] : /* istanbul ignore next */ []);
|
|
1191
|
+
this.selectionChange = output();
|
|
1192
|
+
this.selectedItems = signal(/* @__PURE__ */ new Map(), ...ngDevMode ? [{ debugName: "selectedItems" }] : /* istanbul ignore next */ []);
|
|
1193
|
+
this._placeholderSignal = signal("请选择...", ...ngDevMode ? [{ debugName: "_placeholderSignal" }] : /* istanbul ignore next */ []);
|
|
1194
|
+
this._disabledSignal = signal(false, ...ngDevMode ? [{ debugName: "_disabledSignal" }] : /* istanbul ignore next */ []);
|
|
1195
|
+
this._requiredSignal = signal(false, ...ngDevMode ? [{ debugName: "_requiredSignal" }] : /* istanbul ignore next */ []);
|
|
1196
|
+
this._focusedSignal = signal(false, ...ngDevMode ? [{ debugName: "_focusedSignal" }] : /* istanbul ignore next */ []);
|
|
1197
|
+
this._valueSignal = signal(null, ...ngDevMode ? [{ debugName: "_valueSignal" }] : /* istanbul ignore next */ []);
|
|
1198
|
+
this._formField = inject(MatFormField, { optional: true });
|
|
1199
|
+
this._overlay = inject(Overlay);
|
|
1200
|
+
this._bottomSheet = inject(MatBottomSheet);
|
|
1201
|
+
this._dialog = inject(MatDialog);
|
|
1202
|
+
this._cmatMediaWatcherService = inject(CmatMediaWatcherService);
|
|
1203
|
+
this._elementRef = inject(ElementRef);
|
|
1204
|
+
this.isHandSet = computed(() => {
|
|
1205
|
+
return !this._cmatMediaWatcherService.mediaChange().matchingAliases.includes("lg");
|
|
1206
|
+
}, ...ngDevMode ? [{ debugName: "isHandSet" }] : /* istanbul ignore next */ []);
|
|
1207
|
+
this._onChange = () => {};
|
|
1208
|
+
this._onTouched = () => {};
|
|
1209
|
+
if (this.ngControl != null) this.ngControl.valueAccessor = this;
|
|
1210
|
+
}
|
|
1211
|
+
get appearanceIsFill() {
|
|
1212
|
+
if (this._formField?.appearance === "fill") return true;
|
|
1213
|
+
return false;
|
|
1214
|
+
}
|
|
1215
|
+
get focused() {
|
|
1216
|
+
return this._focusedSignal();
|
|
1217
|
+
}
|
|
1218
|
+
get empty() {
|
|
1219
|
+
return this.selectedItems().size === 0;
|
|
1220
|
+
}
|
|
1221
|
+
get errorState() {
|
|
1222
|
+
if (this.ngControl == null) return false;
|
|
1223
|
+
return (this.ngControl.invalid && (this.ngControl.dirty ?? this.ngControl.touched)) ?? false;
|
|
1224
|
+
}
|
|
1225
|
+
get shouldLabelFloat() {
|
|
1226
|
+
return this.focused || !this.empty;
|
|
1227
|
+
}
|
|
1228
|
+
get placeholder() {
|
|
1229
|
+
return this._placeholderSignal();
|
|
1230
|
+
}
|
|
1231
|
+
set placeholder(value) {
|
|
1232
|
+
this._placeholderSignal.set(value);
|
|
1233
|
+
this.stateChanges.next();
|
|
1234
|
+
}
|
|
1235
|
+
get value() {
|
|
1236
|
+
return this._valueSignal();
|
|
1237
|
+
}
|
|
1238
|
+
set value(val) {
|
|
1239
|
+
if (val !== this._valueSignal()) {
|
|
1240
|
+
this._valueSignal.set(val);
|
|
1241
|
+
if (val === null || val === void 0) this.selectedItems.set(/* @__PURE__ */ new Map());
|
|
1242
|
+
else if (Array.isArray(val)) {
|
|
1243
|
+
if (val.length > 0 && this._isPrimitiveValue(val[0])) this._resolveKeys(val);
|
|
1244
|
+
else {
|
|
1245
|
+
const newMap = /* @__PURE__ */ new Map();
|
|
1246
|
+
val.forEach((item) => {
|
|
1247
|
+
const key = item[this.keyField()];
|
|
1248
|
+
newMap.set(key, item);
|
|
1249
|
+
});
|
|
1250
|
+
this.selectedItems.set(newMap);
|
|
1251
|
+
}
|
|
1252
|
+
} else if (this._isPrimitiveValue(val)) this._resolveKeys([val]);
|
|
1253
|
+
else {
|
|
1254
|
+
const newMap = /* @__PURE__ */ new Map();
|
|
1255
|
+
const key = val[this.keyField()];
|
|
1256
|
+
newMap.set(key, val);
|
|
1257
|
+
this.selectedItems.set(newMap);
|
|
1258
|
+
}
|
|
1259
|
+
this.stateChanges.next();
|
|
1260
|
+
this._onChange(val);
|
|
1261
|
+
}
|
|
1262
|
+
}
|
|
1263
|
+
get required() {
|
|
1264
|
+
return this._requiredSignal();
|
|
1265
|
+
}
|
|
1266
|
+
set required(value) {
|
|
1267
|
+
this._requiredSignal.set(coerceBooleanProperty(value));
|
|
1268
|
+
this.stateChanges.next();
|
|
1269
|
+
}
|
|
1270
|
+
get disabled() {
|
|
1271
|
+
if (this.ngControl?.disabled != null) return this.ngControl.disabled;
|
|
1272
|
+
return this._disabledSignal();
|
|
1273
|
+
}
|
|
1274
|
+
set disabled(value) {
|
|
1275
|
+
const coerced = coerceBooleanProperty(value);
|
|
1276
|
+
this._disabledSignal.set(coerced);
|
|
1277
|
+
this.stateChanges.next();
|
|
1278
|
+
}
|
|
1279
|
+
ngOnInit() {
|
|
1280
|
+
const ds = this.dataSource();
|
|
1281
|
+
if (this.apiUrl() && !ds) console.warn("apiUrl is provided without dataSource. Please provide complete dataSource or dataProvider from parent component.");
|
|
1282
|
+
if (!this.dataProvider() && ds) console.warn("dataSource is provided without dataProvider. Please create dataProvider using createHttpDataProvider in parent component.");
|
|
1283
|
+
}
|
|
1284
|
+
ngOnDestroy() {
|
|
1285
|
+
this.stateChanges.complete();
|
|
1286
|
+
}
|
|
1287
|
+
setDescribedByIds(ids) {
|
|
1288
|
+
if (ids.length) {
|
|
1289
|
+
this.userAriaDescribedBy = ids.join(" ");
|
|
1290
|
+
this._elementRef.nativeElement.setAttribute("aria-describedby", ids.join(" "));
|
|
1291
|
+
} else {
|
|
1292
|
+
this.userAriaDescribedBy = void 0;
|
|
1293
|
+
this._elementRef.nativeElement.removeAttribute("aria-describedby");
|
|
1294
|
+
}
|
|
1295
|
+
this.stateChanges.next();
|
|
1296
|
+
}
|
|
1297
|
+
onContainerClick() {
|
|
1298
|
+
if (!this.focused) this.openPicker();
|
|
1299
|
+
}
|
|
1300
|
+
writeValue(value) {
|
|
1301
|
+
this._valueSignal.set(value);
|
|
1302
|
+
if (value === null || value === void 0) this.selectedItems.set(/* @__PURE__ */ new Map());
|
|
1303
|
+
else if (Array.isArray(value)) {
|
|
1304
|
+
if (value.length > 0 && this._isPrimitiveValue(value[0])) this._resolveKeys(value);
|
|
1305
|
+
else {
|
|
1306
|
+
const newMap = /* @__PURE__ */ new Map();
|
|
1307
|
+
value.forEach((item) => {
|
|
1308
|
+
const key = item[this.keyField()];
|
|
1309
|
+
newMap.set(key, item);
|
|
1310
|
+
});
|
|
1311
|
+
this.selectedItems.set(newMap);
|
|
1312
|
+
}
|
|
1313
|
+
} else if (this._isPrimitiveValue(value)) this._resolveKeys([value]);
|
|
1314
|
+
else {
|
|
1315
|
+
const newMap = /* @__PURE__ */ new Map();
|
|
1316
|
+
const key = value[this.keyField()];
|
|
1317
|
+
newMap.set(key, value);
|
|
1318
|
+
this.selectedItems.set(newMap);
|
|
1319
|
+
}
|
|
1320
|
+
this.stateChanges.next();
|
|
1321
|
+
}
|
|
1322
|
+
registerOnChange(fn) {
|
|
1323
|
+
this._onChange = fn;
|
|
1324
|
+
}
|
|
1325
|
+
registerOnTouched(fn) {
|
|
1326
|
+
this._onTouched = fn;
|
|
1327
|
+
}
|
|
1328
|
+
setDisabledState(isDisabled) {
|
|
1329
|
+
this.disabled = isDisabled;
|
|
1330
|
+
}
|
|
1331
|
+
openPicker() {
|
|
1332
|
+
if (this.disabled) return;
|
|
1333
|
+
const mode = this.resolveUIMode();
|
|
1334
|
+
const data = this.getPickerData();
|
|
1335
|
+
switch (mode) {
|
|
1336
|
+
case "bottom-sheet":
|
|
1337
|
+
this.openBottomSheet(data);
|
|
1338
|
+
break;
|
|
1339
|
+
case "dialog":
|
|
1340
|
+
this.openDialog(data);
|
|
1341
|
+
break;
|
|
1342
|
+
case "drawer": this.openDrawer();
|
|
1343
|
+
}
|
|
1344
|
+
this._onTouched();
|
|
1345
|
+
}
|
|
1346
|
+
removeItem(item) {
|
|
1347
|
+
const key = item[this.keyField()];
|
|
1348
|
+
const newMap = new Map(this.selectedItems());
|
|
1349
|
+
newMap.delete(key);
|
|
1350
|
+
const selectedArray = Array.from(newMap.values());
|
|
1351
|
+
const finalValue = this.multiple() ? selectedArray : selectedArray[0] ?? null;
|
|
1352
|
+
this.value = finalValue;
|
|
1353
|
+
this.selectionChange.emit(finalValue);
|
|
1354
|
+
}
|
|
1355
|
+
hasValue() {
|
|
1356
|
+
return this.selectedItems().size > 0;
|
|
1357
|
+
}
|
|
1358
|
+
getDisplayLabel(item) {
|
|
1359
|
+
const labelFn = this.displayLabelFn();
|
|
1360
|
+
if (labelFn) return labelFn(item);
|
|
1361
|
+
const template = this.displayTemplate();
|
|
1362
|
+
if (template) return this.formatTemplate(template, item);
|
|
1363
|
+
return item[this.labelField()] ?? String(item);
|
|
1364
|
+
}
|
|
1365
|
+
getSelectedArray() {
|
|
1366
|
+
return Array.from(this.selectedItems().values());
|
|
1367
|
+
}
|
|
1368
|
+
onFocusIn() {
|
|
1369
|
+
if (!this.focused) {
|
|
1370
|
+
this._focusedSignal.set(true);
|
|
1371
|
+
this.stateChanges.next();
|
|
1372
|
+
}
|
|
1373
|
+
}
|
|
1374
|
+
onFocusOut() {
|
|
1375
|
+
if (this.focused) {
|
|
1376
|
+
this._focusedSignal.set(false);
|
|
1377
|
+
this._onTouched();
|
|
1378
|
+
this.stateChanges.next();
|
|
1379
|
+
}
|
|
1380
|
+
}
|
|
1381
|
+
resolveUIMode() {
|
|
1382
|
+
const mode = this.uiMode();
|
|
1383
|
+
if (mode !== "auto") return mode;
|
|
1384
|
+
return this.isHandSet() ? "bottom-sheet" : "dialog";
|
|
1385
|
+
}
|
|
1386
|
+
getPickerData() {
|
|
1387
|
+
return {
|
|
1388
|
+
dataProvider: this.dataProvider(),
|
|
1389
|
+
columns: this.columns(),
|
|
1390
|
+
keyField: this.keyField(),
|
|
1391
|
+
multiple: this.multiple(),
|
|
1392
|
+
searchable: this.searchable(),
|
|
1393
|
+
pageSize: this.pageSize(),
|
|
1394
|
+
initialSelection: Array.from(this.selectedItems().values())
|
|
1395
|
+
};
|
|
1396
|
+
}
|
|
1397
|
+
openBottomSheet(data) {
|
|
1398
|
+
this._bottomSheet.open(CmatDataPickerSheetComponent, { data }).afterDismissed().subscribe((result) => {
|
|
1399
|
+
if (result !== void 0) this.updateSelection(result);
|
|
1400
|
+
});
|
|
1401
|
+
}
|
|
1402
|
+
openDialog(data) {
|
|
1403
|
+
this._dialog.open(CmatDataPickerDialogComponent, {
|
|
1404
|
+
width: this.dialogWidth(),
|
|
1405
|
+
maxHeight: this.dialogMaxHeight(),
|
|
1406
|
+
data
|
|
1407
|
+
}).afterClosed().subscribe((result) => {
|
|
1408
|
+
if (result !== void 0) this.updateSelection(result);
|
|
1409
|
+
});
|
|
1410
|
+
}
|
|
1411
|
+
openDrawer() {
|
|
1412
|
+
const positionStrategy = this.drawerPosition() === "end" ? this._overlay.position().global().right("0") : this._overlay.position().global().left("0");
|
|
1413
|
+
const overlayRef = this._overlay.create({
|
|
1414
|
+
hasBackdrop: true,
|
|
1415
|
+
backdropClass: "cdk-overlay-transparent-backdrop",
|
|
1416
|
+
positionStrategy,
|
|
1417
|
+
width: this.drawerWidth(),
|
|
1418
|
+
height: "100%",
|
|
1419
|
+
panelClass: ["cmat-data-picker-drawer-overlay", "cmat-drawer-enter"]
|
|
1420
|
+
});
|
|
1421
|
+
const drawerPortal = new ComponentPortal(CmatDataPickerDrawerComponent);
|
|
1422
|
+
const drawerRef = overlayRef.attach(drawerPortal);
|
|
1423
|
+
const data = {
|
|
1424
|
+
dataProvider: this.dataProvider(),
|
|
1425
|
+
columns: this.columns(),
|
|
1426
|
+
keyField: this.keyField(),
|
|
1427
|
+
multiple: this.multiple(),
|
|
1428
|
+
searchable: this.searchable(),
|
|
1429
|
+
pageSize: this.pageSize(),
|
|
1430
|
+
initialSelection: Array.from(this.selectedItems().values()),
|
|
1431
|
+
onConfirm: (result) => {
|
|
1432
|
+
if (result !== void 0) this.updateSelection(result);
|
|
1433
|
+
},
|
|
1434
|
+
onClose: () => {
|
|
1435
|
+
const paneElement = overlayRef.overlayElement;
|
|
1436
|
+
if (paneElement) {
|
|
1437
|
+
paneElement.classList.remove("cmat-drawer-enter");
|
|
1438
|
+
paneElement.classList.add("cmat-drawer-leave");
|
|
1439
|
+
setTimeout(() => {
|
|
1440
|
+
overlayRef.dispose();
|
|
1441
|
+
}, 300);
|
|
1442
|
+
} else overlayRef.dispose();
|
|
1443
|
+
}
|
|
1444
|
+
};
|
|
1445
|
+
drawerRef.instance.data = data;
|
|
1446
|
+
overlayRef.backdropClick().subscribe(() => {
|
|
1447
|
+
const paneElement = overlayRef.overlayElement;
|
|
1448
|
+
if (paneElement) {
|
|
1449
|
+
paneElement.classList.remove("cmat-drawer-enter");
|
|
1450
|
+
paneElement.classList.add("cmat-drawer-leave");
|
|
1451
|
+
setTimeout(() => {
|
|
1452
|
+
overlayRef.dispose();
|
|
1453
|
+
}, 300);
|
|
1454
|
+
} else overlayRef.dispose();
|
|
1455
|
+
});
|
|
1456
|
+
overlayRef.detachments().subscribe(() => {
|
|
1457
|
+
overlayRef.dispose();
|
|
1458
|
+
});
|
|
1459
|
+
}
|
|
1460
|
+
updateSelection(newValue) {
|
|
1461
|
+
this.value = newValue;
|
|
1462
|
+
this.selectionChange.emit(newValue);
|
|
1463
|
+
}
|
|
1464
|
+
_isPrimitiveValue(val) {
|
|
1465
|
+
return typeof val === "string" || typeof val === "number";
|
|
1466
|
+
}
|
|
1467
|
+
_resolveKeys(keys) {
|
|
1468
|
+
const provider = this.dataProvider();
|
|
1469
|
+
if (!provider?.loadByKeys) {
|
|
1470
|
+
console.warn("cmat-data-picker: 传入了纯 key 值作为初始值,但 dataProvider 未实现 loadByKeys 方法。请实现 loadByKeys 或传入完整对象。");
|
|
1471
|
+
return;
|
|
1472
|
+
}
|
|
1473
|
+
provider.loadByKeys(keys).subscribe({
|
|
1474
|
+
next: (items) => {
|
|
1475
|
+
const newMap = /* @__PURE__ */ new Map();
|
|
1476
|
+
items.forEach((item) => {
|
|
1477
|
+
const key = item[this.keyField()];
|
|
1478
|
+
newMap.set(key, item);
|
|
1479
|
+
});
|
|
1480
|
+
this.selectedItems.set(newMap);
|
|
1481
|
+
this.stateChanges.next();
|
|
1482
|
+
},
|
|
1483
|
+
error: (err) => {
|
|
1484
|
+
console.error("cmat-data-picker: loadByKeys 解析失败", err);
|
|
1485
|
+
}
|
|
1486
|
+
});
|
|
1487
|
+
}
|
|
1488
|
+
formatTemplate(template, item) {
|
|
1489
|
+
const record = item;
|
|
1490
|
+
let result = template.replace(/\{\{(\w+)\}\}/g, (_, key) => {
|
|
1491
|
+
return record[key] ?? "";
|
|
1492
|
+
});
|
|
1493
|
+
result = result.replace(/\$\{(\w+)\}/g, (_, key) => {
|
|
1494
|
+
return record[key] ?? "";
|
|
1495
|
+
});
|
|
1496
|
+
return result;
|
|
1497
|
+
}
|
|
1498
|
+
static {
|
|
1499
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
1500
|
+
minVersion: "12.0.0",
|
|
1501
|
+
version: "22.2.3",
|
|
1502
|
+
ngImport: i0,
|
|
1503
|
+
type: CmatDataPickerComponent,
|
|
1504
|
+
deps: [],
|
|
1505
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
1506
|
+
});
|
|
1507
|
+
}
|
|
1508
|
+
static {
|
|
1509
|
+
this.ɵcmp = i0.ɵɵngDeclareComponent({
|
|
1510
|
+
minVersion: "17.0.0",
|
|
1511
|
+
version: "22.2.3",
|
|
1512
|
+
type: CmatDataPickerComponent,
|
|
1513
|
+
isStandalone: true,
|
|
1514
|
+
selector: "cmat-data-picker",
|
|
1515
|
+
inputs: {
|
|
1516
|
+
apiUrl: {
|
|
1517
|
+
classPropertyName: "apiUrl",
|
|
1518
|
+
publicName: "apiUrl",
|
|
1519
|
+
isSignal: true,
|
|
1520
|
+
isRequired: false,
|
|
1521
|
+
transformFunction: null
|
|
1522
|
+
},
|
|
1523
|
+
dataSource: {
|
|
1524
|
+
classPropertyName: "dataSource",
|
|
1525
|
+
publicName: "dataSource",
|
|
1526
|
+
isSignal: true,
|
|
1527
|
+
isRequired: false,
|
|
1528
|
+
transformFunction: null
|
|
1529
|
+
},
|
|
1530
|
+
dataProvider: {
|
|
1531
|
+
classPropertyName: "dataProvider",
|
|
1532
|
+
publicName: "dataProvider",
|
|
1533
|
+
isSignal: true,
|
|
1534
|
+
isRequired: false,
|
|
1535
|
+
transformFunction: null
|
|
1536
|
+
},
|
|
1537
|
+
columns: {
|
|
1538
|
+
classPropertyName: "columns",
|
|
1539
|
+
publicName: "columns",
|
|
1540
|
+
isSignal: true,
|
|
1541
|
+
isRequired: false,
|
|
1542
|
+
transformFunction: null
|
|
1543
|
+
},
|
|
1544
|
+
keyField: {
|
|
1545
|
+
classPropertyName: "keyField",
|
|
1546
|
+
publicName: "keyField",
|
|
1547
|
+
isSignal: true,
|
|
1548
|
+
isRequired: false,
|
|
1549
|
+
transformFunction: null
|
|
1550
|
+
},
|
|
1551
|
+
labelField: {
|
|
1552
|
+
classPropertyName: "labelField",
|
|
1553
|
+
publicName: "labelField",
|
|
1554
|
+
isSignal: true,
|
|
1555
|
+
isRequired: false,
|
|
1556
|
+
transformFunction: null
|
|
1557
|
+
},
|
|
1558
|
+
displayTemplate: {
|
|
1559
|
+
classPropertyName: "displayTemplate",
|
|
1560
|
+
publicName: "displayTemplate",
|
|
1561
|
+
isSignal: true,
|
|
1562
|
+
isRequired: false,
|
|
1563
|
+
transformFunction: null
|
|
1564
|
+
},
|
|
1565
|
+
displayLabelFn: {
|
|
1566
|
+
classPropertyName: "displayLabelFn",
|
|
1567
|
+
publicName: "displayLabelFn",
|
|
1568
|
+
isSignal: true,
|
|
1569
|
+
isRequired: false,
|
|
1570
|
+
transformFunction: null
|
|
1571
|
+
},
|
|
1572
|
+
multiple: {
|
|
1573
|
+
classPropertyName: "multiple",
|
|
1574
|
+
publicName: "multiple",
|
|
1575
|
+
isSignal: true,
|
|
1576
|
+
isRequired: false,
|
|
1577
|
+
transformFunction: null
|
|
1578
|
+
},
|
|
1579
|
+
searchable: {
|
|
1580
|
+
classPropertyName: "searchable",
|
|
1581
|
+
publicName: "searchable",
|
|
1582
|
+
isSignal: true,
|
|
1583
|
+
isRequired: false,
|
|
1584
|
+
transformFunction: null
|
|
1585
|
+
},
|
|
1586
|
+
debounceTime: {
|
|
1587
|
+
classPropertyName: "debounceTime",
|
|
1588
|
+
publicName: "debounceTime",
|
|
1589
|
+
isSignal: true,
|
|
1590
|
+
isRequired: false,
|
|
1591
|
+
transformFunction: null
|
|
1592
|
+
},
|
|
1593
|
+
pageSize: {
|
|
1594
|
+
classPropertyName: "pageSize",
|
|
1595
|
+
publicName: "pageSize",
|
|
1596
|
+
isSignal: true,
|
|
1597
|
+
isRequired: false,
|
|
1598
|
+
transformFunction: null
|
|
1599
|
+
},
|
|
1600
|
+
uiMode: {
|
|
1601
|
+
classPropertyName: "uiMode",
|
|
1602
|
+
publicName: "uiMode",
|
|
1603
|
+
isSignal: true,
|
|
1604
|
+
isRequired: false,
|
|
1605
|
+
transformFunction: null
|
|
1606
|
+
},
|
|
1607
|
+
drawerPosition: {
|
|
1608
|
+
classPropertyName: "drawerPosition",
|
|
1609
|
+
publicName: "drawerPosition",
|
|
1610
|
+
isSignal: true,
|
|
1611
|
+
isRequired: false,
|
|
1612
|
+
transformFunction: null
|
|
1613
|
+
},
|
|
1614
|
+
drawerWidth: {
|
|
1615
|
+
classPropertyName: "drawerWidth",
|
|
1616
|
+
publicName: "drawerWidth",
|
|
1617
|
+
isSignal: true,
|
|
1618
|
+
isRequired: false,
|
|
1619
|
+
transformFunction: null
|
|
1620
|
+
},
|
|
1621
|
+
dialogWidth: {
|
|
1622
|
+
classPropertyName: "dialogWidth",
|
|
1623
|
+
publicName: "dialogWidth",
|
|
1624
|
+
isSignal: true,
|
|
1625
|
+
isRequired: false,
|
|
1626
|
+
transformFunction: null
|
|
1627
|
+
},
|
|
1628
|
+
dialogMaxHeight: {
|
|
1629
|
+
classPropertyName: "dialogMaxHeight",
|
|
1630
|
+
publicName: "dialogMaxHeight",
|
|
1631
|
+
isSignal: true,
|
|
1632
|
+
isRequired: false,
|
|
1633
|
+
transformFunction: null
|
|
1634
|
+
},
|
|
1635
|
+
placeholder: {
|
|
1636
|
+
classPropertyName: "placeholder",
|
|
1637
|
+
publicName: "placeholder",
|
|
1638
|
+
isSignal: false,
|
|
1639
|
+
isRequired: false,
|
|
1640
|
+
transformFunction: null
|
|
1641
|
+
},
|
|
1642
|
+
value: {
|
|
1643
|
+
classPropertyName: "value",
|
|
1644
|
+
publicName: "value",
|
|
1645
|
+
isSignal: false,
|
|
1646
|
+
isRequired: false,
|
|
1647
|
+
transformFunction: null
|
|
1648
|
+
},
|
|
1649
|
+
required: {
|
|
1650
|
+
classPropertyName: "required",
|
|
1651
|
+
publicName: "required",
|
|
1652
|
+
isSignal: false,
|
|
1653
|
+
isRequired: false,
|
|
1654
|
+
transformFunction: null
|
|
1655
|
+
},
|
|
1656
|
+
disabled: {
|
|
1657
|
+
classPropertyName: "disabled",
|
|
1658
|
+
publicName: "disabled",
|
|
1659
|
+
isSignal: false,
|
|
1660
|
+
isRequired: false,
|
|
1661
|
+
transformFunction: null
|
|
1662
|
+
}
|
|
1663
|
+
},
|
|
1664
|
+
outputs: { selectionChange: "selectionChange" },
|
|
1665
|
+
host: { properties: { "attr.id": "id" } },
|
|
1666
|
+
providers: [{
|
|
1667
|
+
provide: MatFormFieldControl,
|
|
1668
|
+
useExisting: CmatDataPickerComponent
|
|
1669
|
+
}],
|
|
1670
|
+
ngImport: i0,
|
|
1671
|
+
template: "<div class=\"cmat-data-picker\">\r\n <!-- 触发器 -->\r\n <div class=\"picker-trigger\" tabindex=\"0\" role=\"button\" [class.has-value]=\"hasValue()\" [class.disabled]=\"disabled\"\r\n (click)=\"openPicker()\" (focus)=\"onFocusIn()\" (blur)=\"onFocusOut()\" (keydown.enter)=\"openPicker()\"\r\n (keydown.space)=\"$event.preventDefault(); openPicker()\">\r\n\r\n @if (selectedItems().size > 0) {\r\n <mat-chip-grid class=\"items-center\">\r\n @for (item of getSelectedArray(); track item) {\r\n <mat-chip-row (removed)=\"removeItem(item)\">\r\n {{ getDisplayLabel(item) }}\r\n <button matChipRemove class=\"print:hidden\">\r\n <mat-icon class=\"icon-size-5\" [svgIcon]=\"'mat_solid:cancel'\"></mat-icon>\r\n </button>\r\n </mat-chip-row>\r\n }\r\n </mat-chip-grid>\r\n } @else {\r\n <span class=\"placeholder\">{{appearanceIsFill? placeholder:''}}</span>\r\n }\r\n\r\n <mat-icon class=\"trigger-icon\" [svgIcon]=\"'mat_outline:arrow_drop_down'\"></mat-icon>\r\n </div>\r\n</div>",
|
|
1672
|
+
styles: ["cmat-data-picker{width:100%}.cmat-data-picker{width:100%}.picker-trigger{display:flex;align-items:center;box-sizing:border-box}.picker-trigger .placeholder{color:#0009;line-height:1;display:inline-block}.picker-trigger .trigger-icon{margin-right:-6px}.cmat-data-picker-drawer-overlay{box-shadow:-2px 0 8px #00000026;z-index:2000}.cmat-data-picker-drawer-overlay.cmat-drawer-enter{animation:slideInFromRight .3s ease-out}.cmat-data-picker-drawer-overlay.cmat-drawer-leave{animation:slideOutToRight .3s ease-in forwards}.cmat-data-picker-drawer-overlay[style*=\"left: 0\"]{box-shadow:2px 0 8px #00000026}.cmat-data-picker-drawer-overlay[style*=\"left: 0\"].cmat-drawer-enter{animation:slideInFromLeft .3s ease-out}.cmat-data-picker-drawer-overlay[style*=\"left: 0\"].cmat-drawer-leave{animation:slideOutToLeft .3s ease-in forwards}@keyframes slideInFromRight{0%{transform:translate(100%)}to{transform:translate(0)}}@keyframes slideInFromLeft{0%{transform:translate(-100%)}to{transform:translate(0)}}@keyframes slideOutToRight{0%{transform:translate(0)}to{transform:translate(100%)}}@keyframes slideOutToLeft{0%{transform:translate(0)}to{transform:translate(-100%)}}\n"],
|
|
1673
|
+
dependencies: [
|
|
1674
|
+
{
|
|
1675
|
+
kind: "ngmodule",
|
|
1676
|
+
type: CommonModule
|
|
1677
|
+
},
|
|
1678
|
+
{
|
|
1679
|
+
kind: "ngmodule",
|
|
1680
|
+
type: MatChipsModule
|
|
1681
|
+
},
|
|
1682
|
+
{
|
|
1683
|
+
kind: "component",
|
|
1684
|
+
type: i1.MatChipGrid,
|
|
1685
|
+
selector: "mat-chip-grid",
|
|
1686
|
+
inputs: [
|
|
1687
|
+
"disabled",
|
|
1688
|
+
"placeholder",
|
|
1689
|
+
"required",
|
|
1690
|
+
"value",
|
|
1691
|
+
"errorStateMatcher"
|
|
1692
|
+
],
|
|
1693
|
+
outputs: ["change", "valueChange"]
|
|
1694
|
+
},
|
|
1695
|
+
{
|
|
1696
|
+
kind: "directive",
|
|
1697
|
+
type: i1.MatChipRemove,
|
|
1698
|
+
selector: "[matChipRemove]"
|
|
1699
|
+
},
|
|
1700
|
+
{
|
|
1701
|
+
kind: "component",
|
|
1702
|
+
type: i1.MatChipRow,
|
|
1703
|
+
selector: "mat-chip-row, [mat-chip-row], mat-basic-chip-row, [mat-basic-chip-row]",
|
|
1704
|
+
inputs: ["editable"],
|
|
1705
|
+
outputs: ["edited"]
|
|
1706
|
+
},
|
|
1707
|
+
{
|
|
1708
|
+
kind: "ngmodule",
|
|
1709
|
+
type: MatIconModule
|
|
1710
|
+
},
|
|
1711
|
+
{
|
|
1712
|
+
kind: "component",
|
|
1713
|
+
type: i4.MatIcon,
|
|
1714
|
+
selector: "mat-icon",
|
|
1715
|
+
inputs: [
|
|
1716
|
+
"color",
|
|
1717
|
+
"inline",
|
|
1718
|
+
"svgIcon",
|
|
1719
|
+
"fontSet",
|
|
1720
|
+
"fontIcon"
|
|
1721
|
+
],
|
|
1722
|
+
exportAs: ["matIcon"]
|
|
1723
|
+
}
|
|
1724
|
+
],
|
|
1725
|
+
changeDetection: i0.ChangeDetectionStrategy.OnPush,
|
|
1726
|
+
encapsulation: i0.ViewEncapsulation.None
|
|
1727
|
+
});
|
|
1728
|
+
}
|
|
1729
|
+
};
|
|
1730
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
1731
|
+
minVersion: "12.0.0",
|
|
1732
|
+
version: "22.2.3",
|
|
1733
|
+
ngImport: i0,
|
|
1734
|
+
type: CmatDataPickerComponent,
|
|
1735
|
+
decorators: [{
|
|
1736
|
+
type: Component,
|
|
1737
|
+
args: [{
|
|
1738
|
+
selector: "cmat-data-picker",
|
|
1739
|
+
providers: [{
|
|
1740
|
+
provide: MatFormFieldControl,
|
|
1741
|
+
useExisting: CmatDataPickerComponent
|
|
1742
|
+
}],
|
|
1743
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
1744
|
+
encapsulation: ViewEncapsulation.None,
|
|
1745
|
+
imports: [
|
|
1746
|
+
CommonModule,
|
|
1747
|
+
MatChipsModule,
|
|
1748
|
+
MatIconModule
|
|
1749
|
+
],
|
|
1750
|
+
host: { "[attr.id]": "id" },
|
|
1751
|
+
template: "<div class=\"cmat-data-picker\">\r\n <!-- 触发器 -->\r\n <div class=\"picker-trigger\" tabindex=\"0\" role=\"button\" [class.has-value]=\"hasValue()\" [class.disabled]=\"disabled\"\r\n (click)=\"openPicker()\" (focus)=\"onFocusIn()\" (blur)=\"onFocusOut()\" (keydown.enter)=\"openPicker()\"\r\n (keydown.space)=\"$event.preventDefault(); openPicker()\">\r\n\r\n @if (selectedItems().size > 0) {\r\n <mat-chip-grid class=\"items-center\">\r\n @for (item of getSelectedArray(); track item) {\r\n <mat-chip-row (removed)=\"removeItem(item)\">\r\n {{ getDisplayLabel(item) }}\r\n <button matChipRemove class=\"print:hidden\">\r\n <mat-icon class=\"icon-size-5\" [svgIcon]=\"'mat_solid:cancel'\"></mat-icon>\r\n </button>\r\n </mat-chip-row>\r\n }\r\n </mat-chip-grid>\r\n } @else {\r\n <span class=\"placeholder\">{{appearanceIsFill? placeholder:''}}</span>\r\n }\r\n\r\n <mat-icon class=\"trigger-icon\" [svgIcon]=\"'mat_outline:arrow_drop_down'\"></mat-icon>\r\n </div>\r\n</div>",
|
|
1752
|
+
styles: ["cmat-data-picker{width:100%}.cmat-data-picker{width:100%}.picker-trigger{display:flex;align-items:center;box-sizing:border-box}.picker-trigger .placeholder{color:#0009;line-height:1;display:inline-block}.picker-trigger .trigger-icon{margin-right:-6px}.cmat-data-picker-drawer-overlay{box-shadow:-2px 0 8px #00000026;z-index:2000}.cmat-data-picker-drawer-overlay.cmat-drawer-enter{animation:slideInFromRight .3s ease-out}.cmat-data-picker-drawer-overlay.cmat-drawer-leave{animation:slideOutToRight .3s ease-in forwards}.cmat-data-picker-drawer-overlay[style*=\"left: 0\"]{box-shadow:2px 0 8px #00000026}.cmat-data-picker-drawer-overlay[style*=\"left: 0\"].cmat-drawer-enter{animation:slideInFromLeft .3s ease-out}.cmat-data-picker-drawer-overlay[style*=\"left: 0\"].cmat-drawer-leave{animation:slideOutToLeft .3s ease-in forwards}@keyframes slideInFromRight{0%{transform:translate(100%)}to{transform:translate(0)}}@keyframes slideInFromLeft{0%{transform:translate(-100%)}to{transform:translate(0)}}@keyframes slideOutToRight{0%{transform:translate(0)}to{transform:translate(100%)}}@keyframes slideOutToLeft{0%{transform:translate(0)}to{transform:translate(-100%)}}\n"]
|
|
1753
|
+
}]
|
|
1754
|
+
}],
|
|
1755
|
+
ctorParameters: () => [],
|
|
1756
|
+
propDecorators: {
|
|
1757
|
+
apiUrl: [{
|
|
1758
|
+
type: i0.Input,
|
|
1759
|
+
args: [{
|
|
1760
|
+
isSignal: true,
|
|
1761
|
+
alias: "apiUrl",
|
|
1762
|
+
required: false
|
|
1763
|
+
}]
|
|
1764
|
+
}],
|
|
1765
|
+
dataSource: [{
|
|
1766
|
+
type: i0.Input,
|
|
1767
|
+
args: [{
|
|
1768
|
+
isSignal: true,
|
|
1769
|
+
alias: "dataSource",
|
|
1770
|
+
required: false
|
|
1771
|
+
}]
|
|
1772
|
+
}],
|
|
1773
|
+
dataProvider: [{
|
|
1774
|
+
type: i0.Input,
|
|
1775
|
+
args: [{
|
|
1776
|
+
isSignal: true,
|
|
1777
|
+
alias: "dataProvider",
|
|
1778
|
+
required: false
|
|
1779
|
+
}]
|
|
1780
|
+
}],
|
|
1781
|
+
columns: [{
|
|
1782
|
+
type: i0.Input,
|
|
1783
|
+
args: [{
|
|
1784
|
+
isSignal: true,
|
|
1785
|
+
alias: "columns",
|
|
1786
|
+
required: false
|
|
1787
|
+
}]
|
|
1788
|
+
}],
|
|
1789
|
+
keyField: [{
|
|
1790
|
+
type: i0.Input,
|
|
1791
|
+
args: [{
|
|
1792
|
+
isSignal: true,
|
|
1793
|
+
alias: "keyField",
|
|
1794
|
+
required: false
|
|
1795
|
+
}]
|
|
1796
|
+
}],
|
|
1797
|
+
labelField: [{
|
|
1798
|
+
type: i0.Input,
|
|
1799
|
+
args: [{
|
|
1800
|
+
isSignal: true,
|
|
1801
|
+
alias: "labelField",
|
|
1802
|
+
required: false
|
|
1803
|
+
}]
|
|
1804
|
+
}],
|
|
1805
|
+
displayTemplate: [{
|
|
1806
|
+
type: i0.Input,
|
|
1807
|
+
args: [{
|
|
1808
|
+
isSignal: true,
|
|
1809
|
+
alias: "displayTemplate",
|
|
1810
|
+
required: false
|
|
1811
|
+
}]
|
|
1812
|
+
}],
|
|
1813
|
+
displayLabelFn: [{
|
|
1814
|
+
type: i0.Input,
|
|
1815
|
+
args: [{
|
|
1816
|
+
isSignal: true,
|
|
1817
|
+
alias: "displayLabelFn",
|
|
1818
|
+
required: false
|
|
1819
|
+
}]
|
|
1820
|
+
}],
|
|
1821
|
+
multiple: [{
|
|
1822
|
+
type: i0.Input,
|
|
1823
|
+
args: [{
|
|
1824
|
+
isSignal: true,
|
|
1825
|
+
alias: "multiple",
|
|
1826
|
+
required: false
|
|
1827
|
+
}]
|
|
1828
|
+
}],
|
|
1829
|
+
searchable: [{
|
|
1830
|
+
type: i0.Input,
|
|
1831
|
+
args: [{
|
|
1832
|
+
isSignal: true,
|
|
1833
|
+
alias: "searchable",
|
|
1834
|
+
required: false
|
|
1835
|
+
}]
|
|
1836
|
+
}],
|
|
1837
|
+
debounceTime: [{
|
|
1838
|
+
type: i0.Input,
|
|
1839
|
+
args: [{
|
|
1840
|
+
isSignal: true,
|
|
1841
|
+
alias: "debounceTime",
|
|
1842
|
+
required: false
|
|
1843
|
+
}]
|
|
1844
|
+
}],
|
|
1845
|
+
pageSize: [{
|
|
1846
|
+
type: i0.Input,
|
|
1847
|
+
args: [{
|
|
1848
|
+
isSignal: true,
|
|
1849
|
+
alias: "pageSize",
|
|
1850
|
+
required: false
|
|
1851
|
+
}]
|
|
1852
|
+
}],
|
|
1853
|
+
uiMode: [{
|
|
1854
|
+
type: i0.Input,
|
|
1855
|
+
args: [{
|
|
1856
|
+
isSignal: true,
|
|
1857
|
+
alias: "uiMode",
|
|
1858
|
+
required: false
|
|
1859
|
+
}]
|
|
1860
|
+
}],
|
|
1861
|
+
drawerPosition: [{
|
|
1862
|
+
type: i0.Input,
|
|
1863
|
+
args: [{
|
|
1864
|
+
isSignal: true,
|
|
1865
|
+
alias: "drawerPosition",
|
|
1866
|
+
required: false
|
|
1867
|
+
}]
|
|
1868
|
+
}],
|
|
1869
|
+
drawerWidth: [{
|
|
1870
|
+
type: i0.Input,
|
|
1871
|
+
args: [{
|
|
1872
|
+
isSignal: true,
|
|
1873
|
+
alias: "drawerWidth",
|
|
1874
|
+
required: false
|
|
1875
|
+
}]
|
|
1876
|
+
}],
|
|
1877
|
+
dialogWidth: [{
|
|
1878
|
+
type: i0.Input,
|
|
1879
|
+
args: [{
|
|
1880
|
+
isSignal: true,
|
|
1881
|
+
alias: "dialogWidth",
|
|
1882
|
+
required: false
|
|
1883
|
+
}]
|
|
1884
|
+
}],
|
|
1885
|
+
dialogMaxHeight: [{
|
|
1886
|
+
type: i0.Input,
|
|
1887
|
+
args: [{
|
|
1888
|
+
isSignal: true,
|
|
1889
|
+
alias: "dialogMaxHeight",
|
|
1890
|
+
required: false
|
|
1891
|
+
}]
|
|
1892
|
+
}],
|
|
1893
|
+
selectionChange: [{
|
|
1894
|
+
type: i0.Output,
|
|
1895
|
+
args: ["selectionChange"]
|
|
1896
|
+
}],
|
|
1897
|
+
placeholder: [{ type: Input }],
|
|
1898
|
+
value: [{ type: Input }],
|
|
1899
|
+
required: [{ type: Input }],
|
|
1900
|
+
disabled: [{ type: Input }]
|
|
1901
|
+
}
|
|
1902
|
+
});
|
|
1076
1903
|
export { CmatDataPickerComponent, CmatDataPickerDialogComponent, CmatDataPickerDrawerComponent, CmatDataPickerListComponent, CmatDataPickerSheetComponent, HttpDataPickerProvider, createHttpDataProvider };
|
|
1077
|
-
|
|
1904
|
+
|
|
1905
|
+
//# sourceMappingURL=cmat-components-data-picker.mjs.map
|