Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Transparent background in popup #348

Open
cperezabo opened this issue Aug 14, 2023 · 40 comments
Open

Transparent background in popup #348

cperezabo opened this issue Aug 14, 2023 · 40 comments

Comments

@cperezabo
Copy link

cperezabo commented Aug 14, 2023

Hi, I updated Angular and Material to v16.2.0 and datetime-picker to v16.0.1
I don't know what changed, but I'm getting a transparent background now. Any idea?
CleanShot 2023-08-14 at 18 59 08@2x

Edit: In fact, confirmation button is missing, the popup won't close and there are no errors in console.

@AdamsContreras999
Copy link

yes for me is too same error

@cperezabo
Copy link
Author

I updated from v9 to v16, so I don't know if this was working in v15. I would like to find where it broken

@AdamsContreras999
Copy link

in fact when all the angular dependencies were in version 16.1.0 it was working fine but angular was updated to version 16.2.0 and there it presented this error.

@tfiil
Copy link

tfiil commented Aug 16, 2023

I have also experienced the same issue after the upgrade.

However something strange I've noticed is that if I click a "normal" mat-datepicker in the same application and subsequently click the ngx-mat-datetime-picker it will be styled correctly.

If no normal datepicker pop-up has been previously shown it will be transparent.

@cperezabo
Copy link
Author

Maybe the issue comes from Material? I haven't got time to debug it deeply. But by what you say seems that the problem can come from upstream

@francobasilico
Copy link

There are some updates on 16.2.1.
angular/components@0c4f947#diff-70165fe5f110c97706ce01e94ddf46c6aad553a1c6948dabcd60b14ad6d734b6
Maybe this fix it, will try to give it a go soon

@francobasilico
Copy link

I quickly tried it persists in 16.2.1

@serg-mois-capital
Copy link

Faced the same problem. Does anybody have any workaround? It's a critical issue.

@cperezabo
Copy link
Author

cperezabo commented Aug 17, 2023

As a workaround I've added some styles globally, not all of them but enough for what I need in the meantime.

.mat-datepicker-content {
  box-shadow: 0 2px 4px -1px #0003, 0 4px 5px #00000024, 0 1px 10px #0000001f;
  background-color: #fff;
  color: #000000de
}

.mat-calendar-body-selected {
  background-color: #007f51;
  color: #fff;
}

.mat-calendar-body-cell-content {
  border: none !important;
}

@serg-mois-capital
Copy link

@h2qutc need your help)

@francobasilico
Copy link

Thank you @cperezabo (gracias guacho)
I've tried those and work. As you said it fix some cases, for example, I have actions and have to add extra classes.
thanks for the code.

@pantonis
Copy link

Is there any fix for this planned?

@wildercarrot
Copy link

Issue still exists.

@John-Santacruz
Copy link

Please fix this issue.

@Skelyos
Copy link

Skelyos commented Sep 7, 2023

Strange thing I noticed: if you open a pure Angular datepicker & then open up this datetime picker all the styles are temporarily added back in again until you refresh the page.

Not sure how useful this is but may help debug the problem.

@shivamkatyan
Copy link

shivamkatyan commented Sep 14, 2023

I was facing the same issue, I have fixed it by adding the missing CSS

pavel-s-epam added a commit to bci-oss/esmf-sdk-js-schematics that referenced this issue Sep 18, 2023
pavel-s-epam added a commit to bci-oss/esmf-sdk-js-schematics that referenced this issue Sep 22, 2023
@TheDeadCode
Copy link

Still persists

@pkitatta
Copy link

Any help on this. I have the same problem.

@JUBINBIJU
Copy link

I degraded the version from 16.2 to 16.1 and then to 16.0 still its not working. Did that work for anyone?

@JUBINBIJU
Copy link

JUBINBIJU commented Oct 19, 2023

Strange thing I noticed: if you open a pure Angular datepicker & then open up this datetime picker all the styles are temporarily added back in again until you refresh the page.

Not sure how useful this is but may help debug the problem.

yes i was also able to recreate that

