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

DatePicker: disable input on mobile #4592

Open
wants to merge 4 commits into
base: rel-1.2
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@
<DocsAttributesItem Name="Inline" Type="bool" Default="false">
Display the calendar in an always-open state with the inline option.
</DocsAttributesItem>
<DocsAttributesItem Name="DisableMobile" Type="bool" Default="true">
<DocsAttributesItem Name="DisableMobile" Type="bool" Default="false">
If enabled, it disables the native input on mobile devices.
</DocsAttributesItem>
</DocsAttributes>
2 changes: 1 addition & 1 deletion Source/Blazorise/Components/DatePicker/DatePicker.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -533,7 +533,7 @@ protected override IReadOnlyList<TValue> InternalValue
/// <summary>
/// If enabled, it disables the native input on mobile devices.
/// </summary>
[Parameter] public bool DisableMobile { get; set; } = true;
[Parameter] public bool DisableMobile { get; set; }

#endregion
}
6 changes: 3 additions & 3 deletions Source/Blazorise/wwwroot/datePicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ export function initialize(element, elementId, options) {
const defaultOptions = {
enableTime: options.inputMode === 1,
dateFormat: options.inputMode === 1 ? 'Y-m-d H:i' : 'Y-m-d',
allowInput: true,
altInput: true,
allowInput: !(options.disableMobile || false),
altInput: !(options.disableMobile || false),
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this some kind of way to coalesce is that it? I don't get the usage of the or logic here.

altFormat: options.displayFormat ? options.displayFormat : (options.inputMode === 1 ? 'Y-m-d H:i' : 'Y-m-d'),
defaultDate: options.defaultDate,
minDate: options.min,
Expand All @@ -52,7 +52,7 @@ export function initialize(element, elementId, options) {
clickOpens: !(options.readOnly || false),
disable: options.disabledDates || [],
inline: options.inline || false,
disableMobile: options.disableMobile || true,
disableMobile: options.disableMobile || false,
Copy link
Contributor

Choose a reason for hiding this comment

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

maybe I'm dumb, what is this? options.disableMobile || false? is this some kind of way to coalesce?

static: true
};

Expand Down