fix(print): fix app-wide printing and remove a global print-CSS leak
Root cause of blank/clipped print output across the app: the document root (html/body) is globally locked to one viewport height with overflow hidden, and Angular Material's drawer/tab-body containers each add their own on-screen scroll clip on top of that. main.scss now frees the full chain for print (document root, CDK drawer/sidenav containers, mat-tab-body, and the account-view's mat-tab-nav-bar which was rendering as a stray grey scrollable strip since it isn't covered by the mat-tab-group header rule already hidden). Also fixed both certificate print dialogs (share-certificate-dialog, deposit-certificate-dialog) reusing a `::ng-deep body > :not(.cdk-overlay- container)` rule to hide the shell during their own print: under Angular's style encapsulation this style is emitted fully unscoped into the global stylesheet and is never removed once the component has loaded once in a session, silently blanking every other page's print output for the rest of the session. Dropped `::ng-deep` from that one selector so it goes back to being properly scoped (and therefore inert, matching the other two dialogs that never had this bug) — the app shell is already hidden for every print via the global main.scss rules, so no dialog needs its own global override.
This commit is contained in:
+102
-11
@@ -982,6 +982,16 @@ mat-card {
|
||||
.mat-mdc-tab-header,
|
||||
.mat-stepper-vertical-line,
|
||||
.mat-step-header,
|
||||
/* Account-view pages (Shares, Savings, Current, Deposits…) use `<nav mat-tab-nav-bar
|
||||
class="navigation-tabs">` for their General/Passbook/Charges/… tab links — a DIFFERENT
|
||||
Material component from mat-tab-group, so it never carries `.mat-mdc-tab-header` and slipped
|
||||
past the rule above. Its own style (theme/_content.scss) gives it a grey background and
|
||||
`overflow: auto`, which is exactly the grey box with a baked-in scrollbar seen in print/PDF
|
||||
output — printing it is as pointless as printing the tab-group header already excluded above. */
|
||||
.navigation-tabs,
|
||||
[mat-tab-nav-bar],
|
||||
.mat-mdc-tab-nav-bar,
|
||||
.mat-mdc-tab-link-container,
|
||||
/* The real 2-row nav menu (Client Master / Approvals / Cashier … and the row below it) and the
|
||||
live KPI ticker live directly in shell.component.html as .main-header / .kpi-ticker, not
|
||||
inside <mifosx-toolbar> — hiding only the toolbar left this menu printing on every page. */
|
||||
@@ -997,17 +1007,57 @@ mat-card {
|
||||
margin-left: 0 !important;
|
||||
}
|
||||
|
||||
/* The whole app shell scrolls inside CDK's own clipped viewport —
|
||||
.mat-drawer-container { overflow: hidden } and .mat-drawer-content { overflow: auto; height: 100% }
|
||||
— so without freeing these too, print is still capped to one screen's worth of the page
|
||||
regardless of the tab-body fix below. */
|
||||
/* THE root clip: assets/styles/_overflow.scss sets `html, body { overflow: hidden }` and
|
||||
index.html puts `h-full` (height: 100%) on both, so the document itself is locked to exactly
|
||||
one viewport and everything past it is cut away. Every inner container fix below is useless
|
||||
while this stands — it is why printing any page produced a blank sheet with only a sliver of
|
||||
whatever happened to sit at the fold. */
|
||||
html,
|
||||
body {
|
||||
height: auto !important;
|
||||
overflow: visible !important;
|
||||
width: 100% !important;
|
||||
background: #fff !important;
|
||||
|
||||
/* Keep backgrounds/colours (certificate rules, table shading) instead of dropping them. */
|
||||
print-color-adjust: exact;
|
||||
}
|
||||
|
||||
/* The shell then scrolls inside CDK's own clipped viewport —
|
||||
#mifosx-shell-container { height: 100vh }, .mat-drawer-content { height: 100%; overflow: auto }
|
||||
— so these have to be freed as well. */
|
||||
#mifosx-shell-container,
|
||||
mat-sidenav-container,
|
||||
mat-drawer-container,
|
||||
mat-sidenav-content,
|
||||
mat-drawer-content,
|
||||
.mat-drawer-container,
|
||||
.mat-drawer-content,
|
||||
mat-sidenav-content.sidenav {
|
||||
position: static !important;
|
||||
.mat-sidenav-content {
|
||||
overflow: visible !important;
|
||||
height: auto !important;
|
||||
max-height: none !important;
|
||||
|
||||
/* Material's own theme paints a background-color on .mat-drawer-container — without
|
||||
overriding it here, that grey shows behind every printed page even though html/body are
|
||||
already forced white above. */
|
||||
background: #fff !important;
|
||||
}
|
||||
|
||||
/* shell.component.scss:247-271 scopes `mifosx-content { overflow-x: hidden; max-width: 100% }`
|
||||
specifically to `.sidenav mifosx-content` so tables/cards shrink to fit whenever the sidebar
|
||||
is open on screen — this rule has nothing to do with the sidebar being hidden for print, and
|
||||
without overriding it too, the routed page content keeps clipping/scrolling horizontally to
|
||||
whatever width was last measured on screen, which is exactly the narrow box with a baked-in
|
||||
scrollbar seen in print/PDF output. */
|
||||
mifosx-content,
|
||||
.sidenav mifosx-content,
|
||||
mat-tab-nav-panel,
|
||||
.mat-mdc-tab-nav-panel {
|
||||
overflow: visible !important;
|
||||
width: auto !important;
|
||||
max-width: 100% !important;
|
||||
height: auto !important;
|
||||
}
|
||||
|
||||
/* Angular Material clips a tab's content to a JS-measured on-screen height via
|
||||
@@ -1023,11 +1073,6 @@ mat-card {
|
||||
height: auto !important;
|
||||
}
|
||||
|
||||
body,
|
||||
html {
|
||||
background: #fff !important;
|
||||
}
|
||||
|
||||
@page {
|
||||
/* stylelint-disable-next-line unit-allowed-list */
|
||||
margin: 1.5cm;
|
||||
@@ -1869,3 +1914,49 @@ mifosx-client-datatable-step * {
|
||||
--mdc-checkbox-selected-pressed-icon-color: #059669;
|
||||
}
|
||||
/* stylelint-enable selector-max-universal */
|
||||
|
||||
/* ==========================================================================
|
||||
Global Print Styles for Material Dialogs & Certificates
|
||||
========================================================================== */
|
||||
@media print {
|
||||
html,
|
||||
body {
|
||||
height: auto !important;
|
||||
overflow: visible !important;
|
||||
background: #fff !important;
|
||||
}
|
||||
|
||||
/* Hide main application shell during dialog printing */
|
||||
body > :not(.cdk-overlay-container) {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
/* Remove fixed positioning on CDK overlay elements so content flows naturally */
|
||||
.cdk-overlay-backdrop {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
.cdk-overlay-container,
|
||||
.cdk-global-overlay-wrapper,
|
||||
.cdk-overlay-pane,
|
||||
.mat-mdc-dialog-container,
|
||||
.mdc-dialog__container,
|
||||
.mdc-dialog__surface {
|
||||
position: static !important;
|
||||
display: block !important;
|
||||
max-height: none !important;
|
||||
max-width: none !important;
|
||||
height: auto !important;
|
||||
width: auto !important;
|
||||
overflow: visible !important;
|
||||
transform: none !important;
|
||||
box-shadow: none !important;
|
||||
background: transparent !important;
|
||||
padding: 0 !important;
|
||||
}
|
||||
|
||||
.no-print,
|
||||
.mat-mdc-dialog-actions {
|
||||
display: none !important;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user