pavel-s-epam added a commit to bci-oss/esmf-sdk-js-schematics that referenced this issue Oct 30, 2023
michelu89 added a commit to eclipse-esmf/esmf-sdk-js-schematics that referenced this issue Nov 1, 2023
* Add WIP for generation dynamic forms

* Add material design into form

* Extend some features into material design

* Add date time functionality into html component

* WIP dynamic forms

* Fix table generation

* Fix some bugs and remove un used table functionality

* ADD: main functionality of generating a form

Signed-off-by: Pavel Shalamkov <hpl7fe@bosch.com>

* FIX: minor layout inconsistencies

Signed-off-by: Pavel Shalamkov <hpl7fe@bosch.com>

* ADD: handle validation errors in templates

Signed-off-by: Pavel Shalamkov <hpl7fe@bosch.com>

* UPDATE: change ngx-mat-datetime-picker to an input of 'datetime-local' type

Reason: h2qutc/angular-material-components#348

Signed-off-by: Pavel Shalamkov <hpl7fe@bosch.com>

* add readOnlyForm question to prompter

* remove questions from form prompter

* add disabled true if readOnlyForm is true

* start refactoring prompter

* remove choose complex props to hide from form

* remove question from form prompter

* add back question

* fix table

* FIX: inconsistencies with base data types of the form

Signed-off-by: Pavel Shalamkov <hpl7fe@bosch.com>

* REFACTOR: generate form groups/controls as separate components

Signed-off-by: Pavel Shalamkov <hpl7fe@bosch.com>

* REFACTOR: remove "readOnlyForm" option from "fieldConfig"

Signed-off-by: Pavel Shalamkov <hpl7fe@bosch.com>

* FIX: unnecessary imports while generating a form

Signed-off-by: Pavel Shalamkov <hpl7fe@bosch.com>

* ADD: parsing of control's value

Signed-off-by: Pavel Shalamkov <hpl7fe@bosch.com>

* FIX: incorrect naming of controls

Signed-off-by: Pavel Shalamkov <hpl7fe@bosch.com>

* REFACTOR: optimize RootFormFieldStrategy

Signed-off-by: Pavel Shalamkov <hpl7fe@bosch.com>

* ADD: handling of dates

Signed-off-by: Pavel Shalamkov <hpl7fe@bosch.com>

* FIX: handling "readOnlyForm"

Signed-off-by: Pavel Shalamkov <hpl7fe@bosch.com>

* FIX: align form controls "disabled" state

Signed-off-by: Pavel Shalamkov <hpl7fe@bosch.com>

* fix getting selected element

* fix getExcludedProperties

* ADD: handle date/time type fields

Signed-off-by: Pavel Shalamkov <hpl7fe@bosch.com>

* ADD: hide hints on disabled fields

Signed-off-by: Pavel Shalamkov <hpl7fe@bosch.com>

* FIX: incorrect target elements

Signed-off-by: Pavel Shalamkov <hpl7fe@bosch.com>

* FIX: missed copyright on "form" files

Signed-off-by: Pavel Shalamkov <hpl7fe@bosch.com>

* do not show entities that are of type single entity

* fix excluding properties for entity

* allow for form generation to select collection aspect

* FIX: compilation errors with generated components

Signed-off-by: Pavel Shalamkov <hpl7fe@bosch.com>

* ADD: stub for "list" type

Signed-off-by: Pavel Shalamkov <hpl7fe@bosch.com>

* REMOVE: unnecessary options for form generation

Signed-off-by: Pavel Shalamkov <hpl7fe@bosch.com>

* ADD: handler for "structured value" type

Signed-off-by: Pavel Shalamkov <hpl7fe@bosch.com>

* ADD: example value to form fields

Signed-off-by: Pavel Shalamkov <hpl7fe@bosch.com>

* ADD: disable "submit" based on form availability

Signed-off-by: Pavel Shalamkov <hpl7fe@bosch.com>

* UPDATE: interface of a generated form

Signed-off-by: Pavel Shalamkov <hpl7fe@bosch.com>

* REMOVE: unused code

Signed-off-by: Pavel Shalamkov <hpl7fe@bosch.com>

* UPDATE: show example values as placeholders for non-strict input types

