cmat 0.0.96 → 0.0.98
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/fesm2022/cmat-components-adapter.mjs +9 -9
- package/fesm2022/cmat-components-breadcrumb.mjs +9 -9
- package/fesm2022/cmat-components-card.mjs +3 -3
- package/fesm2022/cmat-components-carousel.mjs +12 -12
- package/fesm2022/cmat-components-cascade.mjs +9 -9
- package/fesm2022/cmat-components-chip-input.mjs +3 -3
- package/fesm2022/cmat-components-code-editor.mjs +3 -3
- package/fesm2022/cmat-components-color-picker.mjs +27 -27
- package/fesm2022/cmat-components-custom-formly.mjs +150 -121
- package/fesm2022/cmat-components-custom-formly.mjs.map +1 -1
- package/fesm2022/cmat-components-data-picker.mjs +113 -35
- package/fesm2022/cmat-components-data-picker.mjs.map +1 -1
- package/fesm2022/cmat-components-date-range.mjs +5 -5
- package/fesm2022/cmat-components-date-range.mjs.map +1 -1
- package/fesm2022/cmat-components-date-time-display.mjs +3 -3
- package/fesm2022/cmat-components-drawer.mjs +6 -6
- package/fesm2022/cmat-components-empty-state.mjs +3 -3
- package/fesm2022/cmat-components-file-preview.mjs +3 -3
- package/fesm2022/cmat-components-filter-toolbar.mjs +3 -3
- package/fesm2022/cmat-components-form-actions.mjs +3 -3
- package/fesm2022/cmat-components-fullscreen.mjs +3 -3
- package/fesm2022/cmat-components-highlight.mjs +6 -6
- package/fesm2022/cmat-components-image-viewer.mjs +3 -3
- package/fesm2022/cmat-components-inline-loading.mjs +3 -3
- package/fesm2022/cmat-components-json-editor.mjs +3 -3
- package/fesm2022/cmat-components-knob-input.mjs +3 -3
- package/fesm2022/cmat-components-loading-overlay.mjs +26 -0
- package/fesm2022/cmat-components-loading-overlay.mjs.map +1 -0
- package/fesm2022/cmat-components-masonry.mjs +3 -3
- package/fesm2022/cmat-components-material-color-picker.mjs +3 -3
- package/fesm2022/cmat-components-material-datetimepicker.mjs +42 -42
- package/fesm2022/cmat-components-navigation.mjs +226 -51
- package/fesm2022/cmat-components-navigation.mjs.map +1 -1
- package/fesm2022/cmat-components-opt-input.mjs +3 -3
- package/fesm2022/cmat-components-org-chart.mjs +9 -9
- package/fesm2022/cmat-components-page-header.mjs +3 -3
- package/fesm2022/cmat-components-pagination.mjs +12 -12
- package/fesm2022/cmat-components-password-strength.mjs +9 -9
- package/fesm2022/cmat-components-popover.mjs +9 -9
- package/fesm2022/cmat-components-progress-bar.mjs +3 -3
- package/fesm2022/cmat-components-qrcode.mjs +3 -3
- package/fesm2022/cmat-components-rating.mjs +3 -3
- package/fesm2022/cmat-components-rich-text-editor.mjs +3 -3
- package/fesm2022/cmat-components-select-search.mjs +9 -9
- package/fesm2022/cmat-components-select-table.mjs +3 -3
- package/fesm2022/cmat-components-select-tree.mjs +3 -3
- package/fesm2022/cmat-components-skeleton.mjs +3 -3
- package/fesm2022/cmat-components-speed-dial.mjs +9 -9
- package/fesm2022/cmat-components-status-tag.mjs +3 -3
- package/fesm2022/cmat-components-table-toolbar.mjs +3 -3
- package/fesm2022/cmat-components-timeline.mjs +12 -12
- package/fesm2022/cmat-components-toast.mjs +9 -9
- package/fesm2022/cmat-components-transfer-picker.mjs +18 -18
- package/fesm2022/cmat-components-treetable.mjs +6 -6
- package/fesm2022/cmat-components-upload.mjs +9 -9
- package/fesm2022/cmat-directives-animate-on-scroll.mjs +6 -6
- package/fesm2022/cmat-directives-arrow-cursor.mjs +3 -3
- package/fesm2022/cmat-directives-autofocus.mjs +3 -3
- package/fesm2022/cmat-directives-data-exporter.mjs +21 -21
- package/fesm2022/cmat-directives-debounce.mjs +9 -9
- package/fesm2022/cmat-directives-digit-only.mjs +6 -6
- package/fesm2022/cmat-directives-equal-validator.mjs +3 -3
- package/fesm2022/cmat-directives-seamless-auto-scroll.mjs +3 -3
- package/fesm2022/cmat-lib-mock-api.mjs +6 -6
- package/fesm2022/cmat-pipes-bytes.mjs +3 -3
- package/fesm2022/cmat-pipes-date-format.mjs +3 -3
- package/fesm2022/cmat-pipes-find-by-key.mjs +3 -3
- package/fesm2022/cmat-pipes-group-by.mjs +3 -3
- package/fesm2022/cmat-pipes-keys.mjs +3 -3
- package/fesm2022/cmat-pipes-secure.mjs +3 -3
- package/fesm2022/cmat-pipes-uppercase.mjs +3 -3
- package/fesm2022/cmat-services-alert.mjs +60 -3
- package/fesm2022/cmat-services-alert.mjs.map +1 -1
- package/fesm2022/cmat-services-config.mjs +6 -6
- package/fesm2022/cmat-services-confirmation.mjs +6 -6
- package/fesm2022/cmat-services-data.mjs +3 -3
- package/fesm2022/cmat-services-export-as.mjs +3 -3
- package/fesm2022/cmat-services-loading.mjs +6 -6
- package/fesm2022/cmat-services-local-storage.mjs +3 -3
- package/fesm2022/cmat-services-media-watcher.mjs +3 -3
- package/fesm2022/cmat-services-platform.mjs +3 -3
- package/fesm2022/cmat-services-splash-screen.mjs +3 -3
- package/fesm2022/cmat-services-title.mjs +3 -3
- package/fesm2022/cmat-services-translation.mjs +3 -3
- package/fesm2022/cmat-services-utils.mjs +3 -3
- package/fesm2022/cmat.mjs +949 -610
- package/fesm2022/cmat.mjs.map +1 -1
- package/package.json +5 -1
- package/types/cmat-components-data-picker.d.ts +33 -0
- package/types/cmat-components-loading-overlay.d.ts +11 -0
- package/types/cmat-components-navigation.d.ts +36 -0
- package/types/cmat-services-alert.d.ts +11 -0
- package/types/cmat.d.ts +83 -3
|
@@ -79,6 +79,28 @@ class HttpDataPickerProvider {
|
|
|
79
79
|
};
|
|
80
80
|
}));
|
|
81
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
|
+
}
|
|
82
104
|
}
|
|
83
105
|
/**
|
|
84
106
|
* 创建HTTP数据提供者的工厂函数
|
|
@@ -371,10 +393,10 @@ class CmatDataPickerListComponent {
|
|
|
371
393
|
const keys = new Set(this.selectedItems().keys());
|
|
372
394
|
this.selectionChange.emit(keys);
|
|
373
395
|
}
|
|
374
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.
|
|
375
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.3", 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 }); }
|
|
396
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.4", ngImport: i0, type: CmatDataPickerListComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
397
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.4", 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 }); }
|
|
376
398
|
}
|
|
377
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.
|
|
399
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.4", ngImport: i0, type: CmatDataPickerListComponent, decorators: [{
|
|
378
400
|
type: Component,
|
|
379
401
|
args: [{ selector: 'cmat-data-picker-list', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, imports: [
|
|
380
402
|
CommonModule,
|
|
@@ -424,10 +446,10 @@ class CmatDataPickerSheetComponent {
|
|
|
424
446
|
const result = this.data.multiple ? selectedItems : (selectedItems[0] ?? null);
|
|
425
447
|
this._bottomSheetRef.dismiss(result);
|
|
426
448
|
}
|
|
427
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.
|
|
428
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "22.1.
|
|
449
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.4", ngImport: i0, type: CmatDataPickerSheetComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
450
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "22.1.4", 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 }); }
|
|
429
451
|
}
|
|
430
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.
|
|
452
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.4", ngImport: i0, type: CmatDataPickerSheetComponent, decorators: [{
|
|
431
453
|
type: Component,
|
|
432
454
|
args: [{ selector: 'cmat-data-picker-sheet', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, imports: [
|
|
433
455
|
MatButtonModule,
|
|
@@ -468,10 +490,10 @@ class CmatDataPickerDialogComponent {
|
|
|
468
490
|
const result = this.data.multiple ? selectedItems : (selectedItems[0] ?? null);
|
|
469
491
|
this._dialogRef.close(result);
|
|
470
492
|
}
|
|
471
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.
|
|
472
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "22.1.
|
|
493
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.4", ngImport: i0, type: CmatDataPickerDialogComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
494
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "22.1.4", 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 }); }
|
|
473
495
|
}
|
|
474
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.
|
|
496
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.4", ngImport: i0, type: CmatDataPickerDialogComponent, decorators: [{
|
|
475
497
|
type: Component,
|
|
476
498
|
args: [{ selector: 'cmat-data-picker-dialog', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, imports: [
|
|
477
499
|
MatButtonModule,
|
|
@@ -516,10 +538,10 @@ class CmatDataPickerDrawerComponent {
|
|
|
516
538
|
this.data.onClose();
|
|
517
539
|
}
|
|
518
540
|
}
|
|
519
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.
|
|
520
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "22.1.
|
|
541
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.4", ngImport: i0, type: CmatDataPickerDrawerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
542
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "22.1.4", type: CmatDataPickerDrawerComponent, isStandalone: true, selector: "cmat-data-picker-drawer", viewQueries: [{ propertyName: "_listComponent", first: true, predicate: (CmatDataPickerListComponent), descendants: true, isSignal: true }], ngImport: i0, template: "<div class=\"flex flex-col h-full\">\r\n <!-- \u5934\u90E8 -->\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 <!-- \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 bg-card 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: ["cmat-data-picker-drawer{display:block;width: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 }); }
|
|
521
543
|
}
|
|
522
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.
|
|
544
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.4", ngImport: i0, type: CmatDataPickerDrawerComponent, decorators: [{
|
|
523
545
|
type: Component,
|
|
524
546
|
args: [{ selector: 'cmat-data-picker-drawer', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, imports: [
|
|
525
547
|
MatButtonModule,
|
|
@@ -641,18 +663,30 @@ class CmatDataPickerComponent {
|
|
|
641
663
|
this.selectedItems.set(new Map());
|
|
642
664
|
}
|
|
643
665
|
else if (Array.isArray(val)) {
|
|
644
|
-
|
|
645
|
-
val.
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
666
|
+
// 检测是否为纯 key 数组(需要异步解析)
|
|
667
|
+
if (val.length > 0 && this._isPrimitiveValue(val[0])) {
|
|
668
|
+
this._resolveKeys(val);
|
|
669
|
+
}
|
|
670
|
+
else {
|
|
671
|
+
const newMap = new Map();
|
|
672
|
+
val.forEach((item) => {
|
|
673
|
+
const key = item[this.keyField()];
|
|
674
|
+
newMap.set(key, item);
|
|
675
|
+
});
|
|
676
|
+
this.selectedItems.set(newMap);
|
|
677
|
+
}
|
|
650
678
|
}
|
|
651
679
|
else {
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
680
|
+
// 单值情况:检测是否为纯 key
|
|
681
|
+
if (this._isPrimitiveValue(val)) {
|
|
682
|
+
this._resolveKeys([val]);
|
|
683
|
+
}
|
|
684
|
+
else {
|
|
685
|
+
const newMap = new Map();
|
|
686
|
+
const key = val[this.keyField()];
|
|
687
|
+
newMap.set(key, val);
|
|
688
|
+
this.selectedItems.set(newMap);
|
|
689
|
+
}
|
|
656
690
|
}
|
|
657
691
|
this.stateChanges.next();
|
|
658
692
|
this._onChange(val);
|
|
@@ -717,18 +751,30 @@ class CmatDataPickerComponent {
|
|
|
717
751
|
this.selectedItems.set(new Map());
|
|
718
752
|
}
|
|
719
753
|
else if (Array.isArray(value)) {
|
|
720
|
-
|
|
721
|
-
value.
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
754
|
+
// 检测是否为纯 key 数组(需要异步解析)
|
|
755
|
+
if (value.length > 0 && this._isPrimitiveValue(value[0])) {
|
|
756
|
+
this._resolveKeys(value);
|
|
757
|
+
}
|
|
758
|
+
else {
|
|
759
|
+
const newMap = new Map();
|
|
760
|
+
value.forEach((item) => {
|
|
761
|
+
const key = item[this.keyField()];
|
|
762
|
+
newMap.set(key, item);
|
|
763
|
+
});
|
|
764
|
+
this.selectedItems.set(newMap);
|
|
765
|
+
}
|
|
726
766
|
}
|
|
727
767
|
else {
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
768
|
+
// 单值情况:检测是否为纯 key
|
|
769
|
+
if (this._isPrimitiveValue(value)) {
|
|
770
|
+
this._resolveKeys([value]);
|
|
771
|
+
}
|
|
772
|
+
else {
|
|
773
|
+
const newMap = new Map();
|
|
774
|
+
const key = value[this.keyField()];
|
|
775
|
+
newMap.set(key, value);
|
|
776
|
+
this.selectedItems.set(newMap);
|
|
777
|
+
}
|
|
732
778
|
}
|
|
733
779
|
this.stateChanges.next();
|
|
734
780
|
}
|
|
@@ -944,6 +990,38 @@ class CmatDataPickerComponent {
|
|
|
944
990
|
this.value = newValue;
|
|
945
991
|
this.selectionChange.emit(newValue);
|
|
946
992
|
}
|
|
993
|
+
/**
|
|
994
|
+
* 检测值是否为原始类型(string/number),即纯 key 值
|
|
995
|
+
*/
|
|
996
|
+
_isPrimitiveValue(val) {
|
|
997
|
+
return typeof val === 'string' || typeof val === 'number';
|
|
998
|
+
}
|
|
999
|
+
/**
|
|
1000
|
+
* 异步解析纯 key 数组为完整对象
|
|
1001
|
+
* 调用 dataProvider.loadByKeys 获取完整数据后更新 selectedItems
|
|
1002
|
+
*/
|
|
1003
|
+
_resolveKeys(keys) {
|
|
1004
|
+
const provider = this.dataProvider();
|
|
1005
|
+
if (!provider?.loadByKeys) {
|
|
1006
|
+
console.warn('cmat-data-picker: 传入了纯 key 值作为初始值,但 dataProvider 未实现 loadByKeys 方法。' +
|
|
1007
|
+
'请实现 loadByKeys 或传入完整对象。');
|
|
1008
|
+
return;
|
|
1009
|
+
}
|
|
1010
|
+
provider.loadByKeys(keys).subscribe({
|
|
1011
|
+
next: (items) => {
|
|
1012
|
+
const newMap = new Map();
|
|
1013
|
+
items.forEach((item) => {
|
|
1014
|
+
const key = item[this.keyField()];
|
|
1015
|
+
newMap.set(key, item);
|
|
1016
|
+
});
|
|
1017
|
+
this.selectedItems.set(newMap);
|
|
1018
|
+
this.stateChanges.next();
|
|
1019
|
+
},
|
|
1020
|
+
error: (err) => {
|
|
1021
|
+
console.error('cmat-data-picker: loadByKeys 解析失败', err);
|
|
1022
|
+
}
|
|
1023
|
+
});
|
|
1024
|
+
}
|
|
947
1025
|
/**
|
|
948
1026
|
* Format template string
|
|
949
1027
|
* 支持两种格式:
|
|
@@ -964,12 +1042,12 @@ class CmatDataPickerComponent {
|
|
|
964
1042
|
});
|
|
965
1043
|
return result;
|
|
966
1044
|
}
|
|
967
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.
|
|
968
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.
|
|
1045
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.4", ngImport: i0, type: CmatDataPickerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1046
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.4", type: CmatDataPickerComponent, isStandalone: true, selector: "cmat-data-picker", inputs: { apiUrl: { classPropertyName: "apiUrl", publicName: "apiUrl", isSignal: true, isRequired: false, transformFunction: null }, dataSource: { classPropertyName: "dataSource", publicName: "dataSource", isSignal: true, isRequired: false, transformFunction: null }, dataProvider: { classPropertyName: "dataProvider", publicName: "dataProvider", isSignal: true, isRequired: false, transformFunction: null }, columns: { classPropertyName: "columns", publicName: "columns", isSignal: true, isRequired: false, transformFunction: null }, keyField: { classPropertyName: "keyField", publicName: "keyField", isSignal: true, isRequired: false, transformFunction: null }, labelField: { classPropertyName: "labelField", publicName: "labelField", isSignal: true, isRequired: false, transformFunction: null }, displayTemplate: { classPropertyName: "displayTemplate", publicName: "displayTemplate", isSignal: true, isRequired: false, transformFunction: null }, displayLabelFn: { classPropertyName: "displayLabelFn", publicName: "displayLabelFn", 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 }, debounceTime: { classPropertyName: "debounceTime", publicName: "debounceTime", isSignal: true, isRequired: false, transformFunction: null }, pageSize: { classPropertyName: "pageSize", publicName: "pageSize", isSignal: true, isRequired: false, transformFunction: null }, uiMode: { classPropertyName: "uiMode", publicName: "uiMode", isSignal: true, isRequired: false, transformFunction: null }, drawerPosition: { classPropertyName: "drawerPosition", publicName: "drawerPosition", isSignal: true, isRequired: false, transformFunction: null }, drawerWidth: { classPropertyName: "drawerWidth", publicName: "drawerWidth", isSignal: true, isRequired: false, transformFunction: null }, dialogWidth: { classPropertyName: "dialogWidth", publicName: "dialogWidth", isSignal: true, isRequired: false, transformFunction: null }, dialogMaxHeight: { classPropertyName: "dialogMaxHeight", publicName: "dialogMaxHeight", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: false, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: false, isRequired: false, transformFunction: null }, required: { classPropertyName: "required", publicName: "required", isSignal: false, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: false, isRequired: false, transformFunction: null } }, outputs: { selectionChange: "selectionChange" }, host: { properties: { "attr.id": "id" } }, providers: [
|
|
969
1047
|
{ provide: MatFormFieldControl, useExisting: CmatDataPickerComponent }
|
|
970
1048
|
], ngImport: i0, template: "<div class=\"cmat-data-picker\">\r\n <!-- \u89E6\u53D1\u5668 -->\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>", 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"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: MatChipsModule }, { kind: "component", type: i1$2.MatChipGrid, selector: "mat-chip-grid", inputs: ["disabled", "placeholder", "required", "value", "errorStateMatcher"], outputs: ["change", "valueChange"] }, { kind: "directive", type: i1$2.MatChipRemove, selector: "[matChipRemove]" }, { kind: "component", type: i1$2.MatChipRow, selector: "mat-chip-row, [mat-chip-row], mat-basic-chip-row, [mat-basic-chip-row]", inputs: ["editable"], outputs: ["edited"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i2$1.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
971
1049
|
}
|
|
972
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.
|
|
1050
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.4", ngImport: i0, type: CmatDataPickerComponent, decorators: [{
|
|
973
1051
|
type: Component,
|
|
974
1052
|
args: [{ selector: 'cmat-data-picker', providers: [
|
|
975
1053
|
{ provide: MatFormFieldControl, useExisting: CmatDataPickerComponent }
|