Skip to content
This repository was archived by the owner on Jan 6, 2025. It is now read-only.

Conversation

ThomasBurleson
Copy link
Contributor

@ThomasBurleson ThomasBurleson commented Dec 22, 2018

Implement PrintHook service to intercept print mediaQuery activation events.

  • enhance LayoutConfigOptions to include printWithBreakpoint
  • fix FlexLayoutModule.withConfig() to merge overrides with defaults
  • use PrintHook to intercept activation changes in MediaMarshaller while print-mode is active
  • trigger MediaObserver to notify subscribers with print mqAlias(es)
  • add support for fxShow.print and fxHide.print

Example:

Using the new printWithBreakpoint allows developers to specify a breakpoint that should be used to render layouts only during printing. With the configuration below, the breakpoint associated with the md alias will be used.

    FlexLayoutModule.withConfig({
      useColumnBasisZero: false,
      printWithBreakpoints: ['md', 'gt-sm', 'gt-xs']
    })

Shown below is the print layout rendered in floating dialog over the normal layout using 'lg' breakpoints. The printed version uses:

  • fxHide.print to hide the buttons, and a demo
  • fxShow.print to show a watermark overlay

angular-layout-demo-printing

Fixes #603.

@googlebot googlebot added the cla: no PR author needs to sign Google's CLA: https://opensource.google.com/docs/cla/ label Dec 22, 2018
@ThomasBurleson
Copy link
Contributor Author

@CaerusKaru - these include changes from PRs #946 and #912.

Copy link
Member

@CaerusKaru CaerusKaru left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Love the approach overall. Some things missing or need to be added.

@CaerusKaru
Copy link
Member

Also, scope should be feat

@googlebot
Copy link
Collaborator

CLAs look good, thanks!

@googlebot googlebot added cla: yes and removed cla: no PR author needs to sign Google's CLA: https://opensource.google.com/docs/cla/ labels Dec 22, 2018
@ThomasBurleson ThomasBurleson force-pushed the thomas/fix-print branch 3 times, most recently from 735f6e1 to 72998b2 Compare December 22, 2018 19:59
@ThomasBurleson ThomasBurleson changed the title fix(core): add print support with mediaQuery override feat(core): add print support with mediaQuery override Dec 22, 2018
@ThomasBurleson ThomasBurleson force-pushed the thomas/fix-print branch 2 times, most recently from 9c31ffa to 21e68b5 Compare December 22, 2018 20:02
@ThomasBurleson ThomasBurleson force-pushed the thomas/fix-print branch 3 times, most recently from 0c60244 to 60d3153 Compare December 23, 2018 15:22
@ThomasBurleson ThomasBurleson added the P1 Urgent issue that should be resolved before the next re-lease label Dec 23, 2018
@ThomasBurleson ThomasBurleson force-pushed the thomas/fix-print branch 7 times, most recently from 9235c07 to 543e1f9 Compare December 28, 2018 00:52
When printing developers can now configure how layouts should render
by specifying 1..n mediaQuery aliases. This feature allows totally different
print outputs without modifying the currently layout.

Implement PrintHook service to intercept print mediaQuery activation events.
  * add fxShow.print and fxHide.print support to show/hide elements during printing
  * suspend activation changes in MediaMarshaller while print-mode is active
  * trigger MediaObserver to notify subscribers with print mqAlias(es)
  * use PrintHook to intercept activation changes in MediaMarshaller while print-mode is active
  * trigger MediaObserver to notify subscribers with print mqAlias(es)

Using the new `printWithBreakpoint` allows developers to specify a breakpoint that should be used to render layouts only during printing. With the configuration below, the breakpoint associated with the **`md`** alias will be used.

```ts
    FlexLayoutModule.withConfig({
      useColumnBasisZero: false,
      printWithBreakpoints: ['md', 'gt-sm', 'gt-xs']
    })
```
Shown below is the print layout rendered in floating dialog over the normal layout using 'lg' breakpoints.

![angular-layout-printing](https://user-images.githubusercontent.com/210413/50407211-2e04ca00-0798-11e9-8f35-b4e9e2fca864.jpg)

Fixes #603.
@ThomasBurleson
Copy link
Contributor Author

ThomasBurleson commented Jan 1, 2019

@CaerusKaru - final quick review plz? Ready to merge after your lgtm.

Copy link
Member

@CaerusKaru CaerusKaru left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some small changes, otherwise very close

Copy link
Member

@CaerusKaru CaerusKaru left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@CaerusKaru CaerusKaru added pr: lgtm This PR has been approved by the reviewer pr: merge ready This PR is ready for the caretaker to presubmit and merge and removed pr: needs cleanup/tests labels Jan 2, 2019
@ThomasBurleson ThomasBurleson merged commit 0c9e9cb into master Jan 2, 2019
@CaerusKaru CaerusKaru deleted the thomas/fix-print branch January 2, 2019 02:08
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 6, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
cla: yes P1 Urgent issue that should be resolved before the next re-lease pr: lgtm This PR has been approved by the reviewer pr: merge ready This PR is ready for the caretaker to presubmit and merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Print Preview triggers xs breakpoint
3 participants