Signed-off-by: Pavel Shalamkov <hpl7fe@bosch.com>

* fix form generation

* refactor prompter

* refactor prompter

* ADD: logic for "list" type

Signed-off-by: Pavel Shalamkov <hpl7fe@bosch.com>

* UPDATE: styles for groups of controls

Signed-off-by: Pavel Shalamkov <hpl7fe@bosch.com>

* UPDATE: exclude unnecessary generators for "form"

Signed-off-by: Pavel Shalamkov <hpl7fe@bosch.com>

* FIX: incorrect detection of the target FormFieldStrategy

Signed-off-by: Pavel Shalamkov <hpl7fe@bosch.com>

* ADD: support complex types in form fields of type "list"

Signed-off-by: Pavel Shalamkov <hpl7fe@bosch.com>

* ADD: handle "disabled" state and communication interface

Signed-off-by: Pavel Shalamkov <hpl7fe@bosch.com>

* start documentation for form

* update documentation

* finish form documentation

* add the environments files for form

* UPDATE: "form" components selectors

Signed-off-by: Pavel Shalamkov <hpl7fe@bosch.com>

* UPDATE: split BaseFormFieldConfig interface

Signed-off-by: Pavel Shalamkov <hpl7fe@bosch.com>

* FIX: unhandled scalar types

Signed-off-by: Pavel Shalamkov <hpl7fe@bosch.com>

* ADD: handle import path for both versioned and non-versioned generation

Signed-off-by: Pavel Shalamkov <hpl7fe@bosch.com>

* UPDATE: styles for "legend" tag

Signed-off-by: Pavel Shalamkov <hpl7fe@bosch.com>

* FIX: incorrect import path for form types

Signed-off-by: Pavel Shalamkov <hpl7fe@bosch.com>

* ADD: output overview to "form" README.md

Signed-off-by: Pavel Shalamkov <hpl7fe@bosch.com>

* Fix overwrite problems for static files and run prettier

* Fix unit tests

* Prevent raise condition on request data, shpw error on data load error

see #40
see #41

* Fix unit tests

* FIX: linting errors

Signed-off-by: Pavel Shalamkov <hpl7fe@bosch.com>

---------

Signed-off-by: Pavel Shalamkov <hpl7fe@bosch.com>
Co-authored-by: Pavel Shalamkov <hpl7fe@bosch.com>
Co-authored-by: Larisa Vasile <external.georgiana-larisa.vasile@bosch.com>
Co-authored-by: Anton Shabatin <anton.shabatin@bosch.com>
@AlexElin
Copy link

AlexElin commented Nov 12, 2023

Could somebody provide a minimal reproducible example (MRE)?

The issue isn't reproduced at the library site. So, having the MRE would be helpful

@Klaster1
Copy link

Klaster1 commented Nov 12, 2023

@AlexElin please see the branch I made, you can observe the effect clearly there.

@Guerric-P
Copy link

Guerric-P commented Nov 20, 2023

Why this bug appears only now? It's been since Angular 11 and the deprecation of the extractCss configuration property that the styles are not bundled all together in a global CSS file, but dynamically inserted in a style tag when the component shows.

@stnor
Copy link

stnor commented Dec 6, 2023

Another repro: https://stackblitz.com/edit/angular-cpmuqe

@stnor
Copy link

stnor commented Dec 6, 2023

A simple workaround is to open and close a datepicker to load the styles. This isn't visible to the user. No need for global style hacks.

   //Workaround for https://github.com/h2qutc/angular-material-components/issues/348
   @ViewChild('hiddenpicker')
   private readonly hiddenpicker: MatDatepicker<null>

   ngOnInit() {
        this.hiddenpicker.open();
        this.hiddenpicker.close();
   }

@arjen-t
Copy link

arjen-t commented Dec 8, 2023

The issue does exist, and version 16.x doesn't function well with Angular Material versions >= 16.*. I also encounter styling collisions when using the native Angular Material datepicker alongside the datetimepicker on the same page. Considering that in version 16.x, the default start date is broken (#356), we addressed the issue as follows:

