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

[Calendar] Add ability to disable specific date(s) #211

Merged
merged 7 commits into from
Nov 5, 2018

Conversation

exoego
Copy link
Contributor

@exoego exoego commented Oct 27, 2018

Description

Add an option disabledDates to the Calendar module.
This option should hold an array of Date or structured {date: Date, title: string, message: string}{date: Date, message: string}.
This option allows users to disable the specific date(s) such as national holiday or something like that.

Screenshot

calendar-disabled-dates

Oct 15, 16 and 27 are disabled.
Oct 27 has CSS-only tooltip to explain why it is disabled.

Closes

#200

@exoego
Copy link
Contributor Author

exoego commented Oct 27, 2018

Could anyone help me to implement popup for message?
I tried to use Popup module with data-title and data-content but it does not work as I expected.

@lubber-de lubber-de added state/awaiting-reviews Pull requests which are waiting for reviews lang/javascript Anything involving JavaScript type/feat Any feature requests or improvements labels Oct 27, 2018
@lubber-de
Copy link
Member

First: Thanks for the PR!, I see, it was a good idea to contact you on twitter 😉

Could anyone help me to implement popup for reason?
I tried to use Popup module with data-title and data-content but it does not work as I expected.

Does at least data-tooltip work? Then we might need to improve the css-only version of popup to somehow support a title. In the first step it is maybe enough to just support a message and add support for a title in a later PR when css-only popup with title support has probably been implemented

@exoego
Copy link
Contributor Author

exoego commented Oct 28, 2018

I figured out why CSS-only popup (data-tooltip) does not work initially.

Right now, CSS for td.disabled is:

.ui.calendar .ui.table tr .disabled {
  pointer-events: none;
  color: @disabledTextColor;
}

pointer-events: none is used to stop event bubbling and to stay mouse cursor default.
CSS-only popup is trigged by mouse pointer events. So it does not work initially.
ref: https://developer.mozilla.org/en-US/docs/Web/CSS/pointer-events

I put a workaround for this.

In the first step it is maybe enough to just support a message and add support for a title in a later PR when css-only popup with title support has probably been implemented

I agree.

Copy link
Member

@lubber-de lubber-de left a comment

Choose a reason for hiding this comment

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

Please also try to check for popup positioning and add data-position accordingly if needed.
If an input field is on the very left or right side of the browser window, and the related date aswell, the popup text gets cropped either on the left or on the right side
image

src/definitions/modules/calendar.js Outdated Show resolved Hide resolved
@exoego
Copy link
Contributor Author

exoego commented Oct 28, 2018

Popup positiong implemented.
right-center
left-center

src/definitions/modules/calendar.js Outdated Show resolved Hide resolved
@lubber-de lubber-de added the state/awaiting-docs Pull requests which need doc changes/additions label Oct 29, 2018
Copy link
Member

@ColinFrick ColinFrick left a comment

Choose a reason for hiding this comment

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

LGTM

@y0hami y0hami merged commit 3f7bc5d into fomantic:beta Nov 5, 2018
@y0hami y0hami removed the state/awaiting-reviews Pull requests which are waiting for reviews label Nov 5, 2018
@lubber-de lubber-de added state/has-docs A issue/PR which requires documentation changes and has the corresponding PR open in the docs repo and removed state/awaiting-docs Pull requests which need doc changes/additions labels Nov 5, 2018
@lubber-de lubber-de added this to the 2.6.4 milestone Nov 5, 2018
@y0hami y0hami mentioned this pull request Nov 14, 2018
@exoego exoego deleted the disabledDates branch January 1, 2019 09:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lang/javascript Anything involving JavaScript state/has-docs A issue/PR which requires documentation changes and has the corresponding PR open in the docs repo type/feat Any feature requests or improvements
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants