cmat 0.0.111 → 0.0.112
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/fesm2022/cmat-components-adapter.mjs +531 -536
- package/fesm2022/cmat-components-adapter.mjs.map +1 -1
- package/fesm2022/cmat-components-breadcrumb.mjs +521 -356
- package/fesm2022/cmat-components-breadcrumb.mjs.map +1 -1
- package/fesm2022/cmat-components-card.mjs +150 -42
- package/fesm2022/cmat-components-card.mjs.map +1 -1
- package/fesm2022/cmat-components-carousel.mjs +1120 -629
- package/fesm2022/cmat-components-carousel.mjs.map +1 -1
- package/fesm2022/cmat-components-cascade.mjs +861 -441
- package/fesm2022/cmat-components-cascade.mjs.map +1 -1
- package/fesm2022/cmat-components-chip-input.mjs +580 -335
- package/fesm2022/cmat-components-chip-input.mjs.map +1 -1
- package/fesm2022/cmat-components-code-editor.mjs +197 -105
- package/fesm2022/cmat-components-code-editor.mjs.map +1 -1
- package/fesm2022/cmat-components-color-picker.mjs +1762 -825
- package/fesm2022/cmat-components-color-picker.mjs.map +1 -1
- package/fesm2022/cmat-components-custom-formly.mjs +5196 -2531
- package/fesm2022/cmat-components-custom-formly.mjs.map +1 -1
- package/fesm2022/cmat-components-data-picker.mjs +1901 -1073
- package/fesm2022/cmat-components-data-picker.mjs.map +1 -1
- package/fesm2022/cmat-components-date-range.mjs +701 -456
- package/fesm2022/cmat-components-date-range.mjs.map +1 -1
- package/fesm2022/cmat-components-date-time-display.mjs +137 -30
- package/fesm2022/cmat-components-date-time-display.mjs.map +1 -1
- package/fesm2022/cmat-components-drawer.mjs +410 -258
- package/fesm2022/cmat-components-drawer.mjs.map +1 -1
- package/fesm2022/cmat-components-empty-state.mjs +201 -41
- package/fesm2022/cmat-components-empty-state.mjs.map +1 -1
- package/fesm2022/cmat-components-file-preview.mjs +198 -35
- package/fesm2022/cmat-components-file-preview.mjs.map +1 -1
- package/fesm2022/cmat-components-filter-toolbar.mjs +320 -72
- package/fesm2022/cmat-components-filter-toolbar.mjs.map +1 -1
- package/fesm2022/cmat-components-form-actions.mjs +102 -26
- package/fesm2022/cmat-components-form-actions.mjs.map +1 -1
- package/fesm2022/cmat-components-fullscreen.mjs +167 -47
- package/fesm2022/cmat-components-fullscreen.mjs.map +1 -1
- package/fesm2022/cmat-components-highlight.mjs +203 -112
- package/fesm2022/cmat-components-highlight.mjs.map +1 -1
- package/fesm2022/cmat-components-image-viewer.mjs +489 -215
- package/fesm2022/cmat-components-image-viewer.mjs.map +1 -1
- package/fesm2022/cmat-components-inline-loading.mjs +117 -27
- package/fesm2022/cmat-components-inline-loading.mjs.map +1 -1
- package/fesm2022/cmat-components-json-editor.mjs +276 -230
- package/fesm2022/cmat-components-json-editor.mjs.map +1 -1
- package/fesm2022/cmat-components-knob-input.mjs +615 -420
- package/fesm2022/cmat-components-knob-input.mjs.map +1 -1
- package/fesm2022/cmat-components-loading-overlay.mjs +53 -25
- package/fesm2022/cmat-components-loading-overlay.mjs.map +1 -1
- package/fesm2022/cmat-components-masonry.mjs +120 -40
- package/fesm2022/cmat-components-masonry.mjs.map +1 -1
- package/fesm2022/cmat-components-material-color-picker.mjs +332 -155
- package/fesm2022/cmat-components-material-color-picker.mjs.map +1 -1
- package/fesm2022/cmat-components-material-datetimepicker.mjs +4283 -2504
- package/fesm2022/cmat-components-material-datetimepicker.mjs.map +1 -1
- package/fesm2022/cmat-components-navigation.mjs +3080 -1404
- package/fesm2022/cmat-components-navigation.mjs.map +1 -1
- package/fesm2022/cmat-components-opt-input.mjs +540 -466
- package/fesm2022/cmat-components-opt-input.mjs.map +1 -1
- package/fesm2022/cmat-components-org-chart.mjs +528 -125
- package/fesm2022/cmat-components-org-chart.mjs.map +1 -1
- package/fesm2022/cmat-components-page-header.mjs +141 -32
- package/fesm2022/cmat-components-page-header.mjs.map +1 -1
- package/fesm2022/cmat-components-pagination.mjs +866 -534
- package/fesm2022/cmat-components-pagination.mjs.map +1 -1
- package/fesm2022/cmat-components-password-strength.mjs +873 -434
- package/fesm2022/cmat-components-password-strength.mjs.map +1 -1
- package/fesm2022/cmat-components-popover.mjs +1012 -731
- package/fesm2022/cmat-components-popover.mjs.map +1 -1
- package/fesm2022/cmat-components-progress-bar.mjs +98 -35
- package/fesm2022/cmat-components-progress-bar.mjs.map +1 -1
- package/fesm2022/cmat-components-qrcode.mjs +463 -287
- package/fesm2022/cmat-components-qrcode.mjs.map +1 -1
- package/fesm2022/cmat-components-rating.mjs +377 -203
- package/fesm2022/cmat-components-rating.mjs.map +1 -1
- package/fesm2022/cmat-components-rich-text-editor.mjs +153 -39
- package/fesm2022/cmat-components-rich-text-editor.mjs.map +1 -1
- package/fesm2022/cmat-components-select-search.mjs +926 -496
- package/fesm2022/cmat-components-select-search.mjs.map +1 -1
- package/fesm2022/cmat-components-select-table.mjs +1280 -842
- package/fesm2022/cmat-components-select-table.mjs.map +1 -1
- package/fesm2022/cmat-components-select-tree.mjs +998 -690
- package/fesm2022/cmat-components-select-tree.mjs.map +1 -1
- package/fesm2022/cmat-components-skeleton.mjs +143 -57
- package/fesm2022/cmat-components-skeleton.mjs.map +1 -1
- package/fesm2022/cmat-components-speed-dial.mjs +457 -303
- package/fesm2022/cmat-components-speed-dial.mjs.map +1 -1
- package/fesm2022/cmat-components-status-tag.mjs +136 -44
- package/fesm2022/cmat-components-status-tag.mjs.map +1 -1
- package/fesm2022/cmat-components-table-toolbar.mjs +120 -28
- package/fesm2022/cmat-components-table-toolbar.mjs.map +1 -1
- package/fesm2022/cmat-components-timeline.mjs +464 -168
- package/fesm2022/cmat-components-timeline.mjs.map +1 -1
- package/fesm2022/cmat-components-toast.mjs +346 -262
- package/fesm2022/cmat-components-toast.mjs.map +1 -1
- package/fesm2022/cmat-components-transfer-picker.mjs +1427 -593
- package/fesm2022/cmat-components-transfer-picker.mjs.map +1 -1
- package/fesm2022/cmat-components-treetable.mjs +372 -112
- package/fesm2022/cmat-components-treetable.mjs.map +1 -1
- package/fesm2022/cmat-components-upload.mjs +904 -410
- package/fesm2022/cmat-components-upload.mjs.map +1 -1
- package/fesm2022/cmat-components-x6-angular-shape.mjs +153 -170
- package/fesm2022/cmat-components-x6-angular-shape.mjs.map +1 -1
- package/fesm2022/cmat-directives-animate-on-scroll.mjs +220 -138
- package/fesm2022/cmat-directives-animate-on-scroll.mjs.map +1 -1
- package/fesm2022/cmat-directives-arrow-cursor.mjs +246 -193
- package/fesm2022/cmat-directives-arrow-cursor.mjs.map +1 -1
- package/fesm2022/cmat-directives-autofocus.mjs +43 -25
- package/fesm2022/cmat-directives-autofocus.mjs.map +1 -1
- package/fesm2022/cmat-directives-data-exporter.mjs +537 -338
- package/fesm2022/cmat-directives-data-exporter.mjs.map +1 -1
- package/fesm2022/cmat-directives-debounce.mjs +162 -76
- package/fesm2022/cmat-directives-debounce.mjs.map +1 -1
- package/fesm2022/cmat-directives-digit-only.mjs +457 -356
- package/fesm2022/cmat-directives-digit-only.mjs.map +1 -1
- package/fesm2022/cmat-directives-equal-validator.mjs +70 -53
- package/fesm2022/cmat-directives-equal-validator.mjs.map +1 -1
- package/fesm2022/cmat-directives-seamless-auto-scroll.mjs +180 -132
- package/fesm2022/cmat-directives-seamless-auto-scroll.mjs.map +1 -1
- package/fesm2022/cmat-lib-mock-api.mjs +207 -195
- package/fesm2022/cmat-lib-mock-api.mjs.map +1 -1
- package/fesm2022/cmat-pipes-bytes.mjs +50 -30
- package/fesm2022/cmat-pipes-bytes.mjs.map +1 -1
- package/fesm2022/cmat-pipes-date-format.mjs +41 -25
- package/fesm2022/cmat-pipes-date-format.mjs.map +1 -1
- package/fesm2022/cmat-pipes-find-by-key.mjs +44 -26
- package/fesm2022/cmat-pipes-find-by-key.mjs.map +1 -1
- package/fesm2022/cmat-pipes-group-by.mjs +50 -38
- package/fesm2022/cmat-pipes-group-by.mjs.map +1 -1
- package/fesm2022/cmat-pipes-keys.mjs +44 -31
- package/fesm2022/cmat-pipes-keys.mjs.map +1 -1
- package/fesm2022/cmat-pipes-secure.mjs +60 -49
- package/fesm2022/cmat-pipes-secure.mjs.map +1 -1
- package/fesm2022/cmat-pipes-uppercase.mjs +39 -22
- package/fesm2022/cmat-pipes-uppercase.mjs.map +1 -1
- package/fesm2022/cmat-reports.mjs +2751 -0
- package/fesm2022/cmat-reports.mjs.map +1 -0
- package/fesm2022/cmat-services-alert.mjs +249 -277
- package/fesm2022/cmat-services-alert.mjs.map +1 -1
- package/fesm2022/cmat-services-config.mjs +110 -81
- package/fesm2022/cmat-services-config.mjs.map +1 -1
- package/fesm2022/cmat-services-confirmation.mjs +184 -73
- package/fesm2022/cmat-services-confirmation.mjs.map +1 -1
- package/fesm2022/cmat-services-data.mjs +136 -125
- package/fesm2022/cmat-services-data.mjs.map +1 -1
- package/fesm2022/cmat-services-export-as.mjs +165 -183
- package/fesm2022/cmat-services-export-as.mjs.map +1 -1
- package/fesm2022/cmat-services-loading.mjs +116 -95
- package/fesm2022/cmat-services-loading.mjs.map +1 -1
- package/fesm2022/cmat-services-local-storage.mjs +75 -66
- package/fesm2022/cmat-services-local-storage.mjs.map +1 -1
- package/fesm2022/cmat-services-media-watcher.mjs +69 -64
- package/fesm2022/cmat-services-media-watcher.mjs.map +1 -1
- package/fesm2022/cmat-services-platform.mjs +48 -45
- package/fesm2022/cmat-services-platform.mjs.map +1 -1
- package/fesm2022/cmat-services-print.mjs +984 -1109
- package/fesm2022/cmat-services-print.mjs.map +1 -1
- package/fesm2022/cmat-services-splash-screen.mjs +53 -38
- package/fesm2022/cmat-services-splash-screen.mjs.map +1 -1
- package/fesm2022/cmat-services-title.mjs +57 -47
- package/fesm2022/cmat-services-title.mjs.map +1 -1
- package/fesm2022/cmat-services-translation.mjs +79 -68
- package/fesm2022/cmat-services-translation.mjs.map +1 -1
- package/fesm2022/cmat-services-utils.mjs +424 -517
- package/fesm2022/cmat-services-utils.mjs.map +1 -1
- package/fesm2022/cmat-validators.mjs +23 -33
- package/fesm2022/cmat-validators.mjs.map +1 -1
- package/fesm2022/cmat-version.mjs +12 -16
- package/fesm2022/cmat-version.mjs.map +1 -1
- package/fesm2022/cmat.mjs +39805 -22511
- package/fesm2022/cmat.mjs.map +1 -1
- package/package.json +5 -1
- package/types/cmat-components-adapter.d.ts +145 -156
- package/types/cmat-components-breadcrumb.d.ts +108 -86
- package/types/cmat-components-card.d.ts +34 -18
- package/types/cmat-components-carousel.d.ts +251 -134
- package/types/cmat-components-cascade.d.ts +158 -117
- package/types/cmat-components-chip-input.d.ts +105 -71
- package/types/cmat-components-code-editor.d.ts +59 -34
- package/types/cmat-components-color-picker.d.ts +378 -236
- package/types/cmat-components-custom-formly.d.ts +776 -814
- package/types/cmat-components-data-picker.d.ts +502 -360
- package/types/cmat-components-date-range.d.ts +106 -77
- package/types/cmat-components-date-time-display.d.ts +36 -13
- package/types/cmat-components-drawer.d.ts +91 -61
- package/types/cmat-components-empty-state.d.ts +47 -17
- package/types/cmat-components-file-preview.d.ts +42 -14
- package/types/cmat-components-filter-toolbar.d.ts +57 -25
- package/types/cmat-components-form-actions.d.ts +18 -10
- package/types/cmat-components-fullscreen.d.ts +21 -13
- package/types/cmat-components-highlight.d.ts +33 -26
- package/types/cmat-components-image-viewer.d.ts +119 -58
- package/types/cmat-components-inline-loading.d.ts +24 -11
- package/types/cmat-components-json-editor.d.ts +39 -28
- package/types/cmat-components-knob-input.d.ts +172 -101
- package/types/cmat-components-loading-overlay.d.ts +8 -11
- package/types/cmat-components-masonry.d.ts +27 -14
- package/types/cmat-components-material-color-picker.d.ts +56 -42
- package/types/cmat-components-material-datetimepicker.d.ts +817 -454
- package/types/cmat-components-navigation.d.ts +295 -221
- package/types/cmat-components-opt-input.d.ts +111 -90
- package/types/cmat-components-org-chart.d.ts +53 -35
- package/types/cmat-components-page-header.d.ts +37 -14
- package/types/cmat-components-pagination.d.ts +144 -107
- package/types/cmat-components-password-strength.d.ts +197 -86
- package/types/cmat-components-popover.d.ts +264 -166
- package/types/cmat-components-progress-bar.d.ts +17 -14
- package/types/cmat-components-qrcode.d.ts +111 -42
- package/types/cmat-components-rating.d.ts +105 -59
- package/types/cmat-components-rich-text-editor.d.ts +39 -16
- package/types/cmat-components-select-search.d.ts +195 -99
- package/types/cmat-components-select-table.d.ts +241 -142
- package/types/cmat-components-select-tree.d.ts +185 -118
- package/types/cmat-components-skeleton.d.ts +55 -32
- package/types/cmat-components-speed-dial.d.ts +86 -61
- package/types/cmat-components-status-tag.d.ts +42 -24
- package/types/cmat-components-table-toolbar.d.ts +30 -12
- package/types/cmat-components-timeline.d.ts +83 -51
- package/types/cmat-components-toast.d.ts +84 -85
- package/types/cmat-components-transfer-picker.d.ts +228 -181
- package/types/cmat-components-treetable.d.ts +63 -39
- package/types/cmat-components-upload.d.ts +205 -106
- package/types/cmat-components-x6-angular-shape.d.ts +29 -37
- package/types/cmat-directives-animate-on-scroll.d.ts +48 -30
- package/types/cmat-directives-arrow-cursor.d.ts +55 -35
- package/types/cmat-directives-autofocus.d.ts +8 -11
- package/types/cmat-directives-data-exporter.d.ts +71 -40
- package/types/cmat-directives-debounce.d.ts +31 -28
- package/types/cmat-directives-digit-only.d.ts +90 -53
- package/types/cmat-directives-equal-validator.d.ts +11 -14
- package/types/cmat-directives-seamless-auto-scroll.d.ts +42 -29
- package/types/cmat-lib-mock-api.d.ts +46 -55
- package/types/cmat-pipes-bytes.d.ts +7 -10
- package/types/cmat-pipes-date-format.d.ts +7 -10
- package/types/cmat-pipes-find-by-key.d.ts +8 -12
- package/types/cmat-pipes-group-by.d.ts +11 -15
- package/types/cmat-pipes-keys.d.ts +10 -13
- package/types/cmat-pipes-secure.d.ts +14 -17
- package/types/cmat-pipes-uppercase.d.ts +7 -10
- package/types/cmat-reports.d.ts +1131 -0
- package/types/cmat-services-alert.d.ts +80 -87
- package/types/cmat-services-config.d.ts +37 -43
- package/types/cmat-services-confirmation.d.ts +31 -37
- package/types/cmat-services-data.d.ts +18 -21
- package/types/cmat-services-export-as.d.ts +28 -33
- package/types/cmat-services-loading.d.ts +27 -31
- package/types/cmat-services-local-storage.d.ts +17 -21
- package/types/cmat-services-media-watcher.d.ts +14 -18
- package/types/cmat-services-platform.d.ts +8 -11
- package/types/cmat-services-print.d.ts +97 -102
- package/types/cmat-services-splash-screen.d.ts +11 -14
- package/types/cmat-services-title.d.ts +9 -12
- package/types/cmat-services-translation.d.ts +19 -22
- package/types/cmat-services-utils.d.ts +76 -80
- package/types/cmat-validators.d.ts +5 -8
- package/types/cmat-version.d.ts +8 -10
- package/types/cmat.d.ts +7551 -5204
|
@@ -1,1117 +1,992 @@
|
|
|
1
|
-
import * as i0 from
|
|
2
|
-
import { Injectable } from
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
import { Injectable } from "@angular/core";
|
|
3
|
+
const PRINT_OVERRIDE_CSS = `
|
|
4
|
+
@page { size: A4 var(--orientation); margin: var(--margins); }
|
|
3
5
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
.cmat-print-body
|
|
42
|
-
break-inside: auto !important;
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
.cmat-print-body .
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
}
|
|
66
|
-
.cmat-print-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
.cmat-print-body
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
.cmat-print-body .
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
display: none !important;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
.
|
|
113
|
-
.
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
.cmat-print-body
|
|
117
|
-
.cmat-print-body .mat-mdc-
|
|
118
|
-
.cmat-print-body .mat-mdc-
|
|
119
|
-
.cmat-print-body
|
|
120
|
-
.cmat-print-body
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
}
|
|
132
|
-
.mat-mdc-table:not(.normal-mobile-table)
|
|
133
|
-
display: table-row !important;
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
.
|
|
167
|
-
|
|
168
|
-
}
|
|
169
|
-
/*
|
|
170
|
-
.
|
|
171
|
-
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
.cmat-print-body
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
align-items: center !important;
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
align-items: center !important;
|
|
244
|
-
|
|
245
|
-
.mat-mdc-chip-action{
|
|
246
|
-
padding-right:12px !important;
|
|
247
|
-
}
|
|
248
|
-
}
|
|
249
|
-
/* 隐藏 chip 内的输入框和自动补全 */
|
|
250
|
-
.cmat-print-body .mat-mdc-chip-grid input {
|
|
251
|
-
display: none !important;
|
|
252
|
-
}
|
|
253
|
-
.cmat-print-body .mat-mdc-autocomplete {
|
|
254
|
-
display: none !important;
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
/* Color Picker:确保色块按钮的 ::after 伪元素背景色被打印 */
|
|
258
|
-
.cmat-print-body .mat-mdc-form-field-icon-prefix button {
|
|
259
|
-
overflow: visible !important;
|
|
260
|
-
padding: 4px !important;
|
|
261
|
-
width: 32px !important;
|
|
262
|
-
height: 32px !important;
|
|
263
|
-
min-width: 32px !important;
|
|
264
|
-
min-height: 32px !important;
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
/* 通用:防止 overflow-hidden 裁切 border */
|
|
268
|
-
.cmat-print-body .overflow-hidden {
|
|
269
|
-
overflow: visible !important;
|
|
270
|
-
}
|
|
271
|
-
|
|
272
|
-
/* ─── 容器类型打印适配 ─── */
|
|
273
|
-
|
|
274
|
-
/* Tabs:展开所有标签页内容,隐藏标签导航 */
|
|
275
|
-
.cmat-print-body .mat-mdc-tab-header {
|
|
276
|
-
display: none !important;
|
|
277
|
-
}
|
|
278
|
-
.cmat-print-body .mat-mdc-tab-body-wrapper {
|
|
279
|
-
overflow: visible !important;
|
|
280
|
-
height: auto !important;
|
|
281
|
-
}
|
|
282
|
-
.cmat-print-body .mat-mdc-tab-body {
|
|
283
|
-
display: block !important;
|
|
284
|
-
visibility: visible !important;
|
|
285
|
-
opacity: 1 !important;
|
|
286
|
-
height: auto !important;
|
|
287
|
-
border-bottom: 1px dashed #ccc;
|
|
288
|
-
padding-bottom: 12px;
|
|
289
|
-
margin-bottom: 12px;
|
|
290
|
-
}
|
|
291
|
-
/* 在 tab body 前显示标签名 */
|
|
292
|
-
.cmat-print-body .mat-mdc-tab-body::before {
|
|
293
|
-
content: attr(aria-label);
|
|
294
|
-
display: block;
|
|
295
|
-
font-weight: 600;
|
|
296
|
-
font-size: 1.1em;
|
|
297
|
-
margin-bottom: 8px;
|
|
298
|
-
color: #333;
|
|
299
|
-
}
|
|
300
|
-
|
|
301
|
-
/* Stepper:展开所有步骤,隐藏导航按钮 */
|
|
302
|
-
.cmat-print-body .mat-horizontal-stepper-header-container {
|
|
303
|
-
display: none !important;
|
|
304
|
-
}
|
|
305
|
-
.cmat-print-body .mat-stepper-horizontal-line {
|
|
306
|
-
display: none !important;
|
|
307
|
-
}
|
|
308
|
-
.cmat-print-body .mat-step {
|
|
309
|
-
display: block !important;
|
|
310
|
-
visibility: visible !important;
|
|
311
|
-
opacity: 1 !important;
|
|
312
|
-
height: auto !important;
|
|
313
|
-
overflow: visible !important;
|
|
314
|
-
margin-bottom: 16px;
|
|
315
|
-
padding-bottom: 12px;
|
|
316
|
-
border-bottom: 1px dashed #ccc;
|
|
317
|
-
}
|
|
318
|
-
/* 显示步骤标签 */
|
|
319
|
-
.cmat-print-body .mat-step-label {
|
|
320
|
-
display: block !important;
|
|
321
|
-
font-weight: 600;
|
|
322
|
-
font-size: 1.1em;
|
|
323
|
-
margin-bottom: 8px;
|
|
324
|
-
color: #333;
|
|
325
|
-
}
|
|
326
|
-
|
|
327
|
-
/* Expansion:强制展开面板 */
|
|
328
|
-
.cmat-print-body .mat-expansion-panel {
|
|
329
|
-
break-inside: avoid;
|
|
330
|
-
margin-bottom: 8px;
|
|
331
|
-
}
|
|
332
|
-
.cmat-print-body .mat-expansion-panel-content {
|
|
333
|
-
height: auto !important;
|
|
334
|
-
visibility: visible !important;
|
|
335
|
-
opacity: 1 !important;
|
|
336
|
-
overflow: visible !important;
|
|
337
|
-
display: block !important;
|
|
338
|
-
}
|
|
339
|
-
|
|
340
|
-
/* ─── 报表组件打印适配 ─── */
|
|
341
|
-
|
|
342
|
-
/* 报表渲染器组件宿主:Angular 自定义元素默认 display:inline,需强制 block + 100% 宽度以填满网格单元格 */
|
|
343
|
-
.cmat-print-body app-chart-renderer,
|
|
344
|
-
.cmat-print-body app-table-renderer,
|
|
345
|
-
.cmat-print-body app-text-renderer {
|
|
346
|
-
display: block !important;
|
|
347
|
-
width: 100% !important;
|
|
348
|
-
min-width: 0 !important;
|
|
349
|
-
box-sizing: border-box !important;
|
|
350
|
-
}
|
|
351
|
-
|
|
352
|
-
/* 报表主容器:解除滚动容器的固定高度约束 + 阻止 flex 拉伸 */
|
|
353
|
-
.cmat-print-body > main,
|
|
354
|
-
.cmat-print-body .overflow-y-auto,
|
|
355
|
-
.cmat-print-body .overflow-auto {
|
|
356
|
-
overflow: visible !important;
|
|
357
|
-
height: auto !important;
|
|
358
|
-
min-height: 0 !important;
|
|
359
|
-
max-height: none !important;
|
|
360
|
-
flex: none !important;
|
|
361
|
-
}
|
|
362
|
-
|
|
363
|
-
/* 报表行容器:恢复 flex gap-6 间距(gap 不在 computed style 内联列表中,需手动补回) */
|
|
364
|
-
.cmat-print-body .flex.flex-col.gap-6 {
|
|
365
|
-
gap: 1.5rem !important;
|
|
366
|
-
}
|
|
367
|
-
|
|
368
|
-
/* 报表网格:强制 12 列布局(不依赖媒体查询) */
|
|
369
|
-
.cmat-print-body .grid {
|
|
370
|
-
display: grid !important;
|
|
371
|
-
grid-template-columns: repeat(12, minmax(0, 1fr)) !important;
|
|
372
|
-
gap: 0.75rem !important;
|
|
373
|
-
}
|
|
374
|
-
/* col-span 工具类覆盖(含响应式前缀) */
|
|
375
|
-
.cmat-print-body .grid > .col-span-1 { grid-column: span 1 / span 1 !important; }
|
|
376
|
-
.cmat-print-body .grid > .col-span-2 { grid-column: span 2 / span 2 !important; }
|
|
377
|
-
.cmat-print-body .grid > .col-span-3 { grid-column: span 3 / span 3 !important; }
|
|
378
|
-
.cmat-print-body .grid > .col-span-4 { grid-column: span 4 / span 4 !important; }
|
|
379
|
-
.cmat-print-body .grid > .col-span-6 { grid-column: span 6 / span 6 !important; }
|
|
380
|
-
.cmat-print-body .grid > .col-span-12 { grid-column: span 12 / span 12 !important; }
|
|
381
|
-
/* Tailwind 响应式前缀 md:/lg: 的 col-span 类 */
|
|
382
|
-
.cmat-print-body .grid > [class*="\\:col-span-4"] { grid-column: span 4 / span 4 !important; }
|
|
383
|
-
.cmat-print-body .grid > [class*="\\:col-span-6"] { grid-column: span 6 / span 6 !important; }
|
|
384
|
-
.cmat-print-body .grid > [class*="\\:col-span-12"] { grid-column: span 12 / span 12 !important; }
|
|
385
|
-
|
|
386
|
-
/* 报表图表:限制打印高度,为表格留出空间 */
|
|
387
|
-
.cmat-print-body .chart-container {
|
|
388
|
-
overflow: hidden !important;
|
|
389
|
-
break-inside: avoid;
|
|
390
|
-
max-height: 100mm !important;
|
|
391
|
-
}
|
|
392
|
-
.cmat-print-body .chart-canvas {
|
|
393
|
-
overflow: hidden !important;
|
|
394
|
-
height: auto !important;
|
|
395
|
-
max-height: 95mm !important;
|
|
396
|
-
}
|
|
397
|
-
/* ECharts 渲染容器 div:约束到父级宽度,防止固定像素内联样式溢出 */
|
|
398
|
-
.cmat-print-body .chart-canvas > div {
|
|
399
|
-
max-width: 100% !important;
|
|
400
|
-
box-sizing: border-box !important;
|
|
401
|
-
}
|
|
402
|
-
.cmat-print-body .chart-canvas img {
|
|
403
|
-
max-width: 100% !important;
|
|
404
|
-
height: auto !important;
|
|
405
|
-
display: block !important;
|
|
406
|
-
}
|
|
407
|
-
|
|
408
|
-
/* 报表表格容器:移除 overflow 和 max-height 约束 + 约束到页面宽度 */
|
|
409
|
-
.cmat-print-body .table-container {
|
|
410
|
-
overflow: visible !important;
|
|
411
|
-
height: auto !important;
|
|
412
|
-
max-height: none !important;
|
|
413
|
-
min-height: 0 !important;
|
|
414
|
-
max-width: 100% !important;
|
|
415
|
-
box-sizing: border-box !important;
|
|
416
|
-
break-inside: auto !important;
|
|
417
|
-
}
|
|
418
|
-
.cmat-print-body .table-wrapper {
|
|
419
|
-
overflow: visible !important;
|
|
420
|
-
max-height: none !important;
|
|
421
|
-
height: auto !important;
|
|
422
|
-
max-width: 100% !important;
|
|
423
|
-
box-sizing: border-box !important;
|
|
424
|
-
break-inside: auto !important;
|
|
425
|
-
}
|
|
426
|
-
/* 报表表格:强制适应页面宽度,列均分 + 允许跨页分割 */
|
|
427
|
-
.cmat-print-body table[mat-table] {
|
|
428
|
-
width: 100% !important;
|
|
429
|
-
max-width: 100% !important;
|
|
430
|
-
table-layout: fixed !important;
|
|
431
|
-
font-size: 11px !important;
|
|
432
|
-
break-inside: auto !important;
|
|
433
|
-
}
|
|
434
|
-
/* 报表表格单元格:清除内联固定宽度,允许文字换行 */
|
|
435
|
-
.cmat-print-body table[mat-table] td,
|
|
436
|
-
.cmat-print-body table[mat-table] th {
|
|
437
|
-
width: auto !important;
|
|
438
|
-
word-break: break-word !important;
|
|
439
|
-
overflow-wrap: break-word !important;
|
|
440
|
-
white-space: normal !important;
|
|
441
|
-
padding: 4px 8px !important;
|
|
442
|
-
}
|
|
443
|
-
/* 报表表格 tbody:允许跨页分割 */
|
|
444
|
-
.cmat-print-body table[mat-table] tbody {
|
|
445
|
-
break-inside: auto !important;
|
|
446
|
-
display: table-row-group !important;
|
|
447
|
-
}
|
|
448
|
-
/* 报表表格行:防止单行被跨页截断 */
|
|
449
|
-
.cmat-print-body table[mat-table] tr[mat-row],
|
|
450
|
-
.cmat-print-body table[mat-table] tr[mat-row] td {
|
|
451
|
-
break-inside: avoid !important;
|
|
452
|
-
page-break-inside: avoid !important;
|
|
453
|
-
}
|
|
454
|
-
/* 隐藏报表分页组件 */
|
|
455
|
-
.cmat-print-body .pagination-wrapper,
|
|
456
|
-
.cmat-print-body cmat-pagination {
|
|
457
|
-
display: none !important;
|
|
458
|
-
}
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
`;
|
|
462
|
-
class CmatPrintService {
|
|
463
|
-
/**
|
|
464
|
-
* 打印指定 DOM 元素
|
|
465
|
-
* 保留原始 DOM 结构和样式,同步表单控件的当前值
|
|
466
|
-
*/
|
|
467
|
-
printElement(element, options) {
|
|
468
|
-
const clone = element.cloneNode(true);
|
|
469
|
-
// 同步表单控件的 live value 到克隆节点的 attribute
|
|
470
|
-
this._syncFormValues(element, clone);
|
|
471
|
-
// 移除不需要打印的元素
|
|
472
|
-
this._prepareForPrint(element, clone, options);
|
|
473
|
-
const contentHtml = clone.outerHTML;
|
|
474
|
-
this._print(contentHtml, options);
|
|
6
|
+
/* 强制亮色背景 */
|
|
7
|
+
html, body {
|
|
8
|
+
background: #fff !important;
|
|
9
|
+
color-scheme: light !important;
|
|
10
|
+
}
|
|
11
|
+
body {
|
|
12
|
+
margin: 0 !important;
|
|
13
|
+
padding: 16px !important;
|
|
14
|
+
overflow: visible !important;
|
|
15
|
+
height: auto !important;
|
|
16
|
+
min-height: auto !important;
|
|
17
|
+
box-sizing: border-box !important;
|
|
18
|
+
-webkit-print-color-adjust: exact;
|
|
19
|
+
print-color-adjust: exact;
|
|
20
|
+
}
|
|
21
|
+
/* 打印内容主体:约束到页面宽度,防止子元素溢出 */
|
|
22
|
+
.cmat-print-body {
|
|
23
|
+
max-width: 100% !important;
|
|
24
|
+
box-sizing: border-box !important;
|
|
25
|
+
}
|
|
26
|
+
/* 打印内容 flex 容器 + 网格行:高度由内容决定,不拉伸超过内容 */
|
|
27
|
+
.cmat-print-body .flex.flex-col {
|
|
28
|
+
height: auto !important;
|
|
29
|
+
min-height: 0 !important;
|
|
30
|
+
flex: none !important;
|
|
31
|
+
}
|
|
32
|
+
.cmat-print-body .grid {
|
|
33
|
+
height: auto !important;
|
|
34
|
+
min-height: 0 !important;
|
|
35
|
+
}
|
|
36
|
+
/* 报表渲染器宿主 + 网格子元素:允许跨页分割,防止内容被整体推到下一页 */
|
|
37
|
+
.cmat-print-body app-chart-renderer,
|
|
38
|
+
.cmat-print-body app-table-renderer,
|
|
39
|
+
.cmat-print-body app-text-renderer {
|
|
40
|
+
break-inside: auto !important;
|
|
41
|
+
margin: 0 !important;
|
|
42
|
+
}
|
|
43
|
+
.cmat-print-body .grid > [class*="col-span"] {
|
|
44
|
+
break-inside: auto !important;
|
|
45
|
+
}
|
|
46
|
+
/* 隐藏 ECharts 交互层:tooltip、axis-pointer 等悬浮 DOM */
|
|
47
|
+
.cmat-print-body .el-tooltip__popper,
|
|
48
|
+
.cmat-print-body [style*="pointer-events"] {
|
|
49
|
+
display: none !important;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/* 页眉页脚 */
|
|
53
|
+
.cmat-print-header {
|
|
54
|
+
text-align: center;
|
|
55
|
+
margin-bottom: 16px;
|
|
56
|
+
padding-bottom: 10px;
|
|
57
|
+
border-bottom: 2px solid #333;
|
|
58
|
+
}
|
|
59
|
+
.cmat-print-header h1 {
|
|
60
|
+
font-size: 18pt;
|
|
61
|
+
margin: 0 0 4px 0;
|
|
62
|
+
font-weight: 700;
|
|
63
|
+
}
|
|
64
|
+
.cmat-print-header .cmat-print-time {
|
|
65
|
+
font-size: 9pt;
|
|
66
|
+
color: #666;
|
|
67
|
+
}
|
|
68
|
+
.cmat-print-footer {
|
|
69
|
+
margin-top: 24px;
|
|
70
|
+
padding-top: 8px;
|
|
71
|
+
border-top: 1px solid #ccc;
|
|
72
|
+
font-size: 9pt;
|
|
73
|
+
color: #999;
|
|
74
|
+
text-align: center;
|
|
75
|
+
}
|
|
76
|
+
.cmat-print-body {
|
|
77
|
+
width: 100%;
|
|
78
|
+
padding-top: 8px;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/* 移除滚动容器的滚动约束,仅针对实际可滚动元素 */
|
|
82
|
+
.cmat-print-body {
|
|
83
|
+
overflow: visible !important;
|
|
84
|
+
max-height: none !important;
|
|
85
|
+
}
|
|
86
|
+
.cmat-print-body .scrollbar-custom,
|
|
87
|
+
.cmat-print-body .overflow-y-auto,
|
|
88
|
+
.cmat-print-body .overflow-auto,
|
|
89
|
+
.cmat-print-body .mat-drawer-content,
|
|
90
|
+
.cmat-print-body .cdk-virtual-scroll-content-wrapper {
|
|
91
|
+
overflow: visible !important;
|
|
92
|
+
max-height: none !important;
|
|
93
|
+
height: auto !important;
|
|
94
|
+
flex: none !important;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
.no-print, [data-print-exclude], .print\\:hidden {
|
|
98
|
+
display: none !important;
|
|
99
|
+
}
|
|
100
|
+
/* 隐藏 datetimepicker toggle 按钮并重置标签偏移 */
|
|
101
|
+
cmat-datetimepicker-toggle, .cmat-datetimepicker-toggle {
|
|
102
|
+
display: none !important;
|
|
103
|
+
}
|
|
104
|
+
.cmat-print-body .mat-mdc-form-field:has(.cmat-datetimepicker-toggle) {
|
|
105
|
+
--cmat-prefix-label-offset: 0px !important;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/* 分页控制 */
|
|
109
|
+
.page-break-before { page-break-before: always; }
|
|
110
|
+
.page-break-after { page-break-after: always; }
|
|
111
|
+
.page-break-inside { page-break-inside: avoid; }
|
|
112
|
+
|
|
113
|
+
/* 防止表单字段和小组件被分页截断(不包含 formly-field,因为它可能包含多个字段,导致第一页空白) */
|
|
114
|
+
.cmat-print-body .mat-mdc-form-field,
|
|
115
|
+
.cmat-print-body .mat-mdc-chip-grid,
|
|
116
|
+
.cmat-print-body .mat-mdc-chip-row,
|
|
117
|
+
.cmat-print-body mat-slider,
|
|
118
|
+
.cmat-print-body mat-slide-toggle,
|
|
119
|
+
.cmat-print-body .mat-mdc-checkbox,
|
|
120
|
+
.cmat-print-body .mat-mdc-radio-button,
|
|
121
|
+
.cmat-print-body cmat-date-range,
|
|
122
|
+
.cmat-print-body .range {
|
|
123
|
+
break-inside: avoid !important;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
/* 打印时强制表格使用桌面布局(A4纸宽 < 960px 断点,会触发移动端卡片布局) */
|
|
127
|
+
.mat-mdc-table:not(.normal-mobile-table) {
|
|
128
|
+
display: table !important;
|
|
129
|
+
}
|
|
130
|
+
.mat-mdc-table:not(.normal-mobile-table) .mat-mdc-header-row {
|
|
131
|
+
display: table-row !important;
|
|
132
|
+
position: static !important;
|
|
133
|
+
}
|
|
134
|
+
.mat-mdc-table:not(.normal-mobile-table) tbody {
|
|
135
|
+
display: table-row-group !important;
|
|
136
|
+
}
|
|
137
|
+
.mat-mdc-table:not(.normal-mobile-table) .mat-mdc-row {
|
|
138
|
+
display: table-row !important;
|
|
139
|
+
height: auto !important;
|
|
140
|
+
position: static !important;
|
|
141
|
+
border-radius: 0 !important;
|
|
142
|
+
box-shadow: none !important;
|
|
143
|
+
padding: 0 !important;
|
|
144
|
+
max-height: none !important;
|
|
145
|
+
overflow: visible !important;
|
|
146
|
+
flex-direction: unset !important;
|
|
147
|
+
}
|
|
148
|
+
.mat-mdc-table:not(.normal-mobile-table) .mat-mdc-cell {
|
|
149
|
+
display: table-cell !important;
|
|
150
|
+
padding: 8px 12px !important;
|
|
151
|
+
border-bottom: 1px solid rgba(0, 0, 0, 0.12) !important;
|
|
152
|
+
}
|
|
153
|
+
.mat-mdc-table:not(.normal-mobile-table) .mat-mdc-header-cell {
|
|
154
|
+
display: table-cell !important;
|
|
155
|
+
padding: 8px 12px !important;
|
|
156
|
+
border-bottom: 1px solid rgba(0, 0, 0, 0.12) !important;
|
|
157
|
+
font-weight: 600 !important;
|
|
158
|
+
position: static !important;
|
|
159
|
+
}
|
|
160
|
+
/* 奇偶行背景 */
|
|
161
|
+
.mat-mdc-table:not(.normal-mobile-table) .mat-mdc-row:nth-child(even) {
|
|
162
|
+
background-color: rgb(248 250 252) !important;
|
|
163
|
+
}
|
|
164
|
+
.mat-mdc-table:not(.normal-mobile-table) .mat-mdc-row:nth-child(odd) {
|
|
165
|
+
background-color: #fff !important;
|
|
166
|
+
}
|
|
167
|
+
/* has-label-on-mobile 在打印时不显示前缀标签 */
|
|
168
|
+
.has-label-on-mobile::before {
|
|
169
|
+
display: none !important;
|
|
170
|
+
}
|
|
171
|
+
/* 禁止表头跨页重复 */
|
|
172
|
+
.mat-mdc-table .mat-mdc-header-row {
|
|
173
|
+
position: static !important;
|
|
174
|
+
}
|
|
175
|
+
thead {
|
|
176
|
+
display: table-header-group !important;
|
|
177
|
+
}
|
|
178
|
+
thead tr {
|
|
179
|
+
position: static !important;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
/* 保留所有边框和背景色 */
|
|
183
|
+
*, *::before, *::after {
|
|
184
|
+
-webkit-print-color-adjust: exact !important;
|
|
185
|
+
print-color-adjust: exact !important;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
/* 移除 focus ring(打印无意义),但不影响 border/box-shadow */
|
|
189
|
+
.mat-mdc-form-field-focus-overlay {
|
|
190
|
+
display: none !important;
|
|
191
|
+
}
|
|
192
|
+
.mat-mdc-focus-indicator::after {
|
|
193
|
+
display: none !important;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
/* 确保表单字段间有合理间距,顶部留空防止 float-label 跨页被裁切 */
|
|
197
|
+
.cmat-print-body .mat-mdc-form-field {
|
|
198
|
+
margin-bottom: 0.25em !important;
|
|
199
|
+
margin-top: 0.5em !important;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
/* Repeat 容器内的字段减少顶部间距 */
|
|
203
|
+
.cmat-print-body .repeat-field .mat-mdc-form-field {
|
|
204
|
+
margin-top: 0 !important;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
.cmat-print-body formly-field {
|
|
208
|
+
display: block;
|
|
209
|
+
margin-bottom: 0.25em !important;
|
|
210
|
+
}
|
|
211
|
+
/* 修复 flex-auto 在打印上下文中的布局问题 */
|
|
212
|
+
.cmat-print-body formly-form.flex-auto,
|
|
213
|
+
.cmat-print-body formly-form[class*="flex-auto"] {
|
|
214
|
+
flex: none !important;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
/* 确保 mat-hint(Description)可见,但不过宽 */
|
|
218
|
+
.cmat-print-body .mat-mdc-form-field-subscript-wrapper {
|
|
219
|
+
overflow: visible !important;
|
|
220
|
+
height: auto !important;
|
|
221
|
+
max-height: none !important;
|
|
222
|
+
position: relative !important;
|
|
223
|
+
padding-top: 2px !important;
|
|
224
|
+
}
|
|
225
|
+
.cmat-print-body .mat-mdc-form-field-hint {
|
|
226
|
+
color: #555 !important;
|
|
227
|
+
opacity: 1 !important;
|
|
228
|
+
display: block !important;
|
|
229
|
+
line-height: 1.2 !important;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
/* Chips:确保打印时正确布局 */
|
|
233
|
+
.cmat-print-body .mat-mdc-chip-grid {
|
|
234
|
+
display: flex !important;
|
|
235
|
+
flex-wrap: wrap !important;
|
|
236
|
+
gap: 4px !important;
|
|
237
|
+
align-items: center !important;
|
|
238
|
+
}
|
|
239
|
+
.cmat-print-body .mat-mdc-chip-row {
|
|
240
|
+
display: inline-flex !important;
|
|
241
|
+
align-items: center !important;
|
|
242
|
+
|
|
243
|
+
.mat-mdc-chip-action{
|
|
244
|
+
padding-right:12px !important;
|
|
475
245
|
}
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
246
|
+
}
|
|
247
|
+
/* 隐藏 chip 内的输入框和自动补全 */
|
|
248
|
+
.cmat-print-body .mat-mdc-chip-grid input {
|
|
249
|
+
display: none !important;
|
|
250
|
+
}
|
|
251
|
+
.cmat-print-body .mat-mdc-autocomplete {
|
|
252
|
+
display: none !important;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
/* Color Picker:确保色块按钮的 ::after 伪元素背景色被打印 */
|
|
256
|
+
.cmat-print-body .mat-mdc-form-field-icon-prefix button {
|
|
257
|
+
overflow: visible !important;
|
|
258
|
+
padding: 4px !important;
|
|
259
|
+
width: 32px !important;
|
|
260
|
+
height: 32px !important;
|
|
261
|
+
min-width: 32px !important;
|
|
262
|
+
min-height: 32px !important;
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
/* 通用:防止 overflow-hidden 裁切 border */
|
|
266
|
+
.cmat-print-body .overflow-hidden {
|
|
267
|
+
overflow: visible !important;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
/* ─── 容器类型打印适配 ─── */
|
|
271
|
+
|
|
272
|
+
/* Tabs:展开所有标签页内容,隐藏标签导航 */
|
|
273
|
+
.cmat-print-body .mat-mdc-tab-header {
|
|
274
|
+
display: none !important;
|
|
275
|
+
}
|
|
276
|
+
.cmat-print-body .mat-mdc-tab-body-wrapper {
|
|
277
|
+
overflow: visible !important;
|
|
278
|
+
height: auto !important;
|
|
279
|
+
}
|
|
280
|
+
.cmat-print-body .mat-mdc-tab-body {
|
|
281
|
+
display: block !important;
|
|
282
|
+
visibility: visible !important;
|
|
283
|
+
opacity: 1 !important;
|
|
284
|
+
height: auto !important;
|
|
285
|
+
border-bottom: 1px dashed #ccc;
|
|
286
|
+
padding-bottom: 12px;
|
|
287
|
+
margin-bottom: 12px;
|
|
288
|
+
}
|
|
289
|
+
/* 在 tab body 前显示标签名 */
|
|
290
|
+
.cmat-print-body .mat-mdc-tab-body::before {
|
|
291
|
+
content: attr(aria-label);
|
|
292
|
+
display: block;
|
|
293
|
+
font-weight: 600;
|
|
294
|
+
font-size: 1.1em;
|
|
295
|
+
margin-bottom: 8px;
|
|
296
|
+
color: #333;
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
/* Stepper:展开所有步骤,隐藏导航按钮 */
|
|
300
|
+
.cmat-print-body .mat-horizontal-stepper-header-container {
|
|
301
|
+
display: none !important;
|
|
302
|
+
}
|
|
303
|
+
.cmat-print-body .mat-stepper-horizontal-line {
|
|
304
|
+
display: none !important;
|
|
305
|
+
}
|
|
306
|
+
.cmat-print-body .mat-step {
|
|
307
|
+
display: block !important;
|
|
308
|
+
visibility: visible !important;
|
|
309
|
+
opacity: 1 !important;
|
|
310
|
+
height: auto !important;
|
|
311
|
+
overflow: visible !important;
|
|
312
|
+
margin-bottom: 16px;
|
|
313
|
+
padding-bottom: 12px;
|
|
314
|
+
border-bottom: 1px dashed #ccc;
|
|
315
|
+
}
|
|
316
|
+
/* 显示步骤标签 */
|
|
317
|
+
.cmat-print-body .mat-step-label {
|
|
318
|
+
display: block !important;
|
|
319
|
+
font-weight: 600;
|
|
320
|
+
font-size: 1.1em;
|
|
321
|
+
margin-bottom: 8px;
|
|
322
|
+
color: #333;
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
/* Expansion:强制展开面板 */
|
|
326
|
+
.cmat-print-body .mat-expansion-panel {
|
|
327
|
+
break-inside: avoid;
|
|
328
|
+
margin-bottom: 8px;
|
|
329
|
+
}
|
|
330
|
+
.cmat-print-body .mat-expansion-panel-content {
|
|
331
|
+
height: auto !important;
|
|
332
|
+
visibility: visible !important;
|
|
333
|
+
opacity: 1 !important;
|
|
334
|
+
overflow: visible !important;
|
|
335
|
+
display: block !important;
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
/* ─── 报表组件打印适配 ─── */
|
|
339
|
+
|
|
340
|
+
/* 报表渲染器组件宿主:Angular 自定义元素默认 display:inline,需强制 block + 100% 宽度以填满网格单元格 */
|
|
341
|
+
.cmat-print-body app-chart-renderer,
|
|
342
|
+
.cmat-print-body app-table-renderer,
|
|
343
|
+
.cmat-print-body app-text-renderer {
|
|
344
|
+
display: block !important;
|
|
345
|
+
width: 100% !important;
|
|
346
|
+
min-width: 0 !important;
|
|
347
|
+
box-sizing: border-box !important;
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
/* 报表主容器:解除滚动容器的固定高度约束 + 阻止 flex 拉伸 */
|
|
351
|
+
.cmat-print-body > main,
|
|
352
|
+
.cmat-print-body .overflow-y-auto,
|
|
353
|
+
.cmat-print-body .overflow-auto {
|
|
354
|
+
overflow: visible !important;
|
|
355
|
+
height: auto !important;
|
|
356
|
+
min-height: 0 !important;
|
|
357
|
+
max-height: none !important;
|
|
358
|
+
flex: none !important;
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
/* 报表行容器:恢复 flex gap-6 间距(gap 不在 computed style 内联列表中,需手动补回) */
|
|
362
|
+
.cmat-print-body .flex.flex-col.gap-6 {
|
|
363
|
+
gap: 1.5rem !important;
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
/* 报表网格:强制 12 列布局(不依赖媒体查询) */
|
|
367
|
+
.cmat-print-body .grid {
|
|
368
|
+
display: grid !important;
|
|
369
|
+
grid-template-columns: repeat(12, minmax(0, 1fr)) !important;
|
|
370
|
+
gap: 0.75rem !important;
|
|
371
|
+
}
|
|
372
|
+
/* col-span 工具类覆盖(含响应式前缀) */
|
|
373
|
+
.cmat-print-body .grid > .col-span-1 { grid-column: span 1 / span 1 !important; }
|
|
374
|
+
.cmat-print-body .grid > .col-span-2 { grid-column: span 2 / span 2 !important; }
|
|
375
|
+
.cmat-print-body .grid > .col-span-3 { grid-column: span 3 / span 3 !important; }
|
|
376
|
+
.cmat-print-body .grid > .col-span-4 { grid-column: span 4 / span 4 !important; }
|
|
377
|
+
.cmat-print-body .grid > .col-span-6 { grid-column: span 6 / span 6 !important; }
|
|
378
|
+
.cmat-print-body .grid > .col-span-12 { grid-column: span 12 / span 12 !important; }
|
|
379
|
+
/* Tailwind 响应式前缀 md:/lg: 的 col-span 类 */
|
|
380
|
+
.cmat-print-body .grid > [class*="\\:col-span-4"] { grid-column: span 4 / span 4 !important; }
|
|
381
|
+
.cmat-print-body .grid > [class*="\\:col-span-6"] { grid-column: span 6 / span 6 !important; }
|
|
382
|
+
.cmat-print-body .grid > [class*="\\:col-span-12"] { grid-column: span 12 / span 12 !important; }
|
|
383
|
+
|
|
384
|
+
/* 报表图表:限制打印高度,为表格留出空间 */
|
|
385
|
+
.cmat-print-body .chart-container {
|
|
386
|
+
overflow: hidden !important;
|
|
387
|
+
break-inside: avoid;
|
|
388
|
+
max-height: 100mm !important;
|
|
389
|
+
}
|
|
390
|
+
.cmat-print-body .chart-canvas {
|
|
391
|
+
overflow: hidden !important;
|
|
392
|
+
height: auto !important;
|
|
393
|
+
max-height: 95mm !important;
|
|
394
|
+
}
|
|
395
|
+
/* ECharts 渲染容器 div:约束到父级宽度,防止固定像素内联样式溢出 */
|
|
396
|
+
.cmat-print-body .chart-canvas > div {
|
|
397
|
+
max-width: 100% !important;
|
|
398
|
+
box-sizing: border-box !important;
|
|
399
|
+
}
|
|
400
|
+
.cmat-print-body .chart-canvas img {
|
|
401
|
+
max-width: 100% !important;
|
|
402
|
+
height: auto !important;
|
|
403
|
+
display: block !important;
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
/* 报表表格容器:移除 overflow 和 max-height 约束 + 约束到页面宽度 */
|
|
407
|
+
.cmat-print-body .table-container {
|
|
408
|
+
overflow: visible !important;
|
|
409
|
+
height: auto !important;
|
|
410
|
+
max-height: none !important;
|
|
411
|
+
min-height: 0 !important;
|
|
412
|
+
max-width: 100% !important;
|
|
413
|
+
box-sizing: border-box !important;
|
|
414
|
+
break-inside: auto !important;
|
|
415
|
+
}
|
|
416
|
+
.cmat-print-body .table-wrapper {
|
|
417
|
+
overflow: visible !important;
|
|
418
|
+
max-height: none !important;
|
|
419
|
+
height: auto !important;
|
|
420
|
+
max-width: 100% !important;
|
|
421
|
+
box-sizing: border-box !important;
|
|
422
|
+
break-inside: auto !important;
|
|
423
|
+
}
|
|
424
|
+
/* 报表表格:强制适应页面宽度,列均分 + 允许跨页分割 */
|
|
425
|
+
.cmat-print-body table[mat-table] {
|
|
426
|
+
width: 100% !important;
|
|
427
|
+
max-width: 100% !important;
|
|
428
|
+
table-layout: fixed !important;
|
|
429
|
+
font-size: 11px !important;
|
|
430
|
+
break-inside: auto !important;
|
|
431
|
+
}
|
|
432
|
+
/* 报表表格单元格:清除内联固定宽度,允许文字换行 */
|
|
433
|
+
.cmat-print-body table[mat-table] td,
|
|
434
|
+
.cmat-print-body table[mat-table] th {
|
|
435
|
+
width: auto !important;
|
|
436
|
+
word-break: break-word !important;
|
|
437
|
+
overflow-wrap: break-word !important;
|
|
438
|
+
white-space: normal !important;
|
|
439
|
+
padding: 4px 8px !important;
|
|
440
|
+
}
|
|
441
|
+
/* 报表表格 tbody:允许跨页分割 */
|
|
442
|
+
.cmat-print-body table[mat-table] tbody {
|
|
443
|
+
break-inside: auto !important;
|
|
444
|
+
display: table-row-group !important;
|
|
445
|
+
}
|
|
446
|
+
/* 报表表格行:防止单行被跨页截断 */
|
|
447
|
+
.cmat-print-body table[mat-table] tr[mat-row],
|
|
448
|
+
.cmat-print-body table[mat-table] tr[mat-row] td {
|
|
449
|
+
break-inside: avoid !important;
|
|
450
|
+
page-break-inside: avoid !important;
|
|
451
|
+
}
|
|
452
|
+
/* 隐藏报表分页组件 */
|
|
453
|
+
.cmat-print-body .pagination-wrapper,
|
|
454
|
+
.cmat-print-body cmat-pagination {
|
|
455
|
+
display: none !important;
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
|
|
459
|
+
`;
|
|
460
|
+
var CmatPrintService = class CmatPrintService {
|
|
461
|
+
printElement(element, options) {
|
|
462
|
+
const clone = element.cloneNode(true);
|
|
463
|
+
this._syncFormValues(element, clone);
|
|
464
|
+
this._prepareForPrint(element, clone, options);
|
|
465
|
+
const contentHtml = clone.outerHTML;
|
|
466
|
+
this._print(contentHtml, options);
|
|
467
|
+
}
|
|
468
|
+
printSelector(selector, options) {
|
|
469
|
+
const element = document.querySelector(selector);
|
|
470
|
+
if (!element) {
|
|
471
|
+
console.warn(`[CmatPrintService] 未找到匹配选择器的元素: ${selector}`);
|
|
472
|
+
return;
|
|
473
|
+
}
|
|
474
|
+
this.printElement(element, options);
|
|
475
|
+
}
|
|
476
|
+
printHtml(html, options) {
|
|
477
|
+
this._print(html, options);
|
|
478
|
+
}
|
|
479
|
+
debugPrint(element, options) {
|
|
480
|
+
const clone = element.cloneNode(true);
|
|
481
|
+
this._syncFormValues(element, clone);
|
|
482
|
+
this._prepareForPrint(element, clone, options);
|
|
483
|
+
const contentHtml = clone.outerHTML;
|
|
484
|
+
const title = options?.title ?? "打印调试";
|
|
485
|
+
const orientation = options?.orientation ?? "portrait";
|
|
486
|
+
const margins = options?.margins ?? {
|
|
487
|
+
top: 15,
|
|
488
|
+
right: 15,
|
|
489
|
+
bottom: 15,
|
|
490
|
+
left: 15
|
|
491
|
+
};
|
|
492
|
+
const marginStr = `${margins.top}mm ${margins.right}mm ${margins.bottom}mm ${margins.left}mm`;
|
|
493
|
+
const overrideCss = PRINT_OVERRIDE_CSS.replace("var(--orientation)", orientation).replace("var(--margins)", marginStr);
|
|
494
|
+
const pageStyles = this._collectAllStyles().replace(/@media\s+print\s+and\s*\(/g, "@media (").replace(/@media\s+print\s*\{/g, "@media all {").replace(/@media\s+screen\s+and\s*\(/g, "@media (").replace(/@media\s+screen\s*\{/g, "@media all {").replace(/@media\s+only\s+screen\s+and\s*\(/g, "@media (").replace(/@media\s+only\s+screen\s*\{/g, "@media all {");
|
|
495
|
+
const cssVars = this._collectCssVariables();
|
|
496
|
+
const htmlClass = document.documentElement.className || "light";
|
|
497
|
+
const bodyClass = this._getPrintBodyClass();
|
|
498
|
+
const fullHtml = `<!DOCTYPE html>
|
|
499
|
+
<html lang="zh-CN" class="${htmlClass}" style="${cssVars}">
|
|
500
|
+
<head>
|
|
501
|
+
<meta charset="utf-8">
|
|
502
|
+
<base href="${document.baseURI}">
|
|
503
|
+
<title>[DEBUG] ${this._escapeHtml(title)}</title>
|
|
504
|
+
${pageStyles}
|
|
505
|
+
<style>${overrideCss}${options?.customCss ?? ""}</style>
|
|
506
|
+
<style>
|
|
507
|
+
/* 调试模式专属:模拟 A4 页面宽度 */
|
|
508
|
+
body { background: #e0e0e0 !important; }
|
|
509
|
+
.cmat-debug-page {
|
|
510
|
+
max-width: 180mm;
|
|
511
|
+
margin-left: auto !important;
|
|
512
|
+
margin-right: auto !important;
|
|
513
|
+
background: #fff;
|
|
514
|
+
box-shadow: 0 2px 8px rgba(0,0,0,0.15);
|
|
515
|
+
padding: ${margins.top}mm ${margins.right}mm ${margins.bottom}mm ${margins.left}mm;
|
|
516
|
+
min-height: 297mm;
|
|
484
517
|
}
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
*/
|
|
497
|
-
debugPrint(element, options) {
|
|
498
|
-
const clone = element.cloneNode(true);
|
|
499
|
-
this._syncFormValues(element, clone);
|
|
500
|
-
this._prepareForPrint(element, clone, options);
|
|
501
|
-
const contentHtml = clone.outerHTML;
|
|
502
|
-
const title = options?.title ?? '打印调试';
|
|
503
|
-
const orientation = options?.orientation ?? 'portrait';
|
|
504
|
-
const margins = options?.margins ?? { top: 15, right: 15, bottom: 15, left: 15 };
|
|
505
|
-
const marginStr = `${margins.top}mm ${margins.right}mm ${margins.bottom}mm ${margins.left}mm`;
|
|
506
|
-
const overrideCss = PRINT_OVERRIDE_CSS
|
|
507
|
-
.replace('var(--orientation)', orientation)
|
|
508
|
-
.replace('var(--margins)', marginStr);
|
|
509
|
-
// 关键:转换所有媒体查询,使 debug 标签页(screen 上下文)与实际打印(print 上下文)一致
|
|
510
|
-
// 1. @media screen → @media all(与实际打印一致)
|
|
511
|
-
// 2. @media print → @media all(让打印规则在 screen 中也生效)
|
|
512
|
-
const pageStyles = this._collectAllStyles()
|
|
513
|
-
.replace(/@media\s+print\s+and\s*\(/g, '@media (')
|
|
514
|
-
.replace(/@media\s+print\s*\{/g, '@media all {')
|
|
515
|
-
.replace(/@media\s+screen\s+and\s*\(/g, '@media (')
|
|
516
|
-
.replace(/@media\s+screen\s*\{/g, '@media all {')
|
|
517
|
-
.replace(/@media\s+only\s+screen\s+and\s*\(/g, '@media (')
|
|
518
|
-
.replace(/@media\s+only\s+screen\s*\{/g, '@media all {');
|
|
519
|
-
const cssVars = this._collectCssVariables();
|
|
520
|
-
const htmlClass = document.documentElement.className || 'light';
|
|
521
|
-
const bodyClass = this._getPrintBodyClass();
|
|
522
|
-
const fullHtml = `<!DOCTYPE html>
|
|
523
|
-
<html lang="zh-CN" class="${htmlClass}" style="${cssVars}">
|
|
524
|
-
<head>
|
|
525
|
-
<meta charset="utf-8">
|
|
526
|
-
<base href="${document.baseURI}">
|
|
527
|
-
<title>[DEBUG] ${this._escapeHtml(title)}</title>
|
|
528
|
-
${pageStyles}
|
|
529
|
-
<style>${overrideCss}${options?.customCss ?? ''}</style>
|
|
530
|
-
<style>
|
|
531
|
-
/* 调试模式专属:模拟 A4 页面宽度 */
|
|
532
|
-
body { background: #e0e0e0 !important; }
|
|
533
|
-
.cmat-debug-page {
|
|
534
|
-
max-width: 180mm;
|
|
535
|
-
margin-left: auto !important;
|
|
536
|
-
margin-right: auto !important;
|
|
537
|
-
background: #fff;
|
|
538
|
-
box-shadow: 0 2px 8px rgba(0,0,0,0.15);
|
|
539
|
-
padding: ${margins.top}mm ${margins.right}mm ${margins.bottom}mm ${margins.left}mm;
|
|
540
|
-
min-height: 297mm;
|
|
541
|
-
}
|
|
542
|
-
</style>
|
|
543
|
-
</head>
|
|
544
|
-
<body class="${bodyClass}">
|
|
545
|
-
<div style="background:#fff3cd;padding:8px 16px;text-align:center;font-size:14px;border-bottom:2px solid #ffc107;">
|
|
546
|
-
🔧 <strong>调试模式</strong> — 此页面为打印预览 HTML,可用 DevTools 检查元素。
|
|
547
|
-
按 Ctrl+P 可触发实际打印。
|
|
548
|
-
</div>
|
|
549
|
-
<div class="cmat-debug-page">
|
|
550
|
-
<div class="cmat-print-body">${contentHtml}</div>
|
|
551
|
-
</div>
|
|
552
|
-
</body>
|
|
518
|
+
</style>
|
|
519
|
+
</head>
|
|
520
|
+
<body class="${bodyClass}">
|
|
521
|
+
<div style="background:#fff3cd;padding:8px 16px;text-align:center;font-size:14px;border-bottom:2px solid #ffc107;">
|
|
522
|
+
🔧 <strong>调试模式</strong> — 此页面为打印预览 HTML,可用 DevTools 检查元素。
|
|
523
|
+
按 Ctrl+P 可触发实际打印。
|
|
524
|
+
</div>
|
|
525
|
+
<div class="cmat-debug-page">
|
|
526
|
+
<div class="cmat-print-body">${contentHtml}</div>
|
|
527
|
+
</div>
|
|
528
|
+
</body>
|
|
553
529
|
</html>`;
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
*/
|
|
853
|
-
_inlineComputedStyles(original, root) {
|
|
854
|
-
// 需要复制 computed style 的选择器列表
|
|
855
|
-
// 注意:不包含 .mdc-switch* 和 .mdc-slider*,这些组件的 computed style 可能包含 opacity:0 等不适合打印的值
|
|
856
|
-
const selectors = [
|
|
857
|
-
'.mat-mdc-form-field-subscript-wrapper',
|
|
858
|
-
'.mat-mdc-chip-row',
|
|
859
|
-
'.mat-mdc-chip',
|
|
860
|
-
// 报表组件:Angular 属性选择器在克隆节点失效,需内联 computed style
|
|
861
|
-
// 注意:.chart-container 不在此列表 — 其桌面端固定像素宽高+overflow:hidden 会污染打印输出
|
|
862
|
-
'.metric-card',
|
|
863
|
-
'.metric-card .value',
|
|
864
|
-
'.metric-card .prefix',
|
|
865
|
-
'.metric-card .suffix',
|
|
866
|
-
'.metric-card .label',
|
|
867
|
-
'.table-container',
|
|
868
|
-
'.table-wrapper',
|
|
869
|
-
];
|
|
870
|
-
// 从原始元素(而非 document)查找匹配元素,确保索引与克隆节点匹配
|
|
871
|
-
for (const selector of selectors) {
|
|
872
|
-
const originals = original.querySelectorAll(selector);
|
|
873
|
-
const clones = root.querySelectorAll(selector);
|
|
874
|
-
originals.forEach((orig, i) => {
|
|
875
|
-
const clone = clones[i];
|
|
876
|
-
if (!clone)
|
|
877
|
-
return;
|
|
878
|
-
const computed = getComputedStyle(orig);
|
|
879
|
-
// 复制关键属性
|
|
880
|
-
const props = ['display', 'visibility', 'opacity', 'overflow', 'width', 'height',
|
|
881
|
-
'min-width', 'min-height', 'max-width', 'max-height', 'padding', 'margin',
|
|
882
|
-
'border', 'border-radius', 'background-color', 'color', 'font-size', 'font-weight',
|
|
883
|
-
'line-height', 'position', 'top', 'left', 'right', 'bottom', 'flex', 'flex-direction',
|
|
884
|
-
'align-items', 'justify-content', 'gap', 'box-shadow', 'transform'];
|
|
885
|
-
for (const prop of props) {
|
|
886
|
-
const val = computed.getPropertyValue(prop);
|
|
887
|
-
if (val) {
|
|
888
|
-
clone.style.setProperty(prop, val, 'important');
|
|
889
|
-
}
|
|
890
|
-
}
|
|
891
|
-
});
|
|
892
|
-
}
|
|
893
|
-
}
|
|
894
|
-
/** 构建完整 HTML 并注入 iframe 执行打印 */
|
|
895
|
-
_print(contentHtml, options) {
|
|
896
|
-
const title = options?.title ?? '打印';
|
|
897
|
-
const orientation = options?.orientation ?? 'portrait';
|
|
898
|
-
const margins = options?.margins ?? { top: 15, right: 15, bottom: 15, left: 15 };
|
|
899
|
-
const now = new Date();
|
|
900
|
-
const timeStr = `${now.getFullYear()}-${String(now.getMonth() + 1).padStart(2, '0')}-${String(now.getDate()).padStart(2, '0')} ${String(now.getHours()).padStart(2, '0')}:${String(now.getMinutes()).padStart(2, '0')}`;
|
|
901
|
-
// 页眉
|
|
902
|
-
let headerHtml = '';
|
|
903
|
-
if (options?.header !== null) {
|
|
904
|
-
headerHtml = options?.header ?? `
|
|
905
|
-
<div class="cmat-print-header">
|
|
906
|
-
<h1>${this._escapeHtml(title)}</h1>
|
|
907
|
-
<div class="cmat-print-time">打印时间:${timeStr}</div>
|
|
908
|
-
</div>
|
|
530
|
+
const blob = new Blob([fullHtml], { type: "text/html" });
|
|
531
|
+
const url = URL.createObjectURL(blob);
|
|
532
|
+
window.open(url, "_blank");
|
|
533
|
+
setTimeout(() => URL.revokeObjectURL(url), 6e4);
|
|
534
|
+
}
|
|
535
|
+
_syncFormValues(original, clone) {
|
|
536
|
+
const origFields = original.querySelectorAll("input, textarea, select");
|
|
537
|
+
const cloneFields = clone.querySelectorAll("input, textarea, select");
|
|
538
|
+
origFields.forEach((origField, i) => {
|
|
539
|
+
const cloneField = cloneFields[i];
|
|
540
|
+
if (!cloneField) return;
|
|
541
|
+
if (origField instanceof HTMLInputElement) {
|
|
542
|
+
const cloneInput = cloneField;
|
|
543
|
+
cloneInput.setAttribute("value", origField.value);
|
|
544
|
+
if (origField.type === "checkbox" || origField.type === "radio") {
|
|
545
|
+
if (origField.checked) cloneInput.setAttribute("checked", "");
|
|
546
|
+
else cloneInput.removeAttribute("checked");
|
|
547
|
+
}
|
|
548
|
+
} else if (origField instanceof HTMLTextAreaElement) cloneField.textContent = origField.value;
|
|
549
|
+
else if (origField instanceof HTMLSelectElement) {
|
|
550
|
+
const cloneSelect = cloneField;
|
|
551
|
+
Array.from(origField.options).forEach((opt, idx) => {
|
|
552
|
+
const cloneOpt = cloneSelect.options[idx];
|
|
553
|
+
if (!cloneOpt) return;
|
|
554
|
+
if (opt.selected) cloneOpt.setAttribute("selected", "");
|
|
555
|
+
else cloneOpt.removeAttribute("selected");
|
|
556
|
+
});
|
|
557
|
+
}
|
|
558
|
+
});
|
|
559
|
+
}
|
|
560
|
+
_prepareForPrint(original, root, options) {
|
|
561
|
+
root.querySelectorAll(".print\\:hidden, [data-print-exclude]").forEach((el) => el.remove());
|
|
562
|
+
root.querySelectorAll(".el-tooltip__popper, [style*=\"pointer-events\"]").forEach((el) => {
|
|
563
|
+
if (el.closest(".chart-container, .chart-canvas, [class*=\"echarts\"]")) el.remove();
|
|
564
|
+
});
|
|
565
|
+
root.querySelectorAll("button").forEach((el) => {
|
|
566
|
+
const isPrefixSuffix = el.closest(".mat-mdc-form-field-icon-prefix, .mat-mdc-form-field-icon-suffix, .mat-mdc-form-field-text-prefix, .mat-mdc-form-field-text-suffix");
|
|
567
|
+
const isChipButton = el.closest(".mat-mdc-chip-row");
|
|
568
|
+
const isSwitch = el.classList.contains("mdc-switch");
|
|
569
|
+
if (!isPrefixSuffix && !isChipButton && !isSwitch) el.remove();
|
|
570
|
+
});
|
|
571
|
+
const origCanvases = original.querySelectorAll("canvas");
|
|
572
|
+
const cloneCanvases = root.querySelectorAll("canvas");
|
|
573
|
+
origCanvases.forEach((origCanvas, i) => {
|
|
574
|
+
const cloneCanvas = cloneCanvases[i];
|
|
575
|
+
if (!cloneCanvas) return;
|
|
576
|
+
try {
|
|
577
|
+
const dataUrl = origCanvas.toDataURL("image/png");
|
|
578
|
+
const img = document.createElement("img");
|
|
579
|
+
img.src = dataUrl;
|
|
580
|
+
img.style.width = "100%";
|
|
581
|
+
img.style.height = "auto";
|
|
582
|
+
img.style.display = "block";
|
|
583
|
+
cloneCanvas.parentNode?.replaceChild(img, cloneCanvas);
|
|
584
|
+
} catch (e) {
|
|
585
|
+
console.warn("[CmatPrintService] Canvas 转图片失败:", e);
|
|
586
|
+
}
|
|
587
|
+
});
|
|
588
|
+
root.querySelectorAll(".mat-mdc-chip-row button[matChipRemove]").forEach((btn) => {
|
|
589
|
+
btn.innerHTML = "";
|
|
590
|
+
btn.style.cssText = "display:none !important;";
|
|
591
|
+
});
|
|
592
|
+
root.querySelectorAll(".mat-mdc-form-field-subscript-wrapper").forEach((wrapper) => {
|
|
593
|
+
wrapper.style.cssText += ";overflow:visible!important;height:auto!important;min-height:0!important;max-height:none!important;position:relative!important;padding:0!important;margin:0!important;line-height:1!important;font-size:0.85em!important;";
|
|
594
|
+
});
|
|
595
|
+
this._inlineComputedStyles(original, root);
|
|
596
|
+
root.style.setProperty("overflow", "visible", "important");
|
|
597
|
+
root.style.setProperty("height", "auto", "important");
|
|
598
|
+
root.style.setProperty("min-height", "0", "important");
|
|
599
|
+
root.style.setProperty("max-height", "none", "important");
|
|
600
|
+
root.style.setProperty("max-width", "100%", "important");
|
|
601
|
+
root.style.setProperty("box-sizing", "border-box", "important");
|
|
602
|
+
root.querySelectorAll("[class*=\"overflow-y-auto\"], [class*=\"overflow-auto\"]").forEach((el) => {
|
|
603
|
+
el.style.setProperty("overflow", "visible", "important");
|
|
604
|
+
el.style.setProperty("height", "auto", "important");
|
|
605
|
+
el.style.setProperty("min-height", "0", "important");
|
|
606
|
+
el.style.setProperty("max-height", "none", "important");
|
|
607
|
+
el.style.setProperty("flex", "none", "important");
|
|
608
|
+
});
|
|
609
|
+
root.querySelectorAll("[class*=\"gap-6\"]").forEach((el) => {
|
|
610
|
+
el.style.setProperty("gap", "1.5rem", "important");
|
|
611
|
+
el.style.setProperty("max-width", "100%", "important");
|
|
612
|
+
el.style.setProperty("margin", "0", "important");
|
|
613
|
+
el.style.setProperty("box-sizing", "border-box", "important");
|
|
614
|
+
el.style.setProperty("height", "auto", "important");
|
|
615
|
+
el.style.setProperty("min-height", "0", "important");
|
|
616
|
+
el.style.setProperty("flex", "none", "important");
|
|
617
|
+
});
|
|
618
|
+
root.querySelectorAll(".grid").forEach((el) => {
|
|
619
|
+
if (!el.querySelector("[class*=\"col-span\"]")) return;
|
|
620
|
+
el.style.setProperty("display", "grid", "important");
|
|
621
|
+
el.style.setProperty("grid-template-columns", "repeat(12, minmax(0, 1fr))", "important");
|
|
622
|
+
el.style.setProperty("gap", "0.75rem", "important");
|
|
623
|
+
el.style.setProperty("height", "auto", "important");
|
|
624
|
+
el.style.setProperty("min-height", "0", "important");
|
|
625
|
+
el.style.setProperty("max-height", "none", "important");
|
|
626
|
+
el.style.setProperty("overflow", "visible", "important");
|
|
627
|
+
el.style.setProperty("max-width", "100%", "important");
|
|
628
|
+
el.style.setProperty("margin", "0", "important");
|
|
629
|
+
el.style.setProperty("box-sizing", "border-box", "important");
|
|
630
|
+
Array.from(el.children).forEach((child) => {
|
|
631
|
+
const childEl = child;
|
|
632
|
+
const classes = child.className || "";
|
|
633
|
+
const lgMatch = /lg:col-span-(\d+)/.exec(classes);
|
|
634
|
+
const mdMatch = /md:col-span-(\d+)/.exec(classes);
|
|
635
|
+
const baseMatch = /(?:^|\s)col-span-(\d+)/.exec(classes);
|
|
636
|
+
let span = lgMatch?.[1] ?? mdMatch?.[1] ?? baseMatch?.[1];
|
|
637
|
+
if (childEl.querySelector(".chart-container")) span = "12";
|
|
638
|
+
if (span) {
|
|
639
|
+
childEl.style.cssText = "";
|
|
640
|
+
childEl.style.setProperty("grid-column", `span ${span} / span ${span}`, "important");
|
|
641
|
+
childEl.style.setProperty("width", "auto", "important");
|
|
642
|
+
childEl.style.setProperty("max-width", "100%", "important");
|
|
643
|
+
childEl.style.setProperty("min-width", "0", "important");
|
|
644
|
+
childEl.style.setProperty("height", "auto", "important");
|
|
645
|
+
childEl.style.setProperty("min-height", "0", "important");
|
|
646
|
+
childEl.style.setProperty("max-height", "none", "important");
|
|
647
|
+
childEl.style.setProperty("margin", "0", "important");
|
|
648
|
+
childEl.style.setProperty("break-inside", "auto", "important");
|
|
649
|
+
}
|
|
650
|
+
});
|
|
651
|
+
});
|
|
652
|
+
root.querySelectorAll(".table-wrapper").forEach((el) => {
|
|
653
|
+
el.style.cssText = "";
|
|
654
|
+
el.style.setProperty("overflow", "visible", "important");
|
|
655
|
+
el.style.setProperty("max-height", "none", "important");
|
|
656
|
+
el.style.setProperty("height", "auto", "important");
|
|
657
|
+
el.style.setProperty("max-width", "100%", "important");
|
|
658
|
+
el.style.setProperty("box-sizing", "border-box", "important");
|
|
659
|
+
});
|
|
660
|
+
root.querySelectorAll(".table-container").forEach((el) => {
|
|
661
|
+
el.style.cssText = "";
|
|
662
|
+
el.style.setProperty("overflow", "visible", "important");
|
|
663
|
+
el.style.setProperty("height", "auto", "important");
|
|
664
|
+
el.style.setProperty("max-height", "none", "important");
|
|
665
|
+
el.style.setProperty("min-height", "0", "important");
|
|
666
|
+
el.style.setProperty("margin", "0", "important");
|
|
667
|
+
el.style.setProperty("max-width", "100%", "important");
|
|
668
|
+
el.style.setProperty("box-sizing", "border-box", "important");
|
|
669
|
+
});
|
|
670
|
+
root.querySelectorAll("table[mat-table]").forEach((el) => {
|
|
671
|
+
el.style.setProperty("width", "100%", "important");
|
|
672
|
+
el.style.setProperty("max-width", "100%", "important");
|
|
673
|
+
el.style.setProperty("table-layout", "fixed", "important");
|
|
674
|
+
el.style.setProperty("break-inside", "auto", "important");
|
|
675
|
+
});
|
|
676
|
+
root.querySelectorAll("table[mat-table] td, table[mat-table] th").forEach((el) => {
|
|
677
|
+
el.style.removeProperty("width");
|
|
678
|
+
el.style.setProperty("word-break", "break-word", "important");
|
|
679
|
+
el.style.setProperty("overflow-wrap", "break-word", "important");
|
|
680
|
+
el.style.setProperty("white-space", "normal", "important");
|
|
681
|
+
el.style.setProperty("padding", "4px 8px", "important");
|
|
682
|
+
});
|
|
683
|
+
root.querySelectorAll("app-chart-renderer, app-table-renderer, app-text-renderer").forEach((el) => {
|
|
684
|
+
el.style.cssText = "";
|
|
685
|
+
el.style.setProperty("display", "block", "important");
|
|
686
|
+
el.style.setProperty("width", "100%", "important");
|
|
687
|
+
el.style.setProperty("max-width", "100%", "important");
|
|
688
|
+
el.style.setProperty("min-width", "0", "important");
|
|
689
|
+
el.style.setProperty("margin", "0", "important");
|
|
690
|
+
el.style.setProperty("box-sizing", "border-box", "important");
|
|
691
|
+
el.style.setProperty("break-inside", "auto", "important");
|
|
692
|
+
});
|
|
693
|
+
root.querySelectorAll(".chart-container").forEach((el) => {
|
|
694
|
+
el.style.cssText = "";
|
|
695
|
+
el.style.setProperty("width", "100%", "important");
|
|
696
|
+
el.style.setProperty("max-width", "100%", "important");
|
|
697
|
+
el.style.setProperty("min-width", "0", "important");
|
|
698
|
+
el.style.setProperty("height", "auto", "important");
|
|
699
|
+
el.style.setProperty("min-height", "0", "important");
|
|
700
|
+
el.style.setProperty("max-height", "100mm", "important");
|
|
701
|
+
el.style.setProperty("overflow", "hidden", "important");
|
|
702
|
+
el.style.setProperty("box-sizing", "border-box", "important");
|
|
703
|
+
});
|
|
704
|
+
root.querySelectorAll(".chart-canvas").forEach((el) => {
|
|
705
|
+
el.style.cssText = "";
|
|
706
|
+
el.style.setProperty("width", "100%", "important");
|
|
707
|
+
el.style.setProperty("max-width", "100%", "important");
|
|
708
|
+
el.style.setProperty("min-width", "0", "important");
|
|
709
|
+
el.style.setProperty("height", "auto", "important");
|
|
710
|
+
el.style.setProperty("min-height", "0", "important");
|
|
711
|
+
el.style.setProperty("max-height", "95mm", "important");
|
|
712
|
+
el.style.setProperty("overflow", "hidden", "important");
|
|
713
|
+
el.style.setProperty("box-sizing", "border-box", "important");
|
|
714
|
+
Array.from(el.children).forEach((child) => {
|
|
715
|
+
if (child.tagName === "DIV") {
|
|
716
|
+
const childEl = child;
|
|
717
|
+
childEl.style.cssText = "";
|
|
718
|
+
childEl.style.setProperty("width", "100%", "important");
|
|
719
|
+
childEl.style.setProperty("max-width", "100%", "important");
|
|
720
|
+
childEl.style.setProperty("min-width", "0", "important");
|
|
721
|
+
childEl.style.setProperty("height", "auto", "important");
|
|
722
|
+
childEl.style.setProperty("box-sizing", "border-box", "important");
|
|
723
|
+
}
|
|
724
|
+
});
|
|
725
|
+
});
|
|
726
|
+
root.querySelectorAll(".chart-canvas img").forEach((img) => {
|
|
727
|
+
img.style.cssText = "";
|
|
728
|
+
img.style.setProperty("width", "100%", "important");
|
|
729
|
+
img.style.setProperty("max-width", "100%", "important");
|
|
730
|
+
img.style.setProperty("height", "auto", "important");
|
|
731
|
+
img.style.setProperty("display", "block", "important");
|
|
732
|
+
});
|
|
733
|
+
root.querySelectorAll(".metric-card").forEach((el) => {
|
|
734
|
+
el.style.setProperty("width", "100%", "important");
|
|
735
|
+
el.style.setProperty("max-width", "100%", "important");
|
|
736
|
+
el.style.setProperty("min-width", "0", "important");
|
|
737
|
+
el.style.setProperty("height", "auto", "important");
|
|
738
|
+
el.style.setProperty("min-height", "0", "important");
|
|
739
|
+
});
|
|
740
|
+
root.querySelectorAll(".metric-card .value, .metric-card .label, .metric-card .prefix, .metric-card .suffix").forEach((el) => {
|
|
741
|
+
el.style.setProperty("width", "auto", "important");
|
|
742
|
+
el.style.setProperty("max-width", "100%", "important");
|
|
743
|
+
el.style.setProperty("white-space", "normal", "important");
|
|
744
|
+
el.style.setProperty("overflow-wrap", "break-word", "important");
|
|
745
|
+
});
|
|
746
|
+
root.querySelectorAll(".mat-expansion-panel").forEach((panel) => {
|
|
747
|
+
panel.classList.add("mat-expanded");
|
|
748
|
+
});
|
|
749
|
+
options?.excludeSelectors?.forEach((selector) => {
|
|
750
|
+
root.querySelectorAll(selector).forEach((el) => el.remove());
|
|
751
|
+
});
|
|
752
|
+
}
|
|
753
|
+
_inlineComputedStyles(original, root) {
|
|
754
|
+
for (const selector of [
|
|
755
|
+
".mat-mdc-form-field-subscript-wrapper",
|
|
756
|
+
".mat-mdc-chip-row",
|
|
757
|
+
".mat-mdc-chip",
|
|
758
|
+
".metric-card",
|
|
759
|
+
".metric-card .value",
|
|
760
|
+
".metric-card .prefix",
|
|
761
|
+
".metric-card .suffix",
|
|
762
|
+
".metric-card .label",
|
|
763
|
+
".table-container",
|
|
764
|
+
".table-wrapper"
|
|
765
|
+
]) {
|
|
766
|
+
const originals = original.querySelectorAll(selector);
|
|
767
|
+
const clones = root.querySelectorAll(selector);
|
|
768
|
+
originals.forEach((orig, i) => {
|
|
769
|
+
const clone = clones[i];
|
|
770
|
+
if (!clone) return;
|
|
771
|
+
const computed = getComputedStyle(orig);
|
|
772
|
+
for (const prop of [
|
|
773
|
+
"display",
|
|
774
|
+
"visibility",
|
|
775
|
+
"opacity",
|
|
776
|
+
"overflow",
|
|
777
|
+
"width",
|
|
778
|
+
"height",
|
|
779
|
+
"min-width",
|
|
780
|
+
"min-height",
|
|
781
|
+
"max-width",
|
|
782
|
+
"max-height",
|
|
783
|
+
"padding",
|
|
784
|
+
"margin",
|
|
785
|
+
"border",
|
|
786
|
+
"border-radius",
|
|
787
|
+
"background-color",
|
|
788
|
+
"color",
|
|
789
|
+
"font-size",
|
|
790
|
+
"font-weight",
|
|
791
|
+
"line-height",
|
|
792
|
+
"position",
|
|
793
|
+
"top",
|
|
794
|
+
"left",
|
|
795
|
+
"right",
|
|
796
|
+
"bottom",
|
|
797
|
+
"flex",
|
|
798
|
+
"flex-direction",
|
|
799
|
+
"align-items",
|
|
800
|
+
"justify-content",
|
|
801
|
+
"gap",
|
|
802
|
+
"box-shadow",
|
|
803
|
+
"transform"
|
|
804
|
+
]) {
|
|
805
|
+
const val = computed.getPropertyValue(prop);
|
|
806
|
+
if (val) clone.style.setProperty(prop, val, "important");
|
|
807
|
+
}
|
|
808
|
+
});
|
|
809
|
+
}
|
|
810
|
+
}
|
|
811
|
+
_print(contentHtml, options) {
|
|
812
|
+
const title = options?.title ?? "打印";
|
|
813
|
+
const orientation = options?.orientation ?? "portrait";
|
|
814
|
+
const margins = options?.margins ?? {
|
|
815
|
+
top: 15,
|
|
816
|
+
right: 15,
|
|
817
|
+
bottom: 15,
|
|
818
|
+
left: 15
|
|
819
|
+
};
|
|
820
|
+
const now = /* @__PURE__ */ new Date();
|
|
821
|
+
const timeStr = `${now.getFullYear()}-${String(now.getMonth() + 1).padStart(2, "0")}-${String(now.getDate()).padStart(2, "0")} ${String(now.getHours()).padStart(2, "0")}:${String(now.getMinutes()).padStart(2, "0")}`;
|
|
822
|
+
let headerHtml = "";
|
|
823
|
+
if (options?.header !== null) headerHtml = options?.header ?? `
|
|
824
|
+
<div class="cmat-print-header">
|
|
825
|
+
<h1>${this._escapeHtml(title)}</h1>
|
|
826
|
+
<div class="cmat-print-time">打印时间:${timeStr}</div>
|
|
827
|
+
</div>
|
|
909
828
|
`;
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
<div class="cmat-print-footer">
|
|
916
|
-
此文档由系统生成 · ${timeStr}
|
|
917
|
-
</div>
|
|
829
|
+
let footerHtml = "";
|
|
830
|
+
if (options?.footer !== null) footerHtml = options?.footer ?? `
|
|
831
|
+
<div class="cmat-print-footer">
|
|
832
|
+
此文档由系统生成 · ${timeStr}
|
|
833
|
+
</div>
|
|
918
834
|
`;
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
<
|
|
935
|
-
|
|
936
|
-
<
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
<style>${overrideCss}${options?.customCss ?? ''}</style>
|
|
940
|
-
</head>
|
|
941
|
-
<body class="${bodyClass}">
|
|
942
|
-
${headerHtml}
|
|
943
|
-
<div class="cmat-print-body">${contentHtml}</div>
|
|
944
|
-
${footerHtml}
|
|
945
|
-
</body>
|
|
835
|
+
const pageStyles = this._collectAllStyles();
|
|
836
|
+
const cssVars = this._collectCssVariables();
|
|
837
|
+
const htmlClass = document.documentElement.className || "light";
|
|
838
|
+
const bodyClass = this._getPrintBodyClass();
|
|
839
|
+
const marginStr = `${margins.top}mm ${margins.right}mm ${margins.bottom}mm ${margins.left}mm`;
|
|
840
|
+
const overrideCss = PRINT_OVERRIDE_CSS.replace("var(--orientation)", orientation).replace("var(--margins)", marginStr);
|
|
841
|
+
const fullHtml = `<!DOCTYPE html>
|
|
842
|
+
<html lang="zh-CN" class="${htmlClass}" style="${cssVars}">
|
|
843
|
+
<head>
|
|
844
|
+
<meta charset="utf-8">
|
|
845
|
+
<base href="${document.baseURI}">
|
|
846
|
+
<title>${this._escapeHtml(title)}</title>
|
|
847
|
+
${pageStyles}
|
|
848
|
+
<style>${overrideCss}${options?.customCss ?? ""}</style>
|
|
849
|
+
</head>
|
|
850
|
+
<body class="${bodyClass}">
|
|
851
|
+
${headerHtml}
|
|
852
|
+
<div class="cmat-print-body">${contentHtml}</div>
|
|
853
|
+
${footerHtml}
|
|
854
|
+
</body>
|
|
946
855
|
</html>`;
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
catch (e) {
|
|
1082
|
-
console.error('[CmatPrintService] 打印失败:', e);
|
|
1083
|
-
}
|
|
1084
|
-
// 监听打印完成(兼容处理)
|
|
1085
|
-
if (iframe.contentWindow) {
|
|
1086
|
-
iframe.contentWindow.onafterprint = cleanup;
|
|
1087
|
-
// 兜底:部分浏览器不触发 onafterprint
|
|
1088
|
-
setTimeout(cleanup, 60000);
|
|
1089
|
-
}
|
|
1090
|
-
else {
|
|
1091
|
-
cleanup();
|
|
1092
|
-
}
|
|
1093
|
-
}, 300);
|
|
1094
|
-
};
|
|
1095
|
-
// 使用 srcdoc 替代已废弃的 document.write
|
|
1096
|
-
iframe.srcdoc = html;
|
|
1097
|
-
}
|
|
1098
|
-
/** HTML 转义 */
|
|
1099
|
-
_escapeHtml(text) {
|
|
1100
|
-
const div = document.createElement('div');
|
|
1101
|
-
div.textContent = text;
|
|
1102
|
-
return div.innerHTML;
|
|
1103
|
-
}
|
|
1104
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.2.0", ngImport: i0, type: CmatPrintService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
1105
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.2.0", ngImport: i0, type: CmatPrintService, providedIn: 'root' }); }
|
|
1106
|
-
}
|
|
1107
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.0", ngImport: i0, type: CmatPrintService, decorators: [{
|
|
1108
|
-
type: Injectable,
|
|
1109
|
-
args: [{ providedIn: 'root' }]
|
|
1110
|
-
}] });
|
|
1111
|
-
|
|
1112
|
-
/**
|
|
1113
|
-
* Generated bundle index. Do not edit.
|
|
1114
|
-
*/
|
|
1115
|
-
|
|
856
|
+
this._renderAndPrint(fullHtml, options);
|
|
857
|
+
}
|
|
858
|
+
_collectAllStyles() {
|
|
859
|
+
const cssTexts = [];
|
|
860
|
+
try {
|
|
861
|
+
for (const sheet of Array.from(document.styleSheets)) try {
|
|
862
|
+
const rules = sheet.cssRules;
|
|
863
|
+
if (!rules || rules.length === 0) continue;
|
|
864
|
+
let cssText = "";
|
|
865
|
+
for (const rule of Array.from(rules)) cssText += rule.cssText + "\n";
|
|
866
|
+
if (cssText.trim()) cssTexts.push(`<style>${this._transformMediaForPrint(cssText)}</style>`);
|
|
867
|
+
} catch {
|
|
868
|
+
if (sheet.href) cssTexts.push(`<link rel="stylesheet" href="${sheet.href}" media="all">`);
|
|
869
|
+
}
|
|
870
|
+
} catch (e) {
|
|
871
|
+
console.warn("[CmatPrintService] 样式收集异常:", e);
|
|
872
|
+
}
|
|
873
|
+
return cssTexts.join("\n ");
|
|
874
|
+
}
|
|
875
|
+
_transformMediaForPrint(css) {
|
|
876
|
+
return css.replace(/@media\s+screen\s+and\s*\(/g, "@media (").replace(/@media\s+screen\s*\{/g, "@media all {").replace(/@media\s+only\s+screen\s+and\s*\(/g, "@media (").replace(/@media\s+only\s+screen\s*\{/g, "@media all {");
|
|
877
|
+
}
|
|
878
|
+
_collectCssVariables() {
|
|
879
|
+
const vars = [];
|
|
880
|
+
const rootStyles = getComputedStyle(document.documentElement);
|
|
881
|
+
try {
|
|
882
|
+
for (const sheet of Array.from(document.styleSheets)) try {
|
|
883
|
+
const rules = sheet.cssRules;
|
|
884
|
+
if (!rules) continue;
|
|
885
|
+
for (const rule of Array.from(rules)) if (rule instanceof CSSStyleRule) {
|
|
886
|
+
const selector = rule.selectorText;
|
|
887
|
+
if (selector === ":root" || selector === "html" || selector === ":root, html") {
|
|
888
|
+
const props = Array.from({ length: rule.style.length }, (_, i) => rule.style[i]);
|
|
889
|
+
for (const prop of props) if (prop.startsWith("--")) vars.push(`${prop}: ${rule.style.getPropertyValue(prop)}`);
|
|
890
|
+
}
|
|
891
|
+
}
|
|
892
|
+
} catch {}
|
|
893
|
+
} catch (e) {
|
|
894
|
+
console.warn("[CmatPrintService] CSS变量收集异常:", e);
|
|
895
|
+
}
|
|
896
|
+
const prefixes = [
|
|
897
|
+
"--mdc-",
|
|
898
|
+
"--mat-",
|
|
899
|
+
"--md-",
|
|
900
|
+
"--tw-",
|
|
901
|
+
"--ck-",
|
|
902
|
+
"--color-",
|
|
903
|
+
"--border-"
|
|
904
|
+
];
|
|
905
|
+
const rootProps = Array.from({ length: rootStyles.length }, (_, i) => rootStyles[i]);
|
|
906
|
+
for (const prop of rootProps) if (prop.startsWith("--") && prefixes.some((p) => prop.startsWith(p))) {
|
|
907
|
+
const value = rootStyles.getPropertyValue(prop);
|
|
908
|
+
if (value && !vars.some((v) => v.startsWith(prop + ":"))) vars.push(`${prop}: ${value.trim()}`);
|
|
909
|
+
}
|
|
910
|
+
return vars.join("; ");
|
|
911
|
+
}
|
|
912
|
+
_getPrintBodyClass() {
|
|
913
|
+
const bodyClasses = document.body.className.split(/\s+/);
|
|
914
|
+
const excludeClasses = /* @__PURE__ */ new Set([
|
|
915
|
+
"overflow-hidden",
|
|
916
|
+
"h-full",
|
|
917
|
+
"w-full",
|
|
918
|
+
"h-screen",
|
|
919
|
+
"w-screen"
|
|
920
|
+
]);
|
|
921
|
+
return bodyClasses.filter((c) => c && !excludeClasses.has(c)).join(" ");
|
|
922
|
+
}
|
|
923
|
+
_renderAndPrint(html, options) {
|
|
924
|
+
const iframe = document.createElement("iframe");
|
|
925
|
+
iframe.style.position = "fixed";
|
|
926
|
+
iframe.style.left = "0";
|
|
927
|
+
iframe.style.top = "0";
|
|
928
|
+
iframe.style.width = "100vw";
|
|
929
|
+
iframe.style.height = "100vh";
|
|
930
|
+
iframe.style.border = "0";
|
|
931
|
+
iframe.style.visibility = "hidden";
|
|
932
|
+
iframe.style.zIndex = "-1";
|
|
933
|
+
iframe.style.pointerEvents = "none";
|
|
934
|
+
document.body.appendChild(iframe);
|
|
935
|
+
const cleanup = () => {
|
|
936
|
+
iframe.remove();
|
|
937
|
+
options?.afterPrint?.();
|
|
938
|
+
};
|
|
939
|
+
iframe.onload = () => {
|
|
940
|
+
setTimeout(() => {
|
|
941
|
+
try {
|
|
942
|
+
iframe.contentWindow?.focus();
|
|
943
|
+
iframe.contentWindow?.print();
|
|
944
|
+
} catch (e) {
|
|
945
|
+
console.error("[CmatPrintService] 打印失败:", e);
|
|
946
|
+
}
|
|
947
|
+
if (iframe.contentWindow) {
|
|
948
|
+
iframe.contentWindow.onafterprint = cleanup;
|
|
949
|
+
setTimeout(cleanup, 6e4);
|
|
950
|
+
} else cleanup();
|
|
951
|
+
}, 300);
|
|
952
|
+
};
|
|
953
|
+
iframe.srcdoc = html;
|
|
954
|
+
}
|
|
955
|
+
_escapeHtml(text) {
|
|
956
|
+
const div = document.createElement("div");
|
|
957
|
+
div.textContent = text;
|
|
958
|
+
return div.innerHTML;
|
|
959
|
+
}
|
|
960
|
+
static {
|
|
961
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
962
|
+
minVersion: "12.0.0",
|
|
963
|
+
version: "22.2.3",
|
|
964
|
+
ngImport: i0,
|
|
965
|
+
type: CmatPrintService,
|
|
966
|
+
deps: [],
|
|
967
|
+
target: i0.ɵɵFactoryTarget.Injectable
|
|
968
|
+
});
|
|
969
|
+
}
|
|
970
|
+
static {
|
|
971
|
+
this.ɵprov = i0.ɵɵngDeclareInjectable({
|
|
972
|
+
minVersion: "12.0.0",
|
|
973
|
+
version: "22.2.3",
|
|
974
|
+
ngImport: i0,
|
|
975
|
+
type: CmatPrintService,
|
|
976
|
+
providedIn: "root"
|
|
977
|
+
});
|
|
978
|
+
}
|
|
979
|
+
};
|
|
980
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
981
|
+
minVersion: "12.0.0",
|
|
982
|
+
version: "22.2.3",
|
|
983
|
+
ngImport: i0,
|
|
984
|
+
type: CmatPrintService,
|
|
985
|
+
decorators: [{
|
|
986
|
+
type: Injectable,
|
|
987
|
+
args: [{ providedIn: "root" }]
|
|
988
|
+
}]
|
|
989
|
+
});
|
|
1116
990
|
export { CmatPrintService };
|
|
1117
|
-
|
|
991
|
+
|
|
992
|
+
//# sourceMappingURL=cmat-services-print.mjs.map
|