Downgrade to latest version 9.* to maintain support for the default startdate.
Add styling to the component, scoped to the datetimepicker (ngx-mat-datetime-content), to ensure it works with Angular Material >= 16.*.

::ng-deep {
  .mat-mdc-form-field-icon-suffix {
    .mat-mdc-icon-button.mat-mdc-button-base {
      --mdc-icon-button-state-layer-size: 36px;
      width: var(--mdc-icon-button-state-layer-size) !important;
      height: var(--mdc-icon-button-state-layer-size) !important;
      padding: 6px !important;
    }
  }

  //Fix datepicker styling in ngx-mat-calendar untill we can migratet to 16.x fixed all bugs
  ngx-mat-datetime-content {
    &.mat-datepicker-content {
      box-shadow: 0 2px 4px -1px #0003, 0 4px 5px #00000024,
        0 1px 10px #0000001f;
      background-color: #fff;
      color: #000000de;

      .mat-calendar-body-cell {
        position: relative;
      }

      .mat-calendar-body-cell:hover {
        .mat-calendar-body-cell-content:not(.mat-calendar-body-selected) {
          background-color: #258ea88d;
        }
      }

      .mat-calendar-body-selected {
        background-color: #258ea8;
        color: #fff;
      }

      .mat-calendar-body-today.mat-calendar-body-selected {
        box-shadow: inset 0 0 0 1px #fff;
      }
    }
  }
}

Considering that people invest their free time in maintaining this package, it would be greatly appreciated if the mentioned issues could be resolved. The current state is starting to feel broken.

@yousafzainasir8
Copy link

still facing this issue

@Klaster1
Copy link

@stnor I tried the open/close hack and it did not help. Even after manually opening an Angular Material date picker, the ngx-mat-datetime-picker is still missing styles.

@Nivijoy
Copy link

Nivijoy commented Dec 30, 2023

Overwrite the style
::ng-deep .mat-datepicker-content .mat-calendar {
background-color: #c2185b;
}

::ng-deep .time-container {
background-color: #c2185b;
}

::ng-deep .mat-calendar-body-cell-content.mat-focus-indicator {
color: white;
border: none;
}

@geckodesalpes
Copy link

geckodesalpes commented Jan 4, 2024

As a workaround I added some styles globally, I've not added all the styles at all, but enough for what I need in the meantime.

.mat-datepicker-content {
  box-shadow: 0 2px 4px -1px #0003, 0 4px 5px #00000024, 0 1px 10px #0000001f;
  background-color: #fff;
  color: #000000de
}

.mat-calendar-body-selected {
  background-color: #007f51;
  color: #fff;
}

.mat-calendar-body-cell-content {
  border: none !important;
}

Based on your workaround, it is also possible to directly use the mat- variables in order to support theming:

.mat-datepicker-content, .time-container {
  box-shadow: 0px 2px 4px -1px rgba(0, 0, 0, 0.2), 0px 4px 5px 0px rgba(0, 0, 0, 0.14), 0px 1px 10px 0px rgba(0, 0, 0, 0.12);
  display: block;
  border-radius: 4px;
  background-color: var(--mat-datepicker-calendar-container-background-color);
  color: var(--mat-datepicker-calendar-container-text-color);
}

.mat-calendar-body-cell-content {
  color: var(--mat-datepicker-calendar-date-text-color);
  border-color: var(--mat-datepicker-calendar-date-outline-color)
}

.mat-calendar-body-selected {
  background-color: var(--mat-datepicker-calendar-date-selected-state-background-color);
  color: var(--mat-datepicker-calendar-date-selected-state-text-color);
}

.mat-calendar-body-cell-content {
  border: none !important;
}

.mat-calendar-body-cell:not(.mat-calendar-body-disabled):hover > .mat-calendar-body-cell-content:not(.mat-calendar-body-selected):not(.mat-calendar-body-comparison-identical) {
  background-color: var(--mat-datepicker-calendar-date-hover-state-background-color);
}

.mat-calendar-arrow {
  fill: var(--mat-datepicker-calendar-period-button-icon-color);
}

@SeraphCoding
Copy link

SeraphCoding commented Jan 8, 2024

