cmat 0.0.78 → 0.0.80
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/fesm2022/cmat-components-adapter.mjs +9 -46
- package/fesm2022/cmat-components-adapter.mjs.map +1 -1
- package/fesm2022/cmat-components-breadcrumb.mjs +104 -205
- package/fesm2022/cmat-components-breadcrumb.mjs.map +1 -1
- package/fesm2022/cmat-components-card.mjs +4 -8
- package/fesm2022/cmat-components-card.mjs.map +1 -1
- package/fesm2022/cmat-components-carousel.mjs +21 -21
- package/fesm2022/cmat-components-carousel.mjs.map +1 -1
- package/fesm2022/cmat-components-cascade.mjs +18 -24
- package/fesm2022/cmat-components-cascade.mjs.map +1 -1
- package/fesm2022/cmat-components-chip-input.mjs +21 -21
- package/fesm2022/cmat-components-chip-input.mjs.map +1 -1
- package/fesm2022/cmat-components-code-editor.mjs +4 -22
- package/fesm2022/cmat-components-code-editor.mjs.map +1 -1
- package/fesm2022/cmat-components-custom-formly.mjs +181 -245
- package/fesm2022/cmat-components-custom-formly.mjs.map +1 -1
- package/fesm2022/cmat-components-date-range.mjs +12 -184
- package/fesm2022/cmat-components-date-range.mjs.map +1 -1
- package/fesm2022/cmat-components-date-time-display.mjs +3 -15
- package/fesm2022/cmat-components-date-time-display.mjs.map +1 -1
- package/fesm2022/cmat-components-drawer.mjs +10 -100
- package/fesm2022/cmat-components-drawer.mjs.map +1 -1
- package/fesm2022/cmat-components-empty-state.mjs +4 -25
- package/fesm2022/cmat-components-empty-state.mjs.map +1 -1
- package/fesm2022/cmat-components-file-preview.mjs +3 -21
- package/fesm2022/cmat-components-file-preview.mjs.map +1 -1
- package/fesm2022/cmat-components-filter-toolbar.mjs +7 -50
- package/fesm2022/cmat-components-filter-toolbar.mjs.map +1 -1
- package/fesm2022/cmat-components-form-actions.mjs +3 -9
- package/fesm2022/cmat-components-form-actions.mjs.map +1 -1
- package/fesm2022/cmat-components-fullscreen.mjs +4 -4
- package/fesm2022/cmat-components-fullscreen.mjs.map +1 -1
- package/fesm2022/cmat-components-highlight.mjs +6 -32
- package/fesm2022/cmat-components-highlight.mjs.map +1 -1
- package/fesm2022/cmat-components-image-viewer.mjs +12 -24
- package/fesm2022/cmat-components-image-viewer.mjs.map +1 -1
- package/fesm2022/cmat-components-inline-loading.mjs +3 -12
- package/fesm2022/cmat-components-inline-loading.mjs.map +1 -1
- package/fesm2022/cmat-components-json-editor.mjs +11 -16
- package/fesm2022/cmat-components-json-editor.mjs.map +1 -1
- package/fesm2022/cmat-components-knob-input.mjs +24 -18
- package/fesm2022/cmat-components-knob-input.mjs.map +1 -1
- package/fesm2022/cmat-components-masonry.mjs +8 -17
- package/fesm2022/cmat-components-masonry.mjs.map +1 -1
- package/fesm2022/cmat-components-material-color-picker.mjs +13 -34
- package/fesm2022/cmat-components-material-color-picker.mjs.map +1 -1
- package/fesm2022/cmat-components-material-datetimepicker.mjs +80 -436
- package/fesm2022/cmat-components-material-datetimepicker.mjs.map +1 -1
- package/fesm2022/cmat-components-navigation.mjs +266 -816
- package/fesm2022/cmat-components-navigation.mjs.map +1 -1
- package/fesm2022/cmat-components-opt-input.mjs +7 -10
- package/fesm2022/cmat-components-opt-input.mjs.map +1 -1
- package/fesm2022/cmat-components-org-chart.mjs +11 -11
- package/fesm2022/cmat-components-org-chart.mjs.map +1 -1
- package/fesm2022/cmat-components-page-header.mjs +8 -19
- package/fesm2022/cmat-components-page-header.mjs.map +1 -1
- package/fesm2022/cmat-components-pagination.mjs +113 -108
- package/fesm2022/cmat-components-pagination.mjs.map +1 -1
- package/fesm2022/cmat-components-password-strength.mjs +13 -16
- package/fesm2022/cmat-components-password-strength.mjs.map +1 -1
- package/fesm2022/cmat-components-popover.mjs +15 -151
- package/fesm2022/cmat-components-popover.mjs.map +1 -1
- package/fesm2022/cmat-components-progress-bar.mjs +16 -26
- package/fesm2022/cmat-components-progress-bar.mjs.map +1 -1
- package/fesm2022/cmat-components-qrcode.mjs +5 -11
- package/fesm2022/cmat-components-qrcode.mjs.map +1 -1
- package/fesm2022/cmat-components-rating.mjs +14 -14
- package/fesm2022/cmat-components-rating.mjs.map +1 -1
- package/fesm2022/cmat-components-rich-text-editor.mjs +4 -25
- package/fesm2022/cmat-components-rich-text-editor.mjs.map +1 -1
- package/fesm2022/cmat-components-select-search.mjs +51 -79
- package/fesm2022/cmat-components-select-search.mjs.map +1 -1
- package/fesm2022/cmat-components-select-table.mjs +204 -162
- package/fesm2022/cmat-components-select-table.mjs.map +1 -1
- package/fesm2022/cmat-components-select-tree.mjs +142 -97
- package/fesm2022/cmat-components-select-tree.mjs.map +1 -1
- package/fesm2022/cmat-components-skeleton.mjs +4 -22
- package/fesm2022/cmat-components-skeleton.mjs.map +1 -1
- package/fesm2022/cmat-components-speed-dial.mjs +14 -19
- package/fesm2022/cmat-components-speed-dial.mjs.map +1 -1
- package/fesm2022/cmat-components-status-tag.mjs +3 -18
- package/fesm2022/cmat-components-status-tag.mjs.map +1 -1
- package/fesm2022/cmat-components-table-toolbar.mjs +3 -15
- package/fesm2022/cmat-components-table-toolbar.mjs.map +1 -1
- package/fesm2022/cmat-components-timeline.mjs +18 -21
- package/fesm2022/cmat-components-timeline.mjs.map +1 -1
- package/fesm2022/cmat-components-toast.mjs +20 -20
- package/fesm2022/cmat-components-toast.mjs.map +1 -1
- package/fesm2022/cmat-components-transfer-picker.mjs +159 -123
- package/fesm2022/cmat-components-transfer-picker.mjs.map +1 -1
- package/fesm2022/cmat-components-treetable.mjs +17 -19
- package/fesm2022/cmat-components-treetable.mjs.map +1 -1
- package/fesm2022/cmat-components-upload.mjs +35 -57
- package/fesm2022/cmat-components-upload.mjs.map +1 -1
- package/fesm2022/cmat-components-x6-angular-shape.mjs +0 -4
- package/fesm2022/cmat-components-x6-angular-shape.mjs.map +1 -1
- package/fesm2022/cmat-directives-animate-on-scroll.mjs +6 -27
- package/fesm2022/cmat-directives-animate-on-scroll.mjs.map +1 -1
- package/fesm2022/cmat-directives-arrow-cursor.mjs +7 -9
- package/fesm2022/cmat-directives-arrow-cursor.mjs.map +1 -1
- package/fesm2022/cmat-directives-autofocus.mjs +3 -3
- package/fesm2022/cmat-directives-data-exporter.mjs +24 -33
- package/fesm2022/cmat-directives-data-exporter.mjs.map +1 -1
- package/fesm2022/cmat-directives-debounce.mjs +14 -17
- package/fesm2022/cmat-directives-debounce.mjs.map +1 -1
- package/fesm2022/cmat-directives-digit-only.mjs +6 -23
- package/fesm2022/cmat-directives-digit-only.mjs.map +1 -1
- package/fesm2022/cmat-directives-equal-validator.mjs +3 -3
- package/fesm2022/cmat-directives-seamless-auto-scroll.mjs +4 -11
- package/fesm2022/cmat-directives-seamless-auto-scroll.mjs.map +1 -1
- package/fesm2022/cmat-lib-mock-api.mjs +6 -43
- package/fesm2022/cmat-lib-mock-api.mjs.map +1 -1
- package/fesm2022/cmat-pipes-bytes.mjs +3 -3
- package/fesm2022/cmat-pipes-date-format.mjs +3 -3
- package/fesm2022/cmat-pipes-find-by-key.mjs +3 -5
- package/fesm2022/cmat-pipes-find-by-key.mjs.map +1 -1
- package/fesm2022/cmat-pipes-group-by.mjs +3 -3
- package/fesm2022/cmat-pipes-keys.mjs +3 -3
- package/fesm2022/cmat-pipes-secure.mjs +8 -12
- package/fesm2022/cmat-pipes-secure.mjs.map +1 -1
- package/fesm2022/cmat-pipes-uppercase.mjs +3 -3
- package/fesm2022/cmat-services-alert.mjs +3 -3
- package/fesm2022/cmat-services-config.mjs +50 -26
- package/fesm2022/cmat-services-config.mjs.map +1 -1
- package/fesm2022/cmat-services-confirmation.mjs +9 -11
- package/fesm2022/cmat-services-confirmation.mjs.map +1 -1
- package/fesm2022/cmat-services-data.mjs +56 -101
- package/fesm2022/cmat-services-data.mjs.map +1 -1
- package/fesm2022/cmat-services-export-as.mjs +4 -32
- package/fesm2022/cmat-services-export-as.mjs.map +1 -1
- package/fesm2022/cmat-services-loading.mjs +49 -40
- package/fesm2022/cmat-services-loading.mjs.map +1 -1
- package/fesm2022/cmat-services-local-storage.mjs +3 -3
- package/fesm2022/cmat-services-media-watcher.mjs +19 -25
- package/fesm2022/cmat-services-media-watcher.mjs.map +1 -1
- package/fesm2022/cmat-services-platform.mjs +3 -10
- package/fesm2022/cmat-services-platform.mjs.map +1 -1
- package/fesm2022/cmat-services-splash-screen.mjs +8 -13
- package/fesm2022/cmat-services-splash-screen.mjs.map +1 -1
- package/fesm2022/cmat-services-title.mjs +8 -12
- package/fesm2022/cmat-services-title.mjs.map +1 -1
- package/fesm2022/cmat-services-translation.mjs +3 -3
- package/fesm2022/cmat-services-utils.mjs +5 -27
- package/fesm2022/cmat-services-utils.mjs.map +1 -1
- package/fesm2022/cmat-validators.mjs +0 -8
- package/fesm2022/cmat-validators.mjs.map +1 -1
- package/fesm2022/cmat.mjs +3477 -3795
- package/fesm2022/cmat.mjs.map +1 -1
- package/package.json +1 -1
- package/tailwind/plugins/helpers.js +1 -10
- package/tailwind/plugins/scrollbar/index.js +0 -1
- package/tailwind/plugins/scrollbar/typedefs.js +1 -7
- package/tailwind/plugins/scrollbar/utilities.js +9 -58
- package/tailwind/plugins/scrollbar/variants.js +2 -17
- package/tailwind/plugins/theming.js +1 -57
- package/tailwind/utils/generate-contrasts.js +1 -12
- package/tailwind/utils/generate-palette.js +1 -32
- package/types/cmat-components-adapter.d.ts +0 -25
- package/types/cmat-components-breadcrumb.d.ts +25 -175
- package/types/cmat-components-carousel.d.ts +2 -20
- package/types/cmat-components-cascade.d.ts +4 -4
- package/types/cmat-components-chip-input.d.ts +4 -3
- package/types/cmat-components-code-editor.d.ts +0 -18
- package/types/cmat-components-custom-formly.d.ts +30 -37
- package/types/cmat-components-date-range.d.ts +1 -72
- package/types/cmat-components-date-time-display.d.ts +0 -15
- package/types/cmat-components-drawer.d.ts +2 -44
- package/types/cmat-components-empty-state.d.ts +0 -21
- package/types/cmat-components-file-preview.d.ts +0 -18
- package/types/cmat-components-filter-toolbar.d.ts +3 -43
- package/types/cmat-components-form-actions.d.ts +0 -6
- package/types/cmat-components-image-viewer.d.ts +5 -18
- package/types/cmat-components-inline-loading.d.ts +0 -9
- package/types/cmat-components-json-editor.d.ts +0 -1
- package/types/cmat-components-knob-input.d.ts +3 -3
- package/types/cmat-components-masonry.d.ts +1 -2
- package/types/cmat-components-material-color-picker.d.ts +1 -2
- package/types/cmat-components-material-datetimepicker.d.ts +6 -272
- package/types/cmat-components-navigation.d.ts +34 -171
- package/types/cmat-components-opt-input.d.ts +1 -1
- package/types/cmat-components-page-header.d.ts +2 -16
- package/types/cmat-components-pagination.d.ts +26 -27
- package/types/cmat-components-password-strength.d.ts +1 -2
- package/types/cmat-components-popover.d.ts +1 -110
- package/types/cmat-components-progress-bar.d.ts +9 -11
- package/types/cmat-components-rating.d.ts +6 -7
- package/types/cmat-components-rich-text-editor.d.ts +0 -21
- package/types/cmat-components-select-search.d.ts +4 -20
- package/types/cmat-components-select-table.d.ts +24 -12
- package/types/cmat-components-select-tree.d.ts +29 -29
- package/types/cmat-components-skeleton.d.ts +0 -18
- package/types/cmat-components-speed-dial.d.ts +1 -2
- package/types/cmat-components-status-tag.d.ts +0 -15
- package/types/cmat-components-table-toolbar.d.ts +0 -12
- package/types/cmat-components-timeline.d.ts +3 -4
- package/types/cmat-components-toast.d.ts +2 -2
- package/types/cmat-components-transfer-picker.d.ts +42 -36
- package/types/cmat-components-treetable.d.ts +3 -4
- package/types/cmat-components-upload.d.ts +12 -17
- package/types/cmat-components-x6-angular-shape.d.ts +0 -1
- package/types/cmat-directives-arrow-cursor.d.ts +1 -1
- package/types/cmat-directives-debounce.d.ts +3 -4
- package/types/cmat-pipes-secure.d.ts +3 -4
- package/types/cmat-services-config.d.ts +35 -13
- package/types/cmat-services-data.d.ts +13 -12
- package/types/cmat-services-export-as.d.ts +0 -22
- package/types/cmat-services-loading.d.ts +15 -10
- package/types/cmat-services-media-watcher.d.ts +10 -13
- package/types/cmat-services-splash-screen.d.ts +2 -4
- package/types/cmat-services-title.d.ts +3 -5
- package/types/cmat.d.ts +733 -1391
|
@@ -14,20 +14,20 @@ class CmatConfirmationDialogComponent {
|
|
|
14
14
|
this.data = inject(MAT_DIALOG_DATA);
|
|
15
15
|
this.matDialogRef = inject(MatDialogRef);
|
|
16
16
|
}
|
|
17
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.
|
|
18
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.
|
|
17
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: CmatConfirmationDialogComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
18
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.9", type: CmatConfirmationDialogComponent, isStandalone: true, selector: "cmat-confirmation-dialog", ngImport: i0, template: "<div class=\"relative flex flex-col w-full h-full\">\r\n\r\n \r\n @if (data.dismissible) {\r\n <div class=\"absolute top-0 right-0 pt-4 pr-4\">\r\n <button type=\"button\" matIconButton [matDialogClose]=\"undefined\">\r\n <mat-icon class=\"text-secondary\" [svgIcon]=\"'heroicons_outline:x-mark'\"></mat-icon>\r\n </button>\r\n </div>\r\n }\r\n\r\n \r\n <div class=\"flex flex-col sm:flex-row items-center sm:items-start p-8 pb-6 sm:pb-8\">\r\n\r\n \r\n @if (data.icon?.show) {\r\n <div class=\"flex flex-none items-center justify-center w-10 h-10 sm:mr-4 rounded-full\" [ngClass]=\"{'text-primary-600 bg-primary-100 dark:text-primary-50 dark:bg-primary-600': data.icon?.color === 'primary',\r\n 'text-accent-600 bg-accent-100 dark:text-accent-50 dark:bg-accent-600': data.icon?.color === 'accent',\r\n 'text-warn-600 bg-warn-100 dark:text-warn-50 dark:bg-warn-600': data.icon?.color === 'warn',\r\n 'text-slate-600 bg-slate-100 dark:text-slate-50 dark:bg-slate-600': data.icon?.color === 'basic',\r\n 'text-blue-600 bg-blue-100 dark:text-blue-50 dark:bg-blue-600': data.icon?.color === 'info',\r\n 'text-emerald-500 bg-emerald-100 dark:text-emerald-50 dark:bg-emerald-500': data.icon?.color === 'success',\r\n 'text-amber-500 bg-amber-100 dark:text-amber-50 dark:bg-amber-500': data.icon?.color === 'warning',\r\n 'text-red-600 bg-red-100 dark:text-red-50 dark:bg-red-600': data.icon?.color === 'error'\r\n }\">\r\n @if (data.icon?.name) {\r\n <mat-icon class=\"text-current\" [svgIcon]=\"data.icon?.name||''\"></mat-icon>\r\n }\r\n </div>\r\n }\r\n\r\n @if (data.title || data.message) {\r\n <div\r\n class=\"flex flex-col items-center sm:items-start mt-4 sm:mt-0 sm:pr-8 gap-1 text-center sm:text-left\">\r\n \r\n @if (data.title) {\r\n <div class=\"text-xl leading-6 font-medium\" [innerHTML]=\"data.title\"></div>\r\n }\r\n \r\n @if (data.message) {\r\n <div class=\"text-secondary\" [innerHTML]=\"data.message\"></div>\r\n }\r\n </div>\r\n }\r\n\r\n </div>\r\n\r\n \r\n @if (data.actions?.confirm?.show || data.actions?.cancel?.show) {\r\n <div\r\n class=\"flex items-center justify-center sm:justify-end px-6 py-4 flex-row gap-3 bg-slate-50 dark:bg-black/10\">\r\n \r\n @if (data.actions?.confirm?.show) {\r\n <button type=\"button\" matButton=\"filled\" [color]=\"data.actions?.confirm?.color\"\r\n [matDialogClose]=\"'confirmed'\">\r\n {{data.actions?.confirm?.label}}\r\n </button>\r\n }\r\n \r\n @if (data.actions?.cancel?.show) {\r\n <button type=\"button\" matButton=\"outlined\" [matDialogClose]=\"'cancelled'\">\r\n {{data.actions?.cancel?.label}}\r\n </button>\r\n }\r\n </div>\r\n }\r\n\r\n</div>", styles: [".cmat-confirmation-dialog-panel .mat-mdc-dialog-container{padding:0!important}\n"], dependencies: [{ kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i1.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.MatIconButton, selector: "button[mat-icon-button], a[mat-icon-button], button[matIconButton], a[matIconButton]", exportAs: ["matButton", "matAnchor"] }, { kind: "ngmodule", type: MatDialogModule }, { kind: "directive", type: i2.MatDialogClose, selector: "[mat-dialog-close], [matDialogClose]", inputs: ["aria-label", "type", "mat-dialog-close", "matDialogClose"], exportAs: ["matDialogClose"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i3.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }], encapsulation: i0.ViewEncapsulation.None }); }
|
|
19
19
|
}
|
|
20
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.
|
|
20
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: CmatConfirmationDialogComponent, decorators: [{
|
|
21
21
|
type: Component,
|
|
22
|
-
args: [{ selector: 'cmat-confirmation-dialog', encapsulation: ViewEncapsulation.None, imports: [MatButtonModule, MatDialogModule, MatIconModule, NgClass], template: "<div class=\"relative flex flex-col w-full h-full\">\r\n\r\n
|
|
22
|
+
args: [{ selector: 'cmat-confirmation-dialog', encapsulation: ViewEncapsulation.None, imports: [MatButtonModule, MatDialogModule, MatIconModule, NgClass], template: "<div class=\"relative flex flex-col w-full h-full\">\r\n\r\n \r\n @if (data.dismissible) {\r\n <div class=\"absolute top-0 right-0 pt-4 pr-4\">\r\n <button type=\"button\" matIconButton [matDialogClose]=\"undefined\">\r\n <mat-icon class=\"text-secondary\" [svgIcon]=\"'heroicons_outline:x-mark'\"></mat-icon>\r\n </button>\r\n </div>\r\n }\r\n\r\n \r\n <div class=\"flex flex-col sm:flex-row items-center sm:items-start p-8 pb-6 sm:pb-8\">\r\n\r\n \r\n @if (data.icon?.show) {\r\n <div class=\"flex flex-none items-center justify-center w-10 h-10 sm:mr-4 rounded-full\" [ngClass]=\"{'text-primary-600 bg-primary-100 dark:text-primary-50 dark:bg-primary-600': data.icon?.color === 'primary',\r\n 'text-accent-600 bg-accent-100 dark:text-accent-50 dark:bg-accent-600': data.icon?.color === 'accent',\r\n 'text-warn-600 bg-warn-100 dark:text-warn-50 dark:bg-warn-600': data.icon?.color === 'warn',\r\n 'text-slate-600 bg-slate-100 dark:text-slate-50 dark:bg-slate-600': data.icon?.color === 'basic',\r\n 'text-blue-600 bg-blue-100 dark:text-blue-50 dark:bg-blue-600': data.icon?.color === 'info',\r\n 'text-emerald-500 bg-emerald-100 dark:text-emerald-50 dark:bg-emerald-500': data.icon?.color === 'success',\r\n 'text-amber-500 bg-amber-100 dark:text-amber-50 dark:bg-amber-500': data.icon?.color === 'warning',\r\n 'text-red-600 bg-red-100 dark:text-red-50 dark:bg-red-600': data.icon?.color === 'error'\r\n }\">\r\n @if (data.icon?.name) {\r\n <mat-icon class=\"text-current\" [svgIcon]=\"data.icon?.name||''\"></mat-icon>\r\n }\r\n </div>\r\n }\r\n\r\n @if (data.title || data.message) {\r\n <div\r\n class=\"flex flex-col items-center sm:items-start mt-4 sm:mt-0 sm:pr-8 gap-1 text-center sm:text-left\">\r\n \r\n @if (data.title) {\r\n <div class=\"text-xl leading-6 font-medium\" [innerHTML]=\"data.title\"></div>\r\n }\r\n \r\n @if (data.message) {\r\n <div class=\"text-secondary\" [innerHTML]=\"data.message\"></div>\r\n }\r\n </div>\r\n }\r\n\r\n </div>\r\n\r\n \r\n @if (data.actions?.confirm?.show || data.actions?.cancel?.show) {\r\n <div\r\n class=\"flex items-center justify-center sm:justify-end px-6 py-4 flex-row gap-3 bg-slate-50 dark:bg-black/10\">\r\n \r\n @if (data.actions?.confirm?.show) {\r\n <button type=\"button\" matButton=\"filled\" [color]=\"data.actions?.confirm?.color\"\r\n [matDialogClose]=\"'confirmed'\">\r\n {{data.actions?.confirm?.label}}\r\n </button>\r\n }\r\n \r\n @if (data.actions?.cancel?.show) {\r\n <button type=\"button\" matButton=\"outlined\" [matDialogClose]=\"'cancelled'\">\r\n {{data.actions?.cancel?.label}}\r\n </button>\r\n }\r\n </div>\r\n }\r\n\r\n</div>", styles: [".cmat-confirmation-dialog-panel .mat-mdc-dialog-container{padding:0!important}\n"] }]
|
|
23
23
|
}] });
|
|
24
24
|
|
|
25
25
|
class CmatConfirmationService {
|
|
26
26
|
constructor() {
|
|
27
27
|
this._matDialog = inject(MatDialog);
|
|
28
28
|
this._defaultConfig = {
|
|
29
|
-
title: '
|
|
30
|
-
message: '
|
|
29
|
+
title: '确认操作',
|
|
30
|
+
message: '确认此操作吗?',
|
|
31
31
|
icon: {
|
|
32
32
|
show: true,
|
|
33
33
|
name: 'heroicons_outline:exclamation-triangle',
|
|
@@ -48,9 +48,7 @@ class CmatConfirmationService {
|
|
|
48
48
|
};
|
|
49
49
|
}
|
|
50
50
|
open(config = {}) {
|
|
51
|
-
// Merge the user config with the default config
|
|
52
51
|
const userConfig = merge({}, this._defaultConfig, config);
|
|
53
|
-
// Open the dialog
|
|
54
52
|
return this._matDialog.open(CmatConfirmationDialogComponent, {
|
|
55
53
|
autoFocus: false,
|
|
56
54
|
disableClose: !userConfig.dismissible,
|
|
@@ -58,10 +56,10 @@ class CmatConfirmationService {
|
|
|
58
56
|
panelClass: 'cmat-confirmation-dialog-panel'
|
|
59
57
|
});
|
|
60
58
|
}
|
|
61
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.
|
|
62
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.
|
|
59
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: CmatConfirmationService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
60
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: CmatConfirmationService, providedIn: 'root' }); }
|
|
63
61
|
}
|
|
64
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.
|
|
62
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: CmatConfirmationService, decorators: [{
|
|
65
63
|
type: Injectable,
|
|
66
64
|
args: [{
|
|
67
65
|
providedIn: 'root'
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cmat-services-confirmation.mjs","sources":["../../../projects/cmat/services/confirmation/dialog/dialog.component.ts","../../../projects/cmat/services/confirmation/dialog/dialog.component.html","../../../projects/cmat/services/confirmation/confirmation.service.ts","../../../projects/cmat/services/confirmation/cmat-services-confirmation.ts"],"sourcesContent":["import { NgClass } from '@angular/common';\r\nimport { Component, ViewEncapsulation, inject } from '@angular/core';\r\nimport { MatButtonModule } from '@angular/material/button';\r\nimport { MAT_DIALOG_DATA, MatDialogRef, MatDialogModule } from '@angular/material/dialog';\r\nimport { MatIconModule } from '@angular/material/icon';\r\nimport { CmatConfirmationConfig } from '../confirmation.types';\r\n\r\n@Component({\r\n selector: 'cmat-confirmation-dialog',\r\n templateUrl: './dialog.component.html',\r\n styles: [\r\n /* language=SCSS */\r\n `\r\n .cmat-confirmation-dialog-panel {\r\n .mat-mdc-dialog-container {\r\n padding: 0 !important;\r\n }\r\n }\r\n `\r\n ],\r\n encapsulation: ViewEncapsulation.None,\r\n imports: [MatButtonModule, MatDialogModule, MatIconModule, NgClass]\r\n})\r\nexport class CmatConfirmationDialogComponent {\r\n data = inject<CmatConfirmationConfig>(MAT_DIALOG_DATA);\r\n matDialogRef = inject<MatDialogRef<CmatConfirmationDialogComponent>>(MatDialogRef);\r\n}\r\n","<div class=\"relative flex flex-col w-full h-full\">\r\n\r\n
|
|
1
|
+
{"version":3,"file":"cmat-services-confirmation.mjs","sources":["../../../projects/cmat/services/confirmation/dialog/dialog.component.ts","../../../projects/cmat/services/confirmation/dialog/dialog.component.html","../../../projects/cmat/services/confirmation/confirmation.service.ts","../../../projects/cmat/services/confirmation/cmat-services-confirmation.ts"],"sourcesContent":["import { NgClass } from '@angular/common';\r\nimport { Component, ViewEncapsulation, inject } from '@angular/core';\r\nimport { MatButtonModule } from '@angular/material/button';\r\nimport { MAT_DIALOG_DATA, MatDialogRef, MatDialogModule } from '@angular/material/dialog';\r\nimport { MatIconModule } from '@angular/material/icon';\r\nimport { CmatConfirmationConfig } from '../confirmation.types';\r\n\r\n@Component({\r\n selector: 'cmat-confirmation-dialog',\r\n templateUrl: './dialog.component.html',\r\n styles: [\r\n /* language=SCSS */\r\n `\r\n .cmat-confirmation-dialog-panel {\r\n .mat-mdc-dialog-container {\r\n padding: 0 !important;\r\n }\r\n }\r\n `\r\n ],\r\n encapsulation: ViewEncapsulation.None,\r\n imports: [MatButtonModule, MatDialogModule, MatIconModule, NgClass]\r\n})\r\nexport class CmatConfirmationDialogComponent {\r\n data = inject<CmatConfirmationConfig>(MAT_DIALOG_DATA);\r\n matDialogRef = inject<MatDialogRef<CmatConfirmationDialogComponent>>(MatDialogRef);\r\n}\r\n","<div class=\"relative flex flex-col w-full h-full\">\r\n\r\n \r\n @if (data.dismissible) {\r\n <div class=\"absolute top-0 right-0 pt-4 pr-4\">\r\n <button type=\"button\" matIconButton [matDialogClose]=\"undefined\">\r\n <mat-icon class=\"text-secondary\" [svgIcon]=\"'heroicons_outline:x-mark'\"></mat-icon>\r\n </button>\r\n </div>\r\n }\r\n\r\n \r\n <div class=\"flex flex-col sm:flex-row items-center sm:items-start p-8 pb-6 sm:pb-8\">\r\n\r\n \r\n @if (data.icon?.show) {\r\n <div class=\"flex flex-none items-center justify-center w-10 h-10 sm:mr-4 rounded-full\" [ngClass]=\"{'text-primary-600 bg-primary-100 dark:text-primary-50 dark:bg-primary-600': data.icon?.color === 'primary',\r\n 'text-accent-600 bg-accent-100 dark:text-accent-50 dark:bg-accent-600': data.icon?.color === 'accent',\r\n 'text-warn-600 bg-warn-100 dark:text-warn-50 dark:bg-warn-600': data.icon?.color === 'warn',\r\n 'text-slate-600 bg-slate-100 dark:text-slate-50 dark:bg-slate-600': data.icon?.color === 'basic',\r\n 'text-blue-600 bg-blue-100 dark:text-blue-50 dark:bg-blue-600': data.icon?.color === 'info',\r\n 'text-emerald-500 bg-emerald-100 dark:text-emerald-50 dark:bg-emerald-500': data.icon?.color === 'success',\r\n 'text-amber-500 bg-amber-100 dark:text-amber-50 dark:bg-amber-500': data.icon?.color === 'warning',\r\n 'text-red-600 bg-red-100 dark:text-red-50 dark:bg-red-600': data.icon?.color === 'error'\r\n }\">\r\n @if (data.icon?.name) {\r\n <mat-icon class=\"text-current\" [svgIcon]=\"data.icon?.name||''\"></mat-icon>\r\n }\r\n </div>\r\n }\r\n\r\n @if (data.title || data.message) {\r\n <div\r\n class=\"flex flex-col items-center sm:items-start mt-4 sm:mt-0 sm:pr-8 gap-1 text-center sm:text-left\">\r\n \r\n @if (data.title) {\r\n <div class=\"text-xl leading-6 font-medium\" [innerHTML]=\"data.title\"></div>\r\n }\r\n \r\n @if (data.message) {\r\n <div class=\"text-secondary\" [innerHTML]=\"data.message\"></div>\r\n }\r\n </div>\r\n }\r\n\r\n </div>\r\n\r\n \r\n @if (data.actions?.confirm?.show || data.actions?.cancel?.show) {\r\n <div\r\n class=\"flex items-center justify-center sm:justify-end px-6 py-4 flex-row gap-3 bg-slate-50 dark:bg-black/10\">\r\n \r\n @if (data.actions?.confirm?.show) {\r\n <button type=\"button\" matButton=\"filled\" [color]=\"data.actions?.confirm?.color\"\r\n [matDialogClose]=\"'confirmed'\">\r\n {{data.actions?.confirm?.label}}\r\n </button>\r\n }\r\n \r\n @if (data.actions?.cancel?.show) {\r\n <button type=\"button\" matButton=\"outlined\" [matDialogClose]=\"'cancelled'\">\r\n {{data.actions?.cancel?.label}}\r\n </button>\r\n }\r\n </div>\r\n }\r\n\r\n</div>","import { Injectable, inject } from '@angular/core';\r\nimport { MatDialog, MatDialogRef } from '@angular/material/dialog';\r\nimport { merge } from 'lodash-es';\r\nimport { CmatConfirmationConfig } from './confirmation.types';\r\nimport { CmatConfirmationDialogComponent } from './dialog/dialog.component';\r\n\r\n@Injectable({\r\n providedIn: 'root'\r\n})\r\nexport class CmatConfirmationService {\r\n private _matDialog = inject(MatDialog);\r\n\r\n private _defaultConfig: CmatConfirmationConfig = {\r\n title: '确认操作',\r\n message: '确认此操作吗?',\r\n icon: {\r\n show: true,\r\n name: 'heroicons_outline:exclamation-triangle',\r\n color: 'warn'\r\n },\r\n actions: {\r\n confirm: {\r\n show: true,\r\n label: '确认',\r\n color: 'warn'\r\n },\r\n cancel: {\r\n show: true,\r\n label: '取消'\r\n }\r\n },\r\n dismissible: false\r\n };\r\n\r\n open(config: CmatConfirmationConfig = {}): MatDialogRef<CmatConfirmationDialogComponent> {\r\n const userConfig = merge({}, this._defaultConfig, config);\r\n return this._matDialog.open(CmatConfirmationDialogComponent, {\r\n autoFocus: false,\r\n disableClose: !userConfig.dismissible,\r\n data: userConfig,\r\n panelClass: 'cmat-confirmation-dialog-panel'\r\n });\r\n }\r\n}\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;;;;;MAuBa,+BAA+B,CAAA;AAhB5C,IAAA,WAAA,GAAA;AAiBI,QAAA,IAAA,CAAA,IAAI,GAAG,MAAM,CAAyB,eAAe,CAAC;AACtD,QAAA,IAAA,CAAA,YAAY,GAAG,MAAM,CAAgD,YAAY,CAAC;AACrF,IAAA;8GAHY,+BAA+B,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA,CAAA;kGAA/B,+BAA+B,EAAA,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,0BAAA,EAAA,QAAA,EAAA,EAAA,EAAA,QAAA,ECvB5C,mhGAmEM,EAA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CAAA;AACR,oBAAA,UAAU,EAAE;AACf,iBAAA;;;ACRD;;AAEG;;;;"}
|
|
@@ -1,166 +1,121 @@
|
|
|
1
1
|
import { HttpClient, HttpParams } from '@angular/common/http';
|
|
2
2
|
import * as i0 from '@angular/core';
|
|
3
|
-
import { inject, Injectable } from '@angular/core';
|
|
3
|
+
import { inject, DestroyRef, Injectable } from '@angular/core';
|
|
4
|
+
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
4
5
|
import { CmatUrlStateConfigService } from 'cmat/services/config';
|
|
5
6
|
import { CmatUtilsService } from 'cmat/services/utils';
|
|
6
|
-
import {
|
|
7
|
-
import { takeUntil, retry, map, catchError, tap } from 'rxjs/operators';
|
|
7
|
+
import { retry, map, catchError } from 'rxjs/operators';
|
|
8
8
|
|
|
9
9
|
class CmatDataService {
|
|
10
10
|
constructor() {
|
|
11
11
|
this._http = inject(HttpClient);
|
|
12
12
|
this._urlStateConfigService = inject(CmatUrlStateConfigService);
|
|
13
|
+
this._destroyRef = inject(DestroyRef);
|
|
13
14
|
this._enableDataProtect = false;
|
|
14
|
-
this._unsubscribeAll = new Subject();
|
|
15
15
|
this._urlStateConfigService.config$
|
|
16
|
-
.pipe(
|
|
16
|
+
.pipe(takeUntilDestroyed(this._destroyRef))
|
|
17
17
|
.subscribe((config) => {
|
|
18
18
|
this._enableDataProtect = config.enableDataProtect;
|
|
19
19
|
});
|
|
20
20
|
}
|
|
21
|
-
ngOnDestroy() {
|
|
22
|
-
this._unsubscribeAll.next(void 0);
|
|
23
|
-
this._unsubscribeAll.complete();
|
|
24
|
-
}
|
|
25
21
|
get(url, params = {}, auth = true) {
|
|
26
|
-
const httpParams = new HttpParams();
|
|
27
22
|
const headers = auth ? CmatUtilsService.getRequestHeaders() : CmatUtilsService.getRequestCryptoHeaders('');
|
|
28
|
-
|
|
29
|
-
if (this._enableDataProtect) {
|
|
30
|
-
httpParams.appendAll({
|
|
31
|
-
params: CmatUtilsService.getEncryptData(JSON.stringify({ params: params }))
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
else {
|
|
35
|
-
httpParams.appendAll(params);
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
const options = { params: httpParams };
|
|
23
|
+
const options = { params: this._buildHttpParams(params, this._enableDataProtect) };
|
|
39
24
|
if (this._enableDataProtect) {
|
|
40
25
|
return this._http.get(url, { ...options, headers: headers })
|
|
41
|
-
.pipe(retry({ count: 3, delay: 1000 }), map((res) =>
|
|
42
|
-
if (res) {
|
|
43
|
-
return JSON.parse(CmatUtilsService.getDecryptData(res));
|
|
44
|
-
}
|
|
45
|
-
return res;
|
|
46
|
-
}), catchError((err) => CmatUtilsService.handleError(err)));
|
|
26
|
+
.pipe(retry({ count: 3, delay: 1000 }), map((res) => this._decryptResponse(res)), catchError((err) => CmatUtilsService.handleError(err)));
|
|
47
27
|
}
|
|
48
28
|
else {
|
|
49
29
|
return this._http.get(url, { ...options, headers: headers })
|
|
50
|
-
.pipe(retry({ count: 3, delay: 1000 }),
|
|
30
|
+
.pipe(retry({ count: 3, delay: 1000 }), catchError((err) => CmatUtilsService.handleError(err)));
|
|
51
31
|
}
|
|
52
32
|
}
|
|
53
33
|
post(url, data, params = {}, auth = true, idempotent = false) {
|
|
54
|
-
const httpParams = new HttpParams();
|
|
55
34
|
const headers = auth ? (idempotent ? CmatUtilsService.getRequestIdempotentBypassHeaders() : CmatUtilsService.getRequestBypassHeaders()) : (idempotent ? CmatUtilsService.getRequestCryptoIdempotentBypassHeaders('') : CmatUtilsService.getRequestCryptoBypassHeaders(''));
|
|
56
|
-
|
|
57
|
-
if (this._enableDataProtect) {
|
|
58
|
-
httpParams.appendAll({
|
|
59
|
-
params: CmatUtilsService.getEncryptData(JSON.stringify(params))
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
|
-
else {
|
|
63
|
-
httpParams.appendAll(params);
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
const options = { params: httpParams };
|
|
35
|
+
const options = { params: this._buildHttpParams(params, this._enableDataProtect) };
|
|
67
36
|
if (this._enableDataProtect) {
|
|
68
37
|
data = CmatUtilsService.getEncryptData(JSON.stringify(data));
|
|
69
38
|
return this._http.post(url, data, { ...options, headers: headers })
|
|
70
|
-
.pipe(map((res) =>
|
|
71
|
-
if (res) {
|
|
72
|
-
return JSON.parse(CmatUtilsService.getDecryptData(res));
|
|
73
|
-
}
|
|
74
|
-
return res;
|
|
75
|
-
}), catchError((err) => CmatUtilsService.handleError(err)));
|
|
39
|
+
.pipe(map((res) => this._decryptResponse(res)), catchError((err) => CmatUtilsService.handleError(err)));
|
|
76
40
|
}
|
|
77
41
|
else {
|
|
78
42
|
return this._http.post(url, data, { ...options, headers: headers })
|
|
79
|
-
.pipe(
|
|
43
|
+
.pipe(catchError((err) => CmatUtilsService.handleError(err)));
|
|
80
44
|
}
|
|
81
45
|
}
|
|
82
46
|
put(url, data, params = {}, auth = true) {
|
|
83
|
-
const httpParams = new HttpParams();
|
|
84
47
|
const headers = auth ? CmatUtilsService.getRequestBypassHeaders() : CmatUtilsService.getRequestCryptoBypassHeaders('');
|
|
85
|
-
|
|
86
|
-
if (this._enableDataProtect) {
|
|
87
|
-
httpParams.appendAll({
|
|
88
|
-
params: CmatUtilsService.getEncryptData(JSON.stringify(params))
|
|
89
|
-
});
|
|
90
|
-
}
|
|
91
|
-
else {
|
|
92
|
-
httpParams.appendAll(params);
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
const options = { params: httpParams };
|
|
48
|
+
const options = { params: this._buildHttpParams(params, this._enableDataProtect) };
|
|
96
49
|
if (this._enableDataProtect) {
|
|
97
50
|
data = CmatUtilsService.getEncryptData(JSON.stringify(data));
|
|
98
51
|
return this._http.put(url, data, { ...options, headers: headers })
|
|
99
|
-
.pipe(map((res) =>
|
|
100
|
-
if (res) {
|
|
101
|
-
return JSON.parse(CmatUtilsService.getDecryptData(res));
|
|
102
|
-
}
|
|
103
|
-
return res;
|
|
104
|
-
}), catchError((err) => CmatUtilsService.handleError(err)));
|
|
52
|
+
.pipe(map((res) => this._decryptResponse(res)), catchError((err) => CmatUtilsService.handleError(err)));
|
|
105
53
|
}
|
|
106
54
|
else {
|
|
107
55
|
return this._http.put(url, data, { ...options, headers: headers })
|
|
108
|
-
.pipe(
|
|
56
|
+
.pipe(catchError((err) => CmatUtilsService.handleError(err)));
|
|
109
57
|
}
|
|
110
58
|
}
|
|
111
59
|
delete(url, params = {}, auth = true) {
|
|
112
|
-
const httpParams = new HttpParams();
|
|
113
60
|
const headers = auth ? CmatUtilsService.getRequestBypassHeaders() : CmatUtilsService.getRequestCryptoBypassHeaders('');
|
|
114
|
-
|
|
115
|
-
if (this._enableDataProtect) {
|
|
116
|
-
httpParams.appendAll({
|
|
117
|
-
params: CmatUtilsService.getEncryptData(JSON.stringify(params))
|
|
118
|
-
});
|
|
119
|
-
}
|
|
120
|
-
else {
|
|
121
|
-
httpParams.appendAll(params);
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
const options = { params: httpParams };
|
|
61
|
+
const options = { params: this._buildHttpParams(params, this._enableDataProtect) };
|
|
125
62
|
return this._http.delete(url, {
|
|
126
63
|
...options,
|
|
127
64
|
headers: headers
|
|
128
65
|
})
|
|
129
|
-
.pipe(
|
|
66
|
+
.pipe(catchError((err) => CmatUtilsService.handleError(err)));
|
|
130
67
|
}
|
|
131
68
|
patch(url, data, params = {}, auth = true) {
|
|
132
|
-
const httpParams = new HttpParams();
|
|
133
69
|
const headers = auth ? CmatUtilsService.getRequestBypassHeaders() : CmatUtilsService.getRequestCryptoBypassHeaders('');
|
|
134
|
-
|
|
135
|
-
if (this._enableDataProtect) {
|
|
136
|
-
httpParams.appendAll({
|
|
137
|
-
params: CmatUtilsService.getEncryptData(JSON.stringify(params))
|
|
138
|
-
});
|
|
139
|
-
}
|
|
140
|
-
else {
|
|
141
|
-
httpParams.appendAll(params);
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
const options = { params: httpParams };
|
|
70
|
+
const options = { params: this._buildHttpParams(params, this._enableDataProtect) };
|
|
145
71
|
if (this._enableDataProtect) {
|
|
146
72
|
data = CmatUtilsService.getEncryptData(JSON.stringify(data));
|
|
147
73
|
return this._http.patch(url, data, { ...options, headers: headers })
|
|
148
|
-
.pipe(map((res) =>
|
|
149
|
-
if (res) {
|
|
150
|
-
return JSON.parse(CmatUtilsService.getDecryptData(res));
|
|
151
|
-
}
|
|
152
|
-
return res;
|
|
153
|
-
}), catchError((err) => CmatUtilsService.handleError(err)));
|
|
74
|
+
.pipe(map((res) => this._decryptResponse(res)), catchError((err) => CmatUtilsService.handleError(err)));
|
|
154
75
|
}
|
|
155
76
|
else {
|
|
156
77
|
return this._http.patch(url, data, { ...options, headers: headers })
|
|
157
|
-
.pipe(
|
|
78
|
+
.pipe(catchError((err) => CmatUtilsService.handleError(err)));
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
_buildHttpParams(params, encrypted) {
|
|
82
|
+
if (Object.keys(params).length === 0) {
|
|
83
|
+
return new HttpParams();
|
|
84
|
+
}
|
|
85
|
+
if (encrypted) {
|
|
86
|
+
return new HttpParams().set('params', CmatUtilsService.getEncryptData(JSON.stringify(params)));
|
|
87
|
+
}
|
|
88
|
+
const normalizedParams = {};
|
|
89
|
+
Object.entries(params).forEach(([key, value]) => {
|
|
90
|
+
const normalizedValue = this._normalizeParamValue(value);
|
|
91
|
+
if (normalizedValue !== undefined) {
|
|
92
|
+
normalizedParams[key] = normalizedValue;
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
return new HttpParams({ fromObject: normalizedParams });
|
|
96
|
+
}
|
|
97
|
+
_decryptResponse(res) {
|
|
98
|
+
if (!res) {
|
|
99
|
+
return res;
|
|
100
|
+
}
|
|
101
|
+
return JSON.parse(CmatUtilsService.getDecryptData(res));
|
|
102
|
+
}
|
|
103
|
+
_normalizeParamValue(value) {
|
|
104
|
+
if (value === null || value === undefined) {
|
|
105
|
+
return undefined;
|
|
106
|
+
}
|
|
107
|
+
if (typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean') {
|
|
108
|
+
return `${value}`;
|
|
109
|
+
}
|
|
110
|
+
if (value instanceof Date) {
|
|
111
|
+
return value.toISOString();
|
|
158
112
|
}
|
|
113
|
+
return JSON.stringify(value);
|
|
159
114
|
}
|
|
160
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.
|
|
161
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.
|
|
115
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: CmatDataService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
116
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: CmatDataService, providedIn: 'root' }); }
|
|
162
117
|
}
|
|
163
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.
|
|
118
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: CmatDataService, decorators: [{
|
|
164
119
|
type: Injectable,
|
|
165
120
|
args: [{
|
|
166
121
|
providedIn: 'root'
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cmat-services-data.mjs","sources":["../../../projects/cmat/services/data/data.service.ts","../../../projects/cmat/services/data/cmat-services-data.ts"],"sourcesContent":["import { HttpClient, HttpParams } from '@angular/common/http';\r\nimport { Injectable, OnDestroy, inject } from '@angular/core';\r\nimport { CmatUrlStateConfigService, IUrlStateConfig } from 'cmat/services/config';\r\nimport { CmatUtilsService } from 'cmat/services/utils';\r\nimport { Observable, Subject } from 'rxjs';\r\nimport { catchError, map, retry, takeUntil, tap } from 'rxjs/operators';\r\n\r\n@Injectable({\r\n providedIn: 'root'\r\n})\r\nexport class CmatDataService implements OnDestroy {\r\n private _http = inject(HttpClient);\r\n private _urlStateConfigService = inject(CmatUrlStateConfigService);\r\n\r\n private _enableDataProtect: boolean = false;\r\n private _unsubscribeAll: Subject<void> = new Subject<void>();\r\n\r\n \r\n\r\n constructor() {\r\n this._urlStateConfigService.config$\r\n .pipe(takeUntil(this._unsubscribeAll))\r\n .subscribe((config: IUrlStateConfig) => {\r\n this._enableDataProtect = config.enableDataProtect;\r\n });\r\n }\r\n\r\n ngOnDestroy(): void {\r\n this._unsubscribeAll.next(void 0);\r\n this._unsubscribeAll.complete();\r\n }\r\n\r\n get<T>(url: string, params = {}, auth: boolean = true): Observable<T> {\r\n const httpParams = new HttpParams();\r\n const headers = auth ? CmatUtilsService.getRequestHeaders() : CmatUtilsService.getRequestCryptoHeaders('');\r\n\r\n if (Object.keys(params).length !== 0) {\r\n\r\n if (this._enableDataProtect) {\r\n httpParams.appendAll(\r\n {\r\n params:\r\n CmatUtilsService.getEncryptData(JSON.stringify({ params: params }))\r\n });\r\n } else {\r\n httpParams.appendAll(params);\r\n }\r\n }\r\n const options = { params: httpParams };\r\n\r\n if (this._enableDataProtect) {\r\n return this._http.get<string>(url, { ...options, headers: headers })\r\n .pipe(\r\n retry({ count: 3, delay: 1000 }),\r\n map((res: string) => {\r\n if (res) {\r\n return JSON.parse(CmatUtilsService.getDecryptData(res));\r\n }\r\n return res;\r\n }),\r\n catchError((err: any) => CmatUtilsService.handleError(err))\r\n );\r\n } else {\r\n return this._http.get<T>(url, { ...options, headers: headers })\r\n .pipe(\r\n retry({ count: 3, delay: 1000 }),\r\n tap((res: T) => res),\r\n catchError((err: any) => CmatUtilsService.handleError(err))\r\n );\r\n }\r\n\r\n }\r\n\r\n post<T>(url: string, data: any, params = {}, auth: boolean = true, idempotent: boolean = false): Observable<T> {\r\n const httpParams = new HttpParams();\r\n const headers = auth ? (idempotent ? CmatUtilsService.getRequestIdempotentBypassHeaders() : CmatUtilsService.getRequestBypassHeaders()) : (idempotent ? CmatUtilsService.getRequestCryptoIdempotentBypassHeaders('') : CmatUtilsService.getRequestCryptoBypassHeaders(''));\r\n\r\n if (Object.keys(params).length !== 0) {\r\n\r\n if (this._enableDataProtect) {\r\n httpParams.appendAll(\r\n {\r\n params:\r\n CmatUtilsService.getEncryptData(JSON.stringify(params))\r\n });\r\n } else {\r\n httpParams.appendAll(params);\r\n }\r\n }\r\n const options = { params: httpParams };\r\n\r\n if (this._enableDataProtect) {\r\n data = CmatUtilsService.getEncryptData(JSON.stringify(data));\r\n\r\n return this._http.post<string>(url, data, { ...options, headers: headers })\r\n .pipe(\r\n map((res: string) => {\r\n if (res) {\r\n return JSON.parse(CmatUtilsService.getDecryptData(res));\r\n }\r\n return res;\r\n }),\r\n catchError((err: any) => CmatUtilsService.handleError(err))\r\n );\r\n } else {\r\n return this._http.post<T>(url, data, { ...options, headers: headers })\r\n .pipe(\r\n tap((res: T) => res),\r\n catchError((err: any) => CmatUtilsService.handleError(err))\r\n );\r\n }\r\n }\r\n\r\n put<T>(url: string, data: any, params = {}, auth: boolean = true): Observable<T> {\r\n const httpParams = new HttpParams();\r\n const headers = auth ? CmatUtilsService.getRequestBypassHeaders() : CmatUtilsService.getRequestCryptoBypassHeaders('');\r\n\r\n if (Object.keys(params).length !== 0) {\r\n\r\n if (this._enableDataProtect) {\r\n httpParams.appendAll(\r\n {\r\n params:\r\n CmatUtilsService.getEncryptData(JSON.stringify(params))\r\n });\r\n } else {\r\n httpParams.appendAll(params);\r\n }\r\n }\r\n const options = { params: httpParams };\r\n\r\n if (this._enableDataProtect) {\r\n data = CmatUtilsService.getEncryptData(JSON.stringify(data));\r\n\r\n return this._http.put<string>(url, data, { ...options, headers: headers })\r\n .pipe(\r\n map((res: string) => {\r\n if (res) {\r\n return JSON.parse(CmatUtilsService.getDecryptData(res));\r\n }\r\n return res;\r\n }),\r\n catchError((err: any) => CmatUtilsService.handleError(err))\r\n );\r\n } else {\r\n return this._http.put<T>(url, data, { ...options, headers: headers })\r\n .pipe(\r\n tap((res: T) => res),\r\n catchError((err: any) => CmatUtilsService.handleError(err))\r\n );\r\n }\r\n }\r\n\r\n delete<T>(url: string, params = {}, auth: boolean = true): Observable<T> {\r\n const httpParams = new HttpParams();\r\n const headers = auth ? CmatUtilsService.getRequestBypassHeaders() : CmatUtilsService.getRequestCryptoBypassHeaders('');\r\n\r\n if (Object.keys(params).length !== 0) {\r\n\r\n if (this._enableDataProtect) {\r\n httpParams.appendAll(\r\n {\r\n params:\r\n CmatUtilsService.getEncryptData(JSON.stringify(params))\r\n });\r\n } else {\r\n httpParams.appendAll(params);\r\n }\r\n }\r\n\r\n const options = { params: httpParams };\r\n\r\n return this._http.delete<T>(url, {\r\n ...options,\r\n headers: headers\r\n })\r\n .pipe(\r\n tap((res: T) => res),\r\n catchError((err: any) => CmatUtilsService.handleError(err))\r\n );\r\n }\r\n\r\n patch<T>(url: string, data: any, params = {}, auth: boolean = true): Observable<T> {\r\n const httpParams = new HttpParams();\r\n const headers = auth ? CmatUtilsService.getRequestBypassHeaders() : CmatUtilsService.getRequestCryptoBypassHeaders('');\r\n\r\n if (Object.keys(params).length !== 0) {\r\n\r\n if (this._enableDataProtect) {\r\n httpParams.appendAll(\r\n {\r\n params:\r\n CmatUtilsService.getEncryptData(JSON.stringify(params))\r\n });\r\n } else {\r\n httpParams.appendAll(params);\r\n }\r\n }\r\n\r\n const options = { params: httpParams };\r\n\r\n if (this._enableDataProtect) {\r\n data = CmatUtilsService.getEncryptData(JSON.stringify(data));\r\n\r\n return this._http.patch<string>(url, data, { ...options, headers: headers })\r\n .pipe(\r\n map((res: string) => {\r\n if (res) {\r\n return JSON.parse(CmatUtilsService.getDecryptData(res));\r\n }\r\n return res;\r\n }),\r\n catchError((err: any) => CmatUtilsService.handleError(err))\r\n );\r\n } else {\r\n return this._http.patch<T>(url, data, { ...options, headers: headers })\r\n .pipe(\r\n tap((res: T) => res),\r\n catchError((err: any) => CmatUtilsService.handleError(err))\r\n );\r\n }\r\n }\r\n}\r\n","/**\n * Generated bundle index. Do not ed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G;AACd,YAAA,CAAC,CAAC,EACF,UAAU,CAAC,CAAC,GAAQ,KAAK,gBAAgB,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,CAC9D;QACT;aAAO;AACH,YAAA,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,CAAI,GAAG,EAAE,IAAI,EAAE,EAAE,GAAG,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE;iBACjE,IAAI,CACD,GAAG,CAAC,CAAC,GAAM,KAAK,GAAG,CAAC,EACpB,UAAU,CAAC,CAAC,GAAQ,KAAK,gBAAgB,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,CAC9D;QACT;IACJ;8GAnNS,eAAe,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;AAAf,IAAA,SAAA,IAAA,CAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,eAAe,cAFZ,MAAM,EAAA,CAAA,CAAA;;2FAET,eAAe,EAAA,UAAA,EAAA,CAAA;kBAH3B,UAAU;AAAC,YAAA,IAAA,EAAA,CAAA;AACR,oBAAA,UAAU,EAAE;AACf,iBAAA;;;ACTD;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"cmat-services-data.mjs","sources":["../../../projects/cmat/services/data/data.service.ts","../../../projects/cmat/services/data/cmat-services-data.ts"],"sourcesContent":["import { HttpClient, HttpParams } from '@angular/common/http';\r\nimport { DestroyRef, Injectable, inject } from '@angular/core';\r\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\r\nimport { CmatUrlStateConfigService, IUrlStateConfig } from 'cmat/services/config';\r\nimport { CmatUtilsService } from 'cmat/services/utils';\r\nimport { Observable } from 'rxjs';\r\nimport { catchError, map, retry } from 'rxjs/operators';\r\n\r\n@Injectable({\r\n providedIn: 'root'\r\n})\r\nexport class CmatDataService {\r\n private readonly _http = inject(HttpClient);\r\n private readonly _urlStateConfigService = inject(CmatUrlStateConfigService);\r\n private readonly _destroyRef = inject(DestroyRef);\r\n\r\n private _enableDataProtect: boolean = false;\r\n\r\n constructor() {\r\n this._urlStateConfigService.config$\r\n .pipe(takeUntilDestroyed(this._destroyRef))\r\n .subscribe((config: IUrlStateConfig) => {\r\n this._enableDataProtect = config.enableDataProtect;\r\n });\r\n }\r\n\r\n get<T>(url: string, params: Record<string, unknown> = {}, auth: boolean = true): Observable<T> {\r\n const headers = auth ? CmatUtilsService.getRequestHeaders() : CmatUtilsService.getRequestCryptoHeaders('');\r\n const options = { params: this._buildHttpParams(params, this._enableDataProtect) };\r\n\r\n if (this._enableDataProtect) {\r\n return this._http.get<string>(url, { ...options, headers: headers })\r\n .pipe(\r\n retry({ count: 3, delay: 1000 }),\r\n map((res: string) => this._decryptResponse<T>(res) as T),\r\n catchError((err: any) => CmatUtilsService.handleError(err))\r\n );\r\n } else {\r\n return this._http.get<T>(url, { ...options, headers: headers })\r\n .pipe(\r\n retry({ count: 3, delay: 1000 }),\r\n catchError((err: any) => CmatUtilsService.handleError(err))\r\n );\r\n }\r\n\r\n }\r\n\r\n post<T>(url: string, data: any, params: Record<string, unknown> = {}, auth: boolean = true, idempotent: boolean = false): Observable<T> {\r\n const headers = auth ? (idempotent ? CmatUtilsService.getRequestIdempotentBypassHeaders() : CmatUtilsService.getRequestBypassHeaders()) : (idempotent ? CmatUtilsService.getRequestCryptoIdempotentBypassHeaders('') : CmatUtilsService.getRequestCryptoBypassHeaders(''));\r\n const options = { params: this._buildHttpParams(params, this._enableDataProtect) };\r\n\r\n if (this._enableDataProtect) {\r\n data = CmatUtilsService.getEncryptData(JSON.stringify(data));\r\n\r\n return this._http.post<string>(url, data, { ...options, headers: headers })\r\n .pipe(\r\n map((res: string) => this._decryptResponse<T>(res) as T),\r\n catchError((err: any) => CmatUtilsService.handleError(err))\r\n );\r\n } else {\r\n return this._http.post<T>(url, data, { ...options, headers: headers })\r\n .pipe(\r\n catchError((err: any) => CmatUtilsService.handleError(err))\r\n );\r\n }\r\n }\r\n\r\n put<T>(url: string, data: any, params: Record<string, unknown> = {}, auth: boolean = true): Observable<T> {\r\n const headers = auth ? CmatUtilsService.getRequestBypassHeaders() : CmatUtilsService.getRequestCryptoBypassHeaders('');\r\n const options = { params: this._buildHttpParams(params, this._enableDataProtect) };\r\n\r\n if (this._enableDataProtect) {\r\n data = CmatUtilsService.getEncryptData(JSON.stringify(data));\r\n\r\n return this._http.put<string>(url, data, { ...options, headers: headers })\r\n .pipe(\r\n map((res: string) => this._decryptResponse<T>(res) as T),\r\n catchError((err: any) => CmatUtilsService.handleError(err))\r\n );\r\n } else {\r\n return this._http.put<T>(url, data, { ...options, headers: headers })\r\n .pipe(\r\n catchError((err: any) => CmatUtilsService.handleError(err))\r\n );\r\n }\r\n }\r\n\r\n delete<T>(url: string, params: Record<string, unknown> = {}, auth: boolean = true): Observable<T> {\r\n const headers = auth ? CmatUtilsService.getRequestBypassHeaders() : CmatUtilsService.getRequestCryptoBypassHeaders('');\r\n const options = { params: this._buildHttpParams(params, this._enableDataProtect) };\r\n\r\n return this._http.delete<T>(url, {\r\n ...options,\r\n headers: headers\r\n })\r\n .pipe(\r\n catchError((err: any) => CmatUtilsService.handleError(err))\r\n );\r\n }\r\n\r\n patch<T>(url: string, data: any, params: Record<string, unknown> = {}, auth: boolean = true): Observable<T> {\r\n const headers = auth ? CmatUtilsService.getRequestBypassHeaders() : CmatUtilsService.getRequestCryptoBypassHeaders('');\r\n const options = { params: this._buildHttpParams(params, this._enableDataProtect) };\r\n\r\n if (this._enableDataProtect) {\r\n data = CmatUtilsService.getEncryptData(JSON.stringify(data));\r\n\r\n return this._http.patch<string>(url, data, { ...options, headers: headers })\r\n .pipe(\r\n map((res: string) => this._decryptResponse<T>(res) as T),\r\n catchError((err: any) => CmatUtilsService.handleError(err))\r\n );\r\n } else {\r\n return this._http.patch<T>(url, data, { ...options, headers: headers })\r\n .pipe(\r\n catchError((err: any) => CmatUtilsService.handleError(err))\r\n );\r\n }\r\n }\r\n\r\n private _buildHttpParams(params: Record<string, unknown>, encrypted: boolean): HttpParams {\r\n if (Object.keys(params).length === 0) {\r\n return new HttpParams();\r\n }\r\n\r\n if (encrypted) {\r\n return new HttpParams().set('params', CmatUtilsService.getEncryptData(JSON.stringify(params)));\r\n }\r\n\r\n const normalizedParams: Record<string, string> = {};\r\n\r\n Object.entries(params).forEach(([key, value]) => {\r\n const normalizedValue = this._normalizeParamValue(value);\r\n\r\n if (normalizedValue !== undefined) {\r\n normalizedParams[key] = normalizedValue;\r\n }\r\n });\r\n\r\n return new HttpParams({ fromObject: normalizedParams });\r\n }\r\n\r\n private _decryptResponse<T>(res: string): T | string {\r\n if (!res) {\r\n return res;\r\n }\r\n\r\n return JSON.parse(CmatUtilsService.getDecryptData(res));\r\n }\r\n\r\n private _normalizeParamValue(value: unknown): string | undefined {\r\n if (value === null || value === undefined) {\r\n return undefined;\r\n }\r\n\r\n if (typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean') {\r\n return `${value}`;\r\n }\r\n\r\n if (value instanceof Date) {\r\n return value.toISOString();\r\n }\r\n\r\n return JSON.stringify(value);\r\n }\r\n}\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;;MAWa,eAAe,CAAA;AAOxB,IAAA,WAAA,GAAA;AANiB,QAAA,IAAA,CAAA,KAAK,GAAG,MAAM,CAAC,UAAU,CAAC;AAC1B,QAAA,IAAA,CAAA,sBAAsB,GAAG,MAAM,CAAC,yBAAyB,CAAC;AAC1D,QAAA,IAAA,CAAA,WAAW,GAAG,MAAM,CAAC,UAAU,CAAC;QAEzC,IAAA,CAAA,kBAAkB,GAAY,KAAK;QAGvC,IAAI,CAAC,sBAAsB,CAAC;AACvB,aAAA,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,WAAW,CAAC;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AAG,KAAK,CAAA,CAAE;QACrB;AAEA,QAAA,IAAI,KAAK,YAAY,IAAI,EAAE;AACvB,YAAA,OAAO,KAAK,CAAC,WAAW,EAAE;QAC9B;AAEA,QAAA,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC;IAChC;8GAzJS,eAAe,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;AAAf,IAAA,SAAA,IAAA,CAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,eAAe,cAFZ,MAAM,EAAA,CAAA,CAAA;;2FAET,eAAe,EAAA,UAAA,EAAA,CAAA;kBAH3B,UAAU;AAAC,YAAA,IAAA,EAAA,CAAA;AACR,oBAAA,UAAU,EAAE;AACf,iBAAA;;;ACVD;;AAEG;;;;"}
|
|
@@ -5,10 +5,6 @@ import { Observable } from 'rxjs';
|
|
|
5
5
|
import * as XLSX from 'xlsx';
|
|
6
6
|
|
|
7
7
|
class CmatExportAsService {
|
|
8
|
-
/**
|
|
9
|
-
* Main base64 get method, it will return the file as base64 string
|
|
10
|
-
* @param config your config
|
|
11
|
-
*/
|
|
12
8
|
get(config) {
|
|
13
9
|
switch (config.type.toUpperCase()) {
|
|
14
10
|
case 'CSV':
|
|
@@ -24,28 +20,16 @@ class CmatExportAsService {
|
|
|
24
20
|
case 'XML':
|
|
25
21
|
return this._getXML(config);
|
|
26
22
|
default:
|
|
27
|
-
return new Observable((observer) => { observer.error('
|
|
23
|
+
return new Observable((observer) => { observer.error('导出格式不支持。'); });
|
|
28
24
|
}
|
|
29
25
|
}
|
|
30
|
-
/**
|
|
31
|
-
* Save exported file in old javascript way
|
|
32
|
-
* @param config your custom config
|
|
33
|
-
* @param fileName Name of the file to be saved as
|
|
34
|
-
*/
|
|
35
26
|
save(config, fileName) {
|
|
36
|
-
// set download
|
|
37
27
|
config.download = true;
|
|
38
|
-
// get file name with type
|
|
39
28
|
config.fileName = fileName + '.' + config.type;
|
|
40
29
|
return this.get(config);
|
|
41
30
|
}
|
|
42
|
-
/**
|
|
43
|
-
* Converts content string to blob object
|
|
44
|
-
* @param content string to be converted
|
|
45
|
-
*/
|
|
46
31
|
contentToBlob(content) {
|
|
47
32
|
return new Observable((observer) => {
|
|
48
|
-
// get content string and extract mime type
|
|
49
33
|
const arr = content.split(','), mime = (/:(.*?);/.exec(arr[0]))?.[1], bstr = atob(arr[1]);
|
|
50
34
|
let n = bstr.length;
|
|
51
35
|
const u8arr = new Uint8Array(n);
|
|
@@ -56,27 +40,16 @@ class CmatExportAsService {
|
|
|
56
40
|
observer.complete();
|
|
57
41
|
});
|
|
58
42
|
}
|
|
59
|
-
/**
|
|
60
|
-
* Removes base64 file type from a string like "data:text/csv;base64,"
|
|
61
|
-
* @param fileContent the base64 string to remove the type from
|
|
62
|
-
*/
|
|
63
43
|
removeFileTypeFromBase64(fileContent) {
|
|
64
44
|
const re = /^data:[^]*;base64,/g;
|
|
65
45
|
const newContent = re[Symbol.replace](fileContent, '');
|
|
66
46
|
return newContent;
|
|
67
47
|
}
|
|
68
|
-
/**
|
|
69
|
-
* Structure the base64 file content with the file type string
|
|
70
|
-
* @param fileContent file content
|
|
71
|
-
* @param fileMime file mime type "text/csv"
|
|
72
|
-
*/
|
|
73
48
|
addFileTypeToBase64(fileContent, fileMime) {
|
|
74
49
|
return `data:${fileMime};base64,${fileContent}`;
|
|
75
50
|
}
|
|
76
51
|
downloadFromDataURL(fileName, dataURL) {
|
|
77
|
-
// create blob
|
|
78
52
|
this.contentToBlob(dataURL).subscribe((blob) => {
|
|
79
|
-
// download the blob
|
|
80
53
|
this.downloadFromBlob(blob, fileName);
|
|
81
54
|
});
|
|
82
55
|
}
|
|
@@ -141,7 +114,6 @@ class CmatExportAsService {
|
|
|
141
114
|
for (let index = 0; index < table.rows[0].cells.length; index++) {
|
|
142
115
|
headers[index] = table.rows[0].cells[index].innerHTML.toLowerCase().replace(/ /gi, '');
|
|
143
116
|
}
|
|
144
|
-
// go through cells
|
|
145
117
|
for (let i = 1; i < table.rows.length; i++) {
|
|
146
118
|
const tableRow = table.rows[i];
|
|
147
119
|
let rowData = {};
|
|
@@ -193,10 +165,10 @@ class CmatExportAsService {
|
|
|
193
165
|
_btoa(content) {
|
|
194
166
|
return Buffer.from(content.toString(), 'utf-8').toString('base64');
|
|
195
167
|
}
|
|
196
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.
|
|
197
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.
|
|
168
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: CmatExportAsService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
169
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: CmatExportAsService, providedIn: 'root' }); }
|
|
198
170
|
}
|
|
199
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.
|
|
171
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: CmatExportAsService, decorators: [{
|
|
200
172
|
type: Injectable,
|
|
201
173
|
args: [{
|
|
202
174
|
providedIn: 'root'
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cmat-services-export-as.mjs","sources":["../../../projects/cmat/services/export-as/export-as.service.ts","../../../projects/cmat/services/export-as/cmat-services-export-as.ts"],"sourcesContent":["import { Injectable } from '@angular/core';\r\nimport * as FileSaver from 'file-saver-es';\r\nimport { Observable } from 'rxjs';\r\nimport * as XLSX from 'xlsx';\r\nimport { ExportAsConfig } from './export-as-config.model';\r\n\r\n@Injectable({\r\n providedIn: 'root'\r\n})\r\nexport class CmatExportAsService {\r\n /**\r\n * Main base64 get method, it will return the file as base64 string\r\n * @param config your config\r\n */\r\n get(config: ExportAsConfig): Observable<any> {\r\n switch (config.type.toUpperCase()) {\r\n case 'CSV':\r\n return this._getCSV(config);\r\n case 'TXT':\r\n return this._getTXT(config);\r\n case 'XLS':\r\n return this._getXLS(config);\r\n case 'XLSX':\r\n return this._getXLSX(config);\r\n case 'JSON':\r\n return this._getJSON(config);\r\n case 'XML':\r\n return this._getXML(config);\r\n default:\r\n return new Observable((observer) => { observer.error('导出格式不支持.'); });\r\n }\r\n }\r\n\r\n /**\r\n * Save exported file in old javascript way\r\n * @param config your custom config\r\n * @param fileName Name of the file to be saved as\r\n */\r\n save(config: ExportAsConfig, fileName: string): Observable<string | null> {\r\n // set download\r\n config.download = true;\r\n // get file name with type\r\n config.fileName = fileName + '.' + config.type;\r\n return this.get(config);\r\n }\r\n\r\n /**\r\n * Converts content string to blob object\r\n * @param content string to be converted\r\n */\r\n contentToBlob(content: string): Observable<Blob> {\r\n return new Observable((observer) => {\r\n // get content string and extract mime type\r\n const arr = content.split(','), mime = (/:(.*?);/.exec(arr[0]))?.[1],\r\n bstr = atob(arr[1]);\r\n let n = bstr.length;\r\n const u8arr = new Uint8Array(n);\r\n while (n--) {\r\n u8arr[n] = bstr.charCodeAt(n);\r\n }\r\n observer.next(new Blob([u8arr], { type: mime }));\r\n observer.complete();\r\n });\r\n }\r\n\r\n /**\r\n * Removes base64 file type from a string like \"data:text/csv;base64,\"\r\n * @param fileContent the base64 string to remove the type from\r\n */\r\n removeFileTypeFromBase64(fileContent: string): string {\r\n const re = /^data:[^]*;base64,/g;\r\n const newContent: string = re[Symbol.replace](fileContent, '');\r\n return newContent;\r\n }\r\n\r\n /**\r\n * Structure the base64 file content with the file type string\r\n * @param fileContent file content\r\n * @param fileMime file mime type \"text/csv\"\r\n */\r\n addFileTypeToBase64(fileContent: string, fileMime: string): string {\r\n return `data:${fileMime};base64,${fileContent}`;\r\n }\r\n\r\n downloadFromDataURL(fileName: string, dataURL: string): void {\r\n // create blob\r\n this.contentToBlob(dataURL).subscribe((blob) => {\r\n // download the blob\r\n this.downloadFromBlob(blob, fileName);\r\n });\r\n }\r\n\r\n downloadFromBlob(blob: Blob, fileName: string): void {\r\n FileSaver.saveAs(blob, fileName);\r\n }\r\n\r\n private _getCSV(config: ExportAsConfig): Observable<string | null> {\r\n return new Observable((observer) => {\r\n const element: HTMLElement | null = document.getElementById(config.elementIdOrContent);\r\n let csv: string[] = [];\r\n const rows: any = element?.querySelectorAll('table tr');\r\n rows.forEach((rowElement: { querySelectorAll: (arg0: string) => any; }) => {\r\n let row: string[] = [];\r\n const cols = rowElement.querySelectorAll('td, th');\r\n\r\n cols.array.forEach((col: { innerText: string; }) => {\r\n row.push('\"' + col.innerText + '\"');\r\n });\r\n csv.push(row.join(','));\r\n });\r\n\r\n const csvContent = 'data:text/csv;base64,' + this._btoa(csv.join('\\n'));\r\n if (config.download) {\r\n this.downloadFromDataURL(config.fileName, csvContent);\r\n observer.next(null);\r\n } else {\r\n observer.next(csvContent);\r\n }\r\n observer.complete();\r\n });\r\n }\r\n\r\n private _getTXT(config: ExportAsConfig): Observable<string | null> {\r\n const nameFrags = config.fileName?.split('.');\r\n config.fileName = `${nameFrags?.[0]}.txt`;\r\n return this._getCSV(config);\r\n }\r\n\r\n private _getXLS(config: ExportAsConfig): Observable<string | null> {\r\n return new Observable((observer) => {\r\n const element: HTMLElement | null = document.getElementById(config.elementIdOrContent);\r\n const ws3 = XLSX.utils.table_to_sheet(element, config.options);\r\n const wb = XLSX.utils.book_new();\r\n XLSX.utils.book_append_sheet(wb, ws3, config.fileName);\r\n const out = XLSX.write(wb, { type: 'base64' });\r\n const xlsContent = 'data:application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;base64,' + out;\r\n if (config.download) {\r\n this.downloadFromDataURL(config.fileName, xlsContent);\r\n observer.next(null);\r\n } else {\r\n observer.next(xlsContent);\r\n }\r\n observer.complete();\r\n });\r\n }\r\n\r\n private _getXLSX(config: ExportAsConfig): Observable<string | null> {\r\n return this._getXLS(config);\r\n }\r\n\r\n\r\n private _getJSON(config: ExportAsConfig): Observable<any[] | null> {\r\n return new Observable((observer) => {\r\n const data = []; // first row needs fto be headers\r\n const headers = [];\r\n const table = document.getElementById(config.elementIdOrContent) as HTMLTableElement;\r\n for (let index = 0; index < table.rows[0].cells.length; index++) {\r\n headers[index] = table.rows[0].cells[index].innerHTML.toLowerCase().replace(/ /gi, '');\r\n }\r\n // go through cells\r\n for (let i = 1; i < table.rows.length; i++) {\r\n const tableRow = table.rows[i];\r\n let rowData: Record<string, string> = {};\r\n for (let j = 0; j < tableRow.cells.length; j++) {\r\n rowData[headers[j]] = tableRow.cells[j].innerHTML;\r\n }\r\n data.push(rowData);\r\n }\r\n const jsonString = JSON.stringify(data);\r\n const jsonBase64 = this._btoa(jsonString);\r\n const dataStr = 'data:text/json;base64,' + jsonBase64;\r\n if (config.download) {\r\n this.downloadFromDataURL(config.fileName, dataStr);\r\n observer.next(null);\r\n } else {\r\n observer.next(data);\r\n }\r\n observer.complete();\r\n });\r\n }\r\n\r\n private _getXML(config: ExportAsConfig): Observable<string | null> {\r\n return new Observable((observer) => {\r\n let xml = '<?xml version=\"1.0\" encoding=\"UTF-8\"?><Root><Classes>';\r\n const tritem = document.getElementById(config.elementIdOrContent)?.getElementsByTagName('tr');\r\n\r\n if (tritem) {\r\n Array.from(tritem).forEach((celldata) => {\r\n if (celldata.cells.length > 0) {\r\n xml += '<Class name=\"' + celldata.cells[0].textContent + '\">\\n';\r\n for (let m = 1; m < celldata.cells.length; ++m) {\r\n xml += '\\t<data>' + celldata.cells[m].textContent + '</data>\\n';\r\n }\r\n xml += '</Class>\\n';\r\n }\r\n });\r\n\r\n }\r\n\r\n xml += '</Classes></Root>';\r\n const base64 = 'data:text/xml;base64,' + this._btoa(xml);\r\n if (config.download) {\r\n this.downloadFromDataURL(config.fileName, base64);\r\n observer.next(null);\r\n } else {\r\n observer.next(base64);\r\n }\r\n observer.complete();\r\n });\r\n }\r\n\r\n private _btoa(content: string): string {\r\n return Buffer.from(content.toString(), 'utf-8').toString('base64')\r\n }\r\n\r\n}\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;MASa,mBAAmB,CAAA;AAC5B;;;AAGG;AACH,IAAA,GAAG,CAAC,MAAsB,EAAA;AACtB,QAAA,QAAQ,MAAM,CAAC,IAAI,CAAC,WAAW,EAAE;AAC7B,YAAA,KAAK,KAAK;AACN,gBAAA,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC;AAC/B,YAAA,KAAK,KAAK;AACN,gBAAA,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC;AAC/B,YAAA,KAAK,KAAK;AACN,gBAAA,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC;AAC/B,YAAA,KAAK,MAAM;AACP,gBAAA,OAAO,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC;AAChC,YAAA,KAAK,MAAM;AACP,gBAAA,OAAO,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC;AAChC,YAAA,KAAK,KAAK;AACN,gBAAA,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC;AAC/B,YAAA;AACI,gBAAA,OAAO,IAAI,UAAU,CAAC,CAAC,QAAQ,KAAI,EAAG,QAAQ,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC;;IAEhF;AAEA;;;;AAIG;IACH,IAAI,CAAC,MAAsB,EAAE,QAAgB,EAAA;;AAEzC,QAAA,MAAM,CAAC,QAAQ,GAAG,IAAI;;QAEtB,MAAM,CAAC,QAAQ,GAAG,QAAQ,GAAG,GAAG,GAAG,MAAM,CAAC,IAAI;AAC9C,QAAA,OAAO,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC;IAC3B;AAEA;;;AAGG;AACH,IAAA,aAAa,CAAC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A,IAAI,MAAM,CAAC,QAAQ,EAAE;gBACjB,IAAI,CAAC,mBAAmB,CAAC,MAAM,CAAC,QAAQ,EAAE,MAAM,CAAC;AACjD,gBAAA,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC;YACvB;iBAAO;AACH,gBAAA,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC;YACzB;YACA,QAAQ,CAAC,QAAQ,EAAE;AACvB,QAAA,CAAC,CAAC;IACN;AAEQ,IAAA,KAAK,CAAC,OAAe,EAAA;AACzB,QAAA,OAAO,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,EAAE,OAAO,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC;IACtE;8GA5MS,mBAAmB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;AAAnB,IAAA,SAAA,IAAA,CAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,mBAAmB,cAFhB,MAAM,EAAA,CAAA,CAAA;;2FAET,mBAAmB,EAAA,UAAA,EAAA,CAAA;kBAH/B,UAAU;AAAC,YAAA,IAAA,EAAA,CAAA;AACR,oBAAA,UAAU,EAAE;AACf,iBAAA;;;ACRD;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"cmat-services-export-as.mjs","sources":["../../../projects/cmat/services/export-as/export-as.service.ts","../../../projects/cmat/services/export-as/cmat-services-export-as.ts"],"sourcesContent":["import { Injectable } from '@angular/core';\r\nimport * as FileSaver from 'file-saver-es';\r\nimport { Observable } from 'rxjs';\r\nimport * as XLSX from 'xlsx';\r\nimport { ExportAsConfig } from './export-as-config.model';\r\n\r\n@Injectable({\r\n providedIn: 'root'\r\n})\r\nexport class CmatExportAsService {\r\n \r\n get(config: ExportAsConfig): Observable<any> {\r\n switch (config.type.toUpperCase()) {\r\n case 'CSV':\r\n return this._getCSV(config);\r\n case 'TXT':\r\n return this._getTXT(config);\r\n case 'XLS':\r\n return this._getXLS(config);\r\n case 'XLSX':\r\n return this._getXLSX(config);\r\n case 'JSON':\r\n return this._getJSON(config);\r\n case 'XML':\r\n return this._getXML(config);\r\n default:\r\n return new Observable((observer) => { observer.error('导出格式不支持。'); });\r\n }\r\n }\r\n\r\n \r\n save(config: ExportAsConfig, fileName: string): Observable<string | null> {\r\n config.download = true;\r\n config.fileName = fileName + '.' + config.type;\r\n return this.get(config);\r\n }\r\n\r\n \r\n contentToBlob(content: string): Observable<Blob> {\r\n return new Observable((observer) => {\r\n const arr = content.split(','), mime = (/:(.*?);/.exec(arr[0]))?.[1],\r\n bstr = atob(arr[1]);\r\n let n = bstr.length;\r\n const u8arr = new Uint8Array(n);\r\n while (n--) {\r\n u8arr[n] = bstr.charCodeAt(n);\r\n }\r\n observer.next(new Blob([u8arr], { type: mime }));\r\n observer.complete();\r\n });\r\n }\r\n\r\n \r\n removeFileTypeFromBase64(fileContent: string): string {\r\n const re = /^data:[^]*;base64,/g;\r\n const newContent: string = re[Symbol.replace](fileContent, '');\r\n return newContent;\r\n }\r\n\r\n \r\n addFileTypeToBase64(fileContent: string, fileMime: string): string {\r\n return `data:${fileMime};base64,${fileContent}`;\r\n }\r\n\r\n downloadFromDataURL(fileName: string, dataURL: string): void {\r\n this.contentToBlob(dataURL).subscribe((blob) => {\r\n this.downloadFromBlob(blob, fileName);\r\n });\r\n }\r\n\r\n downloadFromBlob(blob: Blob, fileName: string): void {\r\n FileSaver.saveAs(blob, fileName);\r\n }\r\n\r\n private _getCSV(config: ExportAsConfig): Observable<string | null> {\r\n return new Observable((observer) => {\r\n const element: HTMLElement | null = document.getElementById(config.elementIdOrContent);\r\n let csv: string[] = [];\r\n const rows: any = element?.querySelectorAll('table tr');\r\n rows.forEach((rowElement: { querySelectorAll: (arg0: string) => any; }) => {\r\n let row: string[] = [];\r\n const cols = rowElement.querySelectorAll('td, th');\r\n\r\n cols.array.forEach((col: { innerText: string; }) => {\r\n row.push('\"' + col.innerText + '\"');\r\n });\r\n csv.push(row.join(','));\r\n });\r\n\r\n const csvContent = 'data:text/csv;base64,' + this._btoa(csv.join('\\n'));\r\n if (config.download) {\r\n this.downloadFromDataURL(config.fileName, csvContent);\r\n observer.next(null);\r\n } else {\r\n observer.next(csvContent);\r\n }\r\n observer.complete();\r\n });\r\n }\r\n\r\n private _getTXT(config: ExportAsConfig): Observable<string | null> {\r\n const nameFrags = config.fileName?.split('.');\r\n config.fileName = `${nameFrags?.[0]}.txt`;\r\n return this._getCSV(config);\r\n }\r\n\r\n private _getXLS(config: ExportAsConfig): Observable<string | null> {\r\n return new Observable((observer) => {\r\n const element: HTMLElement | null = document.getElementById(config.elementIdOrContent);\r\n const ws3 = XLSX.utils.table_to_sheet(element, config.options);\r\n const wb = XLSX.utils.book_new();\r\n XLSX.utils.book_append_sheet(wb, ws3, config.fileName);\r\n const out = XLSX.write(wb, { type: 'base64' });\r\n const xlsContent = 'data:application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;base64,' + out;\r\n if (config.download) {\r\n this.downloadFromDataURL(config.fileName, xlsContent);\r\n observer.next(null);\r\n } else {\r\n observer.next(xlsContent);\r\n }\r\n observer.complete();\r\n });\r\n }\r\n\r\n private _getXLSX(config: ExportAsConfig): Observable<string | null> {\r\n return this._getXLS(config);\r\n }\r\n\r\n\r\n private _getJSON(config: ExportAsConfig): Observable<any[] | null> {\r\n return new Observable((observer) => {\r\n const data = []; // first row needs fto be headers\r\n const headers = [];\r\n const table = document.getElementById(config.elementIdOrContent) as HTMLTableElement;\r\n for (let index = 0; index < table.rows[0].cells.length; index++) {\r\n headers[index] = table.rows[0].cells[index].innerHTML.toLowerCase().replace(/ /gi, '');\r\n }\r\n for (let i = 1; i < table.rows.length; i++) {\r\n const tableRow = table.rows[i];\r\n let rowData: Record<string, string> = {};\r\n for (let j = 0; j < tableRow.cells.length; j++) {\r\n rowData[headers[j]] = tableRow.cells[j].innerHTML;\r\n }\r\n data.push(rowData);\r\n }\r\n const jsonString = JSON.stringify(data);\r\n const jsonBase64 = this._btoa(jsonString);\r\n const dataStr = 'data:text/json;base64,' + jsonBase64;\r\n if (config.download) {\r\n this.downloadFromDataURL(config.fileName, dataStr);\r\n observer.next(null);\r\n } else {\r\n observer.next(data);\r\n }\r\n observer.complete();\r\n });\r\n }\r\n\r\n private _getXML(config: ExportAsConfig): Observable<string | null> {\r\n return new Observable((observer) => {\r\n let xml = '<?xml version=\"1.0\" encoding=\"UTF-8\"?><Root><Classes>';\r\n const tritem = document.getElementById(config.elementIdOrContent)?.getElementsByTagName('tr');\r\n\r\n if (tritem) {\r\n Array.from(tritem).forEach((celldata) => {\r\n if (celldata.cells.length > 0) {\r\n xml += '<Class name=\"' + celldata.cells[0].textContent + '\">\\n';\r\n for (let m = 1; m < celldata.cells.length; ++m) {\r\n xml += '\\t<data>' + celldata.cells[m].textContent + '</data>\\n';\r\n }\r\n xml += '</Class>\\n';\r\n }\r\n });\r\n\r\n }\r\n\r\n xml += '</Classes></Root>';\r\n const base64 = 'data:text/xml;base64,' + this._btoa(xml);\r\n if (config.download) {\r\n this.downloadFromDataURL(config.fileName, base64);\r\n observer.next(null);\r\n } else {\r\n observer.next(base64);\r\n }\r\n observer.complete();\r\n });\r\n }\r\n\r\n private _btoa(content: string): string {\r\n return Buffer.from(content.toString(), 'utf-8').toString('base64')\r\n }\r\n\r\n}\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;MASa,mBAAmB,CAAA;AAE5B,IAAA,GAAG,CAAC,MAAsB,EAAA;AACtB,QAAA,QAAQ,MAAM,CAAC,IAAI,CAAC,WAAW,EAAE;AAC7B,YAAA,KAAK,KAAK;AACN,gBAAA,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC;AAC/B,YAAA,KAAK,KAAK;AACN,gBAAA,OA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