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

feat(core): add print support with mediaQuery override #954

Merged
merged 4 commits into from
Jan 2, 2019

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.

src/lib/core/media-marshaller/media-marshaller.ts Outdated Show resolved Hide resolved
src/lib/core/media-marshaller/print-hook.service.ts Outdated Show resolved Hide resolved
src/lib/core/media-marshaller/print-hook.service.ts Outdated Show resolved Hide resolved
src/lib/core/media-marshaller/print-hook.service.ts Outdated Show resolved Hide resolved
src/lib/core/media-marshaller/print-hook.service.ts Outdated Show resolved Hide resolved
src/lib/core/media-observer/media-observer.ts Outdated Show resolved Hide resolved
src/lib/core/tokens/library-config.ts Outdated Show resolved Hide resolved
src/lib/core/media-marshaller/print-hook.service.ts Outdated Show resolved Hide resolved
src/lib/core/media-marshaller/print-hook.service.ts Outdated Show resolved Hide resolved
@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 3 times, most recently from 4baee25 to a386fed Compare December 24, 2018 22:25
@ThomasBurleson ThomasBurleson force-pushed the thomas/fix-print branch 2 times, most recently from bff6040 to 4b798a0 Compare December 27, 2018 02:06
@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

src/lib/core/media-marshaller/media-marshaller.ts Outdated Show resolved Hide resolved
src/lib/core/media-marshaller/media-marshaller.ts Outdated Show resolved Hide resolved
src/lib/core/media-marshaller/media-marshaller.ts Outdated Show resolved Hide resolved
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