As a workaround I added some styles globally, I've not added all the styles at all, but enough for what I need in the meantime.

.mat-datepicker-content {
  box-shadow: 0 2px 4px -1px #0003, 0 4px 5px #00000024, 0 1px 10px #0000001f;
  background-color: #fff;
  color: #000000de
}

.mat-calendar-body-selected {
  background-color: #007f51;
  color: #fff;
}

.mat-calendar-body-cell-content {
  border: none !important;
}

Based on your workaround, it is also possible to directly use the mat- variables in order to support theming:

.mat-datepicker-content, .time-container {
  box-shadow: 0px 2px 4px -1px rgba(0, 0, 0, 0.2), 0px 4px 5px 0px rgba(0, 0, 0, 0.14), 0px 1px 10px 0px rgba(0, 0, 0, 0.12);
  display: block;
  border-radius: 4px;
  background-color: var(--mat-datepicker-calendar-container-background-color);
  color: var(--mat-datepicker-calendar-container-text-color);
}

.mat-calendar-body-cell-content {
  color: var(--mat-datepicker-calendar-date-text-color);
  border-color: var(--mat-datepicker-calendar-date-outline-color)
}

.mat-calendar-body-selected {
  background-color: var(--mat-datepicker-calendar-date-selected-state-background-color);
  color: var(--mat-datepicker-calendar-date-selected-state-text-color);
}

.mat-calendar-body-cell-content {
  border: none !important;
}

.mat-calendar-body-cell:not(.mat-calendar-body-disabled):hover > .mat-calendar-body-cell-content:not(.mat-calendar-body-selected):not(.mat-calendar-body-comparison-identical) {
  background-color: var(--mat-datepicker-calendar-date-hover-state-background-color);
}

Amazing workaround for now! For me the chevron-up icons for the time selector are also missing. Is this related to this issue? The original issue has its chevrons. Anyone else experiencing that?

@geckodesalpes
Copy link

@SeraphCoding Assuming my current understanding of the issue, this may be linked, as my feeling is that the issue could come from breaking changes regarding encapsulation in Angular latest versions.

That said, the time picker buttons are not based on the same principle as the one upper right for the calendar (those last one use borders and 45° rotation). The time picker works with a traditional mat-icon:
image

Assuming on the original capture, all dependencies are at the latest, there should be a way to make it work if the mat-icon module is properly imported and configured in your project / targetted module.
If you use custom icon provider (like FA) for mat-icon this may be more tricky to find a nice workaround as they are using the old way where the icon name is set as content and not HTML attribute, eliminating a pure CSS workaround possibility. At last should be possible but extremely dirty to do something in vanilla JS / JQuery 🤐.

@samuele-ruffino96
Copy link

.mat-datepicker-content {
box-shadow: 0 2px 4px -1px #3, 0 4px 5px #24, 0 1px 10px #0000001f;
background-color: #fff;
color: #000000de
}

.mat-calendar-body-selected {
background-color: #007f51;
color: #fff;
}

.mat-calendar-body-cell-content {
border: none !important;
}

Thank you for workaround. Just a tip for ones who has noticed issues with disabled labels style, in fact for some reason it seems the style for disabled days/years is still missing. Below an example:

How it was before
image | image

How it looks now
image|image

As you can see, only the chevrons disabled style is still present, so i added this class below as temporary workaround, hope it'll help you.

.mat-calendar-body-disabled>.mat-calendar-body-cell-content:not(.mat-calendar-body-selected):not(.mat-calendar-body-comparison-identical) {
    color: var(--mat-datepicker-calendar-date-disabled-state-text-color);
}

@rhwilburn
Copy link

For me the solution was:

/*
 Note: div in the query selector below only to get precidence over the default .mat-datepicker-content-container 
by being more specific. This isn't required for background-color but was required for me to override other things in
 that container 
*/
div.mat-datepicker-content-container {
  background-color: var(--background-color);
  }

Using a variable isn't needed as such; could just be background-color: red; etc

@m-akinc
Copy link

m-akinc commented Mar 29, 2024

The datetime picker includes a theming support file that was copied directly from Angular material, but in Angular material version 16.2, the implementation changed. This datetime picker package is still using the old version of the file, and it doesn't work with the token-based system of v16.2+.

The only way the styling looks right is if the Angular material 16.2+ datepicker gets loaded first, in which case the 'mat-datepicker' theme styles get initialized correctly.

@m-akinc
Copy link

m-akinc commented Mar 29, 2024

@h2qutc I was going to try to update _datepicker-theme.scss to see if that would solve this issue, but I had some concerns:

  • there have been no commits since 8/1/23
  • it looks like you haven't been active on GitHub since then, so I wonder if you're still maintaining this repo
  • there's no CONTRIBUTING file
  • running npm install results in dependency conflict errors
  • even the newest release of tsickle (two years old) is incompatible with the version of Typescript needed by other dependencies
  • running npm run test doesn't find any tests to run
  • running npm run e2e fails because the version of ChromeDriver doesn't support recent versions

If you are still maintaining this repo, let me know so I can try to help resolve this issue that so many users are running into.

@SeraphCoding
Copy link

SeraphCoding commented Apr 1, 2024

Just an FYI - do not use my fork

Just as an FYI for the people waiting in here:
I've begun refactoring (and in that process breaking) this entire repo in a fork of mine. I've installed some more modern linting tools, upgraded the projects dependencies, put a whole lot more emphasis on type safety and much more. It compiles, it also somewhat runs, but it is still nowhere near production ready. This is just a hint in case people scan this post: DO NOT USE MY FORK FOR PRODUCTION

I did this just to see if I can upgrade the repo in a break-neck approach on my own - since I use this component in a production project of mine and wanted an updated version. I sincerely apologize for the resulting horrendous commit history of mine ^^ If you happen to find the time to report issues or even contribute to the fork, I'd greatly appreciate it. I will continue working on it, because I want to use the updated version in a production application eventually.

Fork here: Once more, this isn't working, its just an FYI that I've begun working on upgrading this package.
SeraphCoding/angular-material-components

In that fork - Angular is up to speed
image

I am slowly and agonizingly working my way to a functioning implementation, especially when it comes to theming, but hey colors seems to work (despite some style hick-ups), so that's something that won't need fixing.
image

A whole lot of things in that fork are utterly broken, this is just an FYI that someone is working on it

@Prasanna-Sridharan
Copy link

.mat-datepicker-content {
box-shadow: 0 2px 4px -1px #3, 0 4px 5px #24, 0 1px 10px #0000001f;
background-color: #fff;
color: #000000de
}
.mat-calendar-body-selected {
background-color: #007f51;
color: #fff;
}
.mat-calendar-body-cell-content {
border: none !important;
}

Thank you for workaround. Just a tip for ones who has noticed issues with disabled labels style, in fact for some reason it seems the style for disabled days/years is still missing. Below an example:

How it was before image | image

How it looks now image|image

As you can see, only the chevrons disabled style is still present, so i added this class below as temporary workaround, hope it'll help you.

.mat-calendar-body-disabled>.mat-calendar-body-cell-content:not(.mat-calendar-body-selected):not(.mat-calendar-body-comparison-identical) {
color: var(--mat-datepicker-calendar-date-disabled-state-text-color);
}

Thanks for the workaround fix along with previous contributors styles.. saved a lot of time !!

I just added below as well to not show cursor pointer on disabled dates:
button.mat-calendar-body-disabled {
cursor: default !important;
}

@tito-cr
Copy link

tito-cr commented Apr 6, 2024

This seems to be working in Angular 17. I haven't tested it a lot, just basically commented out the workaround code.

@sousawalker
Copy link

As a workaround I've added some styles globally, not all of them but enough for what I need in the meantime.

.mat-datepicker-content {
  box-shadow: 0 2px 4px -1px #0003, 0 4px 5px #00000024, 0 1px 10px #0000001f;
  background-color: #fff;
  color: #000000de
}

.mat-calendar-body-selected {
  background-color: #007f51;
  color: #fff;
}

.mat-calendar-body-cell-content {
  border: none !important;
}

This worket for me. Thankyou.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests